Tweaks to research multi-agent
This commit is contained in:
parent
70544b5112
commit
670e4e2254
3 changed files with 11 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic_ai import Agent
|
||||
from pydantic_ai.models.openai import OpenAIChatModel
|
||||
from pydantic_ai.providers.ollama import OllamaProvider
|
||||
|
|
@ -86,7 +86,7 @@ class SearchResult(BaseModel):
|
|||
content: str
|
||||
score: float
|
||||
document_uri: str
|
||||
metadata: dict[str, Any] = {}
|
||||
metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class ResearchOutput(BaseModel):
|
||||
|
|
|
|||
|
|
@ -56,16 +56,12 @@ class ResearchOrchestrator(BaseResearchAgent[ResearchPlan]):
|
|||
|
||||
def _format_context_for_prompt(self, context: ResearchContext) -> str:
|
||||
"""Format the research context as XML for inclusion in prompts."""
|
||||
|
||||
context_data = {
|
||||
"original_question": context.original_question,
|
||||
"unanswered_questions": context.sub_questions,
|
||||
"qa_responses": [
|
||||
{
|
||||
"question": qa["question"],
|
||||
"answer": qa["answer"][:500] + "..."
|
||||
if len(qa["answer"]) > 500
|
||||
else qa["answer"],
|
||||
}
|
||||
{"question": qa["question"], "answer": qa["answer"]}
|
||||
for qa in context.qa_responses
|
||||
],
|
||||
"insights": context.insights,
|
||||
|
|
@ -201,7 +197,7 @@ Evaluate the research progress for the original question and identify any remain
|
|||
output = evaluation_result.output
|
||||
if output.key_insights:
|
||||
console.print(" [bold]Key insights:[/bold]")
|
||||
for insight in output.key_insights[:3]:
|
||||
for insight in output.key_insights:
|
||||
console.print(f" • {insight}")
|
||||
console.print(
|
||||
f" Confidence: [yellow]{output.confidence_score:.1%}[/yellow]"
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ Your role is to:
|
|||
4. Base your answer strictly on the information found
|
||||
|
||||
Use the search_and_answer tool to retrieve relevant documents and formulate your response.
|
||||
|
||||
Important:
|
||||
- Always call the search_and_answer tool before drafting any answer.
|
||||
- Never answer without first using the tool at least once.
|
||||
- If no relevant information is found, state that clearly and avoid speculation.
|
||||
|
||||
Be thorough and specific in your answers, citing relevant information from the sources."""
|
||||
|
||||
EVALUATION_AGENT_PROMPT = """You are an analysis and evaluation specialist for research workflows.
|
||||
|
|
|
|||
Loading…
Reference in a new issue