What component(s) are affected?
Opik version
- Opik version: 2.2.71 (
origin/main at f06298d93)
Describe the problem
enable_litellm_models_monitoring is documented as governing one class, but the Anthropic adapter also reads it.
sdks/python/src/opik/config.py:217-222:
enable_litellm_models_monitoring: bool = True
"""
If set to True - Opik will create llm spans for LiteLLMChatModel calls.
It is mainly to be used in tests since litellm uses external Opik callback
which makes HTTP requests not via the opik package.
"""
sdks/python/src/opik/evaluation/models/anthropic/anthropic_chat_model.py:65:
enable_tracking = track and config.enable_litellm_models_monitoring
So an AnthropicChatModel built with track=True silently produces no spans when a user or test harness sets enable_litellm_models_monitoring=False — a flag whose own documentation limits it to LiteLLMChatModel and whose stated reason for existing (litellm's external callback plumbing) does not apply to the Anthropic client, which traces through opik.integrations.anthropic.track_anthropic in-process.
This surfaced while writing #8408/#8409: the repo triage bot suggested the LangChain adapter should honour the same config flag "for consistency". I did not do that, precisely because the flag is documented as LiteLLM-scoped — but checking that led here, and the Anthropic use looks like the same copy-paste viewed from the other side.
Which way is correct?
Either reading is defensible and they are not the same change, so I would rather not guess:
- The docstring is accurate and the usage is wrong → drop the config term from
anthropic_chat_model.py:65, leaving track to govern that adapter. Behaviour change for anyone currently setting the flag to False.
- The flag is meant as a general "SDK-attached LLM span" switch → then
config.py:217 and its name should be generalised (and the LangChain adapter should read it too, which is what the triage bot assumed). Also a behaviour change, in the opposite direction.
Option 3 is adding an Anthropic-specific option, which is a new configuration surface rather than a fix.
Reproduction steps and code snippets
Not executed as a live trace test — this is a code-and-documentation contradiction rather than a runtime mystery, and the two lines above are the whole of it. rg enable_[a-z_]*monitoring src/opik/config.py returns exactly this one option, so there is no general switch being read by mistake.
Error logs or stack trace
None — the failure mode is silent absence of spans.
What component(s) are affected?
Opik version
origin/mainatf06298d93)Describe the problem
enable_litellm_models_monitoringis documented as governing one class, but the Anthropic adapter also reads it.sdks/python/src/opik/config.py:217-222:sdks/python/src/opik/evaluation/models/anthropic/anthropic_chat_model.py:65:So an
AnthropicChatModelbuilt withtrack=Truesilently produces no spans when a user or test harness setsenable_litellm_models_monitoring=False— a flag whose own documentation limits it toLiteLLMChatModeland whose stated reason for existing (litellm's external callback plumbing) does not apply to the Anthropic client, which traces throughopik.integrations.anthropic.track_anthropicin-process.This surfaced while writing #8408/#8409: the repo triage bot suggested the LangChain adapter should honour the same config flag "for consistency". I did not do that, precisely because the flag is documented as LiteLLM-scoped — but checking that led here, and the Anthropic use looks like the same copy-paste viewed from the other side.
Which way is correct?
Either reading is defensible and they are not the same change, so I would rather not guess:
anthropic_chat_model.py:65, leavingtrackto govern that adapter. Behaviour change for anyone currently setting the flag toFalse.config.py:217and its name should be generalised (and the LangChain adapter should read it too, which is what the triage bot assumed). Also a behaviour change, in the opposite direction.Option 3 is adding an Anthropic-specific option, which is a new configuration surface rather than a fix.
Reproduction steps and code snippets
Not executed as a live trace test — this is a code-and-documentation contradiction rather than a runtime mystery, and the two lines above are the whole of it.
rg enable_[a-z_]*monitoring src/opik/config.pyreturns exactly this one option, so there is no general switch being read by mistake.Error logs or stack trace
None — the failure mode is silent absence of spans.