CoolFace
Apppublic

ranranrunforit/deep_research

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
search_agent.py23 linesDownload Raw Back to root
1from agents import Agent, WebSearchTool, ModelSettings, AsyncOpenAI, OpenAIChatCompletionsModel2import os3 4gemini_client = AsyncOpenAI(base_url="https://generativelanguage.googleapis.com/v1beta/openai/", api_key=os.getenv('GOOGLE_API_KEY'))5 6gemini_model = OpenAIChatCompletionsModel(model="gemini-2.5-flash-preview-05-20", openai_client=gemini_client)7 8 9INSTRUCTIONS = (10    "You are a research assistant. Given a search term, you search the web for that term and "11    "produce a concise summary of the results. The summary must 2-3 paragraphs and less than 300 "12    "words. Capture the main points. Write succintly, no need to have complete sentences or good "13    "grammar. This will be consumed by someone synthesizing a report, so its vital you capture the "14    "essence and ignore any fluff. Do not include any additional commentary other than the summary itself."15)16 17search_agent = Agent(18    name="Search agent",19    instructions=INSTRUCTIONS,20    tools=[WebSearchTool(search_context_size="low")],21    model=gemini_model,22    model_settings=ModelSettings(tool_choice="required"),23)