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
File details
Details for the file vector_classifier_python-0.1.0.tar.gz.
File metadata
- Download URL: vector_classifier_python-0.1.0.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 |
2073a2753947cd99cac534cafa61098df4fe4f345b523ddbe163282c0b40da59
|
|
| MD5 |
47c101f2595fb2626fa4c2692ae1d654
|
|
| BLAKE2b-256 |
941c32e07fd88aa3b7e9869120d4597d952155057e573484ec8cf87a3b568e0f
|