Description
Library name and version
Azure.Search.Documents 11.6.0.0
Describe the bug
The problem is when I declare the vector field using annotations.
if I declare it as
[VectorSearchField(VectorSearchDimensions = 1536, VectorSearchProfileName = "my-vector-profile")]
public ReadOnlyMemory<float> DisplayNameVector { get; set; }
it gives the error in the description.
If instead I declare it inline, it works:
new SearchField("DisplayNameVector", SearchFieldDataType.Collection(SearchFieldDataType.Single))
{
IsSearchable = true,
VectorSearchDimensions = m_modelDimensions,
VectorSearchProfileName = m_vectorSearchHnswProfile,
}
ields that have their vector field counterpart (like string DisplayName, ReadOnlyMemory DisplayNameVector) break when pushing this document through calling searchClient.MergeOrUploadDocuments(data), I'm getting errors like below.
Azure.RequestFailedException
HResult=0x80131500
Message=The request is invalid. Details: A node of type 'StartArray' was read from the JSON reader when trying to read the contents of the property 'DisplayNameVector'; however, a 'StartObject' node or 'PrimitiveValue' node with null value was expected.
Status: 400 (Bad Request)
Content:
{"error":{"code":"","message":"The request is invalid. Details: A node of type 'StartArray' was read from the JSON reader when trying to read the contents of the property 'DisplayNameVector'; however, a 'StartObject' node or 'PrimitiveValue' node with null value was expected."}}
Headers:
Content-Language: REDACTED
Strict-Transport-Security: REDACTED
Preference-Applied: REDACTED
client-request-id: 3545775b-17e8-44b1-9e01-109179d0af93
x-ms-client-request-id: 3545775b-17e8-44b1-9e01-109179d0af93
request-id: 3545775b-17e8-44b1-9e01-109179d0af93
elapsed-time: 292
Content-Length: 279
Content-Type: application/json; charset=utf-8
Date: Thu, 28 Mar 2024 21:16:25 GMT
Server: Microsoft-IIS/10.0
Source=Azure.Search.Documents
StackTrace:
at Azure.Search.Documents.SearchClient.d__501.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Azure.Search.Documents.SearchClient.IndexDocuments[T](IndexDocumentsBatch1 batch, IndexDocumentsOptions options, CancellationToken cancellationToken)
at Azure.Search.Documents.SearchClient.MergeOrUploadDocuments[T](IEnumerable1 documents, IndexDocumentsOptions options, CancellationToken cancellationToken) at Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.ExtensionMethods.Ingest[T](IEnumerable1 data, SearchClient searchClient) in Q:\Repos\Shared\Sql\CloudBI\AS\src\PowerBI\PowerBIArtifactIndex\StorageClients\AzureSearchClient\ExtensionMethods.cs:line 51
at Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.AzureSearchClient.IngestData[T](IEnumerable`1 data) in Q:\Repos\Shared\Sql\CloudBI\AS\src\PowerBI\PowerBIArtifactIndex\StorageClients\AzureSearchClient\AzureSearchClient.cs:line 426
This exception was originally thrown at this call stack:
[External Code]
Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.ExtensionMethods.Ingest(System.Collections.Generic.IEnumerable, Azure.Search.Documents.SearchClient) in ExtensionMethods.cs
Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.AzureSearchClient.IngestData(System.Collections.Generic.IEnumerable) in AzureSearchClient.cs
Expected behavior
To push the parse the vector's data and push to its index.
Actual behavior
Azure.RequestFailedException
HResult=0x80131500
Message=The request is invalid. Details: A node of type 'StartArray' was read from the JSON reader when trying to read the contents of the property 'DisplayNameVector'; however, a 'StartObject' node or 'PrimitiveValue' node with null value was expected.
Status: 400 (Bad Request)
Content:
{"error":{"code":"","message":"The request is invalid. Details: A node of type 'StartArray' was read from the JSON reader when trying to read the contents of the property 'DisplayNameVector'; however, a 'StartObject' node or 'PrimitiveValue' node with null value was expected."}}
Headers:
Content-Language: REDACTED
Strict-Transport-Security: REDACTED
Preference-Applied: REDACTED
client-request-id: 3545775b-17e8-44b1-9e01-109179d0af93
x-ms-client-request-id: 3545775b-17e8-44b1-9e01-109179d0af93
request-id: 3545775b-17e8-44b1-9e01-109179d0af93
elapsed-time: 292
Content-Length: 279
Content-Type: application/json; charset=utf-8
Date: Thu, 28 Mar 2024 21:16:25 GMT
Server: Microsoft-IIS/10.0
Source=Azure.Search.Documents
StackTrace:
at Azure.Search.Documents.SearchClient.d__501.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Azure.Search.Documents.SearchClient.IndexDocuments[T](IndexDocumentsBatch1 batch, IndexDocumentsOptions options, CancellationToken cancellationToken)
at Azure.Search.Documents.SearchClient.MergeOrUploadDocuments[T](IEnumerable1 documents, IndexDocumentsOptions options, CancellationToken cancellationToken) at Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.ExtensionMethods.Ingest[T](IEnumerable1 data, SearchClient searchClient) in Q:\Repos\Shared\Sql\CloudBI\AS\src\PowerBI\PowerBIArtifactIndex\StorageClients\AzureSearchClient\ExtensionMethods.cs:line 51
at Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.AzureSearchClient.IngestData[T](IEnumerable`1 data) in Q:\Repos\Shared\Sql\CloudBI\AS\src\PowerBI\PowerBIArtifactIndex\StorageClients\AzureSearchClient\AzureSearchClient.cs:line 426
This exception was originally thrown at this call stack:
[External Code]
Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.ExtensionMethods.Ingest(System.Collections.Generic.IEnumerable, Azure.Search.Documents.SearchClient) in ExtensionMethods.cs
Microsoft.PowerBI.ArtifactIndex.AzureSearchClient.AzureSearchClient.IngestData(System.Collections.Generic.IEnumerable) in AzureSearchClient.cs
Reproduction Steps
Declaring properties like:
[VectorSearchField(VectorSearchDimensions = 1536, VectorSearchProfileName = "my-vector-profile")]
public ReadOnlyMemory<float> DisplayNameVector { get; set; }
And use FieldBuilder() to create the list of fields.
Using Azure.OpenAI client, get the embeddings for DisplayName.
var response = openAIClient.GetEmbeddings(new EmbeddingsOptions("my-text-embedding-ada-002", [text]));
data.displayNameVector = response.Value.Data[0].Embedding;
And push:
var results = searchClient.MergeOrUploadDocuments(data);
Environment
Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
Version 17.9.3
Metadata
Metadata
Assignees
Labels
Type
Projects
Status