Skip to content

Commit 64423f0

Browse files
committed
Change the default returned
1 parent 567c522 commit 64423f0

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎instrumentation/opentelemetry-instrumentation-genai-langchain/src/opentelemetry/instrumentation/genai/langchain/callback_handler.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ def _prompt_variables(
176176
) -> dict[str, Any]:
177177
raw_prompt_config = serialized.get("kwargs")
178178
if not isinstance(raw_prompt_config, Mapping):
179-
return dict(inputs)
179+
return {}
180180
prompt_config = cast(Mapping[str, Any], raw_prompt_config)
181181

182182
raw_input_variables = prompt_config.get("input_variables")
183183
if not isinstance(raw_input_variables, list):
184-
return dict(inputs)
184+
return {}
185185
untyped_input_variables = cast(list[Any], raw_input_variables)
186186
if not all(isinstance(key, str) for key in untyped_input_variables):
187-
return dict(inputs)
187+
return {}
188188
input_variables = cast(list[str], untyped_input_variables)
189189

190190
partial_variables = prompt_config.get("partial_variables")

‎instrumentation/opentelemetry-instrumentation-genai-langchain/tests/test_callback_handler.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,13 @@ def test_prompt_context_from_parent(self):
507507
parent_run_id, None, None
508508
)
509509
handler.on_chain_start(
510-
serialized={"name": "PromptTemplate"},
510+
serialized={
511+
"name": "PromptTemplate",
512+
"kwargs": {
513+
"input_variables": ["name"],
514+
"partial_variables": {},
515+
},
516+
},
511517
inputs={"name": "Ada"},
512518
run_id=_run_id(),
513519
parent_run_id=parent_run_id,
@@ -708,7 +714,7 @@ def test_prompt_template_legacy_name_fallback(self, template_type: str):
708714

709715
assert handler._invocation_manager.get_prompt_context(
710716
parent_run_id
711-
) == (template_type, {"name": "Ada"})
717+
) == (template_type, {})
712718

713719
def test_non_prompt_id_takes_precedence_over_prompt_name(self):
714720
handler, _, _, _ = _make_handler()

0 commit comments

Comments
 (0)