extra_body / dataSources support for Azure OpenAI BYOD
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
- [X] This is a feature request for the Node library
Describe the feature or improvement you're requesting
In the OpenAI Python API library, there are paramters included that allow extra JSON properties to be sent to the OpenAI endpoint, which is particularly useful when using Azure OpenAI endpoints. One of these properties is dataSources, which is used by the Azure OpenAI BYOD feature. I would request adding consistent functionality in the Node library to allow the extra properties to be sent to the endpoint.
Additional context
No response
This works out of the box, no extra_body needed:
client.foo.create({
…
// @ts-ignore this is an Azure-specific param.
data_sources: …
})
@rattrayalex Are you sure this works? I get the error "Unrecognized request argument supplied: dataSources"
Here is a code sample:
let events = await client.chat.completions.create({
model: "gpt-4o",
response_format: {
"type": "json_schema",
"json_schema": schema
},
messages: [
{
role: "system", content: `You are an assistant that identifies content of an image and returns information in JSON.`
},
{
role: "user",
content: content
}
],
// @ts-ignore this is an Azure-specific param.
dataSources: [{
"type": "azure_search",
"parameters": {
"endpoint": "https://XXXXXXXXXXXXX.search.windows.net",
"index_name": "testindex",
"semantic_configuration": "default",
"query_type": "semantic",
"fields_mapping": {},
"in_scope": false,
"role_information": "You are an AI assistant that helps people find information.",
"filter": null,
"strictness": 3,
"top_n_documents": 5,
"authentication": {
"type": "api_key",
"key": "XXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
}]
});
@cohowap Please follow this sample for using Azure OpenAI On Your Data feature. Also notice that it is "data_sources" and not "dataSources".
@cohowap Please follow this sample for using Azure OpenAI On Your Data feature. Also notice that it is "data_sources" and not "dataSources".
@deyaaeldeen
Did you mean to link something? I have tried several variations, looking at the rest api, data_sources is correct. I have tried the below, but it still doesn't seem to work. I am going to continue to debug, because as far as I can tell going through the library and the API, below "seems" correct, but I am not sure because it's not working still. The server is returning a "model error".
data_sources: [{
"type": "azure_search",
"parameters": {
"endpoint": "https://xxxxx.search.windows.net",
"index_name": "index",
"authentication": {
"type": "api_key",
"key": "xxxxx"
}
}
}
"api-supported-versions": "1",
"apim-request-id": "986d3b21-3b91-46ea-ba97-e3531af00a08",
"azureml-model-session": "v20241121-1-150434548",
"content-length": "379",
"content-type": "application/json; charset=utf-8",
"date": "Tue, 31 Dec 2024 17:39:45 GMT",
"ms-azureml-model-error-reason": "model_error",
"ms-azureml-model-error-statuscode": "500",
"request-id": "986d3b21-3b91-46ea-ba97-e3531af00a08",
"strict-transport-security": "max-age=31536000; includeSubDomains; preload",
"x-aml-cluster": "hyena-eastus2-02",
"x-content-type-options": "nosniff",
"x-envoy-upstream-service-time": "1876",
"x-ms-client-request-id": "986d3b21-3b91-46ea-ba97-e3531af00a08",
"x-ms-rai-invoked": "true",
"x-ms-region": "East US",
"x-ratelimit-remaining-requests": "167",
"x-ratelimit-remaining-tokens": "137605",
"x-request-id": "786d643a-741b-44fa-90c8-84ecd2d54cd6"
Ops sorry, yes this is the link: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/openai/openai/samples/v2/typescript/src/onYourData.ts
Also, check out regional availability and model support information in https://learn.microsoft.com/azure/ai-services/openai/concepts/use-your-data