Skip to content

Commit 2fd6b28

Browse files
committed
make toolcall required in context manager call
1 parent 1c18014 commit 2fd6b28

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

  • util/opentelemetry-util-genai/src/opentelemetry/util/genai

util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ def fail_llm(
304304
return self._fail(invocation, error)
305305

306306
@contextmanager
307-
def tool_call(
308-
self, tool_call: ToolCall | None = None
309-
) -> Iterator[ToolCall]:
307+
def tool_call(self, tool_call: ToolCall) -> Iterator[ToolCall]:
310308
"""Context manager for tool call invocations.
311309
312310
Only set data attributes on the tool_call object, do not modify the span or context.
@@ -320,12 +318,6 @@ def tool_call(
320318
# Execute tool logic
321319
tc.tool_result = {"temp": 20, "condition": "sunny"}
322320
"""
323-
if tool_call is None:
324-
tool_call = ToolCall(
325-
name="",
326-
arguments={},
327-
id=None,
328-
)
329321
self.start(tool_call)
330322
try:
331323
yield tool_call

0 commit comments

Comments
 (0)