Azure / Azure/azure-search-vector-samples

Issue while trying to create index with error The request is invalid. Details: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.

Open
#262 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
910
Forks
377
PR merge metrics
No merged PRs in 30d

Description

index_client = SearchIndexClient(
endpoint=service_endpoint,
credential=cognitive_search_credential,
)

# Index name to use
index_name = f"vs_spn_chatrules"

search_client = SearchClient(
endpoint=service_endpoint,
index_name=index_name,
credential=cognitive_search_credential,
)

# Creating an Azure AI Search Vector Store
vector_store = AzureAISearchVectorStore(
search_or_index_client=index_client,
filterable_metadata_field_keys=metadata_fields,
index_name=index_name,
index_management=IndexManagement.CREATE_IF_NOT_EXISTS,
id_field_key="id",
chunk_field_key="chunk", #content
embedding_field_key="embedding", #content_vector
embedding_dimensionality=1536,
metadata_string_field_key="metadata",
doc_id_field_key="doc_id",
language_analyzer="en.lucene",
vector_algorithm_type="exhaustiveKnn", #HNSW focuses on approximate methods for efficiency, KNN ensures exactness through exhaustive searches.
)

Settings.llm = llm
Settings.embed_model = embed_model

storage_context = StorageContext.from_defaults(vector_store=vector_store)

# VectorStoreIndex.from_documents

index = VectorStoreIndex.from_documents(
all_docs, storage_context=storage_context
)

all_docs is a list of documents with document metadata and documents

while im trying to create index its gives error

HttpResponseError: () The request is invalid. Details: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.
Code:
Message: The request is invalid. Details: An unexpected 'StartArray' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected.

any guidance on this

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the AzureAISearchVectorStore construction and the VectorStoreIndex.from_documents call, then compare the supplied metadata_fields and document metadata with the index schema. Reproduce the request using the shown SearchIndexClient setup and identify which field is serialized as an array; done means index creation succeeds without the StartArray/PrimitiveValue error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.