Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
How can I use web search with GPT on Azure using Python?
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?
1 answer
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_datais not currently supported.Performance issues when background mode is used with streaming. The issue is expected to be resolved soon.

0 comment threads