added web_search tool to agents

This commit is contained in:
arkml 2025-04-14 13:08:45 +05:30 committed by Ramnique Singh
parent aad14804ea
commit 41c3f2cfc6

View file

@ -13,7 +13,7 @@ from .helpers.instructions import (
add_rag_instructions_to_agent add_rag_instructions_to_agent
) )
from agents import Agent as NewAgent, Runner, FunctionTool, RunContextWrapper, ModelSettings from agents import Agent as NewAgent, Runner, FunctionTool, RunContextWrapper, ModelSettings, WebSearchTool
# Add import for OpenAI functionality # Add import for OpenAI functionality
from src.utils.common import common_logger as logger, generate_openai_output from src.utils.common import common_logger as logger, generate_openai_output
from typing import Any from typing import Any
@ -221,6 +221,9 @@ def get_agents(agent_configs, tool_configs, complete_request):
"type": "function", "type": "function",
"function": tool_config "function": tool_config
}) })
if tool_name == "web_search":
tool = WebSearchTool()
else:
tool = FunctionTool( tool = FunctionTool(
name=tool_name, name=tool_name,
description=tool_config["description"], description=tool_config["description"],