ITADN

web-search-for-anyone-need

#241OpenScottWhittier6 创建于 2025-12-06
S
ScottWhittier6commented
## Can not web-search-for-openai ` from openai import OpenAI chat = ChatOpenAI( model="global-gpt-5-mini", system_prompt="You are a helpful assistant.", api_key=api_key, base_url=base_url ) response = chat.chat("What month, what day, what year??", kwargs={"tools": [{"type": "function", "function": {"name": "web_search", "description": "Search the web", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}}}]}) ` ## web-search-for-google ` from google import genai from google.genai import types chat = ChatGoogle( model='gemini-2.5-flash-thinking', api_key=api_key_google, kwargs={"http_options": types.HttpOptions(base_url=base_url_google)} ) response = chat.chat( "What month, what day, what year??", kwargs={ "config": types.GenerateContentConfig( tools=[types.Tool(google_search=types.GoogleSearch())] ) } `
3 条评论