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.
Metadata
Release files for chamois 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chamois-0.0.1.tar.gz | 35.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chamois-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.2 kB
Release files / chamois-0.0.1.tar.gz
| Download URL | chamois-0.0.1.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3d4602a4e963528fe58f7ae89231aea385d8c54a047fb983023b92ae6619cbd
|
|
BLAKE2b-256 checksum How to use checksums |
29abc1979a8a6c3e1ee67aaf4e3f235c643573b249e4a882cb719b76626f50fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.8
|
Release files / chamois-0.0.1-py3-none-any.whl
| Download URL | chamois-0.0.1-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef8b919fe3fd77cdb02956f39eee41bed4319eb8ce876201ece01b1da04fc72b
|
|
BLAKE2b-256 checksum How to use checksums |
edd0948347e47f5b6d5baab882b7bed9239f82b65b941ec89f8ff2f6278cf8a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.8
|