Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure AI Search: Error in Vectorizer 'vector-search-vectorizer' : 'uri' parameter cannot be null or empty #31893

Open
3 of 6 tasks
FabianHertwig opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Search Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@FabianHertwig
Copy link

  • 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

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.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Search Service Attention Workflow: This issue is responsible by Azure service team. labels Nov 22, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bleroy @MarkHeff @miwelsh @tjacobhi.

@jeremymeng
Copy link
Member

Looks that the SDK already maps ResourceUrl to resourceUri

className: "AzureOpenAIParameters",
modelProperties: {
resourceUrl: {
serializedName: "resourceUri",
type: {
name: "String",
},
},

maybe the issue is something else /cc @dgetu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Search Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

3 participants