-
Notifications
You must be signed in to change notification settings - Fork 1
Enhance vector search API reference documentation #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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: jhaynie@agentuity.com <jhaynie@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Deploying with
|
Status | Name | Latest Commit | Preview URL | Updated (UTC) |
---|---|---|---|---|
✅ Deployment successful! View logs |
docs | 5879967 | Commit Preview URL | Jul 08 2025, 05:16 AM |
WalkthroughThe documentation for the Changes
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
content/SDKs/javascript/api-reference.mdx (2)
229-230
: Return-value description incompleteThe bullet list omits the
similarity
property that’s referenced later in examples. Suggest:-Returns a Promise that resolves to an array of search results, each containing an ID, key, metadata, and similarity score. +Returns a Promise that resolves to an array of search results. +Each result object has: +`id` (string) • `key` (string) • `metadata` (object | null) • `similarity` (number 0-1).
234-252
: Code-snippet polish: avoidconst
shadowing & show metadata-only hackUsing
const results
three times in the same block shadows the identifier; some bundlers flag this. Also, including an example of a metadata-only search (single-space query) would help users.-// Basic search with query only -const results = await context.vector.search('product-descriptions', { +// Basic search with query only +let results = await context.vector.search('product-descriptions', { query: 'comfortable office chair' }); -// Search with limit and similarity threshold -const results = await context.vector.search('product-descriptions', { +// Search with limit and similarity threshold +results = await context.vector.search('product-descriptions', { query: 'comfortable office chair', limit: 5, similarity: 0.7 }); -// Search with metadata filtering -const results = await context.vector.search('product-descriptions', { +// Metadata-only search (use single space as query) +results = await context.vector.search('product-descriptions', { + query: ' ', + metadata: { category: 'furniture', inStock: true } +}); + +// Combined search with metadata filtering +results = await context.vector.search('product-descriptions', { query: 'comfortable office chair', limit: 10, similarity: 0.6, metadata: { category: 'furniture', inStock: true } });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/SDKs/javascript/api-reference.mdx
(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/retriever.ts:46-51
Timestamp: 2025-06-28T15:55:43.334Z
Learning: In Agentuity vector search API, the query parameter cannot be an empty string as it would throw an error. When performing metadata-only searches (like retrieving all chunks for a specific document path), a single space ' ' can be used as a workaround since the API requires a non-empty query string.
content/SDKs/javascript/api-reference.mdx (1)
Learnt from: afterrburn
PR: agentuity/docs#208
File: agent-docs/src/agents/doc-qa/retriever.ts:46-51
Timestamp: 2025-06-28T15:55:43.334Z
Learning: In Agentuity vector search API, the query parameter cannot be an empty string as it would throw an error. When performing metadata-only searches (like retrieving all chunks for a specific document path), a single space ' ' can be used as a workaround since the API requires a non-empty query string.
🪛 LanguageTool
content/SDKs/javascript/api-reference.mdx
[grammar] ~222-~222: “Text” is a singular noun. It appears that the verb form is incorrect.
Context: ... - query
(string, required): The text query to search for. This will be converted t...
(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[uncategorized] ~225-~225: You might be missing the article “the” here.
Context: ...ied key-value pairs will be included in results. Must be a valid JSON object. ##### Re...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Workers Builds: docs
- `params`: Search parameters object with the following properties: | ||
- `query` (string, required): The text query to search for. This will be converted to embeddings and used to find semantically similar documents. | ||
- `limit` (number, optional): Maximum number of search results to return. Must be a positive integer. If not specified, the server default will be used. | ||
- `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. | ||
- `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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Mention non-empty query
requirement & tighten grammar
- The backend rejects an empty string for
query
(see learning from Agentuity PR QA Agent Interface #208). Add an explicit note or throw ifquery.trim().length === 0
. - Minor grammar tweaks:
• "query
… This will be converted to embeddings"
• "metadata
… will be included in the results."
- - `query` (string, required): The text query to search for. This will be converted to embeddings and used to find semantically similar documents.
+ - `query` (string, required): The text query to search for (must be **non-empty**; use a single space `" "` for metadata-only searches). This query is converted to embeddings and used to find semantically similar documents.
...
- - `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.
+ - `metadata` (object, optional): Metadata filters to apply to the search. Only vectors whose metadata matches all specified key-value pairs will be included in **the** results. Must be a valid JSON object.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
- `params`: Search parameters object with the following properties: | |
- `query` (string, required): The text query to search for. This will be converted to embeddings and used to find semantically similar documents. | |
- `limit` (number, optional): Maximum number of search results to return. Must be a positive integer. If not specified, the server default will be used. | |
- `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. | |
- `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. | |
- `params`: Search parameters object with the following properties: | |
- `query` (string, required): The text query to search for (must be **non-empty**; use a single space `" "` for metadata-only searches). This query is converted to embeddings and used to find semantically similar documents. | |
- `limit` (number, optional): Maximum number of search results to return. Must be a positive integer. If not specified, the server default will be used. | |
- `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. | |
- `metadata` (object, optional): Metadata filters to apply to the search. Only vectors whose metadata matches all specified key-value pairs will be included in **the** results. Must be a valid JSON object. |
🧰 Tools
🪛 LanguageTool
[grammar] ~222-~222: “Text” is a singular noun. It appears that the verb form is incorrect.
Context: ... - query
(string, required): The text query to search for. This will be converted t...
(PCT_SINGULAR_NOUN_PLURAL_VERB_AGREEMENT)
[uncategorized] ~225-~225: You might be missing the article “the” here.
Context: ...ied key-value pairs will be included in results. Must be a valid JSON object. ##### Re...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
🤖 Prompt for AI Agents
In content/SDKs/javascript/api-reference.mdx around lines 221 to 226, update the
description of the `query` parameter to explicitly state that it must be a
non-empty string and that empty or whitespace-only strings are rejected by the
backend. Also, adjust the grammar by changing "This will be converted" to "This
text will be converted" for `query`, and add "the" before "results" in the
`metadata` description to improve clarity.
PR description is being written. Please check back in a minute.
Devin Session: https://app.devin.ai/sessions/ccf549fb2a724912bd58325cdfde68b7
Summary by CodeRabbit
context.vector.search
method, including detailed parameter descriptions and updated return value information.