From f2436039a015b0d408c26288487dd56b617a85e0 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 8 Jan 2023 12:04:56 -0300 Subject: [PATCH] Improve readability of GPT prompt strings in conversation processor --- src/processor/conversation/gpt.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/processor/conversation/gpt.py b/src/processor/conversation/gpt.py index 0fd957f0..66481b66 100644 --- a/src/processor/conversation/gpt.py +++ b/src/processor/conversation/gpt.py @@ -19,9 +19,19 @@ def summarize(text, summary_type, user_query=None, api_key=None, temperature=0.5 # Setup Prompt based on Summary Type if summary_type == "chat": - prompt = f"You are an AI. Summarize the conversation below from your perspective:\n\n{text}\n\nSummarize the conversation from the AI's first-person perspective:" + prompt = f''' +You are an AI. Summarize the conversation below from your perspective: + +{text} + +Summarize the conversation from the AI's first-person perspective:''' elif summary_type == "notes": - prompt = f"Summarize the below notes about {user_query}:\n\n{text}\n\nSummarize the notes in second person perspective and use past tense:" + prompt = f''' +Summarize the below notes about {user_query}: + +{text} + +Summarize the notes in second person perspective and use past tense:''' # Get Response from GPT response = openai.Completion.create(