Skip to content

Commit

Permalink
update langchain to handle vertex and gemini llm calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ncybul committed Dec 9, 2024
1 parent 7320b6f commit e4d51b7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ddtrace/llmobs/_integrations/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
ANTHROPIC_PROVIDER_NAME = "anthropic"
BEDROCK_PROVIDER_NAME = "amazon_bedrock"
OPENAI_PROVIDER_NAME = "openai"
VERTEXAI_PROVIDER_NAME = "vertexai"
GEMINI_PROVIDER_NAME = "google_palm"

ROLE_MAPPING = {
"human": "user",
Expand Down Expand Up @@ -81,6 +83,12 @@ def _llmobs_set_tags(
if model_provider:
if model_provider.startswith(BEDROCK_PROVIDER_NAME):
llmobs_integration = "bedrock"
# only the llm interface for Vertex AI will get instrumented
elif model_provider.startswith(VERTEXAI_PROVIDER_NAME) and operation == "llm":
llmobs_integration = "vertexai"
# only the llm interface for Gemini will get instrumented
elif model_provider.startswith(GEMINI_PROVIDER_NAME) and operation == "llm":
llmobs_integration = "google_generativeai"
elif model_provider.startswith(OPENAI_PROVIDER_NAME):
llmobs_integration = "openai"
elif operation == "chat" and model_provider.startswith(ANTHROPIC_PROVIDER_NAME):
Expand Down

0 comments on commit e4d51b7

Please sign in to comment.