Update app.py
Browse files
app.py
CHANGED
@@ -61,16 +61,15 @@ After writing the document, please provide a list of sources used in your respon
|
|
61 |
main_content = ""
|
62 |
try:
|
63 |
for i in range(num_calls):
|
64 |
-
|
65 |
messages=[{"role": "user", "content": prompt}],
|
66 |
max_tokens=10000,
|
67 |
temperature=temperature,
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
yield main_content, ""
|
74 |
except Exception as e:
|
75 |
logging.error(f"Error in get_response_with_search: {str(e)}")
|
76 |
yield f"An error occurred while processing your request: {str(e)}", ""
|
|
|
61 |
main_content = ""
|
62 |
try:
|
63 |
for i in range(num_calls):
|
64 |
+
response = await client.chat_completion(
|
65 |
messages=[{"role": "user", "content": prompt}],
|
66 |
max_tokens=10000,
|
67 |
temperature=temperature,
|
68 |
+
)
|
69 |
+
if response.choices and response.choices[0].message:
|
70 |
+
chunk = response.choices[0].message.content
|
71 |
+
main_content += chunk
|
72 |
+
yield main_content, ""
|
|
|
73 |
except Exception as e:
|
74 |
logging.error(f"Error in get_response_with_search: {str(e)}")
|
75 |
yield f"An error occurred while processing your request: {str(e)}", ""
|