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