> ## 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.

# clear_llm_context

> Remove LLM context from a language model instance.

Remove LLM context from a language model instance.

This is a convenience wrapper that calls `set_llm_context(llm, None)`.
Use it in multi-step agent workflows after a RAG retrieval step to
ensure subsequent non-RAG LLM calls (tool planning, routing, etc.) do
not carry stale context and do not trigger faithfulness evaluation.

The context is stored in the model's metadata and read by
[`FiddlerAgentMiddleware`](/sdk-api/langchain/fiddler-agent-middleware)
when creating LLM spans.

## Parameters

<ParamField path="llm" type="BaseLanguageModel | RunnableBinding" required={true}>
  The language model instance or binding to clear context from.
</ParamField>

## Raises

**TypeError** – If a `RunnableBinding` is provided but its bound
object is not a `BaseLanguageModel`.

## Returns

<ResponseField>
  None Example: default from langchain\_openai import ChatOpenAI from fiddler\_langchain import set\_llm\_context, clear\_llm\_context llm = ChatOpenAI(model="gpt-4o") retrieved\_context = "Relevant documents joined as a single string..." rag\_prompt = "Answer the question using the context above." planning\_prompt = "Plan the next agent step." # Step 1: RAG retrieval -- attach context for faithfulness evaluation set\_llm\_context(llm, retrieved\_context) response = llm.invoke(rag\_prompt) # faithfulness evaluated # Step 2: Non-RAG planning -- clear context to skip faithfulness evaluation clear\_llm\_context(llm) plan = llm.invoke(planning\_prompt) # no faithfulness evaluation
</ResponseField>

## SEE ALSO

`set_llm_context()` – Set or clear context on a language model
instance. Passing `None` as the context value is equivalent to
calling `clear_llm_context()`.
