Skip to content

Commit 8850b55

Browse files
jsimphergithub-actions[bot]
authored andcommitted
fix(llmobs): remove version setting in langchain auto prompt template (#14937)
## Description Remove setting version from auto instrumented prompt templates. We adjusted the way we interpret explicitly set versions. Auto instrumentation should not set one. ## Testing <!-- Describe your testing strategy or note what tests are included --> ## Risks <!-- Note any risks associated with this change, or "None" if no risks --> ## Additional Notes <!-- Any other information that would be helpful for reviewers --> (cherry picked from commit 8b7fe13)
1 parent de9dbc1 commit 8850b55

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

ddtrace/llmobs/_integrations/langchain.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,6 @@ def handle_prompt_template_invoke(self, instance, result, args: List[Any], kwarg
915915
"template": template,
916916
"chat_template": chat_template,
917917
"id": prompt_id if prompt_id is not None else "unknown",
918-
"version": "0.0.0",
919918
"rag_context_variables": [],
920919
"rag_query_variables": [],
921920
"tags": tags,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
langchain: This fix resolves an issue where auto instrumented prompt templates incorrectly included a
5+
``version`` field. The version field is now omitted unless explicitly set by the user.

tests/contrib/langchain/test_langchain_llmobs.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@ def test_llmobs_chain(langchain_core, langchain_openai, openai_url, llmobs_event
414414
{"content": "{input}", "role": "user"},
415415
],
416416
"variables": {"input": "Can you explain what an LLM chain is?"},
417-
"version": "0.0.0",
418417
"_dd_context_variable_keys": ["context"],
419418
"_dd_query_variable_keys": ["question"],
420419
},
@@ -456,7 +455,6 @@ def test_llmobs_chain_nested(langchain_core, langchain_openai, openai_url, llmob
456455
"id": "langchain.unknown_prompt_template",
457456
"chat_template": [{"content": "what is the city {person} is from?", "role": "user"}],
458457
"variables": {"person": "Spongebob Squarepants", "language": "Spanish"},
459-
"version": "0.0.0",
460458
"_dd_context_variable_keys": ["context"],
461459
"_dd_query_variable_keys": ["question"],
462460
},
@@ -469,7 +467,6 @@ def test_llmobs_chain_nested(langchain_core, langchain_openai, openai_url, llmob
469467
"id": "test_langchain_llmobs.prompt2",
470468
"chat_template": [{"content": "what country is the city {city} in? respond in {language}", "role": "user"}],
471469
"variables": {"city": mock.ANY, "language": "Spanish"},
472-
"version": "0.0.0",
473470
"_dd_context_variable_keys": ["context"],
474471
"_dd_query_variable_keys": ["question"],
475472
},
@@ -505,7 +502,6 @@ def test_llmobs_chain_batch(langchain_core, langchain_openai, llmobs_events, tra
505502
"id": "langchain.unknown_prompt_template",
506503
"chat_template": [{"content": "Tell me a short joke about {topic}", "role": "user"}],
507504
"variables": {"topic": "chickens"},
508-
"version": "0.0.0",
509505
"_dd_context_variable_keys": ["context"],
510506
"_dd_query_variable_keys": ["question"],
511507
},
@@ -519,7 +515,6 @@ def test_llmobs_chain_batch(langchain_core, langchain_openai, llmobs_events, tra
519515
"id": "langchain.unknown_prompt_template",
520516
"chat_template": [{"content": "Tell me a short joke about {topic}", "role": "user"}],
521517
"variables": {"topic": "pigs"},
522-
"version": "0.0.0",
523518
"_dd_context_variable_keys": ["context"],
524519
"_dd_query_variable_keys": ["question"],
525520
},
@@ -534,7 +529,6 @@ def test_llmobs_chain_batch(langchain_core, langchain_openai, llmobs_events, tra
534529
"id": "langchain.unknown_prompt_template",
535530
"chat_template": [{"content": "Tell me a short joke about {topic}", "role": "user"}],
536531
"variables": {"topic": "chickens"},
537-
"version": "0.0.0",
538532
"_dd_context_variable_keys": ["context"],
539533
"_dd_query_variable_keys": ["question"],
540534
},
@@ -548,7 +542,6 @@ def test_llmobs_chain_batch(langchain_core, langchain_openai, llmobs_events, tra
548542
"id": "langchain.unknown_prompt_template",
549543
"chat_template": [{"content": "Tell me a short joke about {topic}", "role": "user"}],
550544
"variables": {"topic": "pigs"},
551-
"version": "0.0.0",
552545
"_dd_context_variable_keys": ["context"],
553546
"_dd_query_variable_keys": ["question"],
554547
},

0 commit comments

Comments
 (0)