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.
- Include the data source in your API request using the
extensions
orazure_extension_config
field. Example payload:
- { { "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.