Spaces:
Running
on
T4
Running
on
T4
adding Explicit AI flags in Intro and Response
Browse files
app.py
CHANGED
|
@@ -307,11 +307,13 @@ async def chat(query,history, method, sources,reports,subtype, client_ip=None, s
|
|
| 307 |
elif model_config.get('reader','TYPE') == 'INF_PROVIDERS':
|
| 308 |
chat_model = inf_provider()
|
| 309 |
start_time = time.time()
|
|
|
|
| 310 |
async def process_stream():
|
| 311 |
nonlocal answer_yet # Use the outer scope's answer_yet variable
|
| 312 |
# Without nonlocal, Python would create a new local variable answer_yet inside process_stream(),
|
| 313 |
# instead of modifying the one from the outer scope.
|
| 314 |
# Iterate over the streaming response chunks
|
|
|
|
| 315 |
response = chat_model.chat.completions.create(
|
| 316 |
model=model_config.get("reader","INF_PROVIDER_MODEL"),
|
| 317 |
messages = messages,
|
|
@@ -413,7 +415,7 @@ theme = gr.themes.Base(
|
|
| 413 |
)
|
| 414 |
|
| 415 |
init_prompt = """
|
| 416 |
-
Hello, I am Audit Q&A,
|
| 417 |
💡 How to use (tabs on right)
|
| 418 |
- **Reports**: You can choose to address your question to either specific report or a collection of report like District or Ministry focused reports. \
|
| 419 |
If you dont select any then the Consolidated report is relied upon to answer your question.
|
|
|
|
| 307 |
elif model_config.get('reader','TYPE') == 'INF_PROVIDERS':
|
| 308 |
chat_model = inf_provider()
|
| 309 |
start_time = time.time()
|
| 310 |
+
ai_prefix = "**AI-Generated Response:**\n\n"
|
| 311 |
async def process_stream():
|
| 312 |
nonlocal answer_yet # Use the outer scope's answer_yet variable
|
| 313 |
# Without nonlocal, Python would create a new local variable answer_yet inside process_stream(),
|
| 314 |
# instead of modifying the one from the outer scope.
|
| 315 |
# Iterate over the streaming response chunks
|
| 316 |
+
answer_yet += ai_prefix
|
| 317 |
response = chat_model.chat.completions.create(
|
| 318 |
model=model_config.get("reader","INF_PROVIDER_MODEL"),
|
| 319 |
messages = messages,
|
|
|
|
| 415 |
)
|
| 416 |
|
| 417 |
init_prompt = """
|
| 418 |
+
Hello, I am Audit Q&A, an AI-powered conversational assistant designed to help you understand audit Reports. I will answer your questions by using **Audit reports publishsed by Auditor General Office**.
|
| 419 |
💡 How to use (tabs on right)
|
| 420 |
- **Reports**: You can choose to address your question to either specific report or a collection of report like District or Ministry focused reports. \
|
| 421 |
If you dont select any then the Consolidated report is relied upon to answer your question.
|