From 0f5880b83d222790bac72d83cdd777ddd8587ebf Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:34:39 +0000 Subject: [PATCH] Fix vector delete API documentation to show single key deletion - Update JavaScript SDK API reference to show delete(name, key) instead of delete(name, ...ids) - Update Python SDK API reference to show delete(name, key) instead of delete(name, *ids) - Fix JavaScript example to use single key deletion - Fix Python example to use single key deletion and improve clarity - Align documentation with actual SDK implementations that only support single key deletion The backend Catalyst API only supports single key deletion, so the SDKs were correctly implemented but the documentation was never updated to reflect this limitation. Co-Authored-By: jhaynie@agentuity.com --- content/SDKs/javascript/api-reference.mdx | 14 +++++++------- content/SDKs/javascript/examples/index.mdx | 10 +++++----- content/SDKs/python/api-reference.mdx | 16 ++++++++-------- content/SDKs/python/examples/index.mdx | 14 +++++++------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/content/SDKs/javascript/api-reference.mdx b/content/SDKs/javascript/api-reference.mdx index 4c6ff76f..e980c11d 100644 --- a/content/SDKs/javascript/api-reference.mdx +++ b/content/SDKs/javascript/api-reference.mdx @@ -239,25 +239,25 @@ for (const result of results) { } ``` -#### `delete(name: string, ...ids: string[]): Promise` +#### `delete(name: string, key: string): Promise` -Deletes vectors from the vector storage. +Deletes a vector from the vector storage. ##### Parameters - `name`: The name of the vector storage -- `ids`: One or more IDs of vectors to delete +- `key`: The ID of the vector to delete ##### Return Value -Returns a Promise that resolves to the number of vectors that were deleted. +Returns a Promise that resolves to the number of vectors that were deleted (0 or 1). ##### Example ```typescript -// Delete vectors -const deletedCount = await context.vector.delete('product-descriptions', 'id1', 'id2', 'id3'); -console.log(`Deleted ${deletedCount} vectors`); +// Delete a single vector +const deletedCount = await context.vector.delete('product-descriptions', 'id1'); +console.log(`Deleted ${deletedCount} vector(s)`); ``` ## Agent Communication diff --git a/content/SDKs/javascript/examples/index.mdx b/content/SDKs/javascript/examples/index.mdx index aa30dbf5..cd20b378 100644 --- a/content/SDKs/javascript/examples/index.mdx +++ b/content/SDKs/javascript/examples/index.mdx @@ -156,15 +156,15 @@ const handler: AgentHandler = async (request, response, context) => { } case 'delete': { - // Delete products from vector storage - if (!Array.isArray(products) || products.length === 0) { - return response.json({ error: 'No product IDs to delete' }); + // Delete a product from vector storage + if (!products || !Array.isArray(products) || products.length === 0) { + return response.json({ error: 'No product ID to delete' }); } - const count = await context.vector.delete('products', ...products); + const count = await context.vector.delete('products', products[0]); return response.json({ - message: `Deleted ${count} products successfully` + message: `Deleted ${count} product successfully` }); } diff --git a/content/SDKs/python/api-reference.mdx b/content/SDKs/python/api-reference.mdx index 30c4f74b..e69592ad 100644 --- a/content/SDKs/python/api-reference.mdx +++ b/content/SDKs/python/api-reference.mdx @@ -458,30 +458,30 @@ except Exception as e: # Handle the error appropriately ``` -#### `async delete(name: str, *ids: str) -> int` +#### `async delete(name: str, key: str) -> int` -Deletes vectors from the vector storage. +Deletes a vector from the vector storage. ##### Parameters - `name`: The name of the vector storage -- `ids`: One or more IDs of vectors to delete +- `key`: The ID of the vector to delete ##### Return Value -Returns the number of vectors that were deleted. +Returns the number of vectors that were deleted (0 or 1). ##### Example ```python from agentuity.sdk import AgentContext -# Delete vectors with error handling +# Delete a single vector with error handling try: - deleted_count = await context.vector.delete("product-descriptions", "id1", "id2", "id3") - context.logger.info(f"Deleted {deleted_count} vectors") + deleted_count = await context.vector.delete("product-descriptions", "id1") + context.logger.info(f"Deleted {deleted_count} vector(s)") except Exception as e: - context.logger.error(f"Failed to delete vectors: {str(e)}") + context.logger.error(f"Failed to delete vector: {str(e)}") # Handle the error appropriately ``` diff --git a/content/SDKs/python/examples/index.mdx b/content/SDKs/python/examples/index.mdx index 5d0f4715..cd25a811 100644 --- a/content/SDKs/python/examples/index.mdx +++ b/content/SDKs/python/examples/index.mdx @@ -211,19 +211,19 @@ async def run(request: AgentRequest, response: AgentResponse, context: AgentCont }) elif action == "delete": - # Delete products from vector storage + # Delete a product from vector storage if not isinstance(products, list) or len(products) == 0: - return response.json({"error": "No product IDs to delete"}) + return response.json({"error": "No product ID to delete"}) - # Extract product IDs - product_ids = [p["id"] for p in products] + # Extract first product ID (single key deletion) + product_id = products[0]["id"] # Delete from vector database - count = await context.vector.delete("products", product_ids[0]) + count = await context.vector.delete("products", product_id) return response.json({ - "message": f"Deleted {count} products successfully", - "ids": product_ids + "message": f"Deleted {count} product successfully", + "id": product_id }) else: