Metadata-Version: 2.1
Name: firstbatch
Version: 0.1.73
Summary: FirstBatch SDK for integrating user embeddings to your project. Add real-time personalization to your AI application without user data.
License: MIT
Author: andthattoo
Author-email: omer@firstbatch.xyz
Requires-Python: >=3.9,<3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Provides-Extra: chromadb
Provides-Extra: pinecone
Provides-Extra: product
Provides-Extra: supabase
Provides-Extra: typesense
Provides-Extra: weaviate
Requires-Dist: chromadb (>=0.4.13,<0.5.0) ; extra == "chromadb"
Requires-Dist: dataclasses-json (>=0.6.1,<0.7.0)
Requires-Dist: httpx (>=0.25.0,<0.26.0)
Requires-Dist: nanopq (>=0.2.0,<0.3.0) ; extra == "product"
Requires-Dist: numpy (>=1.26.0,<2.0.0)
Requires-Dist: pinecone-client (>=2.2.4,<3.0.0) ; extra == "pinecone"
Requires-Dist: pydantic (==1.10.13)
Requires-Dist: requests (>=2.31.0,<3.0.0)
Requires-Dist: tdigest (>=0.5.2.2,<0.6.0.0)
Requires-Dist: typesense (>=0.17.0,<0.18.0) ; extra == "typesense"
Requires-Dist: vecs (>=0.4.1,<0.5.0) ; extra == "supabase"
Requires-Dist: weaviate-client (>=3.24.2,<4.0.0) ; extra == "weaviate"
Description-Content-Type: text/markdown

# FirstBatch SDK

The FirstBatch SDK provides an interface for integrating vector databases and powering personalized AI experiences in your application.

## Key Features

- Seamlessly manage user sessions with persistent IDs or temporary sessions
- Send signal actions like likes, clicks, etc. to update user embeddings in real-time
- Fetch personalized batches of data tailored to each user's embeddings  
- Support for multiple vector database integrations: Pinecone, Weaviate, etc.
- Built-in algorithms for common personalization use cases
- Easy configuration with Python classes and environment variables

## Getting Started

### Prerequisites

- Python 3.9+
- API keys for FirstBatch and your chosen vector database

### Installation

```
pip install firstbatch
```

## Basic Usage

1. **Initialize VectorDB of your choice**
    ```python
   api_key = os.environ["PINECONE_API_KEY"]
   env = os.environ["PINECONE_ENV"]

   pinecone.init(api_key=api_key, environment=env)
   index = pinecone.Index("your_index_name")
   
   # Init FirstBatch
   config = Config(batch_size=20)
   personalized = FirstBatch(api_key=os.environ["FIRSTBATCH_API_KEY"], config=config)
   
   personalized.add_vdb("my_db", Pinecone(index, embedding_size=1536))
    ```

### Personalization

2. **Create a session with an Algorithm suiting your needs**
    ```python 
   session = personalized.session(algorithm=AlgorithmLabel.AI_AGENTS, vdbid="my_db")
    ```

3. **Make recommendations**
    ```python
   ids, batch = personalized.batch(session)
    ```
4. **Let users add signals to shape their embeddings**
   ```python
   user_pick = 0  # User liked the first content from the previous batch.
   personalized.add_signal(session, UserAction(Signal.LIKE), ids[user_pick])
   ```

## Support

For any issues or queries contact `support@firstbatch.xyz`.

  
## Resources

- [User Embedding Guide](https://firstbatch.gitbook.io/user-embeddings/)
- [SDK Documentation](https://firstbatch.gitbook.io/firstbatch-sdk/)

Feel free to dive into the technicalities and leverage FirstBatch SDK for highly personalized user experiences.

