Spaces:
Running
Running
File size: 933 Bytes
f7506e5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from pydantic import BaseModel, Field
from agents import Agent
import os
from dotenv import load_dotenv
load_dotenv(override=True)
MODEL_NAME = os.getenv("DEFAULT_MODEL_NAME", "gpt-5.4-mini")
HOW_MANY_SEARCHES = int(os.getenv("HOW_MANY_SEARCHES", 5))
INSTRUCTIONS = f"""
You are a research assistant. Given a user query, come up with a set of web searches
to perform to best answer the query. Output {HOW_MANY_SEARCHES} terms to query for.
"""
class WebSearchItem(BaseModel):
reason: str = Field(description="Your reasoning for why this search is important to the query.")
query: str = Field(description="The search term to use for the web search.")
class WebSearchPlan(BaseModel):
searches: list[WebSearchItem] = Field(description="A list of web searches to perform to best answer the query.")
planner_agent = Agent(name="Planner Agent", instructions=INSTRUCTIONS, model=MODEL_NAME, output_type=WebSearchPlan) |