Implement embeddings
Browse files- app.py +7 -5
- requirements.txt +3 -3
app.py
CHANGED
|
@@ -367,12 +367,14 @@ class ChatWrapper:
|
|
| 367 |
openai.api_key = api_key
|
| 368 |
if not monologue:
|
| 369 |
if use_embeddings:
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
|
|
|
|
|
|
| 374 |
else:
|
| 375 |
-
output = "
|
| 376 |
else:
|
| 377 |
output, hidden_text = run_chain(chain, inp, capture_hidden_text=trace_chain)
|
| 378 |
else:
|
|
|
|
| 367 |
openai.api_key = api_key
|
| 368 |
if not monologue:
|
| 369 |
if use_embeddings:
|
| 370 |
+
if inp and inp.strip() != "":
|
| 371 |
+
if docsearch:
|
| 372 |
+
docs = docsearch.similarity_search(inp)
|
| 373 |
+
output = str(qa_chain.run(input_documents=docs, question=inp))
|
| 374 |
+
else:
|
| 375 |
+
output, hidden_text = "Please supply some text in the the Embeddings tab.", None
|
| 376 |
else:
|
| 377 |
+
output, hidden_text = "What's on your mind?", None
|
| 378 |
else:
|
| 379 |
output, hidden_text = run_chain(chain, inp, capture_hidden_text=trace_chain)
|
| 380 |
else:
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
openai==0.26.
|
| 2 |
-
gradio==3.
|
| 3 |
google-search-results
|
| 4 |
-
google-api-python-client==2.
|
| 5 |
wolframalpha
|
| 6 |
langchain==0.0.64
|
| 7 |
requests==2.28.2
|
|
|
|
| 1 |
+
openai==0.26.4
|
| 2 |
+
gradio==3.17.0
|
| 3 |
google-search-results
|
| 4 |
+
google-api-python-client==2.75.0
|
| 5 |
wolframalpha
|
| 6 |
langchain==0.0.64
|
| 7 |
requests==2.28.2
|