API Documentation
Vector Search
Discover semantic search capabilities that find relevant documents based on meaning, not just keywords.
Vector Search Overview
VectorForgeAI's vector search allows you to find documents based on their semantic meaning rather than exact keyword matches. When documents are added to a collection, they are automatically converted into vector embeddings that capture their semantic meaning. This enables powerful natural language queries and more accurate search results.
Search Documents in a Collection
Perform a semantic search across documents in a collection using natural language queries.
Path Parameters
Parameter | Type | Description |
---|---|---|
collection_id | string | ID of the collection to search |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
query | string | Yes | The search query in natural language (max 512 characters) |
limit | integer | No | Maximum number of results to return (1-100). Default: 10 |
Request
curl -X GET "https://api.vectorforgeai.com/v1/collections/abc123xyz456/documents/search?query=How%20does%20AI%20embedding%20work&limit=3" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Team-Token: YOUR_TEAM_TOKEN"
Response
{ "documents": [ { "identifier": "ai-embeddings-101", "title": "Understanding AI Embeddings", "body": "AI embeddings transform text or other data into numerical vectors that capture semantic meaning...", "metadata": { "author": "Dr. Alan Turing", "category": "AI Fundamentals" }, "score": 0.892 }, { "identifier": "vector-db-guide", "title": "Vector Databases Explained", "body": "Vector databases specialize in storing and retrieving embeddings efficiently...", "metadata": { "author": "Jane Smith", "category": "Database Technology" }, "score": 0.764 }, { "identifier": "semantic-search-intro", "title": "Introduction to Semantic Search", "body": "Semantic search uses embeddings to find documents based on meaning rather than keywords...", "metadata": { "author": "Maya Johnson", "category": "Search Technology" }, "score": 0.715 } ] }
How Vector Search Works
VectorForgeAI's vector search follows these steps to find relevant documents:
- Query Embedding: Your search query is transformed into a vector embedding using the same embedding model used for your documents.
- Similarity Calculation: The system calculates cosine similarity between your query vector and the vectors of all document chunks in the collection.
- Result Ranking: Documents are ranked by similarity score, with the most semantically similar documents appearing first.
- Response Generation: The most relevant documents are returned with their similarity scores.
💡 Understanding Similarity Scores
The score
value in search results represents the cosine similarity between your query and the document. Values range from 0 to 1, where 1 indicates perfect semantic similarity. Scores above 0.75 typically indicate strong relevance.
Tips for Effective Vector Search
- Use Natural Language: Unlike traditional search, vector search works best with natural language queries rather than keywords.
- Be Specific: More detailed queries often yield more precise results.
- Focus on Concepts: Ask about concepts and ideas rather than searching for exact phrases.
- Adjust Limits: If you're not finding relevant documents, try increasing the limit parameter to get more results.
Next Steps
Now that you understand vector search, explore these related topics:
- LLM Completions - Generate AI responses using your documents as context
- Conversation API - Build interactive chatbots with memory
Need Help?
If you're having trouble with vector search or have questions, we're here to help!