How to use your Knowledge Bases
In this tutorial, you'll make your first call to the Snack Prompt AI Engine API and receive semantic search results.
Prerequisites
1
2
Step 2: Understand the Response
{
"items": [
{
"id": "abc123-uuid",
"score": 0.85,
"payload": {
"tenant_id": "YOUR_TENANT_ID",
"snack_elemental_id": "elemental-456",
"snack_item_id": "item-789",
"original_text": "Our products include: Management software, Integration API, Analytics Dashboard...",
"tag_names": ["Products", "Catalog"]
}
},
{
"id": "def456-uuid",
"score": 0.72,
"payload": {
"tenant_id": "YOUR_TENANT_ID",
"snack_elemental_id": "elemental-456",
"snack_item_id": "item-790",
"original_text": "Product price list effective from...",
"tag_names": ["Products", "Prices"]
}
}
],
"total_found": 2
}What Each Field Means
Field
Description
3
Step 3: Try the Chat
curl -X POST https://api-integrations.snackprompt.com/v1/kb/chat \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"query": "what are the available products and how much do they cost?",
"filters": {
"tenant_id": "YOUR_TENANT_ID"
}
}'{
"answer": "Based on the available data, the products offered are: Management software ($99/month), Integration API ($199/month), and Analytics Dashboard ($149/month). All plans include technical support.",
"sources": [
{
"id": "abc123-uuid",
"score": 0.85,
"snack_item_id": "item-789",
"text": "Our products include..."
}
]
}Possible Errors
Error: tenant_id required
{
"detail": "tenant_id is required in filters"
}Error: No results found
{
"items": [],
"total_found": 0
}Next Steps
Last updated
Was this helpful?