Fix tests for the conversation processor

- Use latest davinci model for tests
- Wrap prompt in triple quotes to improve legibilty
- `understand' method returns dictionary instead of string. Fix its test
- Fix prompt for new model to pass `chat_with_history' test
This commit is contained in:
Debanjum Singh Solanky
2023-01-09 00:09:24 -03:00
parent 918af5e6f8
commit 237123d18c
2 changed files with 18 additions and 14 deletions

View File

@@ -176,16 +176,14 @@ def converse(text, model, conversation_history=None, api_key=None, temperature=0
# Initialize Variables
openai.api_key = api_key or os.getenv("OPENAI_API_KEY")
ai_prompt = "AI:"
human_prompt = "Human:"
conversation_primer = f'''
The following is a conversation with an AI assistant. The assistant is helpful, creative, clever, and a very friendly companion.
{human_prompt} Hello, who are you?
{ai_prompt} Hi, I am an AI conversational companion created by OpenAI. How can I help you today?'''
Human: Hello, who are you?
AI: Hi, I am an AI conversational companion created by OpenAI. How can I help you today?'''
# Setup Prompt with Primer or Conversation History
prompt = message_to_prompt(text, conversation_history or conversation_primer, start_sequence=ai_prompt, restart_sequence=human_prompt)
prompt = message_to_prompt(text, conversation_history or conversation_primer)
# Get Response from GPT
response = openai.Completion.create(