diff --git a/agentops/host_env.py b/agentops/host_env.py index 5307dec4a..d3f798b72 100644 --- a/agentops/host_env.py +++ b/agentops/host_env.py @@ -100,9 +100,9 @@ def get_ram_details(): try: ram_info = psutil.virtual_memory() return { - "Total": f"{ram_info.total / (1024 ** 3):.2f} GB", - "Available": f"{ram_info.available / (1024 ** 3):.2f} GB", - "Used": f"{ram_info.used / (1024 ** 3):.2f} GB", + "Total": f"{ram_info.total / (1024**3):.2f} GB", + "Available": f"{ram_info.available / (1024**3):.2f} GB", + "Used": f"{ram_info.used / (1024**3):.2f} GB", "Percentage": f"{ram_info.percent}%", } except: diff --git a/agentops/llms/providers/ollama.py b/agentops/llms/providers/ollama.py index c83a85bc9..ce2a7fc8b 100644 --- a/agentops/llms/providers/ollama.py +++ b/agentops/llms/providers/ollama.py @@ -26,7 +26,7 @@ def handle_stream_chunk(chunk: dict): if chunk.get("done"): llm_event.end_timestamp = get_ISO_time() - llm_event.model = f'ollama/{chunk.get("model")}' + llm_event.model = f"ollama/{chunk.get('model')}" llm_event.returns = chunk llm_event.returns["message"] = llm_event.completion llm_event.prompt = kwargs["messages"] @@ -53,7 +53,7 @@ def generator(): return generator() llm_event.end_timestamp = get_ISO_time() - llm_event.model = f'ollama/{response["model"]}' + llm_event.model = f"ollama/{response['model']}" llm_event.returns = response llm_event.agent_id = check_call_stack_for_agent_id() llm_event.prompt = kwargs["messages"] diff --git a/examples/anthropic_examples/anthropic-example-sync.py b/examples/anthropic_examples/anthropic-example-sync.py deleted file mode 100644 index b4060293c..000000000 --- a/examples/anthropic_examples/anthropic-example-sync.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -# # Anthropic Sync Example -# -# We are going to create a program called "Nier Storyteller". In short, it uses a message system similar to Nier Automata's to generate a one sentence summary before creating a short story. -# -# Example: -# -# {A foolish doll} {died in a world} {of ended dreams.} turns into "In a forgotten land where sunlight barely touched the ground, a little doll wandered through the remains of shattered dreams. Its porcelain face, cracked and wea..." - -# First, we start by importing Agentops and Anthropic - -# In[ ]: - - -get_ipython().run_line_magic('pip', 'install agentops') -get_ipython().run_line_magic('pip', 'install anthropic') - - -# Setup our generic default statements - -# In[4]: - - -from anthropic import Anthropic, AsyncAnthropic -import agentops -from dotenv import load_dotenv -import os -import random - - -# And set our API keys. - -# In[6]: - - -load_dotenv() -ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY") or "ANTHROPIC KEY HERE" -AGENTOPS_API_KEY = os.getenv("AGENTOPS_API_KEY") or "AGENTOPS KEY HERE" - - -# Now let's set the client as Anthropic and an AgentOps session! - -# In[7]: - - -client = Anthropic(api_key=ANTHROPIC_API_KEY) - - -# In[ ]: - - -agentops.init(AGENTOPS_API_KEY, default_tags=["anthropic-example"]) - -# Remember that story we made earlier? As of writing, claude-3-5-sonnet-20240620 (the version we will be using) has a 150k word, 680k character length. We also get an 8192 context length. This is great because we can actually set an example for the script! -# -# Let's assume we have user (the person speaking), assistant (the AI itself) for now and computer (the way the LLM gets references from). -# Let's set a default story as a script! - -# In[10]: - - -defaultstory = "In a forgotten land where sunlight barely touched the ground, a little doll wandered through the remains of shattered dreams. Its porcelain face, cracked and weathered, reflected the emptiness that hung in the air like a lingering fog. The doll's painted eyes, now chipped and dull, stared into the distance, searching for something—anything—that still held life. It had once belonged to a child who dreamt of endless adventures, of castles in the clouds and whispered secrets under starry skies. But those dreams had long since crumbled to dust, leaving behind nothing but a hollow world where even hope dared not tread. The doll, a relic of a life that had faded, trudged through the darkness, its tiny feet stumbling over broken wishes and forgotten stories. Each step took more effort than the last, as if the world itself pulled at the doll's limbs, weary and bitter. It reached a place where the ground fell away into an abyss of despair, the edge crumbling under its weight. The doll paused, teetering on the brink. It reached out, as though to catch a fading dream, but there was nothing left to hold onto. With a faint crack, its brittle body gave way, and the doll tumbled silently into the void. And so, in a world where dreams had died, the foolish little doll met its end. There were no tears, no mourning. Only the soft, empty echo of its fall, fading into the darkness, as the land of ended dreams swallowed the last trace of what once was." - - -# We are almost done! Let's generate a one sentence story summary by taking 3 random sentence fragments and connecting them! - -# In[11]: - - -# Define the lists -first = [ - "A unremarkable soldier", - "A lone swordsman", - "A lone lancer", - "A lone pugilist", - "A dual-wielder", - "A weaponless soldier", - "A beautiful android", - "A small android", - "A double-crossing android", - "A weapon carrying android", -] - -second = [ - "felt despair at this cold world", - "held nothing back", - "gave it all", - "could not get up again", - "grimaced in anger", - "missed the chance of a lifetime", - "couldn't find a weakpoint", - "was overwhelmed", - "was totally outmatched", - "was distracted by a flower", - "hesitated to land the killing blow", - "was attacked from behind", - "fell to the ground", -] - -third = [ - "in a dark hole beneath a city", - "underground", - "at the enemy's lair", - "inside an empty ship", - "at a tower built by the gods", - "on a tower smiled upon by angels", - "inside a tall tower", - "at a peace-loving village", - "at a village of refugees", - "in the free skies", - "below dark skies", - "in a blood-soaked battlefield", -] - -# Generate a random sentence -generatedsentence = ( - f"{random.choice(first)} {random.choice(second)} {random.choice(third)}." -) - - -# And now to construct a stream/message! We set an example for the assistant now! - -# In[ ]: - - -stream = client.messages.create( - max_tokens=2400, - model="claude-3-5-sonnet-20240620", # Comma added here - messages=[ - { - "role": "user", - "content": "Create a story based on the three sentence fragments given to you, it has been combined into one below.", - }, - { - "role": "assistant", - "content": "{A foolish doll} {died in a world} {of ended dreams.}", - }, - {"role": "assistant", "content": defaultstory}, - { - "role": "user", - "content": "Create a story based on the three sentence fragments given to you, it has been combined into one below.", - }, - {"role": "assistant", "content": generatedsentence}, - ], - stream=True, -) - -response = "" -for event in stream: - if event.type == "content_block_delta": - response += event.delta.text - elif event.type == "message_stop": - print(generatedsentence) - print(response) - - -# We can observe the session in the AgentOps dashboard by going to the session URL provided above. -# -# Now we will end the session with a success message. We can also end the session with a failure or intdeterminate status. By default, the session will be marked as indeterminate. - -# In[ ]: - - -agentops.end_session("Success") - diff --git a/examples/openai_examples/openai_example_sync.py b/examples/openai_examples/openai_example_sync.py deleted file mode 100644 index c1a64227c..000000000 --- a/examples/openai_examples/openai_example_sync.py +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -# # OpenAI Sync Example -# -# We are going to create a simple chatbot that creates stories based on a prompt. The chatbot will use the gpt-4o-mini LLM to generate the story using a user prompt. -# -# We will track the chatbot with AgentOps and see how it performs! - -# First let's install the required packages - -# In[ ]: - - -get_ipython().run_line_magic('pip', 'install -U openai') -get_ipython().run_line_magic('pip', 'install -U agentops') - - -from openai import OpenAI -import agentops -import os -from dotenv import load_dotenv - -# Then continue with the example - - -# Next, we'll grab our API keys. You can use dotenv like below or however else you like to load environment variables - -# In[2]: - - -load_dotenv() -OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") or "" -AGENTOPS_API_KEY = os.getenv("AGENTOPS_API_KEY") or "" - - -# Next we initialize the AgentOps client. - -# In[ ]: - - -agentops.init(AGENTOPS_API_KEY, default_tags=["openai-sync-example"]) - - -# And we are all set! Note the seesion url above. We will use it to track the chatbot. -# -# Let's create a simple chatbot that generates stories. - -# In[4]: - - -client = OpenAI(api_key=OPENAI_API_KEY) - -system_prompt = """ -You are a master storyteller, with the ability to create vivid and engaging stories. -You have experience in writing for children and adults alike. -You are given a prompt and you need to generate a story based on the prompt. -""" - -user_prompt = "Write a story about a cyber-warrior trapped in the imperial time period." - -messages = [ - {"role": "system", "content": system_prompt}, - {"role": "user", "content": user_prompt}, -] - - -# In[ ]: - - -response = client.chat.completions.create( - model="gpt-4o-mini", - messages=messages, -) - -print(response.choices[0].message.content) - - -# The response is a string that contains the story. We can track this with AgentOps by navigating to the session url and viewing the run. - -# ## Streaming Version -# We will demonstrate the streaming version of the API. - -# In[ ]: - - -stream = client.chat.completions.create( - model="gpt-4o-mini", - messages=messages, - stream=True, -) - -for chunk in stream: - print(chunk.choices[0].delta.content or "", end="") - - -# Note that the response is a generator that yields chunks of the story. We can track this with AgentOps by navigating to the session url and viewing the run. - -# In[ ]: - - -agentops.end_session(end_state="Success", end_state_reason="The story was generated successfully.") - - -# We end the session with a success state and a success reason. This is useful if you want to track the success or failure of the chatbot. In that case you can set the end state to failure and provide a reason. By default the session will have an indeterminate end state. -# -# All done! diff --git a/pyproject.toml b/pyproject.toml index d3f09da22..6adc81867 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ test = [ "anthropic", "cohere", "litellm", - "ai21>=3.0.0", + "ai21>=2.0.0, <3.0.0", "groq", "ollama", "mistralai", @@ -58,6 +58,7 @@ test = [ # "crewai-tools @ git+https://github.com/crewAIInc/crewAI-tools.git@a14091abb24527c97ccfcc8539d529c8b4559a0f; python_version>='3.10'", # ------------------------------------------------------------------------------------------------------------------------------------ # ;; + "taskweaver @ git+https://github.com/microsoft/TaskWeaver@v0.0.1; python_version>='3.10'", "autogen<0.4.0", "pytest-cov", "fastapi[standard]", diff --git a/tests/fixtures/partners.py b/tests/fixtures/partners.py new file mode 100644 index 000000000..64e8ccc1b --- /dev/null +++ b/tests/fixtures/partners.py @@ -0,0 +1,82 @@ +import pytest +from agentops.partners.autogen_logger import AutogenLogger +from autogen import UserProxyAgent, AssistantAgent, register_function +import agentops + + +@pytest.fixture +def autogen_logger(): + """Fixture for AutogenLogger with auto start/stop.""" + logger = AutogenLogger() + logger.start() + yield logger + logger.stop() + + +@pytest.fixture +def math_agents(openai_client, autogen_logger): + """Math agent group with calculator tool and all configurations.""" + # Base configuration for all agents + base_config = { + "max_consecutive_auto_reply": 0, # Disable auto-reply + "code_execution_config": False, + "llm_config": False, # Disable LLM-based auto reply + } + + # LLM configuration for math assistant + llm_config = { + "config_list": [ + { + "model": "gpt-4", + "api_key": openai_client.api_key, + "timeout": 10, + } + ], + "timeout": 10, + "temperature": 0, # Deterministic for testing + } + + # Create user proxy agent + user_proxy = UserProxyAgent( + name="user_proxy", + human_input_mode="NEVER", + is_termination_msg=lambda x: "TERMINATE" in x.get("content", "") or x.get("content", "") == "", + **base_config, + ) + + # Create assistant agent + assistant = AssistantAgent( + name="assistant", + system_message="You are a math assistant. Use the calculator tool when needed. Return TERMINATE when done.", + llm_config=llm_config, + max_consecutive_auto_reply=1, + ) + + # Register agents with logger + autogen_logger.log_new_agent(user_proxy, {}) + autogen_logger.log_new_agent(assistant, {}) + + # Define calculator tool + def calculator(a: int, b: int, operator: str) -> 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") + + # Register calculator with both agents + assistant.register_for_llm(name="calculator", description="A simple calculator")(calculator) + + user_proxy.register_for_execution(name="calculator")(calculator) + + # Register function between agents + register_function( + calculator, caller=assistant, executor=user_proxy, name="calculator", description="A simple calculator" + ) + + return user_proxy, assistant diff --git a/tests/fixtures/providers.py b/tests/fixtures/providers.py index b199d5338..f5eb4460b 100644 --- a/tests/fixtures/providers.py +++ b/tests/fixtures/providers.py @@ -1,7 +1,9 @@ import os +import json import pytest -from typing import Any, List import litellm +import tempfile +from pathlib import Path from openai import OpenAI from anthropic import Anthropic from ai21 import AI21Client, AsyncAI21Client @@ -10,6 +12,8 @@ from mistralai import Mistral from ai21.models.chat import ChatMessage from dotenv import load_dotenv +from taskweaver.app.app import TaskWeaverApp +from taskweaver.llm import LLMApi load_dotenv() @@ -84,16 +88,56 @@ def mistral_client(): return Mistral(api_key=api_key) +@pytest.fixture +def gemini_client(): + """Initialize Google's Gemini client.""" + import google.generativeai as genai + + api_key = os.getenv("GEMINI_API_KEY", "test-api-key") + genai.configure(api_key=api_key) + + return genai.GenerativeModel("gemini-1.5-flash") + + @pytest.fixture def litellm_client(): """Initialize LiteLLM client.""" openai_key = os.getenv("OPENAI_API_KEY", "test-api-key") anthropic_key = os.getenv("ANTHROPIC_API_KEY", "test-api-key") - openrouter_key = os.getenv("OPENROUTER_API_KEY", "test-api-key") litellm.openai_key = openai_key litellm.anthropic_key = anthropic_key - litellm.openrouter_key = openrouter_key return litellm + + +@pytest.fixture(scope="function") +def taskweaver_app(): + """Initialize TaskWeaver app with minimal config.""" + # Create a temporary directory for TaskWeaver project + with tempfile.TemporaryDirectory() as temp_dir: + app_dir = Path(temp_dir) + + # Create config file + config_file = app_dir / "taskweaver_config.json" + config = { + "llm.type": "openai", + "llm.api_type": "openai", + "llm.api_key": os.getenv("OPENAI_API_KEY", "test-api-key"), + "llm.api_base": "https://api.openai.com/v1", + "llm.model": "gpt-4o-mini", + } + + with open(config_file, "w") as f: + json.dump(config, f, indent=4) + + # Initialize TaskWeaver app + app = TaskWeaverApp(app_dir=str(app_dir)) + yield app + + +@pytest.fixture +def taskweaver_client(taskweaver_app): + """Get LLM interface from TaskWeaver app.""" + return taskweaver_app.app_injector.get(LLMApi) diff --git a/tests/fixtures/recordings/test_autogen.yaml b/tests/fixtures/recordings/test_autogen.yaml new file mode 100644 index 000000000..8c1350418 --- /dev/null +++ b/tests/fixtures/recordings/test_autogen.yaml @@ -0,0 +1,605 @@ +interactions: +- request: + body: '{"session": {"end_timestamp": "TIMESTAMP", "end_state": "Indeterminate", + "session_id": "SESSION_ID", "init_timestamp": "TIMESTAMP", "tags": [], "video": + null, "end_state_reason": null, "host_env": {"SDK": {"AgentOps SDK Version": + null}, "OS": {"OS": "Darwin"}}, "config": "", "jwt": "JWT_TOKEN", "_lock": "", + "_end_session_lock": "", "token_cost": "", "_session_url": "", "event_counts": + {"llms": 0, "tools": 0, "actions": 0, "errors": 0, "apis": 0}, "is_running": + false}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '12002' + Content-Type: + - application/json; charset=UTF-8 + Keep-Alive: + - timeout=10, max=1000 + User-Agent: + - python-requests/2.32.3 + x-agentops-api-key: + - REDACTED + method: POST + uri: https://api.agentops.ai/v2/create_session + response: + body: + string: '{"jwt": "REDACTED", "session_url": "https://app.agentops.ai/drilldown?session_id=2fc8be5b-2176-49e8-9969-49fb3c951700", + "status": "Success"}' + headers: + Content-Length: + - '311' + Content-Type: + - application/json + Date: + - Thu, 16 Jan 2025 22:58:43 GMT + Server: + - railway-edge + X-Railway-Request-Id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"id": "AGENT_ID", "name": "user_proxy"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '68' + Content-Type: + - application/json; charset=UTF-8 + Keep-Alive: + - timeout=10, max=1000 + User-Agent: + - python-requests/2.32.3 + authorization: + - REDACTED + x-agentops-api-key: + - REDACTED + method: POST + uri: https://api.agentops.ai/v2/create_agent + response: + body: + string: '"Success"' + headers: + Content-Length: + - '9' + Content-Type: + - application/json + Date: + - Thu, 16 Jan 2025 22:58:44 GMT + Server: + - railway-edge + X-Railway-Request-Id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"id": "AGENT_ID", "name": "assistant"}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '67' + Content-Type: + - application/json; charset=UTF-8 + Keep-Alive: + - timeout=10, max=1000 + User-Agent: + - python-requests/2.32.3 + authorization: + - REDACTED + x-agentops-api-key: + - REDACTED + method: POST + uri: https://api.agentops.ai/v2/create_agent + response: + body: + string: '"Success"' + headers: + Content-Length: + - '9' + Content-Type: + - application/json + Date: + - Thu, 16 Jan 2025 22:58:45 GMT + Server: + - railway-edge + X-Railway-Request-Id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"session": {"end_timestamp": "TIMESTAMP", "end_state": "Indeterminate", + "session_id": "SESSION_ID", "init_timestamp": "TIMESTAMP", "tags": [], "video": + null, "end_state_reason": null, "host_env": {"SDK": {"AgentOps SDK Version": + null}, "OS": {"OS": "Darwin"}}, "config": "", "jwt": "JWT_TOKEN", "_lock": "", + "_end_session_lock": "", "token_cost": "", "_session_url": "", "event_counts": + {"llms": 0, "tools": 0, "actions": 0, "errors": 0, "apis": 0}, "is_running": + false, "_tracer_provider": "", "_otel_tracer": "", "_otel_exporter": ""}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '12301' + Content-Type: + - application/json; charset=UTF-8 + Keep-Alive: + - timeout=10, max=1000 + User-Agent: + - python-requests/2.32.3 + authorization: + - REDACTED + x-agentops-api-key: + - REDACTED + method: POST + uri: https://api.agentops.ai/v2/update_session + response: + body: + string: '{"session_url": "https://app.agentops.ai/drilldown?session_id=2fc8be5b-2176-49e8-9969-49fb3c951700", + "status": "success", "token_cost": "0.00"}' + headers: + Content-Length: + - '138' + Content-Type: + - application/json + Date: + - Thu, 16 Jan 2025 22:58:46 GMT + Server: + - railway-edge + X-Railway-Request-Id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"content": "You are a math assistant. Use the calculator + tool when needed. Return TERMINATE when done.", "role": "system"}, {"content": + "What is 2 + 2?", "role": "user", "name": "user_proxy"}], "model": "gpt-4", + "stream": false, "temperature": 0, "tools": [{"type": "function", "function": + {"description": "A simple calculator", "name": "calculator", "parameters": {"type": + "object", "properties": {"a": {"type": "integer", "description": "a"}, "b": + {"type": "integer", "description": "b"}, "operator": {"type": "string", "description": + "operator"}}, "required": ["a", "b", "operator"]}}}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '605' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: '{"id": "chatcmpl-As42h2K3sm413SuT40cPyKvF7idIT", "object": "chat.completion", + "created": 1737448615, "model": "gpt-4-0613", "choices": [{"index": 0, "message": + {"role": "assistant", "content": null, "tool_calls": [{"id": "call_ecFDWTNlhpZtB7wrVlHztvei", + "type": "function", "function": {"name": "calculator", "arguments": "{\n \"a\": + 2,\n \"b\": 2,\n \"operator\": \"+\"\n}"}}], "refusal": null}, "logprobs": + null, "finish_reason": "tool_calls"}], "usage": {"prompt_tokens": 88, "completion_tokens": + 29, "total_tokens": 117, "prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": + 0}, "completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0, + "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}}, "service_tier": + "default", "system_fingerprint": null}' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 21 Jan 2025 08:36:56 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=PpEXg6vgyNAN7WUSBQpH1tvgVwtO37K0ew9GlnCz_FU-1737448616-1.0.1.1-XCgG8UzjKFsmpTX8qKp1TSl0k2o_7CTLCTbAOWOPqMVgZCkvEzK9lFLTmLHhCfKCy_IXwKvdFj4z4wdto39qnQ; + path=/; expires=Tue, 21-Jan-25 09:06:56 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=P761hOcApVI5tb3gVbbSj.Z0rBbOd6VbCC5PkHbBYuA-1737448616634-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1067' + openai-organization: + - REDACTED + openai-processing-ms: + - '1552' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"content": "You are a math assistant. Use the calculator + tool when needed. Return TERMINATE when done.", "role": "system"}, {"content": + "What is (1423 - 123) / 3 + (32 + 23) * 5?", "role": "user", "name": "user_proxy"}], + "model": "gpt-4", "stream": false, "temperature": 0, "tools": [{"type": "function", + "function": {"description": "A simple calculator", "name": "calculator", "parameters": + {"type": "object", "properties": {"a": {"type": "integer", "description": "a"}, + "b": {"type": "integer", "description": "b"}, "operator": {"type": "string", + "description": "operator"}}, "required": ["a", "b", "operator"]}}}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '632' + content-type: + - application/json + cookie: + - __cf_bm=PpEXg6vgyNAN7WUSBQpH1tvgVwtO37K0ew9GlnCz_FU-1737448616-1.0.1.1-XCgG8UzjKFsmpTX8qKp1TSl0k2o_7CTLCTbAOWOPqMVgZCkvEzK9lFLTmLHhCfKCy_IXwKvdFj4z4wdto39qnQ; + _cfuvid=P761hOcApVI5tb3gVbbSj.Z0rBbOd6VbCC5PkHbBYuA-1737448616634-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: '{"id": "chatcmpl-As42idz8FBIAfECwBtgeGXpHu82yf", "object": "chat.completion", + "created": 1737448616, "model": "gpt-4-0613", "choices": [{"index": 0, "message": + {"role": "assistant", "content": null, "tool_calls": [{"id": "call_TLoj935HTL4mPERqNBdr5Xy8", + "type": "function", "function": {"name": "calculator", "arguments": "{\n \"a\": + 1423,\n \"b\": 123,\n \"operator\": \"-\"\n}"}}], "refusal": null}, "logprobs": + null, "finish_reason": "tool_calls"}], "usage": {"prompt_tokens": 103, "completion_tokens": + 29, "total_tokens": 132, "prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": + 0}, "completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0, + "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}}, "service_tier": + "default", "system_fingerprint": null}' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 21 Jan 2025 08:36:58 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1073' + openai-organization: + - REDACTED + openai-processing-ms: + - '1695' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"content": "You are a math assistant. Use the calculator + tool when needed. Return TERMINATE when done.", "role": "system"}, {"content": + "What is 123 @ 456?", "role": "user", "name": "user_proxy"}], "model": "gpt-4", + "stream": false, "temperature": 0, "tools": [{"type": "function", "function": + {"description": "A simple calculator", "name": "calculator", "parameters": {"type": + "object", "properties": {"a": {"type": "integer", "description": "a"}, "b": + {"type": "integer", "description": "b"}, "operator": {"type": "string", "description": + "operator"}}, "required": ["a", "b", "operator"]}}}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '609' + content-type: + - application/json + cookie: + - __cf_bm=PpEXg6vgyNAN7WUSBQpH1tvgVwtO37K0ew9GlnCz_FU-1737448616-1.0.1.1-XCgG8UzjKFsmpTX8qKp1TSl0k2o_7CTLCTbAOWOPqMVgZCkvEzK9lFLTmLHhCfKCy_IXwKvdFj4z4wdto39qnQ; + _cfuvid=P761hOcApVI5tb3gVbbSj.Z0rBbOd6VbCC5PkHbBYuA-1737448616634-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: '{"id": "chatcmpl-As42m7LjODdR82aaM6v7pEd6vHPgF", "object": "chat.completion", + "created": 1737448620, "model": "gpt-4-0613", "choices": [{"index": 0, "message": + {"role": "assistant", "content": "I''m sorry, but I didn''t understand the + operation you want to perform with the numbers 123 and 456. Could you please + specify if you want to add, subtract, multiply, or divide these numbers?", + "refusal": null}, "logprobs": null, "finish_reason": "stop"}], "usage": {"prompt_tokens": + 88, "completion_tokens": 45, "total_tokens": 133, "prompt_tokens_details": + {"cached_tokens": 0, "audio_tokens": 0}, "completion_tokens_details": {"reasoning_tokens": + 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": + 0}}, "service_tier": "default", "system_fingerprint": null}' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 21 Jan 2025 08:37:02 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '946' + openai-organization: + - REDACTED + openai-processing-ms: + - '2069' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"content": "You are a math assistant. Use the calculator + tool when needed. Return TERMINATE when done.", "role": "system"}, {"content": + "What is 1 + 1? Return TERMINATE when done.", "role": "user", "name": "user_proxy"}], + "model": "gpt-4", "stream": false, "temperature": 0, "tools": [{"type": "function", + "function": {"description": "A simple calculator", "name": "calculator", "parameters": + {"type": "object", "properties": {"a": {"type": "integer", "description": "a"}, + "b": {"type": "integer", "description": "b"}, "operator": {"type": "string", + "description": "operator"}}, "required": ["a", "b", "operator"]}}}]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '633' + content-type: + - application/json + cookie: + - __cf_bm=PpEXg6vgyNAN7WUSBQpH1tvgVwtO37K0ew9GlnCz_FU-1737448616-1.0.1.1-XCgG8UzjKFsmpTX8qKp1TSl0k2o_7CTLCTbAOWOPqMVgZCkvEzK9lFLTmLHhCfKCy_IXwKvdFj4z4wdto39qnQ; + _cfuvid=P761hOcApVI5tb3gVbbSj.Z0rBbOd6VbCC5PkHbBYuA-1737448616634-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: '{"id": "chatcmpl-As42oDi4Xfs27rO1Wfdd2iavShg94", "object": "chat.completion", + "created": 1737448622, "model": "gpt-4-0613", "choices": [{"index": 0, "message": + {"role": "assistant", "content": null, "tool_calls": [{"id": "call_MeYwJ6b4ncFqOfzrM4kVcyxu", + "type": "function", "function": {"name": "calculator", "arguments": "{\n \"a\": + 1,\n \"b\": 1,\n \"operator\": \"+\"\n}"}}], "refusal": null}, "logprobs": + null, "finish_reason": "tool_calls"}], "usage": {"prompt_tokens": 94, "completion_tokens": + 29, "total_tokens": 123, "prompt_tokens_details": {"cached_tokens": 0, "audio_tokens": + 0}, "completion_tokens_details": {"reasoning_tokens": 0, "audio_tokens": 0, + "accepted_prediction_tokens": 0, "rejected_prediction_tokens": 0}}, "service_tier": + "default", "system_fingerprint": null}' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Tue, 21 Jan 2025 08:37:04 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '1067' + openai-organization: + - REDACTED + openai-processing-ms: + - '1647' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +version: 1 diff --git a/tests/fixtures/recordings/test_groq_provider.yaml b/tests/fixtures/recordings/test_groq_provider.yaml index 6b1abd7f1..fbbd1f76f 100644 --- a/tests/fixtures/recordings/test_groq_provider.yaml +++ b/tests/fixtures/recordings/test_groq_provider.yaml @@ -39,15 +39,19 @@ interactions: uri: https://api.groq.com/openai/v1/chat/completions response: body: - string: '{"id":"chatcmpl-2af4c427-2bd9-4cd3-96f6-b606fdbb3861","object":"chat.completion","created":1736892098,"model":"llama3-70b-8192","choices":[{"index":0,"message":{"role":"assistant","content":"Hello! - It''s nice to meet you. I''m here to help with any questions or tasks you - may have. How can I assist you today?"},"logprobs":null,"finish_reason":"stop"}],"usage":{"queue_time":0.01813716,"prompt_tokens":26,"prompt_time":0.006384788,"completion_tokens":31,"completion_time":0.088571429,"total_tokens":57,"total_time":0.094956217},"system_fingerprint":"fp_7ab5f7e105","x_groq":{"id":"req_01jhkdc9s1fkms5t70nkenz0cd"}} - - ' + string: '{"id": "chatcmpl-2af4c427-2bd9-4cd3-96f6-b606fdbb3861", "object": "chat.completion", + "created": 1736892098, "model": "llama3-70b-8192", "choices": [{"index": 0, + "message": {"role": "assistant", "content": "Hello! It''s nice to meet you. + I''m here to help with any questions or tasks you may have. How can I assist + you today?"}, "logprobs": null, "finish_reason": "stop"}], "usage": {"queue_time": + 0.01813716, "prompt_tokens": 26, "prompt_time": 0.006384788, "completion_tokens": + 31, "completion_time": 0.088571429, "total_tokens": 57, "total_time": 0.094956217}, + "system_fingerprint": "fp_7ab5f7e105", "x_groq": {"id": "req_01jhkdc9s1fkms5t70nkenz0cd"}}' headers: CF-Cache-Status: - DYNAMIC - CF-Ray: REDACTED + CF-Ray: + - REDACTED Cache-Control: - private, max-age=0, no-store, no-cache, must-revalidate Connection: @@ -74,13 +78,20 @@ interactions: - '613' x-groq-region: - us-west-1 - x-ratelimit-limit-requests: REDACTED - x-ratelimit-limit-tokens: REDACTED - x-ratelimit-remaining-requests: REDACTED - x-ratelimit-remaining-tokens: REDACTED - x-ratelimit-reset-requests: REDACTED - x-ratelimit-reset-tokens: REDACTED - x-request-id: REDACTED + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED status: code: 200 message: OK @@ -291,7 +302,8 @@ interactions: headers: CF-Cache-Status: - DYNAMIC - CF-Ray: REDACTED + CF-Ray: + - REDACTED Cache-Control: - no-cache Connection: @@ -312,13 +324,270 @@ interactions: - h3=":443"; ma=86400 x-groq-region: - us-west-1 - x-ratelimit-limit-requests: REDACTED - x-ratelimit-limit-tokens: REDACTED - x-ratelimit-remaining-requests: REDACTED - x-ratelimit-remaining-tokens: REDACTED - x-ratelimit-reset-requests: REDACTED - x-ratelimit-reset-tokens: REDACTED - x-request-id: REDACTED + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Write a short greeting."}], "model": "llama-3.3-70b-versatile"}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '169' + content-type: + - application/json + host: + - api.groq.com + user-agent: + - Groq/Python 0.15.0 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 0.15.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: '{"id": "chatcmpl-6cf0d6fe-87a0-4e9a-b445-79b2eed47bbc", "object": "chat.completion", + "created": 1737293844, "model": "llama-3.3-70b-versatile", "choices": [{"index": + 0, "message": {"role": "assistant", "content": "Hello, it''s nice to meet + you. Is there something I can help you with today?"}, "logprobs": null, "finish_reason": + "stop"}], "usage": {"queue_time": 0.526516886, "prompt_tokens": 46, "prompt_time": + 0.012112661, "completion_tokens": 20, "completion_time": 0.100698985, "total_tokens": + 66, "total_time": 0.112811646}, "system_fingerprint": "fp_c0cfa69934", "x_groq": + {"id": "req_01jhzcgk0yfc5bbjfyrtt6rsqp"}}' + headers: + CF-Cache-Status: + - DYNAMIC + CF-Ray: + - REDACTED + Cache-Control: + - private, max-age=0, no-store, no-cache, must-revalidate + Connection: + - keep-alive + Content-Type: + - application/json + Date: + - Sun, 19 Jan 2025 13:37:24 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=qFaVUB5iW1LI..EnEOZABv479cX2NKcnIO9XbHXxzx8-1737293844-1.0.1.1-wjdzMztTACMALQj8o4mZD5Glv6DuRVy4t49YkQqRqrovVwQ5NReNwNn6AMlcKxZGrGc3fOpPRqjizC4SxKHJbQ; + path=/; expires=Sun, 19-Jan-25 14:07:24 GMT; domain=.groq.com; HttpOnly; Secure; + SameSite=None + Transfer-Encoding: + - chunked + Vary: + - Origin, Accept-Encoding + Via: + - 1.1 google + alt-svc: + - h3=":443"; ma=86400 + content-length: + - '581' + x-groq-region: + - us-west-1 + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +- request: + body: '{"messages": [{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Write a short greeting."}], "model": "llama-3.3-70b-versatile", + "stream": true}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '185' + content-type: + - application/json + cookie: + - __cf_bm=qFaVUB5iW1LI..EnEOZABv479cX2NKcnIO9XbHXxzx8-1737293844-1.0.1.1-wjdzMztTACMALQj8o4mZD5Glv6DuRVy4t49YkQqRqrovVwQ5NReNwNn6AMlcKxZGrGc3fOpPRqjizC4SxKHJbQ + host: + - api.groq.com + user-agent: + - Groq/Python 0.15.0 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 0.15.0 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.groq.com/openai/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"role":"assistant","content":""},"logprobs":null,"finish_reason":null}],"x_groq":{"id":"req_01jhzcgkx2et2awe1fvd3y4dpw"}} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + it"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":"''s"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + nice"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + to"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + meet"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + you"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + How"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + can"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + I"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + assist"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + you"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":" + today"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{"content":"?"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-5cd656da-4c2b-4095-bce3-031986a23761","object":"chat.completion.chunk","created":1737293844,"model":"llama-3.3-70b-versatile","system_fingerprint":"fp_fcc3b74982","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"x_groq":{"id":"req_01jhzcgkx2et2awe1fvd3y4dpw","usage":{"queue_time":0.50562272,"prompt_tokens":46,"prompt_time":0.008745809,"completion_tokens":17,"completion_time":0.061818182,"total_tokens":63,"total_time":0.070563991}}} + + + data: [DONE] + + + ' + headers: + CF-Cache-Status: + - DYNAMIC + CF-Ray: + - REDACTED + Cache-Control: + - no-cache + Connection: + - keep-alive + Content-Type: + - text/event-stream + Date: + - Sun, 19 Jan 2025 13:37:25 GMT + Server: + - cloudflare + Transfer-Encoding: + - chunked + Vary: + - Origin, Accept-Encoding + Via: + - 1.1 google + alt-svc: + - h3=":443"; ma=86400 + x-groq-region: + - us-west-1 + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED status: code: 200 message: OK diff --git a/tests/fixtures/recordings/test_litellm_provider.yaml b/tests/fixtures/recordings/test_litellm_provider.yaml index 09531459f..73ae4b0fe 100644 --- a/tests/fixtures/recordings/test_litellm_provider.yaml +++ b/tests/fixtures/recordings/test_litellm_provider.yaml @@ -29,8 +29,6 @@ interactions: - REDACTED x-stainless-package-version: - 1.59.7 - x-stainless-raw-response: - - 'true' x-stainless-retry-count: - '0' x-stainless-runtime: @@ -41,35 +39,33 @@ interactions: uri: https://api.openai.com/v1/chat/completions response: body: - string: "{\n \"id\": \"chatcmpl-ApjGiJn585luUEit6xN0jw5dKDo2h\",\n \"object\": - \"chat.completion\",\n \"created\": 1736892104,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n - \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"Hello! I hope you\u2019re having a - wonderful day. If there\u2019s anything you need or want to talk about, I\u2019m - here to help!\",\n \"refusal\": null\n },\n \"logprobs\": - null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": - 22,\n \"completion_tokens\": 30,\n \"total_tokens\": 52,\n \"prompt_tokens_details\": - {\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": - {\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": - 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": - \"default\",\n \"system_fingerprint\": \"fp_72ed7ab54c\"\n}\n" + string: '{"id": "chatcmpl-AqTe330pv7SLEYXnCO181XaS3DkAG", "object": "chat.completion", + "created": 1737070375, "model": "gpt-4o-mini-2024-07-18", "choices": [{"index": + 0, "message": {"role": "assistant", "content": "Hello! I hope this message + finds you well. Wishing you a day filled with positivity and joy!", "refusal": + null}, "logprobs": null, "finish_reason": "stop"}], "usage": {"prompt_tokens": + 22, "completion_tokens": 22, "total_tokens": 44, "prompt_tokens_details": + {"cached_tokens": 0, "audio_tokens": 0}, "completion_tokens_details": {"reasoning_tokens": + 0, "audio_tokens": 0, "accepted_prediction_tokens": 0, "rejected_prediction_tokens": + 0}}, "service_tier": "default", "system_fingerprint": "fp_72ed7ab54c"}' headers: CF-Cache-Status: - DYNAMIC - CF-RAY: REDACTED + CF-RAY: + - REDACTED Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 14 Jan 2025 22:01:46 GMT + - Thu, 16 Jan 2025 23:32:56 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=VZJx_faFj6770ez9UQRJPHiVOar8.rDZHHjgopTXIvI-1736892106-1.0.1.1-pXcK6sMQ1OET.xkYliaYrHl7oD0w1_4M94x_L1O6nolXXWj7vAEf4aQeHngF8o1GrAMIvsmIok3HkQ1tq6cJgA; - path=/; expires=Tue, 14-Jan-25 22:31:46 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=lGaQhW4BjRDeXT.6zix6reiEXUeDd_aaNKE1IxS0MWg-1737070376-1.0.1.1-jeCbEYifseE1DCcX8tLSxc4zUrHSiGBqAdcibXJpWyxV3ds5hODd1hALWy4HjBes_upToyOphEl.rR6oGvEYWA; + path=/; expires=Fri, 17-Jan-25 00:02:56 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=i1qHe5Dq7I0tQx8N2yiSC49IpHCpAnBX.8W87TNF3Uk-1736892106225-0.0.1.1-604800000; + - _cfuvid=0cbbyNo9078pru7YpRA_NIGoOsI8oKHqut1xMbYedlY-1737070376012-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked @@ -80,230 +76,351 @@ interactions: alt-svc: - h3=":443"; ma=86400 content-length: - - '900' - openai-organization: REDACTED + - '872' + openai-organization: + - REDACTED openai-processing-ms: - - '1148' + - '501' openai-version: - '2020-10-01' strict-transport-security: - max-age=31536000; includeSubDomains; preload - x-ratelimit-limit-requests: REDACTED - x-ratelimit-limit-tokens: REDACTED - x-ratelimit-remaining-requests: REDACTED - x-ratelimit-remaining-tokens: REDACTED - x-ratelimit-reset-requests: REDACTED - x-ratelimit-reset-tokens: REDACTED - x-request-id: REDACTED + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED status: code: 200 message: OK - request: - body: '{"model": "claude-3-5-sonnet-latest", "messages": [{"role": "user", "content": - [{"type": "text", "text": "Write a short greeting."}]}], "system": [{"type": - "text", "text": "You are a helpful assistant."}], "max_tokens": 4096, "stream": - true}' + body: '{"messages": [{"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "Write a short greeting."}], "model": "gpt-4o-mini", + "stream": true}' headers: accept: - application/json accept-encoding: - gzip, deflate - anthropic-version: + authorization: - REDACTED connection: - keep-alive content-length: - - '241' + - '173' content-type: - application/json + cookie: + - __cf_bm=lGaQhW4BjRDeXT.6zix6reiEXUeDd_aaNKE1IxS0MWg-1737070376-1.0.1.1-jeCbEYifseE1DCcX8tLSxc4zUrHSiGBqAdcibXJpWyxV3ds5hODd1hALWy4HjBes_upToyOphEl.rR6oGvEYWA; + _cfuvid=0cbbyNo9078pru7YpRA_NIGoOsI8oKHqut1xMbYedlY-1737070376012-0.0.1.1-604800000 host: - - api.anthropic.com + - api.openai.com user-agent: - - litellm/1.58.1 - x-api-key: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: - REDACTED method: POST - uri: https://api.anthropic.com/v1/messages + uri: https://api.openai.com/v1/chat/completions response: body: - string: 'event: message_start + string: 'data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"Hello"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"!"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + I"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + hope"},"logprobs":null,"finish_reason":null}]} - data: {"type":"message_start","message":{"id":"msg_01NHdXbMbxAY5St4JoFySmKD","type":"message","role":"assistant","model":"claude-3-5-sonnet-20241022","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":18,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":1}} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + this"},"logprobs":null,"finish_reason":null}]} - event: content_block_start - data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + message"},"logprobs":null,"finish_reason":null}]} - event: ping + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + finds"},"logprobs":null,"finish_reason":null}]} - data: {"type": "ping"} + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + you"},"logprobs":null,"finish_reason":null}]} - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hi"} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + well"},"logprobs":null,"finish_reason":null}]} - event: content_block_delta + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"."},"logprobs":null,"finish_reason":null}]} - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" - there! I hope"} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + W"},"logprobs":null,"finish_reason":null}]} - event: content_block_delta - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" - you''re having a great day. How can I"} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"ishing"},"logprobs":null,"finish_reason":null}]} - event: content_block_delta + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + you"},"logprobs":null,"finish_reason":null}]} - data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":" - help you?"} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + a"},"logprobs":null,"finish_reason":null}]} - event: content_block_stop - data: {"type":"content_block_stop","index":0 } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + day"},"logprobs":null,"finish_reason":null}]} - event: message_delta + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + filled"},"logprobs":null,"finish_reason":null}]} - data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":21} } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + with"},"logprobs":null,"finish_reason":null}]} - event: message_stop - data: {"type":"message_stop" } + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + positivity"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + and"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + joy"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"!"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-AqTe4V9Qjvtq7jxBouSAsv1iI5Qr7","object":"chat.completion.chunk","created":1737070376,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + + + data: [DONE] ' headers: CF-Cache-Status: - DYNAMIC - CF-RAY: REDACTED - Cache-Control: - - no-cache + CF-RAY: + - REDACTED Connection: - keep-alive Content-Type: - text/event-stream; charset=utf-8 Date: - - Tue, 14 Jan 2025 22:01:47 GMT + - Thu, 16 Jan 2025 23:32:56 GMT Server: - cloudflare Transfer-Encoding: - chunked - X-Robots-Tag: - - none - anthropic-ratelimit-input-tokens-limit: - - '400000' - anthropic-ratelimit-input-tokens-remaining: - - '400000' - anthropic-ratelimit-input-tokens-reset: - - '2025-01-14T22:01:47Z' - anthropic-ratelimit-output-tokens-limit: - - '80000' - anthropic-ratelimit-output-tokens-remaining: - - '76000' - anthropic-ratelimit-output-tokens-reset: - - '2025-01-14T22:01:50Z' - anthropic-ratelimit-requests-limit: - - '4000' - anthropic-ratelimit-requests-remaining: - - '3999' - anthropic-ratelimit-requests-reset: - - '2025-01-14T22:01:47Z' - anthropic-ratelimit-tokens-limit: - - '480000' - anthropic-ratelimit-tokens-remaining: - - '476000' - anthropic-ratelimit-tokens-reset: - - '2025-01-14T22:01:47Z' - request-id: - - req_0152ZgzyVZ1evwa14rFvgbPc - via: - - 1.1 google + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + alt-svc: + - h3=":443"; ma=86400 + openai-organization: + - REDACTED + openai-processing-ms: + - '245' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED status: code: 200 message: OK - request: - body: '{"messages": [{"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "Write a short greeting."}], "model": "deepseek/deepseek-chat"}' + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - identity + Connection: + - keep-alive + X-Amzn-Trace-Id: + - fffbe2d0-d7e0-4307-8af8-10590c47fb4c + authorization: + - REDACTED + user-agent: + - unknown/None; hf_hub/0.27.1; python/3.10.16 + method: HEAD + uri: https://huggingface.co/gpt-4o-mini/resolve/main/tokenizer.json + response: + body: + string: '' + headers: + Access-Control-Allow-Origin: + - https://huggingface.co + Access-Control-Expose-Headers: + - X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range,X-Xet-Access-Token,X-Xet-Token-Expiration,X-Xet-Refresh-Route,X-Xet-Cas-Url,X-Xet-Hash + Connection: + - keep-alive + Content-Length: + - '20' + Content-Type: + - text/plain; charset=utf-8 + Date: + - Thu, 16 Jan 2025 23:32:57 GMT + ETag: + - W/"14-ZYI5tVOD2gG7mWSpjynndpu9W6Y" + Referrer-Policy: + - strict-origin-when-cross-origin + Vary: + - Origin + Via: + - 1.1 687fb42a3f5347130334b2a6a6bfd8ba.cloudfront.net (CloudFront) + X-Amz-Cf-Id: + - d1yMGLR1tCXPsLwQ4CtcN_5bBY8p322B9QSCSn9fOQFGTZ5jQx38Hg== + X-Amz-Cf-Pop: + - DEL54-P7 + X-Cache: + - Error from cloudfront + X-Error-Code: + - RepoNotFound + X-Error-Message: + - Repository not found + X-Powered-By: + - huggingface-moon + X-Request-Id: + - REDACTED + cross-origin-opener-policy: + - same-origin + status: + code: 404 + message: Not Found +- request: + body: '{"model": "claude-3-5-sonnet-latest", "messages": [{"role": "user", "content": + [{"type": "text", "text": "Write a short greeting."}]}], "system": "You are + a helpful assistant.", "max_tokens": 4096}' headers: accept: - application/json accept-encoding: - gzip, deflate - authorization: + anthropic-version: - REDACTED connection: - keep-alive content-length: - - '168' + - '197' content-type: - application/json host: - - openrouter.ai - http-referer: - - https://litellm.ai + - api.anthropic.com user-agent: - - AsyncOpenAI/Python 1.59.7 - x-stainless-arch: - - REDACTED - x-stainless-async: - - REDACTED - x-stainless-lang: - - REDACTED - x-stainless-os: - - REDACTED - x-stainless-package-version: - - 1.59.7 - x-stainless-raw-response: - - 'true' - x-stainless-retry-count: - - '0' - x-stainless-runtime: - - REDACTED - x-stainless-runtime-version: + - python-httpx/0.27.2 + x-api-key: - REDACTED - x-title: - - liteLLM method: POST - uri: https://openrouter.ai/api/v1/chat/completions + uri: https://api.anthropic.com/v1/messages response: body: - string: "\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n\n \n\n \n\n \n\n \n\n - \ \n\n \n\n \n\n \n{\"id\":\"gen-1736892109-Bw6T8Zz8t3IlUpRWImy8\",\"provider\":\"DeepSeek\",\"model\":\"deepseek/deepseek-chat\",\"object\":\"chat.completion\",\"created\":1736892109,\"choices\":[{\"logprobs\":null,\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Hello! - How can I assist you today? \U0001F60A\",\"refusal\":\"\"}}],\"system_fingerprint\":\"fp_3a5770e1b4\",\"usage\":{\"prompt_tokens\":14,\"completion_tokens\":11,\"total_tokens\":25}}" + string: '{"id": "msg_01JuTFUiPmujJcBFg84hoPBB", "type": "message", "role": "assistant", + "model": "claude-3-5-sonnet-20241022", "content": [{"type": "text", "text": + "Hi there! Hope you''re having a great day! How can I help you today?"}], + "stop_reason": "end_turn", "stop_sequence": null, "usage": {"input_tokens": + 18, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": + 21}}' headers: - Access-Control-Allow-Origin: - - '*' - CF-RAY: REDACTED + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED Connection: - keep-alive Content-Type: - application/json Date: - - Tue, 14 Jan 2025 22:01:49 GMT + - Thu, 16 Jan 2025 23:32:58 GMT Server: - cloudflare Transfer-Encoding: - chunked - Vary: - - Accept-Encoding + X-Robots-Tag: + - none + anthropic-ratelimit-input-tokens-limit: + - '400000' + anthropic-ratelimit-input-tokens-remaining: + - '400000' + anthropic-ratelimit-input-tokens-reset: + - '2025-01-16T23:32:58Z' + anthropic-ratelimit-output-tokens-limit: + - '80000' + anthropic-ratelimit-output-tokens-remaining: + - '80000' + anthropic-ratelimit-output-tokens-reset: + - '2025-01-16T23:32:58Z' + anthropic-ratelimit-requests-limit: + - '4000' + anthropic-ratelimit-requests-remaining: + - '3999' + anthropic-ratelimit-requests-reset: + - '2025-01-16T23:32:58Z' + anthropic-ratelimit-tokens-limit: + - '480000' + anthropic-ratelimit-tokens-remaining: + - '480000' + anthropic-ratelimit-tokens-reset: + - '2025-01-16T23:32:58Z' content-length: - - '578' - x-clerk-auth-message: - - Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid, - token-carrier=header) - x-clerk-auth-reason: - - token-invalid - x-clerk-auth-status: - - signed-out + - '368' + request-id: + - req_01AXEfBj7Nb6rLznqbQU9CLt + via: + - 1.1 google status: code: 200 message: OK diff --git a/tests/fixtures/recordings/test_taskweaver_provider.yaml b/tests/fixtures/recordings/test_taskweaver_provider.yaml new file mode 100644 index 000000000..9b3116143 --- /dev/null +++ b/tests/fixtures/recordings/test_taskweaver_provider.yaml @@ -0,0 +1,722 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are a Python coding assistant."}, + {"role": "user", "content": "Write a function to calculate factorial. Answer + in the JSON format."}], "model": "gpt-4o-mini", "frequency_penalty": 0.0, "max_tokens": + 200, "presence_penalty": 0.0, "response_format": {"type": "json_object"}, "seed": + 123456, "stop": [""], "stream": true, "temperature": 0, "top_p": 1.0}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + authorization: + - REDACTED + connection: + - keep-alive + content-length: + - '404' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.59.7 + x-stainless-arch: + - REDACTED + x-stainless-async: + - REDACTED + x-stainless-lang: + - REDACTED + x-stainless-os: + - REDACTED + x-stainless-package-version: + - 1.59.7 + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - REDACTED + x-stainless-runtime-version: + - REDACTED + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + body: + string: 'data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"{\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"function"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + {\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"name"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"factor"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"ial"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\",\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"description"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"Calcul"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"ates"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + the"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + factorial"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + of"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + a"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + non"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"-negative"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":".\",\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"parameters"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + {\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + {\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"type"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\",\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"description"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"A"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + non"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"-negative"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + for"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + which"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + the"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + factorial"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + is"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + to"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + be"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + calculated"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":".\"\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + }\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + },\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"returns"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + {\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"type"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\",\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"description"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"The"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + factorial"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + of"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + the"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + input"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":".\"\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + },\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"code"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\":"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + \""},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"def"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + factorial"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"(n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"):"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + if"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + <"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"0"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":":\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + raise"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + Value"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"Error"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"(''"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"Input"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + must"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + be"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + a"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + non"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"-negative"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + integer"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":".'')"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + elif"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + =="},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"0"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":":\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + return"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"1"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + else"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":":\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + result"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + ="},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"1"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + for"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + i"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + in"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + range"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"("},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"1"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":","},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + +"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"1"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"):"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + result"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + *="},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + i"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + return"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + result"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"\"\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + "},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":" + }\n"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{"content":"}"},"logprobs":null,"finish_reason":null}]} + + + data: {"id":"chatcmpl-ArMeBiTppL5p2ngIGKQIpFjKGImfm","object":"chat.completion.chunk","created":1737281803,"model":"gpt-4o-mini-2024-07-18","service_tier":"default","system_fingerprint":"fp_72ed7ab54c","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}]} + + + data: [DONE] + + + ' + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - REDACTED + Connection: + - keep-alive + Content-Type: + - text/event-stream; charset=utf-8 + Date: + - Sun, 19 Jan 2025 10:16:43 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=TQTdk3ym87xBylAszHGJArpJMamM0fEhvVFPKszmWEY-1737281803-1.0.1.1-4nJ9Ci_1WgQd89Go2LCSgMgFkumNz.1H9VMyc6vGvOZ7.3GgI77tR4CwpBT3t0BdCUuFpHUcYsFxR1JPPyzdLQ; + path=/; expires=Sun, 19-Jan-25 10:46:43 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=j6zmX6oy_MlFtVDL9PojQlJ0wMQH9Chv5bAqdcWzav8-1737281803873-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + access-control-expose-headers: + - X-Request-ID + openai-organization: + - REDACTED + openai-processing-ms: + - '206' + openai-version: + - '2020-10-01' + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + x-ratelimit-limit-requests: + - REDACTED + x-ratelimit-limit-tokens: + - REDACTED + x-ratelimit-remaining-requests: + - REDACTED + x-ratelimit-remaining-tokens: + - REDACTED + x-ratelimit-reset-requests: + - REDACTED + x-ratelimit-reset-tokens: + - REDACTED + x-request-id: + - REDACTED + status: + code: 200 + message: OK +version: 1 diff --git a/tests/fixtures/vcr.py b/tests/fixtures/vcr.py index a824c3535..4258fbb76 100644 --- a/tests/fixtures/vcr.py +++ b/tests/fixtures/vcr.py @@ -1,5 +1,6 @@ import pytest from pathlib import Path +import json @pytest.fixture(scope="session") @@ -35,6 +36,8 @@ def vcr_config(): ("replicate-api-token", "REDACTED"), ("huggingface-api-key", "REDACTED"), ("x-huggingface-api-key", "REDACTED"), + ("gemini-api-key", "REDACTED"), + ("x-gemini-api-key", "REDACTED"), ("claude-api-key", "REDACTED"), ("x-claude-api-key", "REDACTED"), ("x-railway-request-id", "REDACTED"), @@ -76,21 +79,137 @@ def vcr_config(): ("x-stainless-async", "REDACTED"), ("x-stainless-runtime", "REDACTED"), ("x-stainless-runtime-version", "REDACTED"), + # Add JWT-related headers + ("x-railway-request-id", "REDACTED"), + ("x-request-id", "REDACTED"), + ("x-ratelimit-remaining-tokens", "REDACTED"), + ("x-ratelimit-reset-requests", "REDACTED"), + ("x-ratelimit-reset-tokens", "REDACTED"), + ("x-debug-trace-id", "REDACTED"), ] + def redact_jwt_recursive(obj): + """Recursively redact JWT tokens from dict/list structures.""" + if obj is None: + return obj + + if isinstance(obj, dict): + for key, value in obj.items(): + if isinstance(key, str) and ("jwt" in key.lower()): + obj[key] = "REDACTED" + elif isinstance(value, str) and "eyJ" in value: # JWT tokens start with 'eyJ' + obj[key] = "REDACTED_JWT" + else: + redact_jwt_recursive(value) + elif isinstance(obj, list): + for item in obj: + redact_jwt_recursive(item) + return obj + def filter_response_headers(response): - """Filter sensitive headers from response.""" - headers = response["headers"] - headers_lower = {k.lower(): k for k in headers} # Map of lowercase -> original header names - - for header, replacement in sensitive_headers: - header_lower = header.lower() - if header_lower in headers_lower: - # Replace using the original header name from the response - original_header = headers_lower[header_lower] - headers[original_header] = replacement + """Filter sensitive headers and body content from response.""" + if not isinstance(response, dict): + raise ValueError("Response must be a dictionary") + + # Filter headers + headers = response.get("headers", {}) + if headers: + headers_lower = {k.lower(): k for k in headers} + + for header, replacement in sensitive_headers: + header_lower = header.lower() + if header_lower in headers_lower: + headers[headers_lower[header_lower]] = [replacement] + + # Filter response body + if "body" in response and isinstance(response["body"], dict): + body_content = response["body"].get("string") + if body_content is not None: + try: + # Handle JSON response bodies + if isinstance(body_content, bytes): + body_str = body_content.decode("utf-8") + else: + body_str = str(body_content) + + try: + body = json.loads(body_str) + body = redact_jwt_recursive(body) + response["body"]["string"] = json.dumps(body).encode("utf-8") + except json.JSONDecodeError: + # If not JSON, handle as plain text + import re + + jwt_pattern = r"eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+" + body_str = re.sub(jwt_pattern, "REDACTED_JWT", body_str) + response["body"]["string"] = body_str.encode("utf-8") + except (AttributeError, UnicodeDecodeError) as e: + raise ValueError(f"Failed to process response body: {str(e)}") + return response + def scrub_request_body(request): + """Scrub sensitive and dynamic data from request body.""" + if not request or not hasattr(request, "body"): + raise ValueError("Invalid request object") + + if request.body: + try: + body_dict = json.loads(request.body) + if not isinstance(body_dict, dict): + raise ValueError("Request body must be a JSON object") + + body_dict = redact_jwt_recursive(body_dict) + + # Handle session creation/update requests + if request.uri and ( + request.uri.endswith("/v2/create_session") or request.uri.endswith("/v2/update_session") + ): + session = body_dict.get("session") + if session and isinstance(session, dict): + # Standardize all dynamic fields + for key in session: + if key.startswith("_"): # Internal fields + session[key] = "" + elif isinstance(session[key], str): # String fields that might be dynamic + if key not in ["end_state", "OS"]: # Preserve specific fields + session[key] = "" + + # Standardize known fields + session["session_id"] = "SESSION_ID" + session["init_timestamp"] = "TIMESTAMP" + session["end_timestamp"] = "TIMESTAMP" + session["jwt"] = "JWT_TOKEN" + session["token_cost"] = "" + session["_session_url"] = "" + + # Standardize host environment + if "host_env" in session: + session["host_env"] = { + "SDK": {"AgentOps SDK Version": None}, + "OS": {"OS": session.get("host_env", {}).get("OS", {}).get("OS", "Darwin")}, + } + + # Reset all counters and states + session["event_counts"] = {"llms": 0, "tools": 0, "actions": 0, "errors": 0, "apis": 0} + session["is_running"] = False + + # Clear any dynamic lists + session["tags"] = [] + session["video"] = None + session["end_state_reason"] = None + + # Handle agent creation requests + if request.uri and request.uri.endswith("/v2/create_agent"): + if "id" in body_dict: + body_dict["id"] = "AGENT_ID" + + request.body = json.dumps(body_dict).encode() + except (json.JSONDecodeError, AttributeError, UnicodeDecodeError) as e: + raise ValueError(f"Failed to process request body: {str(e)}") + + return request + return { # Basic VCR configuration "serializer": "yaml", @@ -105,6 +224,7 @@ def filter_response_headers(response): "localhost:4318", # Default OTLP HTTP endpoint "127.0.0.1:4317", "127.0.0.1:4318", + "huggingface.co", ], # Header filtering for requests and responses "filter_headers": sensitive_headers, @@ -113,4 +233,5 @@ def filter_response_headers(response): "decode_compressed_response": True, "record_on_exception": False, "allow_playback_repeats": True, + "before_record_request": scrub_request_body, } diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 90fda319b..e288c5efc 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -7,19 +7,25 @@ ai21_test_messages, anthropic_client, cohere_client, + gemini_client, groq_client, litellm_client, mistral_client, openai_client, + taskweaver_app, + taskweaver_client, test_messages, ) +from tests.fixtures.partners import ( + autogen_logger, + math_agents, +) from tests.fixtures.vcr import vcr_config @pytest.fixture def agentops_session(): + """Fixture for managing AgentOps sessions.""" agentops.start_session() - yield - agentops.end_all_sessions() diff --git a/tests/integration/test_llm_providers.py b/tests/integration/test_llm_providers.py index 3d9616fbe..fa655d228 100644 --- a/tests/integration/test_llm_providers.py +++ b/tests/integration/test_llm_providers.py @@ -1,13 +1,13 @@ import asyncio -from asyncio import TimeoutError from typing import Any, Dict, List +import json import pytest def collect_stream_content(stream_response: Any, provider: str) -> List[str]: """Collect streaming content based on provider-specific response format.""" - collected_content = [] # Initialize the list first + collected_content = [] handlers = { "openai": lambda chunk: chunk.choices[0].delta.content, @@ -15,6 +15,7 @@ def collect_stream_content(stream_response: Any, provider: str) -> List[str]: "cohere": lambda event: event.text if event.event_type == "text-generation" else None, "ai21": lambda chunk: chunk.choices[0].delta.content, "groq": lambda chunk: chunk.choices[0].delta.content, + "gemini": lambda chunk: chunk.text if hasattr(chunk, "text") else None, "mistral": lambda event: event.data.choices[0].delta.content if hasattr(event.data.choices[0].delta, "content") else None, @@ -27,8 +28,8 @@ def collect_stream_content(stream_response: Any, provider: str) -> List[str]: raise ValueError(f"Unknown provider: {provider}") for chunk in stream_response: - if chunk_content := handler(chunk): # Use different variable name - collected_content.append(chunk_content) # Append to the list + if chunk_content := handler(chunk): + collected_content.append(chunk_content) return collected_content @@ -57,8 +58,7 @@ def test_openai_provider(openai_client, test_messages: List[Dict[str, Any]]): ## Assistants API Tests -# @pytest.mark.vcr() -@pytest.mark.skip("For some reason this is not being recorded and the test is not behaving correctly") +@pytest.mark.vcr() async def test_openai_assistants_provider(openai_client): """Test OpenAI Assistants API integration for all overridden methods.""" @@ -107,21 +107,8 @@ async def test_openai_assistants_provider(openai_client): run = openai_client.beta.threads.runs.create(thread_id=thread.id, assistant_id=assistant.id) assert run.id.startswith("run_") - # Monitor run status with timeout - async def check_run_status(): - while True: - run_status = openai_client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id) - print(f"Current run status: {run_status.status}") # Print status for debugging - if run_status.status in ["completed", "failed", "cancelled", "expired"]: - return run_status - await asyncio.sleep(1) - - try: - run_status = await asyncio.wait_for(check_run_status(), timeout=10) # Shorter timeout - except TimeoutError: - # Cancel the run if it's taking too long - openai_client.beta.threads.runs.cancel(thread_id=thread.id, run_id=run.id) - pytest.skip("Assistant run timed out and was cancelled") + while run.status not in ["completed", "failed"]: + run = openai_client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id) # Get run steps run_steps = openai_client.beta.threads.runs.steps.list(thread_id=thread.id, run_id=run.id) @@ -210,20 +197,50 @@ def test_cohere_provider(cohere_client): assert len(content) > 0 +# Gemini Tests +# @pytest.mark.vcr() +@pytest.mark.skip(reason="Gemini tests require gRPC transport not supported by VCR") +def test_gemini_provider(gemini_client, test_messages): + """Test Gemini provider integration.""" + # Convert messages to Gemini format + gemini_messages = [] + for msg in test_messages: + if msg["role"] != "system": # Gemini doesn't support system messages directly + gemini_messages.append(msg["content"]) + + # Sync completion + response = gemini_client.generate_content(gemini_messages) + assert response.text + + # Stream completion + stream = gemini_client.generate_content(gemini_messages, stream=True) + + content = collect_stream_content(stream, "gemini") + assert len(content) > 0 + + # Test async completion + async def async_test(): + response = await gemini_client.generate_content_async(gemini_messages) + return response + + async_response = asyncio.run(async_test()) + assert async_response.text + + # Groq Tests @pytest.mark.vcr() def test_groq_provider(groq_client, test_messages: List[Dict[str, Any]]): """Test Groq provider integration.""" # Sync completion response = groq_client.chat.completions.create( - model="llama3-70b-8192", + model="llama-3.3-70b-versatile", messages=test_messages, ) assert response.choices[0].message.content # Stream completion stream = groq_client.chat.completions.create( - model="llama3-70b-8192", + model="llama-3.3-70b-versatile", messages=test_messages, stream=True, ) @@ -275,7 +292,7 @@ def test_litellm_provider(litellm_client, test_messages: List[Dict[str, Any]]): # Stream completion stream_response = litellm_client.completion( - model="anthropic/claude-3-5-sonnet-latest", + model="openai/gpt-4o-mini", messages=test_messages, stream=True, ) @@ -285,7 +302,7 @@ def test_litellm_provider(litellm_client, test_messages: List[Dict[str, Any]]): # Async completion async def async_test(): async_response = await litellm_client.acompletion( - model="openrouter/deepseek/deepseek-chat", + model="anthropic/claude-3-5-sonnet-latest", messages=test_messages, ) return async_response @@ -301,40 +318,64 @@ def test_ollama_provider(test_messages: List[Dict[str, Any]]): import ollama from ollama import AsyncClient - try: - # Test if Ollama server is running - ollama.list() - except Exception as e: - pytest.skip(f"Ollama server not running: {e}") + # Sync chat + response = ollama.chat( + model="llama3.2:1b", + messages=test_messages, + ) + assert response["message"]["content"] + + # Stream chat + stream = ollama.chat( + model="llama3.2:1b", + messages=test_messages, + stream=True, + ) + content = collect_stream_content(stream, "ollama") + assert len(content) > 0 - try: - # Sync chat - response = ollama.chat( + # Async chat + async def async_test(): + client = AsyncClient() + response = await client.chat( model="llama3.2:1b", messages=test_messages, ) - assert response["message"]["content"] + return response - # Stream chat - stream = ollama.chat( - model="llama3.2:1b", - messages=test_messages, - stream=True, - ) - content = collect_stream_content(stream, "ollama") - assert len(content) > 0 - - # Async chat - async def async_test(): - client = AsyncClient() - response = await client.chat( - model="llama3.2:1b", - messages=test_messages, - ) - return response - - async_response = asyncio.run(async_test()) - assert async_response["message"]["content"] - - except Exception as e: - pytest.skip(f"Ollama test failed: {e}") + async_response = asyncio.run(async_test()) + assert async_response["message"]["content"] + + +# TaskWeaver Tests +@pytest.mark.vcr() +def test_taskweaver_provider(taskweaver_client, test_messages): + """Test TaskWeaver provider integration.""" + # Test with code execution messages + code_messages = [ + {"role": "system", "content": "You are a Python coding assistant."}, + {"role": "user", "content": "Write a function to calculate factorial. Answer in the JSON format."}, + ] + + response = taskweaver_client.chat_completion( + messages=code_messages, + temperature=0, + max_tokens=200, + top_p=1.0, + ) + + assert isinstance(response, dict) + assert "content" in response + + # Convert 'content' from string to dictionary + content = json.loads(response["content"]) + + assert "function" in content + + assert "name" in content["function"] + assert "description" in content["function"] + assert "parameters" in content["function"] + assert "returns" in content["function"] + assert "code" in content["function"] + + assert "def factorial" in content["function"]["code"] diff --git a/tests/integration/test_partners.py b/tests/integration/test_partners.py new file mode 100644 index 000000000..7fadcc0d0 --- /dev/null +++ b/tests/integration/test_partners.py @@ -0,0 +1,52 @@ +import pytest +from agentops.partners.autogen_logger import AutogenLogger + + +@pytest.mark.vcr +def test_autogen(autogen_logger, math_agents): + """Test complete AutogenLogger integration with math agents""" + # 1. Verify logger initialization + assert isinstance(autogen_logger, AutogenLogger) + assert hasattr(autogen_logger, "start") + assert hasattr(autogen_logger, "stop") + assert hasattr(autogen_logger, "get_connection") + + user_proxy, assistant = math_agents + + # 2. Test basic calculation and agent registration + user_proxy.initiate_chat( + assistant, + message="What is 2 + 2?", + ) + + # Verify agent registration + assert len(autogen_logger.agent_store) > 0 + assert any(agent["autogen_id"] == str(id(user_proxy)) for agent in autogen_logger.agent_store) + assert any(agent["autogen_id"] == str(id(assistant)) for agent in autogen_logger.agent_store) + + # 3. Test complex calculation with tool usage + user_proxy.initiate_chat( + assistant, + message="What is (1423 - 123) / 3 + (32 + 23) * 5?", + ) + + # Verify tool usage logging + assert any(agent["autogen_id"] == str(id(assistant)) for agent in autogen_logger.agent_store) + + # 4. Test error handling + user_proxy.initiate_chat( + assistant, + message="What is 123 @ 456?", + ) + + # Verify error logging + assert any(agent["autogen_id"] == str(id(assistant)) for agent in autogen_logger.agent_store) + + # 5. Test termination + user_proxy.initiate_chat( + assistant, + message="What is 1 + 1? Return TERMINATE when done.", + ) + + # Verify termination logging + assert any(agent["autogen_id"] == str(id(assistant)) for agent in autogen_logger.agent_store)