Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
map_openai_finish_reason_to_finish_type,
OPENAI_FINISH_REASON_MAPPING
)
from monocle_apptrace.instrumentation.common.constants import AGENT_PREFIX_KEY, INFERENCE_AGENT_DELEGATION, INFERENCE_TURN_END, INFERENCE_TOOL_CALL
from monocle_apptrace.instrumentation.common.constants import AGENT_PREFIX_KEY, INFERENCE_AGENT_DELEGATION, INFERENCE_TURN_END, INFERENCE_TOOL_CALL, TOOL_TYPE
from contextlib import suppress

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -427,7 +427,7 @@ def extract_tool_type(arguments):
tool_call = _get_first_tool_call(response)
if tool_call:
# Return generic tool type for OpenAI tools
return "tool.openai"
return TOOL_TYPE

except Exception as e:
logger.warning("Warning: Error occurred in extract_tool_type: %s", str(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_finish_reason_function_call(setup):
assert "entity.3.name" in span_attributes, "entity.3.name should be present when finish_type is tool_call"
assert "entity.3.type" in span_attributes, "entity.3.type should be present when finish_type is tool_call"
assert span_attributes["entity.3.name"] == "get_current_weather", f"Expected tool name 'get_current_weather', got '{span_attributes.get('entity.3.name')}'"
assert span_attributes["entity.3.type"] == "tool.openai", f"Expected tool type 'tool.openai', got '{span_attributes.get('entity.3.type')}'"
assert span_attributes["entity.3.type"] == "tool.function", f"Expected tool type 'tool.function', got '{span_attributes.get('entity.3.type')}'"


if __name__ == "__main__":
Expand Down
Loading