-
Notifications
You must be signed in to change notification settings - Fork 602
feat(langchain): Broaden AI provider detection beyond OpenAI and Anthropic #5707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
561688e
1f88b70
1bc78cc
5cc615e
f58a60b
351475f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,6 +108,15 @@ | |
| OllamaEmbeddings = None | ||
|
|
||
|
|
||
| def _get_ai_system(all_params: "Dict[str, Any]") -> "Optional[str]": | ||
| ai_type = all_params.get("_type") | ||
|
|
||
| if not ai_type or not isinstance(ai_type, str): | ||
| return None | ||
|
|
||
| return ai_type | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raw
|
||
|
|
||
|
|
||
| DATA_FIELDS = { | ||
| "frequency_penalty": SPANDATA.GEN_AI_REQUEST_FREQUENCY_PENALTY, | ||
| "function_call": SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS, | ||
|
|
@@ -380,11 +389,9 @@ | |
| model, | ||
| ) | ||
|
|
||
| ai_type = all_params.get("_type", "") | ||
| if "anthropic" in ai_type: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, "anthropic") | ||
| elif "openai" in ai_type: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, "openai") | ||
| ai_system = _get_ai_system(all_params) | ||
| if ai_system: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, ai_system) | ||
ericapisani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| for key, attribute in DATA_FIELDS.items(): | ||
| if key in all_params and all_params[key] is not None: | ||
|
|
@@ -448,11 +455,9 @@ | |
| if model: | ||
| span.set_data(SPANDATA.GEN_AI_REQUEST_MODEL, model) | ||
|
|
||
| ai_type = all_params.get("_type", "") | ||
| if "anthropic" in ai_type: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, "anthropic") | ||
| elif "openai" in ai_type: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, "openai") | ||
| ai_system = _get_ai_system(all_params) | ||
| if ai_system: | ||
| span.set_data(SPANDATA.GEN_AI_SYSTEM, ai_system) | ||
|
Check warning on line 460 in sentry_sdk/integrations/langchain.py
|
||
|
|
||
| agent_name = _get_current_agent() | ||
| if agent_name: | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.