Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Commit 08ff8e9

Browse files
Enhance vector search API reference documentation (#226)
- Add detailed parameter descriptions for VectorSearchParams - Include multiple practical examples showing different use cases - Document parameter constraints and valid ranges - Update return value description to match current interface Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: jhaynie@agentuity.com <jhaynie@gmail.com>
1 parent 90ea6ea commit 08ff8e9

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

content/SDKs/javascript/api-reference.mdx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,26 +218,43 @@ Searches for vectors in the vector storage.
218218
##### Parameters
219219

220220
- `name`: The name of the vector storage
221-
- `params`: Search parameters including query, limit, similarity threshold, and metadata filters
221+
- `params`: Search parameters object with the following properties:
222+
- `query` (string, required): The text query to search for. This will be converted to embeddings and used to find semantically similar documents.
223+
- `limit` (number, optional): Maximum number of search results to return. Must be a positive integer. If not specified, the server default will be used.
224+
- `similarity` (number, optional): Minimum similarity threshold for results (0.0-1.0). Only vectors with similarity scores greater than or equal to this value will be returned. 1.0 means exact match, 0.0 means no similarity requirement.
225+
- `metadata` (object, optional): Metadata filters to apply to the search. Only vectors whose metadata matches all specified key-value pairs will be included in results. Must be a valid JSON object.
222226

223227
##### Return Value
224228

225-
Returns a Promise that resolves to an array of search results, each containing an ID, metadata, and distance score.
229+
Returns a Promise that resolves to an array of search results, each containing an ID, key, metadata, and similarity score.
226230

227-
##### Example
231+
##### Examples
228232

229233
```typescript
230-
// Search for similar products
234+
// Basic search with query only
235+
const results = await context.vector.search('product-descriptions', {
236+
query: 'comfortable office chair'
237+
});
238+
239+
// Search with limit and similarity threshold
231240
const results = await context.vector.search('product-descriptions', {
232241
query: 'comfortable office chair',
233242
limit: 5,
234-
similarity: 0.7,
235-
metadata: { category: 'furniture' }
243+
similarity: 0.7
244+
});
245+
246+
// Search with metadata filtering
247+
const results = await context.vector.search('product-descriptions', {
248+
query: 'comfortable office chair',
249+
limit: 10,
250+
similarity: 0.6,
251+
metadata: { category: 'furniture', inStock: true }
236252
});
237253

238254
// Process search results
239255
for (const result of results) {
240-
console.log(`Product ID: ${result.id}, Similarity: ${result.distance}`);
256+
console.log(`Product ID: ${result.id}, Similarity: ${result.similarity}`);
257+
console.log(`Key: ${result.key}`);
241258
console.log(`Metadata: ${JSON.stringify(result.metadata)}`);
242259
}
243260
```

0 commit comments

Comments
 (0)