The standardized information retrieval interface.
Project description
Chamois
Goal: build a standardized interface for developing retrieval systems.
This project is under active development, and we expect to release additional features in the coming months as we iterate and finalize the first version of the interface. In its current form, Chamois is a simple wrapper on embedding endpoints like OpenAI.
Installation
pip install chamois[openai]
Usage
For optimal performance, use async to run as many of the I/O embedding operations in parallel as possible:
import asyncio
import chamois
# Define a function that splits text into chunks
@chamois.embed("openai:text-embedding-3-small", dims=128)
async def embed_paragraphs(text: str) -> list[str]:
"""Split text into paragraphs and embed them."""
return text.strip().split("\n\n")
# Process text with the decorated function
text = """
Once upon a time in a forest far away, there lived a family of rabbits.
They spent their days gathering food and playing games.
"""
embeddings: list[chamois.Embedding] = asyncio.run(embed_paragraphs(text))
# Access the embedding vectors
print(f"Number of embeddings: {len(embeddings)}")
# > 2
print(f"First embedding dimensions: {len(embeddings[0].embedding)}")
# > 128
print(f"First few values: {embeddings[0].embedding[:5]}")
# > [0.016108348965644836, 0.012391675263643265, ...]
You can of course also run things synchronously:
import chamois
@chamois.embed("openai:text-embedding-3-small", dims=128)
def embed_paragraphs(text: str) -> list[str]:
return text.strip().split("\n\n")
# Process text with the decorated function
text = """Once upon a time..."""
embeddings: list[chamois.Embedding] = embed_paragraphs(text)
print(f"Number of embeddings: {len(embeddings)}")
print(f"First embedding dimensions: {len(embeddings[0].embedding)}")
print(f"First few values: {embeddings[0].embedding[:5]}")
Supported Providers
openai: OpenAI's embedding models (requirespip install chamois[openai])- Example:
openai:text-embedding-3-small - Example:
openai:text-embedding-ada-002
- Example:
Versioning
Chamois uses Semantic Versioning.
License
This project is licensed under the terms of the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chamois-0.0.1.tar.gz.
File metadata
- Download URL: chamois-0.0.1.tar.gz
- Upload date:
- Size: 35.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3d4602a4e963528fe58f7ae89231aea385d8c54a047fb983023b92ae6619cbd
|
|
| MD5 |
6b1d744830e345261425e068e0bd2ee2
|
|
| BLAKE2b-256 |
29abc1979a8a6c3e1ee67aaf4e3f235c643573b249e4a882cb719b76626f50fe
|
File details
Details for the file chamois-0.0.1-py3-none-any.whl.
File metadata
- Download URL: chamois-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef8b919fe3fd77cdb02956f39eee41bed4319eb8ce876201ece01b1da04fc72b
|
|
| MD5 |
016ba14857caeb83d45110c750eff914
|
|
| BLAKE2b-256 |
edd0948347e47f5b6d5baab882b7bed9239f82b65b941ec89f8ff2f6278cf8a4
|