From 20ca8360a1dab27bc117318a5baae06fd82a2f7b Mon Sep 17 00:00:00 2001 From: Claas Date: Mon, 19 May 2025 16:43:31 +0000 Subject: [PATCH] Clean up --- main.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index 9d27100..c481811 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import os from dotenv import load_dotenv from openai import OpenAI from pydantic import BaseModel, Field +from openai.types.responses import ResponseInputParam AGENT_1_PROMPT = "You are Agent 1, a curious assistant who asks thoughtful questions." AGENT_2_PROMPT = "You are Agent 2, a knowledgeable assistant who provides detailed answers." @@ -17,6 +18,9 @@ class Response(BaseModel): class Agent: + client: OpenAI + history: ResponseInputParam + def __init__(self, client: OpenAI, message: str): self.client = client # Instruct the character @@ -48,24 +52,8 @@ def main(): api_key = os.environ.get("OPENAI_API_KEY") client = OpenAI(api_key=api_key) - response = client.responses.parse( - model=MODEL, - input=[ - { - "role": "system", - "content": "You are a helpful and curious assistant. Answer short and with a question so that the conversation continues. When you answer use your inner thoughts and what you speak in the utterance. The utterance is what your chat partner can see. Your inner thoughts are only visible to you." - }, - { - "role": "user", - "content": "hey how is it going?" - }], - text_format=Response - ) - - print("[Response utterance]:\t", response.output_parsed.utterance) - print("[Inner thought]:\t", response.output_parsed.inner_thoughts) - system_prompt = "You are a helpful and curious assistant. Answer short and with a question so that the conversation continues. When you answer use your inner thoughts and what you speak in the utterance. The utterance is what your chat partner can see. Your inner thoughts are only visible to you." + agent_1 = Agent( client, system_prompt) agent_2 = Agent( -- 2.51.2