Description
code:
"name": "actionsVector",
"type": "Collection(Edm.Single)",
"searchable": True,
"retrievable": True,
"dimensions": 3072,
"vectorSearchProfile": "vector-profile",
service_name = "cobra-video-search-eliz"
admin_key = ""
api_version = "2024-07-01"
index_name = "complexscene_index"
Create a SearchIndexClient to manage the index
index_client = SearchIndexClient(
endpoint=f"https://{service_name}.search.windows.net",
credential=AzureKeyCredential(admin_key),
api_version=api_version,
)
Add IDs to documents
for i, doc in enumerate(data):
summary_vector = generate_embedding(doc['summary'])
documents.append({
"@search.action": "mergeOrUpload", #
"id": str(i),
"characters": doc.get("characters", ""),
"summary": doc.get("summary", ""),
"summaryVector": summary_vector,
"chunk_id": f"chunk_{i}"
})
Upload documents to the index
try:
result = search_client.upload_documents(documents=documents)
error:
Failed to create or update index: (InvalidRequestParameter) The request is invalid. Details: definition : The vector field 'summaryVector' must have the property 'dimensions' set.
Code: InvalidRequestParameter
Message: The request is invalid. Details: definition : The vector field 'summaryVector' must have the property 'dimensions' set.
Exception Details: (InvalidField) The vector field 'summaryVector' must have the property 'dimensions' set. Parameters: definition
Code: InvalidField
Message: The vector field 'summaryVector' must have the property 'dimensions' set. Parameters: definition