I want to use web search when calling GPT on Azure using Python.
I can call GPT on Azure using Python as follows:
import os
from openai import AzureOpenAI
endpoint = "https://somewhere.openai.azure.com/"
model_name = "gpt5"
deployment = "gpt5"
subscription_key = ""
api_version = "2024年12月01日-preview"
client = AzureOpenAI(
api_version=api_version,
azure_endpoint=endpoint,
api_key=subscription_key,
)
response = client.chat.completions.create(
messages=[
{
"role": "system",
"content": "You are a funny assistant.",
},
{
"role": "user",
"content": "Tell me a joke about birds",
}
],
max_completion_tokens=16384,
model=deployment
)
print(response.choices[0].message.content)
How do I add web search? Just like ChatGPT can do:
-
1you can do this in 2 ways, if you want to be in the azure ecosystem then you can use bing search or other wise you can use something like tavily, firecrawl, you will have to provide web search as a function call when creating the response (refer to platform.openai.com/docs/guides/function-calling)htrehrthtr– htrehrthtr2025年10月04日 11:46:03 +00:00Commented Oct 4 at 11:46
1 Answer 1
Based on learn.microsoft.com (mirror 1; mirror 2), web search with GPT on Azure using Python is not supported yet:
Not currently supported:
The web search tool
Image generation using multi-turn editing and streaming - coming soon
Images can't be uploaded as a file and then referenced as input. Coming soon.
There's a known issue with the following:
PDF as an input file is now supported , but setting file upload purpose to
user_data
is not currently supported.Performance issues when background mode is used with streaming. The issue is expected to be resolved soon.
Comments
Explore related questions
See similar questions with these tags.