Quickstart Guide
Get started with Agentify in under 5 minutes. This guide shows you how to perform semantic product search using vector embeddings.
Prerequisites
- •OpenAI API key (for generating embeddings) - Get one here
- •Node.js 18+ or Python 3.8+
- •Basic understanding of REST APIs
Choose your language:
📦 Installation
npm install openai1
Generate Embedding Vector
Convert the user's search query into a 1536-dimensional vector using OpenAI's text-embedding-3-small model.
// Step 1: Generate embedding from user query
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY
});
async function generateEmbedding(query: string) {
const response = await openai.embeddings.create({
model: 'text-embedding-3-small',
input: query,
});
return response.data[0].embedding; // 1536-dimensional vector
}
const userQuery = "eco-friendly water bottle for hiking";
const embedding = await generateEmbedding(userQuery);💡 Cost: ~$0.00002 per query (0.002¢). You handle embedding costs, we handle infrastructure.
2
Search Agentify API
Send the embedding vector to Agentify's vector search endpoint. Use minTrustScore: 0.7 to ensure high-quality results.
// Step 2: Search Agentify with the embedding vector
async function searchProducts(embedding: number[]) {
const response = await fetch('https://api.agentifyproduct.com/api/dpp/v1/vector-search', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
q_vector: embedding,
top_k: 5,
minTrustScore: 0.7, // Only high-quality products
}),
});
return response.json();
}
const results = await searchProducts(embedding);✅ Trust Score: 0.7+ means multi-agent validated (Gemini + Claude + ChatGPT).
3
Present Results to User
Display the Decision-Ready Product Passports (DPPAs) with transparent trust scores and direct buy links.
// Step 3: Present results to user
results.results.forEach((product: any) => {
console.log(`
📦 ${product.dppa.title}
🏷️ ${product.dppa.brand}
💰 ${product.dppa.price.value} ${product.dppa.price.currency}
🛡️ Trust Score: ${(product.dppa['ai:trustScore'] * 100).toFixed(0)}%
🔗 Buy: ${product.dppa['ai:actions']?.buyUrl}
📊 Similarity: ${(product.score * 100).toFixed(1)}%
`);
});📊 Example Output
📦 Hydro Flask Wide Mouth 32oz 🏷️ Hydro Flask 💰 44.95 EUR 🛡️ Trust Score: 87% 🔗 Buy: https://amazon.com/dp/B01ACJRGXE 📊 Similarity: 94.2% 📦 Nalgene Tritan 32oz BPA-Free 🏷️ Nalgene 💰 12.99 EUR 🛡️ Trust Score: 91% 🔗 Buy: https://amazon.com/dp/B001NCDE8Y 📊 Similarity: 91.8%
🚀 Next Steps
Need help? Got questions?
Contact Support