Skip to content
Merged
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
2 changes: 1 addition & 1 deletion agentops/instrumentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class InstrumentorConfig(TypedDict):
"class_name": "CrewAIInstrumentor",
"min_version": "0.56.0",
},
"autogen": {"module_name": "agentops.instrumentation.ag2", "class_name": "AG2Instrumentor", "min_version": "0.1.0"},
"autogen": {"module_name": "agentops.instrumentation.ag2", "class_name": "AG2Instrumentor", "min_version": "0.3.2"},
"agents": {
"module_name": "agentops.instrumentation.openai_agents",
"class_name": "OpenAIAgentsInstrumentor",
Expand Down
2 changes: 1 addition & 1 deletion agentops/instrumentation/ag2/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def instrumentation_dependencies(self) -> Collection[str]:
"""Return packages required for instrumentation."""
return ["autogen >= 0.3.2"]
return ["ag2 >= 0.3.2"]

Check warning on line 35 in agentops/instrumentation/ag2/instrumentor.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/instrumentor.py#L35

Added line #L35 was not covered by tests

def _instrument(self, **kwargs):
"""Instrument AG2 components."""
Expand Down
13 changes: 7 additions & 6 deletions agentops/instrumentation/openai/wrappers/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,13 @@
# Tools
if "tools" in kwargs:
tools = kwargs["tools"]
for i, tool in enumerate(tools):
function = tool.get("function", {})
prefix = f"{SpanAttributes.LLM_REQUEST_FUNCTIONS}.{i}"
attributes[f"{prefix}.name"] = function.get("name")
attributes[f"{prefix}.description"] = function.get("description")
attributes[f"{prefix}.parameters"] = json.dumps(function.get("parameters"))
if tools: # Check if tools is not None
for i, tool in enumerate(tools):
function = tool.get("function", {})
prefix = f"{SpanAttributes.LLM_REQUEST_FUNCTIONS}.{i}"
attributes[f"{prefix}.name"] = function.get("name")
attributes[f"{prefix}.description"] = function.get("description")
attributes[f"{prefix}.parameters"] = json.dumps(function.get("parameters"))

Check warning on line 113 in agentops/instrumentation/openai/wrappers/chat.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/openai/wrappers/chat.py#L107-L113

Added lines #L107 - L113 were not covered by tests

# Extract response attributes from return value
if return_value:
Expand Down
10 changes: 2 additions & 8 deletions examples/ag2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,14 @@ This directory contains examples of using AG2 (AutoGen 2.0) with AgentOps instru

## Examples

### 1. Agent Chat with Memory

Example: `agentchat_with_memory`
This example demonstrates:
- Agent chat with persistent memory

### 2. Asynchronous Human Input
### 1. Asynchronous Human Input

Example: `async_human_input`

This example demonstrates:
- Asynchronous human input handling

### 3. Wikipedia Search Tool
### 2. Wikipedia Search Tool

Example: `tools_wikipedia_search`

Expand Down
320 changes: 0 additions & 320 deletions examples/ag2/agentchat_with_memory.ipynb

This file was deleted.

Loading
Loading