From 0a673cdbf4ae2080861cb3c99d6fdc56e97e9f40 Mon Sep 17 00:00:00 2001 From: reibs Date: Tue, 15 Oct 2024 20:40:52 -0700 Subject: [PATCH] remove bad files --- ag.py | 93 ------------------------------------------------------ latency.py | 50 ----------------------------- output.txt | 61 ----------------------------------- 3 files changed, 204 deletions(-) delete mode 100644 ag.py delete mode 100644 latency.py delete mode 100644 output.txt diff --git a/ag.py b/ag.py deleted file mode 100644 index e75ff40d..00000000 --- a/ag.py +++ /dev/null @@ -1,93 +0,0 @@ -from typing import Annotated, Literal -from autogen import ConversableAgent, register_function -import agentops -import os -from dotenv import load_dotenv -from IPython.core.error import ( - StdinNotImplementedError, -) # only needed by AgentOps testing automation -import time - -load_dotenv() -OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") or "" -AGENTOPS_API_KEY = os.getenv("AGENTOPS_API_KEY") or "" - -agentops.init(AGENTOPS_API_KEY, default_tags=["autogen-tool-example"]) - -print("AgentOps is now running. You can view your session in the link above") - -# Define model, openai api key, tags, etc in the agent configuration -config_list = [ - { - "model": "gpt-4o-mini", - "api_key": OPENAI_API_KEY, - "tags": ["mathagent-example", "tool"], - "cache_seed": None, - } -] - -Operator = Literal["+", "-", "*", "/"] - - -def calculator(a: int, b: int, operator: Annotated[Operator, "operator"]) -> int: - if operator == "+": - return a + b - elif operator == "-": - return a - b - elif operator == "*": - return a * b - elif operator == "/": - return int(a / b) - else: - raise ValueError("Invalid operator") - - -# Create the agent that uses the LLM. -assistant = ConversableAgent( - name="Assistant", - system_message="You are a helpful AI assistant. " - "You can help with simple calculations. " - "Return 'TERMINATE' when the task is done.", - llm_config={"config_list": config_list}, -) - -# The user proxy agent is used for interacting with the assistant agent -# and executes tool calls. -user_proxy = ConversableAgent( - name="User", - llm_config=False, - is_termination_msg=lambda msg: msg.get("content") is not None - and "TERMINATE" in msg["content"], - human_input_mode="NEVER", -) - -assistant.register_for_llm(name="calculator", description="A simple calculator")( - calculator -) -user_proxy.register_for_execution(name="calculator")(calculator) - -# Register the calculator function to the two agents. -register_function( - calculator, - caller=assistant, # The assistant agent can suggest calls to the calculator. - executor=user_proxy, # The user proxy agent can execute the calculator calls. - name="calculator", # By default, the function name is used as the tool name. - description="A simple calculator", # A description of the tool. -) - -# Let the assistant start the conversation. It will end when the user types "exit". -start_time = time.time() -try: - user_proxy.initiate_chat( - assistant, message="What is (1423 - 123) / 3 + (32 + 23) * 5?" - ) -except StdinNotImplementedError: - # This is only necessary for AgentOps testing automation which is headless and will not have user input - print("Stdin not implemented. Skipping initiate_chat") - # agentops.end_session("Indeterminate") - -end_time = time.time() -duration = end_time - start_time -print(f"The duration of this run was {duration:.2f} seconds") - -# agentops.end_session("Success") diff --git a/latency.py b/latency.py deleted file mode 100644 index 597bb5d0..00000000 --- a/latency.py +++ /dev/null @@ -1,50 +0,0 @@ -import agentops -import time -import openai - -# OpenAI calls take ~0.5-0.8s - -# Define the maximum acceptable execution time (in seconds) -MAX_EXECUTION_TIME = 0.5 # Adjust this value as needed - -client = openai.OpenAI() - -start_time = time.time() -agentops.init( - api_key="1bbdc836-b95e-4b14-8538-3c2464989f88", - endpoint="https://api.playground.agentops.ai", -) -end_time = time.time() -init_time = end_time - start_time -client.chat.completions.create( - model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}] -) -print(f"AgentOps initialization time: {init_time:.4f} seconds") - -agentops.end_session("Success") - -# total_start_time = time.time() - -# # First test -# print("Start of first test") -# start_time = time.time() - -# client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}]) -# end_time = time.time() -# elapsed_time = end_time - start_time -# print(f"Elapsed time for first test: {elapsed_time:.4f} seconds") -# # agentops.end_session('Success') - -# # Second test -# print("Start of second test") -# start_time = time.time() -# client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}]) -# end_time = time.time() -# elapsed_time = end_time - start_time -# print(f"Elapsed time for second test: {elapsed_time:.4f} seconds") - -# total_end_time = time.time() -# total_elapsed_time = total_end_time - total_start_time -# print(f"Total elapsed time for entire test: {total_elapsed_time:.4f} seconds") - -# print("Latency test passed successfully!") diff --git a/output.txt b/output.txt deleted file mode 100644 index 5db69061..00000000 --- a/output.txt +++ /dev/null @@ -1,61 +0,0 @@ - -File: ./docs/v1/examples/recording_events.mdx -No spelling errors found. - Punctuation Corrections -╭──────────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────╮ -│ Original │ Corrected │ Explanation │ -├──────────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤ -│ AgentOps has a number of different [Event │ AgentOps has a number of different [Event │ Added a period at the end of the sentence │ -│ Types](https://docs.agentops.ai/v1/details/… │ Types](https://docs.agentops.ai/v1/details/e… │ for proper punctuation. │ -│ │ │ │ -╰──────────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────╯ - Grammar Corrections -╭──────────────────────────────────────────────┬───────────────────────────────────────────────┬──────────────────────────────────────────────╮ -│ Original │ Corrected │ Explanation │ -├──────────────────────────────────────────────┼───────────────────────────────────────────────┼──────────────────────────────────────────────┤ -│ We automatically instrument your LLM Calls │ We automatically instrument your LLM calls │ Changed 'Calls' to lowercase 'calls' for │ -│ from OpenAI, LiteLLM, Cohere, and more. Just │ from OpenAI, LiteLLM, Cohere, and more. Just │ consistency, and added a comma and 'as │ -│ make sure their SDKs are imported before │ make sure their SDKs are imported before │ shown' for better flow and clarity. │ -│ initializing AgentOps like we see below │ initializing AgentOps, as shown below. │ │ -│ │ │ │ -│ Next, we'll set our API keys. There are │ Next, we'll set our API keys. There are │ Changed semicolon to separate independent │ -│ several ways to do this, the code below is │ several ways to do this; the code below is │ clauses, removed 'just' for conciseness, and │ -│ just the most foolproof way for the purposes │ just the most foolproof way for the purposes │ changed 'API Key' to lowercase 'API key' for │ -│ of this notebook. It accounts for both users │ of this notebook. It accounts for both users │ consistency. │ -│ who use environment variables and those who │ who use environment variables and those who │ │ -│ just want to set the API Key here in this │ want to set the API key directly in this │ │ -│ notebook. │ notebook. │ │ -│ │ │ │ -│ Create an environment variable in a .env │ Create an environment variable in a .env file │ Added 'use' to improve the sentence │ -│ file or other method. By default, the │ or use another method. By default, the │ structure and clarity. │ -│ AgentOps `init()` function will look for an │ AgentOps `init()` function will look for an │ │ -│ environment variable named │ environment variable named │ │ -│ `AGENTOPS_API_KEY`. Or... │ `AGENTOPS_API_KEY`. Or... │ │ -│ │ │ │ -│ Replace `` below and pass │ Replace `` below and pass │ Changed 'pass in' to 'pass' for conciseness, │ -│ in the optional `api_key` parameter to the │ the optional `api_key` parameter to the │ and expanded 'repo' to 'repository' for │ -│ AgentOps `init(api_key=...)` function. │ AgentOps `init(api_key=...)` function. │ clarity. │ -│ Remember not to commit your API key to a │ Remember not to commit your API key to a │ │ -│ public repo! │ public repository! │ │ -│ │ │ │ -│ AgentOps allows you to record other actions. │ AgentOps allows you to record other actions. │ Corrected 'AgentOp's' to 'AgentOps'' for │ -│ The easiest way to record actions is through │ The easiest way to record actions is through │ proper possessive form of the company name, │ -│ the use of AgentOp's decorators │ the use of AgentOps' decorators. │ and added a period at the end of the │ -│ │ │ sentence. │ -│ │ │ │ -│ We can also manually craft an event exactly │ We can also manually craft an event exactly │ Added a period at the end of the sentence │ -│ the way we want by creating and recording an │ the way we want by creating and recording an │ for proper punctuation. │ -│ `ActionEvent` │ `ActionEvent`. │ │ -│ │ │ │ -│ Agents use tools. These tools are useful to │ Agents use tools. These tools are useful to │ Added 'the method shown' to provide more │ -│ track with information such as name, end │ track with information such as name, end │ context and improve clarity. │ -│ status, runtime, etc. To record tool usage, │ status, runtime, etc. To record tool usage, │ │ -│ you can create and record a `ToolEvent` │ you can create and record a `ToolEvent` │ │ -│ similar to above. │ similar to the method shown above. │ │ -│ │ │ │ -│ Error events can be used alone or in │ Error events can be used alone or in │ Added an apostrophe to 'Let's' for the │ -│ reference to another event. Lets add a catch │ reference to another event. Let's add a catch │ contraction of 'Let us', and added a period │ -│ block to the code above │ block to the code above. │ at the end of the sentence. │ -│ │ │ │ -╰──────────────────────────────────────────────┴───────────────────────────────────────────────┴──────────────────────────────────────────────╯ -Total errors found: 9