How to Use GPT-4o without Azure Cognitive Search

BAHADIR ARAZ 10 Reputation points
2024-05-23T09:45:53.45+00:00

When I want to use GPT-4o, I get this error:
{'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}
I want to use GPT-4o without using Cognitive Search. In previous versions of Azure Open AI, this was possible, but now it is not. In the example given in the playground, it is done using Cognitive Search. How can I solve this problem?

I want to use GPT-4 in this way:

client = AsyncAzureOpenAI(
    azure_endpoint=settings.AZURE_OPENAI_API_BASE_URL,
    api_key=settings.AZURE_OPENAI4O_API_KEY,
    api_version=settings.AZURE_API_VERSION,
)
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,542 questions
Azure Startups
Azure Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Startups: Companies that are in their initial stages of business and typically developing a business model and seeking financing.
236 questions
{count} vote

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 30,066 Reputation points
    2024-05-27T02:55:35.9666667+00:00

    BAHADIR ARAZ Greetings!

    I'm glad that your issue is resolved and thank you for posting your solution so that others experiencing the same thing can easily reference this!

    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.

    I want to use GPT-4o without using Cognitive Search. In previous versions of Azure Open AI, this was possible, but now it is not.

    Cognitive search resource is required to generate the results if you use your data. There are other Supported data sources as well.

    {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}

    As per the error, it is possible that your API key is missing or invalid, or the endpoint is incorrect. Please make sure that you have a valid API key and endpoint for GPT-4o.

    Thanks for confirming that your issue is resolved. "Interestingly, it is fixed, and now I can use it just like in the example I mentioned and you are using python 3.12 openai>=1.30.1 api_version 2024-02-01"

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.

    0 comments No comments