File size: 845 Bytes
aa9134d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from agents import Agent, Runner, trace, output_guardrail, GuardrailFunctionOutput
from pydantic import BaseModel, Field
from typing import Dict, List
from model import model

INSTRUCTIONS = (
    "You are a helpful research assistant. "
    "Given a user query, generate a set of 3 insightful questions "
    "to ask the user in order to facilitate detailed and in-depth planning."
)

class QuestionItem(BaseModel):
    number: int = Field(description='Question Number')
    question: str = Field(description='The question text based on user query')
    answer: str | None = None

class QuestionPlan(BaseModel):
    questions: list[QuestionItem] = Field(description='List of question')

question_agent = Agent(
    name='question_agent',
    instructions=INSTRUCTIONS,
    model=model,
    output_type=QuestionPlan
)