fix(langchain): Extract model name from 'model' field for non-OpenAI providers#125
Open
NikitaVoitov wants to merge 1 commit intosignalfx:mainfrom
Open
fix(langchain): Extract model name from 'model' field for non-OpenAI providers#125NikitaVoitov wants to merge 1 commit intosignalfx:mainfrom
NikitaVoitov wants to merge 1 commit intosignalfx:mainfrom
Conversation
…providers Fixes model name extraction for providers like ChatSnowflake and ChatAnthropic that use 'model' instead of 'model_name' in invocation_params. Priority order: 1. invocation_params.model_name (OpenAI convention) 2. invocation_params.model (Snowflake, Anthropic) 3. metadata.model_name 4. metadata.ls_model_name (LangSmith) Tests added: - test_model_name_extraction_from_model_field - test_model_name_extraction_priority - test_model_name_fallback_to_unknown
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
zhirafovod
approved these changes
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes model name extraction to support providers that use
modelinstead ofmodel_namein invocation params. This enables proper model identification for Snowflake Cortex, Anthropic, Google, and other non-OpenAI providers.Fixes #124
The Bug (Before)
The Fix (After)
Changes
callback_handler.py
Updated model name extraction with fallback chain:
Testing
test_model_name_extraction_from_model_field- verifiesmodelfield extractiontest_model_name_extraction_priority- verifiesmodel_nametakes precedence overmodeltest_model_name_fallback_to_unknown- verifies fallback when neither field presentFiles Changed
instrumentation-genai/opentelemetry-instrumentation-langchain/src/opentelemetry/instrumentation/langchain/callback_handler.pyinstrumentation-genai/opentelemetry-instrumentation-langchain/tests/test_callback_handler_agent.py