Spaces:
Sleeping
Sleeping
stefanches7
commited on
Commit
·
77a5171
1
Parent(s):
34f3f40
add context to the feedback queries
Browse files
cli.py
CHANGED
|
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
| 8 |
from logging_utils import setup_logging
|
| 9 |
|
| 10 |
from agent import BIDSifierAgent
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
def _read_pdf(path: str) -> str:
|
|
@@ -85,14 +86,17 @@ def short_divider(title: str) -> None:
|
|
| 85 |
print(title)
|
| 86 |
print("=" * 80 + "\n")
|
| 87 |
|
| 88 |
-
def enter_feedback_loop(agent: BIDSifierAgent, context: dict, logger: Optional[logging.Logger] = None) -> dict:
|
| 89 |
feedback = input("\nAny comments or corrections to the summary? (press Enter to skip): ").strip()
|
| 90 |
while feedback:
|
| 91 |
if logger:
|
| 92 |
logger.info("User feedback: %s", feedback)
|
| 93 |
context["user_feedback"] += feedback
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
print(agent_response)
|
|
|
|
| 96 |
feedback = input("\nAny additional comments or corrections? (press Enter to skip): ").strip()
|
| 97 |
return context
|
| 98 |
|
|
|
|
| 8 |
from logging_utils import setup_logging
|
| 9 |
|
| 10 |
from agent import BIDSifierAgent
|
| 11 |
+
from prompts import _ctx
|
| 12 |
|
| 13 |
|
| 14 |
def _read_pdf(path: str) -> str:
|
|
|
|
| 86 |
print(title)
|
| 87 |
print("=" * 80 + "\n")
|
| 88 |
|
| 89 |
+
def enter_feedback_loop(agent: BIDSifierAgent, context: dict, last_model_reply: str, logger: Optional[logging.Logger] = None) -> dict:
|
| 90 |
feedback = input("\nAny comments or corrections to the summary? (press Enter to skip): ").strip()
|
| 91 |
while feedback:
|
| 92 |
if logger:
|
| 93 |
logger.info("User feedback: %s", feedback)
|
| 94 |
context["user_feedback"] += feedback
|
| 95 |
+
ctx = f"\n{_ctx(context['dataset_xml'], context['readme_text'], context['publication_text'])}"
|
| 96 |
+
query = f"Tackle the user feedback. \n ### Context:### {ctx} \n ### Your previous message:### {last_model_reply} \n ### User feedback:### {feedback} \n ###Output:###"
|
| 97 |
+
agent_response = agent.run_query(query)
|
| 98 |
print(agent_response)
|
| 99 |
+
last_model_reply = agent_response
|
| 100 |
feedback = input("\nAny additional comments or corrections? (press Enter to skip): ").strip()
|
| 101 |
return context
|
| 102 |
|