Files
chroma/clients/python
Hammad Bashir bdc1841e22 Add a thin client (#610)
## Description of changes
*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - Typing cleanup
- Changes embedding function defaults to work through the default params
as opposed to via None so that None now means - NO embedding function as
opposed to use the default. This is technically a breaking change.
 - New functionality
- Adds a thin client that restricts what you can create to the REST api
client and builds it separately so it can be published to its own pypi
package. The thin client restricts the default embedding function to be
None always - forcing manual specification of the embedding function
while using the thin client.
- The thin client is built with its own pyproject.toml with a limited
set of dependencies and a is_thin_client.py file that acts as a compile
flag. The build script stages the toml, places the two files in the
right place, performs the build and then tears down the changes.
	 
Addresses #289 

## Test plan
The existing tests should cover this configuration. We can add CI for
the thin-client in the future.

## Documentation Changes
We will add a section on the docs that explains the thin client and its
limitations.
2023-05-31 14:23:10 -07:00
..
2023-05-31 14:23:10 -07:00
2023-05-31 14:23:10 -07:00
2023-05-31 14:23:10 -07:00
2023-05-31 14:23:10 -07:00

Chroma logo

Chroma - the open-source embedding database.
This package is for the the Python HTTP client-only library for Chroma. This client connects to the Chroma Server. If that it not what you are looking for, you might want to check out the full library.

pip install chromadb-client # python http-client only library

To connect to your server and perform operations using the client only library, you can do the following:

import chromadb
from chromadb.config import Settings
# Example setup of the client to connect to your chroma server
client = chromadb.Client(Settings(chroma_api_impl="rest",
                                  chroma_server_host="localhost",
                                  chroma_server_port=8000))

collection = client.create_collection("all-my-documents")

collection.add(
    documents=["This is document1", "This is document2"],
    metadatas=[{"source": "notion"}, {"source": "google-docs"}], # filter on these!
    ids=["doc1", "doc2"], # unique for each doc
    embeddings = [[1.2, 2.1, ...], [1.2, 2.1, ...]]
)

results = collection.query(
    query_texts=["This is a query document"],
    n_results=2,
    # where={"metadata_field": "is_equal_to_this"}, # optional filter
    # where_document={"$contains":"search_string"}  # optional filter
)

License

Apache 2.0