[Feature Request]: Support Azure OpenAI Service chat completion extensions
See original GitHub issueDescribe your user scenario
A key customer scenario will be to use AI to chat with their own data. Azure OpenAI Service supports bringing your own data from Azure Cognitive Search. The Azure OpenAI Service REST API has an endpoint for chat completion extensions. This extends the chat completion endpoint to enable developers to specify an Azure Cognitive Search data source as part of the request.
Describe the solution you’d like
Extend the config.json
schema to include a new type called chat_extensions
.
{
"schema": 1,
"description": "Chat with your SharePoint data",
"type": "chat_extensions",
"completion": {
"max_tokens": 800,
"temperature": 0.0,
"top_p": 1.0,
"presence_penalty": 0.0,
"frequency_penalty": 0.0
}
}
Extend AzureOpenAIPlanner
with a new property for setting data sources.
const planner = new AzureOpenAIPlanner({
apiKey: config.openAIKey,
apiVersion: '2023-03-15-preview',
dataSources: [
{
type: "AzureCognitiveSearch",
parameters: {
endpoint: config.azureCognitiveSearchEndpoint,
key: config.azureCognitiveSearchKey,
indexName: config.azureCognitiveSearchIndexName,
}
}
],
defaultModel: 'gpt-msteams-spo-oai',
endpoint: config.openAIEndpoint,
logRequests: true,
useSystemMessage: true
});
Requests should be made to the correct endpoint by the SDK.
POST https://{your-resource-name}/openai/deployments/{deployment-id}/extensions/chat/completions?api-version={api-version}
The datasources
object should be passed in the body of the request along with the messages object.
{
"dataSources": [
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": "https://{acs-resource-name}.search.windows.net",
"key": "{acs-api-key}",
"indexName": "{acs-index}"
}
}
],
"messages": [
{
"role": "user",
"content": "What are the differences between Azure Machine Learning and Azure AI services?"
}
]
}
Describe alternatives you’ve considered
The alternative I have considered is to not use the AI capabilities of the SDK, but instead send my own requests and manage the conversation history myself. Here is an example of how I have done this in another sample: https://github.com/garrytrinder/msteams-azure-search-openai-demo
Additional context
Azure OpenAI Service REST API reference - Completions Extensions
Issue Analytics
- State:
- Created 2 months ago
- Reactions:4
- Comments:5 (1 by maintainers)
Top GitHub Comments
Disappointed to see this on the Backburner. Having your own data is a key feature for some of our clients and frustrating to see this held back
I would love this feature, this is only going to get more popular to bring your own data as it dramatically improves the quality and relevance of responses. To be able to surface this within apps would be super powerful. I am working on a project that really could have used this feature.
@garrytrinder I noticed you don’t have a license set (or MIT) on your repo example, can I use the sample code? I think I am going to need to switch to raw calls like in that example, Id love to build on what yo have done already.