change external source recommener
Browse files- src/streamlit_app.py +12 -5
src/streamlit_app.py
CHANGED
|
@@ -256,7 +256,7 @@ Guidelines:
|
|
| 256 |
- If the subtask implies a taxonomic or common name group (e.g., frog, snake, salmon), apply CONTAINS or STARTS WITH filters on Species.name or species_full_name, using toLower(...) for case-insensitive matching.
|
| 257 |
- If the subtask includes a time range, include date filtering.
|
| 258 |
- Prefer using DISTINCT to avoid redundant results.
|
| 259 |
-
- Only return fields that are
|
| 260 |
|
| 261 |
Return your response strictly as a **JSON object** with the following fields:
|
| 262 |
- "intent": a short description of what the query does
|
|
@@ -466,17 +466,23 @@ Plain text only — no code fences. Markdown link syntax (`[text](url)`) is allo
|
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
-
|
| 470 |
def external_resource_recommender(subtask: str, client=openai_client) -> str:
|
| 471 |
prompt = f"""
|
| 472 |
-
You are a helpful assistant
|
| 473 |
|
| 474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
-
Format your
|
| 477 |
- [Name of Source](URL)
|
| 478 |
- [Name of Source](URL)
|
| 479 |
- [Name of Source](URL)
|
|
|
|
|
|
|
| 480 |
"""
|
| 481 |
rsp = client.chat.completions.create(
|
| 482 |
model="gpt-4o",
|
|
@@ -487,6 +493,7 @@ Format your output in markdown as:
|
|
| 487 |
|
| 488 |
|
| 489 |
|
|
|
|
| 490 |
def fallback_query_router(subtask: str, driver) -> pd.DataFrame:
|
| 491 |
text = subtask.lower()
|
| 492 |
|
|
|
|
| 256 |
- If the subtask implies a taxonomic or common name group (e.g., frog, snake, salmon), apply CONTAINS or STARTS WITH filters on Species.name or species_full_name, using toLower(...) for case-insensitive matching.
|
| 257 |
- If the subtask includes a time range, include date filtering.
|
| 258 |
- Prefer using DISTINCT to avoid redundant results.
|
| 259 |
+
- Only return fields that are clearl y needed to fulfill the subtask.
|
| 260 |
|
| 261 |
Return your response strictly as a **JSON object** with the following fields:
|
| 262 |
- "intent": a short description of what the query does
|
|
|
|
| 466 |
|
| 467 |
|
| 468 |
|
|
|
|
| 469 |
def external_resource_recommender(subtask: str, client=openai_client) -> str:
|
| 470 |
prompt = f"""
|
| 471 |
+
You are a helpful research assistant. Your task is to recommend **three reliable, publicly accessible online datasets or data repositories** that can assist with the following scientific subtask:
|
| 472 |
|
| 473 |
+
{subtask}
|
| 474 |
+
|
| 475 |
+
Only include sources that are:
|
| 476 |
+
- Trusted (e.g., government, academic, or well-established platforms)
|
| 477 |
+
- Relevant to the topic
|
| 478 |
+
- Accessible without login when possible
|
| 479 |
|
| 480 |
+
Format your answer strictly in markdown:
|
| 481 |
- [Name of Source](URL)
|
| 482 |
- [Name of Source](URL)
|
| 483 |
- [Name of Source](URL)
|
| 484 |
+
|
| 485 |
+
Do not include any explanations or extra text—only the list.
|
| 486 |
"""
|
| 487 |
rsp = client.chat.completions.create(
|
| 488 |
model="gpt-4o",
|
|
|
|
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
+
|
| 497 |
def fallback_query_router(subtask: str, driver) -> pd.DataFrame:
|
| 498 |
text = subtask.lower()
|
| 499 |
|