Azure model has access to an assigned Data Source in the playground, but external requests to it do not seem to have the datasource.

Justin Frawley 0 Reputation points
2025-05-05T20:09:54.9+00:00

As I said above, I created an index of a sharepoint site and assigned that datasource to a model in the playground. When asking questions about these documents in the playground it is able to answer correctly using the datasource. When I send requests from a 3rd party app, the model does not offer the same answers and inf act does not seem aware of the datasource I attached via the website interface.

I'm sure there could be a very simple explanation and that I am just missing a step, but how should I go about rectifying this? The model is gpt-4o-mini

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,293 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vinodh247 33,316 Reputation points MVP Moderator
    2025-05-06T00:54:56.1533333+00:00

    Hi ,

    Thanks for reaching out to Microsoft Q&A.

    In Azure OpenAI, when you assign a data source (like a SharePoint indexed site) to a model in the Playground, it is used only in that chat session/environment. When you access the model via API calls from an external app, you must explicitly enable and include the data source configuration in your API request. The model does not automatically apply Playground configurations outside of it.

    You need to use the Azure OpenAI on Your Data feature in your API calls by following these steps:

    Ensure your index (Azure Cognitive Search or SharePoint via Azure AI Search) is deployed and accessible.

    1. Include the data source in your API request using the extensions or azure_extension_config field. Example payload:
    1. { { "role": "user", "content": "Summarize the content from the SharePoint site." } ], "temperature": 0, "top_p": 1, "extensions": { "dataSources": [ { "type": "AzureCognitiveSearch", "parameters": { "endpoint": "https://<your-search-service>.search.windows.net", "indexName": "<your-index-name>", "authentication": { "type": "apiKey", "key": "<your-api-key>" } } } ] } }

    Make sure your request is sent to the correct chat completions API endpoint for Azure OpenAI, typically:

    https://<your-resource-name>.openai.azure.com/openai/deployments/<deployment-name>/chat/completions?api-version=2024-02-15-preview

    Optional: If you used the Azure AI Studio to configure the data source, it may have created a deployment with RAG builtin. You can export that setup or use its API settings directly by clicking "Use in app" in the Studio.

    To sum it up:

    In Playground: Data source is auto attached. In API calls: You must explicitly attach the data source via JSON payload.

    Please feel free to click the 'Upvote' (Thumbs-up) button and 'Accept as Answer'. This helps the community by allowing others with similar queries to easily find the solution.

    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.