Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from openai.embeddings_utils import get_embedding, cosine_similarity
|
|
| 6 |
import openai
|
| 7 |
openai.api_key = config.OPENAI_API_KEY
|
| 8 |
|
| 9 |
-
messages = [{"role": "system", "content": 'You are
|
| 10 |
|
| 11 |
# prepare Q&A embeddings dataframe
|
| 12 |
question_df = pd.read_csv('data/questions_with_embeddings.csv')
|
|
@@ -29,7 +29,7 @@ def transcribe(audio):
|
|
| 29 |
|
| 30 |
best_answer = question_df.iloc[0]['answer']
|
| 31 |
|
| 32 |
-
user_text = f"Using the following text, answer the question '{transcript['text']}'."
|
| 33 |
messages.append({"role": "user", "content": user_text})
|
| 34 |
|
| 35 |
response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)
|
|
|
|
| 6 |
import openai
|
| 7 |
openai.api_key = config.OPENAI_API_KEY
|
| 8 |
|
| 9 |
+
messages = [{"role": "system", "content": 'You are a Energy Expert . Respond to all input in 50 words in dictionary format .'}]
|
| 10 |
|
| 11 |
# prepare Q&A embeddings dataframe
|
| 12 |
question_df = pd.read_csv('data/questions_with_embeddings.csv')
|
|
|
|
| 29 |
|
| 30 |
best_answer = question_df.iloc[0]['answer']
|
| 31 |
|
| 32 |
+
user_text = f"Using the following text, answer the question '{transcript['text']}'. {config.ADVISOR_CUSTOM_PROMPT}: {best_answer}"
|
| 33 |
messages.append({"role": "user", "content": user_text})
|
| 34 |
|
| 35 |
response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)
|