Azure / azure-search-vector-samples

A repository of code samples for Vector search capabilities in Azure AI Search.
https://azure.microsoft.com/products/search
MIT License
731 stars 308 forks source link

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. #262

Open avisheka93 opened 1 month ago

avisheka93 commented 1 month ago

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

farzad528 commented 1 month ago

can you ensure you are using azure-search-documents==11.4.0 since that is the version that's integrated within llamaindex.