Skip to main content
Remove any previously set LLM context from a language model instance. After calling this function, subsequent spans created for the model will not carry gen_ai.llm.context unless it is set again via set_llm_context(). This is equivalent to set_llm_context(llm, None).

Parameters

llm
BaseLanguageModel | RunnableBinding
required
The language model (or binding) to clear context from.

Raises

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

Returns

None Example: default from langchain_openai import ChatOpenAI from fiddler_langchain import set_llm_context, clear_llm_context model = ChatOpenAI(model=“gpt-4”) set_llm_context(model, “RAG retrieved documents…”) # … RAG LLM call … clear_llm_context(model) # … subsequent non-RAG LLM calls have no context …