Description
- Package Name: @azure/search-documents
- Package Version: 12.1.0
- Operating system: Mac OS
- nodejs
- version:
- browser
- name/version:
- typescript
- version:
- Is the bug related to documentation in
- README.md
- source code documentation
- SDK API docs on https://learn.microsoft.com
Describe the bug
I want to create an Index and add a vectorizer to it. But I get the error message The request is invalid. Details: definition : Error in Vectorizer 'vector-search-vectorizer' : 'uri' parameter cannot be null or empty
.
I am following this guide: https://learn.microsoft.com/en-us/azure/search/vector-search-how-to-configure-vectorizer
There it is ResourceUri
, but in the type description search-documents.d.ts
it is ResourceUrl
.
export declare interface AzureOpenAIParameters {
/** The resource uri for your Azure Open AI resource. */
resourceUrl?: string;
/** ID of your Azure Open AI model deployment on the designated resource. */
deploymentId?: string;
/** API key for the designated Azure Open AI resource. */
apiKey?: string;
/** The user-assigned managed identity used for outbound connections. */
authIdentity?: SearchIndexerDataIdentity;
/** The name of the embedding model that is deployed at the provided deploymentId path. */
modelName?: AzureOpenAIModelName;
}
Either way, I get the same error.
To Reproduce
Steps to reproduce the behaviour:
Create a new index with the following code.
try {
const result = await client.createIndex({
name: env.INDEX_NAME,
fields: [
{
type: 'Edm.String',
name: 'key',
key: true
},
{
name: 'contentVector',
type: 'Collection(Edm.Single)',
searchable: true,
vectorSearchDimensions: Number(env.EMBEDDING_VECTOR_SIZE),
vectorSearchProfileName: 'myHnswProfile'
},
{
name: 'content',
type: 'Edm.String',
searchable: true
}
],
vectorSearch: {
algorithms: [
{
name: 'vector-search-algorithm',
kind: 'hnsw'
}
],
profiles: [
{
name: 'myHnswProfile',
algorithmConfigurationName: 'vector-search-algorithm',
vectorizerName: 'vector-search-vectorizer'
}
],
vectorizers: [
{
vectorizerName: 'vector-search-vectorizer',
kind: 'azureOpenAI',
parameters: {
resourceUrl: env.AZURE_OPENAI_API_ENDPOINT,
deploymentId: env.AZURE_OPENAI_DEPLOYMENT_NAME,
apiKey: env.AZURE_OPENAI_API_KEY,
}
}
]
}
});
return new Response(JSON.stringify(result), { status: 201 });
} catch (error) {
console.error(error);
return new Response(
JSON.stringify({ message: 'An error occurred while creating the index.' }),
{
status: 500
}
);
}
Error message:
RestError: The request is invalid. Details: definition : Error in Vectorizer 'vector-search-vectorizer' : 'uri' parameter cannot be null or empty
{
"name": "RestError",
"code": "",
"statusCode": 400,
"request": {
"url": "https://REDACTED.search.windows.net/indexes?api-version=2024-07-01",
"headers": {
"content-type": "application/json",
"accept": "application/json;odata.metadata=minimal",
"accept-encoding": "gzip,deflate",
"user-agent": "azsdk-js-search-documents/12.1.0 core-rest-pipeline/1.16.2 Node/23.2.0 OS/(arm64-Darwin-24.1.0)",
"x-ms-client-request-id": "34376bc0-643b-4e55-accb-28a856e38e46",
"api-key": "REDACTED",
"content-length": "4625"
},
"method": "POST",
"timeout": 0,
"disableKeepAlive": false,
"streamResponseStatusCodes": {},
"withCredentials": false,
"tracingOptions": {
"tracingContext": {
"_contextMap": {}
}
},
"requestId": "34376bc0-643b-4e55-accb-28a856e38e46",
"allowInsecureConnection": false,
"enableBrowserStreams": false
},
"details": {
"error": {
"code": "",
"message": "The request is invalid. Details: definition : Error in Vectorizer 'vector-search-vectorizer' : 'uri' parameter cannot be null or empty"
}
},
"message": "The request is invalid. Details: definition : Error in Vectorizer 'vector-search-vectorizer' : 'uri' parameter cannot be null or empty"
}
Expected behavior
The index gets created with the vectorizer configured.
Additional context
This issue is related: #31458
But I didn't really understand the answer and somehow it got resolved for the author, but the suggested resolution to use ResourceUrl
does not work for me. Therefore I opened a new issue.