Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: WeaviateDocumentIndex fails if index name is not capitalized #1709

Closed
jupyterjazz opened this issue Jul 18, 2023 · 0 comments · Fixed by #1711
Closed

bug: WeaviateDocumentIndex fails if index name is not capitalized #1709

jupyterjazz opened this issue Jul 18, 2023 · 0 comments · Fixed by #1711
Assignees

Comments

@jupyterjazz
Copy link
Contributor

jupyterjazz commented Jul 18, 2023

WeaviateDocumentIndex fails if index name is not capitalized

from docarray import BaseDoc, DocList
from docarray.index import WeaviateDocumentIndex
from docarray.typing import NdArray
from pydantic import Field
import numpy as np

# Define the document schema.
class MyDoc(BaseDoc):
    title: str
    embedding: NdArray[128] = Field(is_embedding=True)

# Create dummy documents.
docs = DocList[MyDoc](MyDoc(title=f'title #{i}', embedding=np.random.rand(128)) for i in range(10))

# Initialize a new WeaviateDocumentIndex instance and add the documents to the index.
doc_index = WeaviateDocumentIndex[MyDoc](index_name='zdzd')
doc_index.index(docs)

# Perform a vector search.
query = np.ones(128)
retrieved_docs = doc_index.find(query, limit=10)

File "/Users/jinaai/Desktop/docarray/docarray/index/backends/weaviate.py", line 354, in find
docs, scores = self._find(
File "/Users/jinaai/Desktop/docarray/docarray/index/backends/weaviate.py", line 408, in _find
results["data"]["Get"][index_name], score_name
KeyError: 'zdzd'

@jupyterjazz jupyterjazz self-assigned this Jul 18, 2023
@jupyterjazz jupyterjazz linked a pull request Jul 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant