Sets additional context information on a language model instance. This context provides environmental or operational information that will be attached to all spans created for this model. Use this to add relevant metadata such as user preferences, session state, or runtime conditions that influenced the LLM’s behavior. This is valuable for debugging and understanding why the model produced specific outputs. Supports both BaseLanguageModel instances and RunnableBinding objects. When a RunnableBinding is provided, the context is automatically set on the underlying bound object (which must be a BaseLanguageModel). For more information on RunnableBinding, see: <https://python.langchain.com/api\\_reference/core/runnables/langchain\\_core.runnables.base.RunnableBinding.html>Documentation Index
Fetch the complete documentation index at: https://handbook.fiddler.ai/llms.txt
Use this file to discover all available pages before exploring further.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
llm | `BaseLanguageModel | RunnableBinding` | ✓ | - |
context | str | ✓ | - | The context string to add. This will be included in span attributes as |