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

local_persistence.ipynb in /examples is giving embeddings as none #313

Closed
shivankar-p opened this issue Apr 9, 2023 · 1 comment
Closed

Comments

@shivankar-p
Copy link
Contributor

I tried running examples/local_persistence.ipynb locally on my machine.

# Query the collection
results = collection.query(
    query_embeddings=[[1.1, 2.3, 3.2]],
    n_results=1,
)

print(results)

This cell is supposed to print

{'embeddings': [[[1.1, 2.3, 3.2]]], 'documents': [['doc5']], 'ids': [['id5']], 'metadatas': [[{'uri': 'img5.png', 'style': 'style1'}]], 'distances': [[0.0]]}' as per the given output.

But its printing

{'ids': [['id5']], 'embeddings': None, 'documents': [['doc5']], 'metadatas': [[{'uri': 'img5.png', 'style': 'style1'}]], 'distances': [[0.0]]}

Why is embeddings None here?

@jeffchuber
Copy link
Contributor

@shivankar-p this is because .query by default does not return the embedding themselves, https://github.com/chroma-core/chroma/blob/main/chromadb/api/local.py#L245

This is a default for performance reasons. To get them to return, you can add an explicit include=['embeddings'] to your query.

There has been discussion elsewhere about changing this behavior to make it more intuitive. #300

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

No branches or pull requests

2 participants