Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,16 +31,7 @@ texts = text_splitter.split_text(text)
|
|
31 |
|
32 |
docsearch = FAISS.from_texts(texts, embeddings)
|
33 |
|
34 |
-
|
35 |
-
def proper_query(query):
|
36 |
-
prompt = f"The following text is a users' question: {query}\n\nHow should that question be modified so that it uses correct language?\nReturn the question in the same language.\nCorrected Question:"
|
37 |
-
response = openai.Completion.create(
|
38 |
-
engine="text-davinci-003", prompt=prompt, max_tokens=1000, temperature=0.2)
|
39 |
-
return response.choices[0].text
|
40 |
-
|
41 |
-
|
42 |
def answer_question(query):
|
43 |
-
query = proper_query(query)
|
44 |
docs = docsearch.similarity_search(query)
|
45 |
refine_prompt_template = (
|
46 |
"The original question is as follows: {question}\n"
|
|
|
31 |
|
32 |
docsearch = FAISS.from_texts(texts, embeddings)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def answer_question(query):
|
|
|
35 |
docs = docsearch.similarity_search(query)
|
36 |
refine_prompt_template = (
|
37 |
"The original question is as follows: {question}\n"
|