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

refactor: remove docarray dependency #229

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Conversation

JoanFM
Copy link
Member

@JoanFM JoanFM commented Jul 20, 2023

No description provided.

@JoanFM JoanFM force-pushed the remove-docarray-dependency branch from 3c27c54 to 3469de8 Compare July 20, 2023 14:42
@JoanFM JoanFM force-pushed the remove-docarray-dependency branch from 73d4a13 to 3b3a4a0 Compare July 20, 2023 15:07
### Index

Then you can create an `AnnIndexer` to index the created `docs` and search for nearest neighbors:

```python
from annlite import AnnLite

docs = [{'id': '0', 'embedding': [], 'price': 8}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use dummy embedding as the example? 'embedding': np.random.random([128]).astype(np.float32)

@numb3r3
Copy link
Member

numb3r3 commented Jul 21, 2023

Maybe we can define a simple pydantic model as the basic data structure:

class Document(BaseModel):
    id: str = Field(..., required=True)
    embedding: Union[nd.array, list[float]] = Field(..., required=True)
    meta_data: Dict = Field(..., default = {})

    def validator():
          # validate the shape of the embedding
          ...

class Query(BaseModel):
    ....

class Result(BaseModel):
    ....

Anyway, this idea can be in a new PR instead.

numb3r3
numb3r3 previously approved these changes Jul 21, 2023
Copy link
Member

@numb3r3 numb3r3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JoanFM
Copy link
Member Author

JoanFM commented Jul 21, 2023

@numb3r3 I sitll want to do a change which is to set the key from which to extract the embedding, not always rely on embedding.

SInce my idea is to expose via DocArray, I will not use Pydantic for this since the validation would come from DocArray.

The idea here is that here it remains focused only on ANN search, nothing else

@JoanFM JoanFM force-pushed the remove-docarray-dependency branch from 32c9351 to edace38 Compare July 21, 2023 11:55
Signed-off-by: Joan Fontanals Martinez <[email protected]>
@JoanFM JoanFM force-pushed the remove-docarray-dependency branch from edace38 to 2af1eda Compare July 21, 2023 12:07
@JoanFM JoanFM changed the title Remove docarray dependency refactor: remove docarray dependency Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants