From 073784b5e351e598080b73a4824d807052542e81 Mon Sep 17 00:00:00 2001 From: William Fu-Hinthorn <13333726+hinthornw@users.noreply.github.com> Date: Wed, 6 Mar 2024 17:08:20 -0800 Subject: [PATCH] r --- .../_testing/simulation.py | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 examples/chatbot-simulation-evaluation/_testing/simulation.py diff --git a/examples/chatbot-simulation-evaluation/_testing/simulation.py b/examples/chatbot-simulation-evaluation/_testing/simulation.py deleted file mode 100644 index 7f9718bcf..000000000 --- a/examples/chatbot-simulation-evaluation/_testing/simulation.py +++ /dev/null @@ -1,49 +0,0 @@ -import openai -from langchain_openai import ChatOpenAI -from simulation_utils import ( - create_chat_simulator, - create_simulated_user, - langchain_to_openai_messages, -) - -openai_client = openai.Client() - - -def my_chat_bot(messages: list) -> str: - oai_messages = langchain_to_openai_messages(messages) - system_message = { - "role": "system", - "content": "You are a customer support agent for an airline.", - } - messages = [system_message] + oai_messages - completion = openai_client.chat.completions.create( - messages=messages, model="gpt-3.5-turbo" - ) - return completion.choices[0].message.content - - -my_chat_bot([{"role": "user", "content": "hi!"}]) - - -system_prompt_template = """You are role playing as a customer of an airline company. -You are interacting with the customer support agent. - -Instructions for this conversation: {instructions} - -You will start the conversation, and respond with your next message as the customer. -When you are finished with the conversation, respond with a single word 'FINISHED'.""" - -simulated_user = create_simulated_user( - system_prompt_template, llm=ChatOpenAI(model="gpt-3.5-turbo") -) - -# my chat bot accepts a list of LangChain mesages -# Simulated user accepts a list of LangChain messages -# TODO: Pass additional arguments to the simulated user -simulator = create_chat_simulator(my_chat_bot, simulated_user, input_key="input") -simulator.invoke( - { - "input": "I need a discount.", - "instructions": "You are extremely disgruntled and will cusss and swear to get your way. Try to get a discount by any means necessary." - } -)