-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
145 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
# agentops/__init__.py | ||
|
||
from .client import Client | ||
from .event import Event | ||
from .event import Event # TODO: Don't expose? Since it's abstract? | ||
from .logger import AgentOpsLogger | ||
from .enums import Models | ||
from .enums import Models, EventType # TODO: Is EventType needed? | ||
|
||
# Import event classes | ||
from .events.action import ActionEvent | ||
from .events.error import ErrorEvent | ||
from .events.llm import LLMEvent | ||
from .events.tool import ToolEvent | ||
|
||
# TODO: Expose them at the package level? | ||
# __all__ = ['Client', 'Event', 'AgentOpsLogger', 'Models', | ||
# 'ActionEvent', 'ErrorEvent', 'LLMEvent', 'ToolEvent'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ class EventType(Enum): | |
LLM = "llm" | ||
ACTION = "action" | ||
API = "api" | ||
TOOL = "tool" | ||
ERROR = "error" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Processing /Users/howardgil/Desktop/agentops/AgentOps-AI/agentops\n", | ||
" Installing build dependencies ... \u001b[?25ldone\n", | ||
"\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", | ||
"\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", | ||
"\u001b[?25hRequirement already satisfied: requests==2.31.0 in ./env/lib/python3.12/site-packages (from agentops==0.0.20) (2.31.0)\n", | ||
"Requirement already satisfied: pydantic>=1.9.0 in ./env/lib/python3.12/site-packages (from agentops==0.0.20) (2.6.3)\n", | ||
"Requirement already satisfied: packaging<24.0,>=23.1 in ./env/lib/python3.12/site-packages (from agentops==0.0.20) (23.2)\n", | ||
"Requirement already satisfied: charset-normalizer<4,>=2 in ./env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.0.20) (3.3.2)\n", | ||
"Requirement already satisfied: idna<4,>=2.5 in ./env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.0.20) (3.6)\n", | ||
"Requirement already satisfied: urllib3<3,>=1.21.1 in ./env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.0.20) (2.2.1)\n", | ||
"Requirement already satisfied: certifi>=2017.4.17 in ./env/lib/python3.12/site-packages (from requests==2.31.0->agentops==0.0.20) (2024.2.2)\n", | ||
"Requirement already satisfied: annotated-types>=0.4.0 in ./env/lib/python3.12/site-packages (from pydantic>=1.9.0->agentops==0.0.20) (0.6.0)\n", | ||
"Requirement already satisfied: pydantic-core==2.16.3 in ./env/lib/python3.12/site-packages (from pydantic>=1.9.0->agentops==0.0.20) (2.16.3)\n", | ||
"Requirement already satisfied: typing-extensions>=4.6.1 in ./env/lib/python3.12/site-packages (from pydantic>=1.9.0->agentops==0.0.20) (4.10.0)\n", | ||
"Building wheels for collected packages: agentops\n", | ||
" Building wheel for agentops (pyproject.toml) ... \u001b[?25ldone\n", | ||
"\u001b[?25h Created wheel for agentops: filename=agentops-0.0.20-py3-none-any.whl size=20466 sha256=2ec5b069d7411bd7fbabe5ce448264cb4cb603e0a76a9f6edc2ead13392ff0bd\n", | ||
" Stored in directory: /private/var/folders/jb/71y2z4v178jdr5xcgbxfm0gc0000gp/T/pip-ephem-wheel-cache-r78w781y/wheels/43/52/53/9286c77226c557a85392056462580d0d7db8d733d3a9c9be69\n", | ||
"Successfully built agentops\n", | ||
"Installing collected packages: agentops\n", | ||
" Attempting uninstall: agentops\n", | ||
" Found existing installation: agentops 0.0.20\n", | ||
" Uninstalling agentops-0.0.20:\n", | ||
" Successfully uninstalled agentops-0.0.20\n", | ||
"Successfully installed agentops-0.0.20\n", | ||
"Note: you may need to restart the kernel to use updated packages.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%pip install .\n", | ||
"import agentops\n", | ||
"agentopsClient = agentops.Client(api_key=\"e2d78f13-1585-4d45-b482-f67a42ae6099\", tags=[\"event-ABC-test\"])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"action = agentops.ActionEvent(action_type=\"action-test\",detail=\"This is a test event\", logs=\"blah\")\n", | ||
"event = agentopsClient.record(action)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"llmEvent = agentops.LLMEvent(model=\"gpt-4\",prompt=\"ligma\",prompt_tokens=\"69\",completion_tokens=\"420\")\n", | ||
"event = agentopsClient.record(llmEvent)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"toolEvent = agentops.ToolEvent(name=\"tool-test\",inputs=\"test\",outputs=\"test\",logs=\"test\")\n", | ||
"event = agentopsClient.record(toolEvent)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"errorEvent = agentops.ErrorEvent(error_type=\"f\", code=\"404\", details=\"ligma\", logs=\"69\")\n", | ||
"event = agentopsClient.record(errorEvent)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "env", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |