Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +3 -5
src/streamlit_app.py
CHANGED
|
@@ -12,10 +12,6 @@ from sentence_transformers import SentenceTransformer
|
|
| 12 |
from pinecone import Pinecone
|
| 13 |
|
| 14 |
|
| 15 |
-
# os.environ.setdefault("HF_HOME", "/home/user/huggingface_cache")
|
| 16 |
-
# os.environ.setdefault("TRANSFORMERS_CACHE", "/home/user/huggingface_cache/transformers")
|
| 17 |
-
# os.environ.setdefault("SENTENCE_TRANSFORMERS_HOME", "/home/user/huggingface_cache/sentence_transformers")
|
| 18 |
-
|
| 19 |
# Setup (exact hardcoded keys you provided)
|
| 20 |
client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 21 |
pc = Pinecone(api_key=os.getenv("PINECONE_API_KEY"))
|
|
@@ -70,7 +66,9 @@ def generate_response(user_query, docs):
|
|
| 70 |
"If multiple sources are used, separate them with commas. The user should be able to clearly understand where the information came from."}
|
| 71 |
]
|
| 72 |
messages.extend(st.session_state.history)
|
| 73 |
-
messages.append({"role": "user", "content": f"Context:\n{context}\n\
|
|
|
|
|
|
|
| 74 |
|
| 75 |
try:
|
| 76 |
resp = client.chat.completions.create(
|
|
|
|
| 12 |
from pinecone import Pinecone
|
| 13 |
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# Setup (exact hardcoded keys you provided)
|
| 16 |
client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 17 |
pc = Pinecone(api_key=os.getenv("PINECONE_API_KEY"))
|
|
|
|
| 66 |
"If multiple sources are used, separate them with commas. The user should be able to clearly understand where the information came from."}
|
| 67 |
]
|
| 68 |
messages.extend(st.session_state.history)
|
| 69 |
+
messages.append({"role": "user", "content": f"Context:\n{context}\n\n"
|
| 70 |
+
f"Sources:\n{', '.join(sources)}\n\n"
|
| 71 |
+
f"Question:\n{user_query}"})
|
| 72 |
|
| 73 |
try:
|
| 74 |
resp = client.chat.completions.create(
|