Metadata-Version: 2.4
Name: chamois
Version: 0.0.1
Summary: The standardized information retrieval interface.
Author-email: William Bakst <william@mirascope.com>
Maintainer-email: William Bakst <william@mirascope.com>
License-File: LICENSE
Keywords: artificial intelligence,developer tools,embeddings,llm,rag
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: typing-extensions>=4.12.2
Provides-Extra: openai
Requires-Dist: openai>=1.66.5; extra == 'openai'
Description-Content-Type: text/markdown

# 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

```bash
pip install chamois[openai]
```

## Usage

For optimal performance, use `async` to run as many of the I/O embedding operations in parallel as possible:

```python
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:

```python
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 (requires `pip install chamois[openai]`)
  - Example: `openai:text-embedding-3-small`
  - Example: `openai:text-embedding-ada-002`

## Versioning

Chamois uses [Semantic Versioning](https://semver.org/).

## License

This project is licensed under the terms of the [MIT License](https://github.com/Mirascope/chamois/blob/main/LICENSE).
