> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# set_llm_context

> Set or clear additional context information for LLM interactions.

Set or clear additional context information for LLM interactions.

The LLM context allows you to provide additional background information
or available options that can be tracked alongside model invocations.
This context will be added to telemetry spans as 'gen\_ai.llm.context'
and can be used for debugging or analysis in Fiddler's platform.

The context persists until explicitly changed by calling this function
again with a new value, or cleared by passing `None`. Clearing is
useful in multi-step agent workflows where context set after a RAG step
should not leak into later non-RAG LLM calls.

Works automatically in both synchronous and asynchronous contexts.

## Parameters

<ParamField path="model" type="Model" required={true}>
  The Model instance to attach context to
</ParamField>

<ParamField path="context" type="str | None" required={false} default="None">
  Context string providing additional information about available
  options, constraints, or background for the LLM interaction.
  Pass `None` to clear any previously set context.
</ParamField>

## Example

```python theme={null}
from strands.models.openai import OpenAIModel
from fiddler_strandsagents import set_llm_context

model = OpenAIModel(api_key="...", model_id="gpt-4")
set_llm_context(
    model,
    'Available hotels: Hilton, Marriott, Hyatt...'
)

# Now when the model is invoked, the context will be
# included in the telemetry span
agent = Agent(model=model, system_prompt="You are a travel assistant")
response = agent("Which hotel should I book?")

# Clear context before non-RAG steps
set_llm_context(model, None)
```
