Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,15 @@ from langchain.chat_models import ChatOpenAI
|
|
12 |
from htmlTemplates import css, bot_template, user_template
|
13 |
from langchain.embeddings import openai
|
14 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
|
|
|
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
# creating custom template to guide llm model
|
18 |
custom_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language.
|
19 |
Chat History:
|
|
|
12 |
from htmlTemplates import css, bot_template, user_template
|
13 |
from langchain.embeddings import openai
|
14 |
from langchain.embeddings.openai import OpenAIEmbeddings
|
15 |
+
import os
|
16 |
+
from openai import OpenAIApi # Assuming you have openai module
|
17 |
|
18 |
|
19 |
+
|
20 |
+
# Retrieve API key from environment variable
|
21 |
+
api_key = os.environ.get("OPENAI_API_KEY")
|
22 |
+
openai_api = OpenAIApi(api_key)
|
23 |
+
|
24 |
# creating custom template to guide llm model
|
25 |
custom_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question, in its original language.
|
26 |
Chat History:
|