Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

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?

+1
−2

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?

History

0 comment threads

1 answer

+0
−0

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.

History

0 comment threads

Sign up to answer this question »