Is Azure AI Studio - Chat Playground's 'copy Sample Code' feature broken by default?

JP 25 Reputation points
2024-06-14T21:23:17.1066667+00:00

Azure AI Studio - Chat Playground

I have successfully deployed a model and querying it is fine in the Chat playground. It also works in the deployed Web app.

  1. However when I click on the [View code] button, select [curl] from the drop-down and copy the [Sample code], I get errors resulting from the code.

There are variables that are missing when you copy, but filling them in or leaving them out makes no difference.

  1. When I run the CURL command I get the following response every time (in bash and postman)
  2. I have verified in AI Search, Open AI and other places to make sure the keys were correct (and they were)

How can I run the Sample code using the CURL command?

Response:

{

    "error": {

        "code": "404",

        "message": "Resource not found"

    }

}

"error": {
        "code": "404",
        "message": "Resource not found"
    }
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,462 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 47,676 Reputation points
    2024-06-16T06:34:31.9033333+00:00

    Hello @JP

    I'm glad that you were able to resolve your issue 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.

    The issue was caused by invalid version in the sample code generator, so I will escalate this issue to product team to correct it. Before it is fixed, please refer to below version list to use the correct version.

    Supported versions

    Please refer to the document here - https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions

    Thank you for your support.


    Regards,

    Yutong

    -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. JP 25 Reputation points
    2024-06-15T14:28:30.7566667+00:00

    I followed the recommendations of another post to help me trouble shoot. It helped me get based the 404 response. Thank you.

    I just hope they update the code sample generators to use the proper versions of the endpoints moving forward.

    1 person found this answer helpful.
    0 comments No comments

  2. JP 25 Reputation points
    2024-06-14T21:46:19.2033333+00:00

    Update: I tested from scratch with no Azure Cognitive Search associated with the deployment. I received the expected output.

    Now this points me in the direction of Azure AI Search being the culprit. Possibilities:

    1. Authentication to AI Search?
    2. Invalid AI Search resource/paths in the copied code?
    3. Missing parameters not included in the copied code?

    User's image

    {"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"finish_reason":"stop","index":0,"logprobs":null,"message":{"content":"I can help answer questions, provide information, generate text, assist with research, and engage in conversation on a wide range of topics.","role":"assistant"}}],"created":1718401090,"id":"chatcmpl-9a8uYlSBdDLIhxiWjDjPDDvLRmHjN","model":"gpt-35-turbo-16k","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":null,"usage":{"completion_tokens":27,"prompt_tokens":61,"total_tokens":88}}
    
    0 comments No comments