You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Evaluated on LLM spans| Evaluated using LLM | Tool Selection verifies that the tools chosen by the LLM align with the user's request and the available tools. The evaluation identifies cases where irrelevant or incorrect tool calls were made.|
313
+
314
+
##### Instrumentation
315
+
316
+
This evaluation is supported in dd-trace version 3.12 and above. The example below uses the OpenAI Agents SDK to illustrate how tools are made available to the agent and to the evaluation:
317
+
318
+
{{< code-block lang="python" >}}
319
+
from ddtrace.llmobs import LLMObs
320
+
from agents import Agent, ModelSettings, function_tool
321
+
322
+
@function_tool
323
+
def add_numbers(a: int, b: int) -> int:
324
+
"""
325
+
Adds two numbers together.
326
+
"""
327
+
return a + b
328
+
329
+
@function_tool
330
+
def subtract_numbers(a: int, b: int) -> int:
331
+
"""
332
+
Subtracts two numbers.
333
+
"""
334
+
return a - b
335
+
336
+
337
+
# List of tools available to the agent
338
+
math_tutor_agent = Agent(
339
+
name="Math Tutor",
340
+
handoff_description="Specialist agent for math questions",
341
+
instructions="You provide help with math problems. Please use the tools to find the answer.",
342
+
model="o3-mini",
343
+
tools=[
344
+
add_numbers, subtract_numbers
345
+
],
346
+
)
347
+
348
+
history_tutor_agent = Agent(
349
+
name="History Tutor",
350
+
handoff_description="Specialist agent for history questions",
351
+
instructions="You provide help with history problems.",
352
+
model="o3-mini",
353
+
)
354
+
355
+
# The triage agent decides which specialized agent to hand off the task to — another type of tool selection covered by this evaluation.
0 commit comments