Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -84,19 +84,17 @@ def generate(
|
|
84 |
reformed_query = reformulate_query(prompt, history)
|
85 |
formatted_prompt = format_prompt(reformed_query, history)
|
86 |
|
87 |
-
|
88 |
-
docs = retriever.get_relevant_documents(prompt)
|
89 |
|
|
|
90 |
sources = "\nSources:\n"
|
91 |
for doc in docs:
|
92 |
if 'source' in doc.metadata:
|
93 |
sources += doc.metadata['source'] + '\n'
|
94 |
|
95 |
-
stream = chat_client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
96 |
-
|
97 |
output = ""
|
98 |
|
99 |
-
for response in
|
100 |
output += response.token.text
|
101 |
yield output
|
102 |
|
|
|
84 |
reformed_query = reformulate_query(prompt, history)
|
85 |
formatted_prompt = format_prompt(reformed_query, history)
|
86 |
|
87 |
+
text_stream = chat_client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
88 |
|
89 |
+
docs = retriever.get_relevant_documents(reformed_query)
|
90 |
sources = "\nSources:\n"
|
91 |
for doc in docs:
|
92 |
if 'source' in doc.metadata:
|
93 |
sources += doc.metadata['source'] + '\n'
|
94 |
|
|
|
|
|
95 |
output = ""
|
96 |
|
97 |
+
for response in text_stream:
|
98 |
output += response.token.text
|
99 |
yield output
|
100 |
|