diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.yml index 1d548d1cf..1a32e81f0 100644 --- a/.github/workflows/test-notebooks.yml +++ b/.github/workflows/test-notebooks.yml @@ -1,9 +1,6 @@ name: Test Notebooks on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + workflow_dispatch: # Allows manual triggering jobs: test-notebooks: runs-on: ubuntu-latest diff --git a/agentops/cli.py b/agentops/cli.py index 29b9e90b1..562c8053d 100644 --- a/agentops/cli.py +++ b/agentops/cli.py @@ -32,10 +32,6 @@ def main(): if args.branch_name: fetch_time_travel_id(args.branch_name) if args.on: - set_time_travel_active_state("on") + set_time_travel_active_state(True) if args.off: - set_time_travel_active_state("off") - - -if __name__ == "__main__": - main() + set_time_travel_active_state(False) diff --git a/agentops/session.py b/agentops/session.py index 5abb96293..cec18c3f4 100644 --- a/agentops/session.py +++ b/agentops/session.py @@ -268,7 +268,7 @@ def _flush_queue(self) -> None: if not self.is_running: return with self.lock: - queue_copy = copy.deepcopy(self.queue) # Copy the current items + queue_copy = self.queue[:] # Copy the current items self.queue = [] if len(queue_copy) > 0: diff --git a/agentops/time_travel.py b/agentops/time_travel.py index a6de34b36..5b3b9a6f8 100644 --- a/agentops/time_travel.py +++ b/agentops/time_travel.py @@ -1,10 +1,9 @@ import json import yaml +import os from .http_client import HttpClient from .exceptions import ApiServerException -import os from .helpers import singleton -from os import environ @singleton @@ -32,13 +31,10 @@ def __init__(self): def fetch_time_travel_id(ttd_id): try: - endpoint = environ.get("AGENTOPS_API_ENDPOINT", "https://api.agentops.ai") - payload = json.dumps({"ttd_id": ttd_id}).encode("utf-8") + endpoint = os.environ.get("AGENTOPS_API_ENDPOINT", "https://api.agentops.ai") ttd_res = HttpClient.get(f"{endpoint}/v2/ttd/{ttd_id}") if ttd_res.code != 200: - raise Exception( - f"Failed to fetch TTD with status code {ttd_res.status_code}" - ) + raise Exception(f"Failed to fetch TTD with status code {ttd_res.code}") prompt_to_returns_map = { "completion_overrides": { diff --git a/docs/v0/logger.mdx b/docs/v0/logger.mdx index 209e4687e..dd9514025 100644 --- a/docs/v0/logger.mdx +++ b/docs/v0/logger.mdx @@ -7,7 +7,7 @@ description: 'This document explains the use of the AgentOpsLogger ## AgentOps logger -The AgentsOps logger is quick and simple way of integrating your existing +The AgentOps logger is quick and simple way of integrating your existing agent codebase with AgentOps. It allows you to use your current logs as events by extending the built-in Python logging system to emit events to AgentOps. diff --git a/docs/v0/recording-events.mdx b/docs/v0/recording-events.mdx index ff4181f97..c831a5a2a 100644 --- a/docs/v0/recording-events.mdx +++ b/docs/v0/recording-events.mdx @@ -35,7 +35,7 @@ From this point, simply call the .record() method in the AgentOps client: ao_client.record(Event("event_type1")) ``` -In AgentsOps, each session is associated with a number of "Events". Events have +In AgentOps, each session is associated with a number of "Events". Events have must have an "event_type" which is any abitrary string of your choice. It might be something like "OpenAI Call". Events can also have other information such as the parameters of the operation, the returned data, alongside tags, etc. diff --git a/examples/openai-gpt.ipynb b/examples/openai-gpt.ipynb index 613880ab1..09cf5ac37 100644 --- a/examples/openai-gpt.ipynb +++ b/examples/openai-gpt.ipynb @@ -130,10 +130,11 @@ }, "outputs": [], "source": [ - "message = ({\"role\": \"user\", \"content\": \"Write a 12 word poem about secret agents.\"},)\n", + "message = [{\"role\": \"user\", \"content\": \"Write a 12 word poem about secret agents.\"}]\n", "res = openai.chat.completions.create(\n", - " model=\"gpt-3.5-turbo\", messages=message, temperature=0.5, stream=True\n", - ")" + " model=\"gpt-3.5-turbo\", messages=message, temperature=0.5, stream=False\n", + ")\n", + "print(res.choices[0].message[\"content\"])" ] }, { @@ -282,7 +283,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.4" } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index 2680e070c..dc3b88d5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,3 +41,6 @@ Issues = "https://github.com/AgentOps-AI/agentops/issues" [tool.autopep8] max_line_length = 120 + +[project.scripts] +agentops = "agentops.cli:main"