Retrieval-based classification for structured data using embeddings and Pinecone. Zero-training, fast to integrate.
Project description
vector-classifier-python
Retrieval-based classification for structured data using embeddings and Pinecone. Zero-training, fast to integrate.
Install
pip install vector-classifier-python pinecone openai huggingface_hub
Quickstart
from vector_classifier import VectorClassifier
classifier = VectorClassifier({
"pinecone": {
"api_key": "YOUR_PINECONE_API_KEY",
"index_name": "animals",
"metric": "cosine",
"namespace": "prod"
},
"embedding": {
"provider": "openai",
"model": "text-embedding-3-small",
"api_key": "YOUR_OPENAI_API_KEY"
}
})
classifier.index_data([
{"id": "1", "label": "Cat", "description": "Small domestic cat", "metadata": {"color": "gray"}},
{"id": "2", "label": "Dog", "description": "Friendly domestic dog", "metadata": {"size": "medium"}},
])
result = classifier.classify({"description": "Playful feline"}, {"topK": 3, "threshold": 0.2})
print(result)
API
index_data(records, options=None)classify(query, options=None)batch_classify(queries, options=None)update_entry(id, data, namespace=None)delete_index()
See inline docs for details.
Image embeddings and classification (CLIP + Pinecone)
Example mirroring the TypeScript clip-plantnet.ts is available at examples/clip_plantnet.py.
Environment variables required:
export HF_TOKEN=your_hf_token
export PINECONE_API_KEY=your_pinecone_key
export VC_INDEX=plantnet-clip
export VC_NAMESPACE=dev
export VC_MODEL=sentence-transformers/clip-ViT-B-32
Run the example:
python -m vector-classifier-python.examples.clip_plantnet
vector-indexing-python
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 vector_classifier_python-0.1.1.tar.gz.
File metadata
- Download URL: vector_classifier_python-0.1.1.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d3194d4c052accb3ad42fb0691625d1dc887fbd3f68fb65ec1abf38143bad8d
|
|
| MD5 |
634a79a22e6fdef75f0231ea4d5071b7
|
|
| BLAKE2b-256 |
61fbb59c7b4505e140f2c3b66fd8e47e7018080af76d18e4161922dbe5338012
|
File details
Details for the file vector_classifier_python-0.1.1-py3-none-any.whl.
File metadata
- Download URL: vector_classifier_python-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9b625acd11c6623f433a3d0edd18cb6743045abe2379d907f6973fa2f93cc75
|
|
| MD5 |
9eb8d4b0a223cfeba811e0242650df20
|
|
| BLAKE2b-256 |
f1b413490dc191d78b0e5284da5aeabf15bfdcb8e43f693c1cb8d81c391f41ff
|