feat(test): add manual spec retriever test script

Introduce a new manual test file `test/manual/test-spec-retriever.ts` that demonstrates how to use the `spec_retriever` agent tool with a query. The script loads embeddings, connects to the LanceDB storage, creates the tool, executes it, and prints the result. This provides a runnable example for developers.
This commit is contained in:
2026-04-01 18:31:42 +05:30
parent f5d3884d5a
commit b3381508c3
+35
View File
@@ -0,0 +1,35 @@
/**
* Manual test script for spec_retriever agent tool
* Usage: bun run test/manual/test-spec-retriever.ts "your search query"
*/
import * as lancedbSdk from "@lancedb/lancedb";
import { OllamaEmbeddings } from "@langchain/ollama";
import { createSpecRetrieverTool } from "../../agent_tools";
import { EMBEDDING_MODEL, STORAGE_DIR } from "../../constants";
async function main() {
const query = process.argv[2] || "array.[[DefineOwnProperty]]";
console.log(`Testing spec_retriever with query: "${query}"`);
console.log("Loading database and embeddings...\n");
const embeddings = new OllamaEmbeddings({
model: EMBEDDING_MODEL,
});
const db = await lancedbSdk.connect(STORAGE_DIR);
const table = await db.openTable("spec_vectors");
console.log("Creating tool...\n");
const specRetrieverTool = createSpecRetrieverTool(table, embeddings);
console.log("Executing tool...\n");
const result = await specRetrieverTool.func({ query });
console.log("=== TOOL OUTPUT ===");
console.log(result);
console.log("\n=== END OUTPUT ===");
}
main().catch(console.error);