Open-source inference server and production cluster for all the models your agent needs.
E-Commerce Product Search (Python)
Python implementation of the gallery example using sie-sdk, FastAPI, and NumPy.
Pipeline:
extract()pulls structured attributes from product descriptionsencode()embeds the catalog into dense vectorssearch.pyretrieves by cosine similarity and reranks withscore()server.pyexposes the shared UI and REST endpoints
Files
ingest.pybuilds../data/embeddings.npyand../data/metadata.jsonsearch.pyruns CLI demo searches against the saved indexserver.pyserves/,/api/search,/api/categories, and/api/statsrequirements.txtcontains the Python dependencies for this path and the shared dataset fetch step
Requirements
- Python 3.12 (required by
sie-sdk) - A reachable SIE server. Local Docker is the default:
Or a managed SIE cluster viadocker run -p 8080:8080 ghcr.io/superlinked/sie-server:latest-cpu-defaultSIE_CLUSTER_URLandSIE_API_KEYenv vars.
Configuration
This implementation reads ../config.yaml. The defaults target a local SIE server at http://localhost:8080. Tune only when you need to.
See the top-level README for the full config.
To point at a managed cluster instead:
export SIE_CLUSTER_URL="https://your-cluster-url"
export SIE_API_KEY="your-api-key"
Run It
From examples/ecommerce-product-search/:
pip install -r python/requirements.txt
python data/fetch_dataset.py
cd python
python ingest.py
python search.py
uvicorn server:app --host 0.0.0.0 --port 8888
Open http://localhost:8888.
This also serves the shared browser UI, so you can type a query, choose a category, and explore results interactively without using the API directly.
Generated files:
../data/products.json../data/embeddings.npy../data/metadata.json
Exact Verification
After the server starts:
curl http://localhost:8888/api/stats
curl "http://localhost:8888/api/search?q=wireless+bluetooth+headphones&category=All+Electronics"
Expected response shapes:
{
"total_products": 3000,
"embedding_dims": 1024,
"categories": 7,
"models": {
"embedding": "NovaSearch/stella_en_400M_v5",
"reranker": "BAAI/bge-reranker-v2-m3",
"extractor": "urchade/gliner_multi-v2.1"
}
}
{
"query": "wireless bluetooth headphones",
"filters": {
"category": "All Electronics"
},
"results": [
{
"id": "<product-id>",
"title": "<product-title>",
"description": "<truncated-product-description>",
"category": "All Electronics",
"price": "<number-or-null>",
"rating": "<number-or-null>",
"image": "<image-url-or-null>",
"features": ["<feature-text>", "<feature-text>"],
"attributes": {
"brand": "<extracted-brand>"
},
"scores": {
"vector": "<similarity-score>",
"rerank": "<rerank-score>"
}
}
]
}
API
GET /api/search
Parameters:
qrequired query stringcategoryoptional category filterbrandoptional extracted brand filter
Response fields:
queryfiltersresults[].idresults[].titleresults[].descriptionresults[].categoryresults[].priceresults[].ratingresults[].imageresults[].featuresresults[].attributesresults[].scores.vectorresults[].scores.rerank
GET /api/categories
Returns category counts as [name, count] tuples.
Example:
[
["AMAZON FASHION", 613],
["Amazon Home", 549]
]
GET /api/stats
Returns:
{
"total_products": 3000,
"embedding_dims": 1024,
"categories": 7,
"models": {
"embedding": "NovaSearch/stella_en_400M_v5",
"reranker": "BAAI/bge-reranker-v2-m3",
"extractor": "urchade/gliner_multi-v2.1"
}
}
Troubleshooting
Missing dataset files
From examples/ecommerce-product-search/, run:
python data/fetch_dataset.py
Search returns no results
- Verify
../data/metadata.jsonand../data/embeddings.npyexist - Check that the query is broad enough to retrieve candidates
- Confirm the category filter matches the dataset values
Cannot connect to the cluster
- Check
cluster.urlandcluster.api_keyin../config.yaml - Or set
SIE_CLUSTER_URLandSIE_API_KEY - Verify the cluster can serve the configured models