Using own data in Azure Open AI via the REST API

Henk Terblanche 55 Reputation points
2024-02-12T13:01:29.0366667+00:00

I have created a deployment and loaded my own data (number of html files from a knowledge base). When asking a question related to the data in the Chat Playground / a Web App deployed from Azure OpenAI Studio the answer is related to my own data. However when I use the Azure OpenAI REST API (using the keys and end-point supplied for my deployment) it returns a generic answer and not based on my data. Does the REST API support user data at this stage or have I made a mistake in my configuration?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
4,081 questions
{count} votes

Accepted answer
  1. Charlie Wei 3,335 Reputation points
    2024-02-15T02:45:18.9366667+00:00

    Hello @Henk Terblanche ,

    If your answer on Chat Playground is related to your own data, the same applies when using Azure OpenAI REST API.

    Suppose your data is stored on Azure AI Search, you can refer to the request examples in this document.

    curl -i -X POST YOUR_RESOURCE_NAME/openai/deployments/YOUR_DEPLOYMENT_NAME/extensions/chat/completions?api-version=2023-06-01-preview \
    -H "Content-Type: application/json" \
    -H "api-key: YOUR_API_KEY" \
    -d \
    '
    {
        "temperature": 0,
        "max_tokens": 1000,
        "top_p": 1.0,
        "dataSources": [
            {
                "type": "AzureCognitiveSearch",
                "parameters": {
                    "endpoint": "YOUR_AZURE_COGNITIVE_SEARCH_ENDPOINT",
                    "key": "YOUR_AZURE_COGNITIVE_SEARCH_KEY",
                    "indexName": "YOUR_AZURE_COGNITIVE_SEARCH_INDEX_NAME"
                }
            }
        ],
        "messages": [
            {
                "role": "user",
                "content": "What are the differences between Azure Machine Learning and Azure AI services?"
            }
        ]
    }
    '
    

    Best regards,
    Charlie

    If you find my response helpful, please consider accepting this answer and voting 'yes' to support the community. Thank you!

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 35,971 Reputation points Moderator
    2024-02-12T14:22:28.85+00:00

    Henk Terblanche Greetings & Welcome to Microsoft Q&A forum!

    Does the REST API support user data at this stage or have I made a mistake in my configuration?

    To answer your question, yes you can access Azure OpenAI on your data using a REST API or the web-based interface in the Azure OpenAI Studio

    However when I use the Azure OpenAI REST API (using the keys and end-point supplied for my deployment) it returns a generic answer and not based on my data.

    Make sure that you have correctly loaded your data into the deployment. You can check this by verifying that your data is visible in the Chat Playground or Web App

    Did you try setting the inScope parameter?

    You can refer to the Azure OpenAI Service REST API reference documentation for details on how to structure a request and receive a response.

    Do let me know if that helps or have any further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.