Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/paperqa/agents/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,19 @@ async def gather_evidence(self, question: str, state: EnvironmentState) -> str:
reverse=True,
)

# Show scores over numbered list, since scores are actually the heuristic
top_contexts = "\n".join(
[
f"{n + 1}. {sc.context}\n"
for n, sc in enumerate(
sorted_relevant_contexts[: self.settings.agent.agent_evidence_n]
)
]
f"- Relevance score {sc.score}: {sc.context}\n"
for sc in sorted_relevant_contexts[: self.settings.agent.agent_evidence_n]
)

best_evidence = f" Best evidence(s):\n\n{top_contexts}" if top_contexts else ""
# Include 'current question' because different questions will lead to
# different best evidences being shown
best_evidence = (
f" Best evidence(s) current question:\n\n{top_contexts}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f" Best evidence(s) current question:\n\n{top_contexts}"
f" Best evidence(s) for the current question:\n\n{top_contexts}"

if top_contexts
else ""
)

if f"{self.TOOL_FN_NAME}_completed" in self.settings.agent.callbacks:
await asyncio.gather(
Expand Down
Loading