Hi,
I am building a rag app based on this tutorial:
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 ‘@ai-sdk/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: Debug code with Visual Studio Code
“version”: “0.2.0”,
“configurations”: [
{
“type”: “node”,
“request”: “launch”,
“name”: “embedding_debug”,
“skipFiles”: [
“<node_internals>/"
],
“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 (<node_internals>/internal/modules/esm/get_format:219:9)
at defaultGetFormat (<node_internals>/internal/modules/esm/get_format:245:36)
at defaultLoad (<node_internals>/internal/modules/esm/load:120:22)
— await —
at runEntryPointWithESMLoader (<node_internals>/internal/modules/run_main:138:19)
at loadESMFromCJS (<node_internals>/internal/modules/cjs/loader:1329:42)
at (<node_internals>/internal/modules/cjs/loader:1536:5)
at (<node_internals>/internal/modules/cjs/loader:1706:10)
at (<node_internals>/internal/modules/cjs/loader:1289:32)
at (<node_internals>/internal/modules/cjs/loader:1108:12)
at traceSync (<node_internals>/diagnostics_channel:322:14)
at wrapModuleLoad (<node_internals>/internal/modules/cjs/loader:220:24)
at executeUserEntryPoint (<node_internals>/internal/modules/run_main:170:5)
at (<node_internals>/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.