You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import express from 'express';
import fs from 'fs';
import path from 'path';
import {RAGApplicationBuilder, RAGApplication,
PdfLoader, YoutubeSearchLoader, SitemapLoader, WebLoader, TextLoader } from '@llm-tools/embedjs';
import {LanceDb} from '@llm-tools/embedjs/vectorDb/lance';
import { OpenAI } from "openai";
let key = process.env.OPENAI_API_KEY; // Replace with your OpenAI API key
const openai = new OpenAI({
apiKey: key
});
router.get('/test', async (req, res) => {
const ragApplication = await new RAGApplicationBuilder()
.addLoader(new WebLoader({ url: 'https://en.wikipedia.org/wiki/Tesla,_Inc.' }))
.setVectorDb(new LanceDb({ path: './db' })); res.status(200).send(await ragApplication.query('Tell me about the history of Tesla?'));
})
TypeError: ragApplication.query is not a function
Failed to build RAG application: TypeError: Cannot read properties of undefined (reading 'query')
However query is failing what imports do i need to specify for this?
Notice youtube issue's a fetch warning "experimental". I'm using node v18, moving to v20 soon.
The text was updated successfully, but these errors were encountered:
Glad it worked. I am a little curious, did you see the error by just referencing / importing from the OpenAI package? Also, do you mind sharing why you are using OpenAI directly with this package - any use case that this library does not cover?
You have to keep your script clear of any openai imports or openai variable declarations. So no referencing in the script. I had like an openai import from openai, and i had a openai var declaration passing in the key. You see this a lot in these types of scripts but its not required for your library. All is needed is the env open ai entry you specify in docs and its key nothing more. Your lib does the rest. Once i did that everything worked thank you
import express from 'express';
import fs from 'fs';
import path from 'path';
import {RAGApplicationBuilder, RAGApplication,
PdfLoader, YoutubeSearchLoader, SitemapLoader, WebLoader, TextLoader } from '@llm-tools/embedjs';
import {LanceDb} from '@llm-tools/embedjs/vectorDb/lance';
import { OpenAI } from "openai";
let key = process.env.OPENAI_API_KEY; // Replace with your OpenAI API key
const openai = new OpenAI({
apiKey: key
});
router.get('/test', async (req, res) => {
const ragApplication = await new RAGApplicationBuilder()
.addLoader(new WebLoader({ url: 'https://en.wikipedia.org/wiki/Tesla,_Inc.' }))
.setVectorDb(new LanceDb({ path: './db' }));
res.status(200).send(await ragApplication.query('Tell me about the history of Tesla?'));
TypeError: ragApplication.query is not a function
Failed to build RAG application: TypeError: Cannot read properties of undefined (reading 'query')
However query is failing what imports do i need to specify for this?
Notice youtube issue's a fetch warning "experimental". I'm using node v18, moving to v20 soon.
The text was updated successfully, but these errors were encountered: