Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liteobject/embeddings_with_chromadb
https://github.com/liteobject/embeddings_with_chromadb
chromadb embeddings llm vector-database
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/liteobject/embeddings_with_chromadb
- Owner: LiteObject
- Created: 2024-05-15T02:41:55.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-07-09T19:25:51.000Z (6 months ago)
- Last Synced: 2024-11-07T22:13:09.864Z (about 2 months ago)
- Topics: chromadb, embeddings, llm, vector-database
- Language: Jupyter Notebook
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Embeddings with Chromadb
Embeddings have revolutionized the way we represent and process data in machine learning and natural language processing tasks. They allow us to transform high-dimensional, unstructured data into compact, meaningful vector representations. ChromaDB, a powerful vector database, takes embeddings to the next level by providing efficient storage, retrieval, and similarity search capabilities. In this blog post, we'll explore how ChromaDB empowers developers to harness the full potential of embeddings.## What is embeddings?
## Setup Chroma DB
### Install chromadb package
pip install chromadb### Get the chroma client
import chromadb
chroma_client = chromadb.Client()### Create a collection
Collections are where you'll store your embeddings, documents, and any additional metadata. You can create a collection with a name:collection = chroma_client.create_collection(name="my_collection")
### Add some text documents to the collection
Chroma will store your text and handle embedding and indexing automatically. You can also customize the embedding model.```python
collection.add(
documents=[
"This is a document about pineapple",
"This is a document about oranges"
],
ids=["id1", "id2"]
)
```### Query the collection
```python
results = collection.query(
query_texts=["This is a query document about hawaii"], # Chroma will embed this for you
n_results=2 # how many results to return
)
print(results)
```### Inspect Results
## Links
- [ChromaDB: Getting Started](https://docs.trychroma.com/getting-started)