Hi,
I am building a rag app based on this tutorial: https://sdk.vercel.ai/docs/guides/rag-chatbot
App seems to work but I dont manage to setup the debugger:
E.g. I have the file embedding.ts
import { embed, embedMany } from 'ai'; import { openai } from '/openai'; import { db } from '../db'; import { cosineDistance, desc, gt, sql } from 'drizzle-orm'; import { embeddings } from '../db/schema/embeddings';
const embeddingModel = openai.embedding('text-embedding-ada-002');
const generateChunks = (input: string): string[] => { return input .trim() .split('.') .filter(i => i !== ''); };
generateChunks('This is a test. This is another test. This is a third test. This is a fourth test. This is a fifth test.');
I set the breakpoint in the last line.
I am using VSCode and tried to use follow launch config:
{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "embedding_debug", "skipFiles": [ "/" ], "program": "${workspaceFolder}/code/lib/ai/embedding.ts", "outFiles": [ "${workspaceFolder}//*.js" ] } ] }
However it always throws me an error:
/usr/local/bin/node ./code/lib/ai/embedding.ts Process exited with code 1 Uncaught TypeError TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /Users/kosmirnov/Desktop/chatmottest/code/lib/ai/embedding.ts at getFileProtocolModuleFormat (/internal/modules/esm/get_format:219:9) at defaultGetFormat (/internal/modules/esm/get_format:245:36) at defaultLoad (/internal/modules/esm/load:120:22) --- await --- at runEntryPointWithESMLoader (/internal/modules/run_main:138:19) at loadESMFromCJS (/internal/modules/cjs/loader:1329:42) at (/internal/modules/cjs/loader:1536:5) at (/internal/modules/cjs/loader:1706:10) at (/internal/modules/cjs/loader:1289:32) at (/internal/modules/cjs/loader:1108:12) at traceSync (/diagnostics_channel:322:14) at wrapModuleLoad (/internal/modules/cjs/loader:220:24) at executeUserEntryPoint (/internal/modules/run_main:170:5) at (/internal/main/run_main_module:36:49)
I am new to TypeScript and I have Python background. I come from a world where you press the debug button and it debugs ![]()
Would appreciate if someone could help.