Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: loader.getUniqueId is not a function #137

Closed
leVoT8 opened this issue Oct 25, 2024 · 3 comments
Closed

Error: loader.getUniqueId is not a function #137

leVoT8 opened this issue Oct 25, 2024 · 3 comments
Assignees

Comments

@leVoT8
Copy link

leVoT8 commented Oct 25, 2024

🐛 Describe the bug

Model: GPT-4o
Vector DB: Pinecone, serverless

import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { WebLoader } from '@llm-tools/embedjs-loader-web';
import { PineconeDb } from '@llm-tools/embedjs-pinecone'
import { OpenAi } from '@llm-tools/embedjs-openai'

//Replace this with your OpenAI key
process.env.OPENAI_API_KEY = "<xxx>"
process.env.PINECONE_API_KEY= "<xxx>"
const ragApplication = await new RAGApplicationBuilder()
.setModel(new OpenAi({model: "GPT-4o"}))
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDb(new PineconeDb({
	projectName: 'medicalinfo',
	namespace: 'ns1',
	indexSpec: {
		serverless: {
			cloud: 'aws',
			environment: 'us-east-1'
		},
	},
}))
.build();

ragApplication.addLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })
ragApplication.addLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' })

await ragApplication.query('What is the net worth of Elon Musk today?')

Error:

.../node_modules/@llm-tools/embedjs/src/core/rag-application.js:134
        const uniqueId = loader.getUniqueId();
                                ^

TypeError: loader.getUniqueId is not a function
    at RAGApplication._addLoader (.../embedJS/node_modules/@llm-tools/embedjs/src/core/rag-application.js:134:33)
    at RAGApplication.addLoader (.../embedJS/node_modules/@llm-tools/embedjs/src/core/rag-application.js:121:21)
    at file:///.../embedJS/index.js:26:16
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.16.0

I am unsure if I did something wrong or if this is a bug.

Note:
I exchanged { LanceDb } to { PineconeDb } on the import statement. { LanceDb } is what is written in the documentation, however, I think it was supposed to be { PineconeDb }

@adhityan
Copy link
Collaborator

adhityan commented Oct 25, 2024

The documentation needs fixing. Could you try replacing the addLoader line with -

await app.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));

The library before versions 0.1.x used to support dynamic loaders - where you don't need to create an instance of a loader manually - this functionality was removed when the library moved into a monorepo - and will be available again later. The documentation wasn't updated properly.

@adhityan
Copy link
Collaborator

Find fixed / updated documentation here -

https://llm-tools.mintlify.app/components/vector-databases/pinecone

@leVoT8
Copy link
Author

leVoT8 commented Oct 27, 2024

That seemed to have worked! Thank you!

@leVoT8 leVoT8 closed this as completed Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants