Skip to main content
Add custom span-level attributes to a specific LangChain component’s metadata. Attributes are stored in the component’s metadata and automatically included in OTel spans when the component executes. Unlike session attributes, these are scoped to individual components.

Parameters

node
BaseLanguageModel | BaseRetriever | BaseTool
required
The LangChain component to annotate (modified in place).
kwargs
Any
Arbitrary key-value attributes. Keys matching known FiddlerSpanAttributes values are set directly; all others are prefixed with fiddler.span.user..

Returns

None Example: default from langchain_openai import ChatOpenAI from fiddler_langgraph import add_span_attributes llm = ChatOpenAI(model=“gpt-4”) add_span_attributes(llm, model_tier=“premium”, use_case=“summarization”)