Spaces:
Running
Running
daavoo
commited on
Commit
ยท
bf33614
1
Parent(s):
a5c72af
enh(openai): Use `OpenAIAgentsInstrumentor` instead of `OpenAIInstrumentor`.
Browse files
pyproject.toml
CHANGED
@@ -29,7 +29,7 @@ smolagents = [
|
|
29 |
|
30 |
openai = [
|
31 |
"openai-agents",
|
32 |
-
"openinference-instrumentation-openai"
|
33 |
]
|
34 |
|
35 |
mcp = [
|
|
|
29 |
|
30 |
openai = [
|
31 |
"openai-agents",
|
32 |
+
"openinference-instrumentation-openai-agents"
|
33 |
]
|
34 |
|
35 |
mcp = [
|
src/surf_spot_finder/agents/openai.py
CHANGED
@@ -77,7 +77,6 @@ def run_openai_agent(
|
|
77 |
tool = getattr(module, func)
|
78 |
imported_tools.append(function_tool(tool))
|
79 |
|
80 |
-
logger.info(f"Imported tools: {imported_tools}")
|
81 |
if api_key_var and api_base:
|
82 |
external_client = AsyncOpenAI(
|
83 |
api_key=os.environ[api_key_var],
|
|
|
77 |
tool = getattr(module, func)
|
78 |
imported_tools.append(function_tool(tool))
|
79 |
|
|
|
80 |
if api_key_var and api_base:
|
81 |
external_client = AsyncOpenAI(
|
82 |
api_key=os.environ[api_key_var],
|
src/surf_spot_finder/tracing.py
CHANGED
@@ -97,9 +97,9 @@ def setup_tracing(tracer_provider: TracerProvider, agent_type: str) -> None:
|
|
97 |
validate_agent_type(agent_type)
|
98 |
|
99 |
if "openai" in agent_type:
|
100 |
-
from openinference.instrumentation.
|
101 |
|
102 |
-
|
103 |
elif agent_type == "smolagents":
|
104 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
105 |
|
|
|
97 |
validate_agent_type(agent_type)
|
98 |
|
99 |
if "openai" in agent_type:
|
100 |
+
from openinference.instrumentation.openai_agents import OpenAIAgentsInstrumentor
|
101 |
|
102 |
+
OpenAIAgentsInstrumentor().instrument(tracer_provider=tracer_provider)
|
103 |
elif agent_type == "smolagents":
|
104 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
105 |
|
tests/unit/test_unit_tracing.py
CHANGED
@@ -35,8 +35,8 @@ def test_get_tracer_provider(tmp_path, json_tracer):
|
|
35 |
@pytest.mark.parametrize(
|
36 |
"agent_type,instrumentor",
|
37 |
[
|
38 |
-
("openai", "
|
39 |
-
("openai_multi_agent", "
|
40 |
("smolagents", "smolagents.SmolagentsInstrumentor"),
|
41 |
],
|
42 |
)
|
|
|
35 |
@pytest.mark.parametrize(
|
36 |
"agent_type,instrumentor",
|
37 |
[
|
38 |
+
("openai", "openai_agents.OpenAIAgentsInstrumentor"),
|
39 |
+
("openai_multi_agent", "openai_agents.OpenAIAgentsInstrumentor"),
|
40 |
("smolagents", "smolagents.SmolagentsInstrumentor"),
|
41 |
],
|
42 |
)
|