Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/firstbatchxyz/firstbatch-sdk
Python SDK for FirstBatch: Real-time personalization using vectorDBs
https://github.com/firstbatchxyz/firstbatch-sdk
chromadb personalization pinecone sdk-python supabase typesense vector-database vectordb weaviate
Last synced: 17 days ago
JSON representation
Python SDK for FirstBatch: Real-time personalization using vectorDBs
- Host: GitHub
- URL: https://github.com/firstbatchxyz/firstbatch-sdk
- Owner: firstbatchxyz
- License: mit
- Created: 2023-10-06T13:20:28.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-26T18:34:05.000Z (about 1 year ago)
- Last Synced: 2024-11-13T00:35:38.634Z (3 months ago)
- Topics: chromadb, personalization, pinecone, sdk-python, supabase, typesense, vector-database, vectordb, weaviate
- Language: Python
- Homepage: https://firstbatch.xyz
- Size: 222 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 `[email protected]`.
## 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.