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

Receiving Conversation error #161

Open
leVoT8 opened this issue Nov 8, 2024 · 2 comments
Open

Receiving Conversation error #161

leVoT8 opened this issue Nov 8, 2024 · 2 comments
Assignees
Labels
bug Something isn't working stale

Comments

@leVoT8
Copy link

leVoT8 commented Nov 8, 2024

🐛 Describe the bug

My current code:

import { RAGApplicationBuilder, LocalPathLoader } 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'
import { PdfLoader } from '@llm-tools/embedjs-loader-pdf';

//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-mini",}))
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new PineconeDb({
	projectName: 'medicalinfo',
	namespace: 'ns1',
	indexSpec: {
		serverless: {
			cloud: 'aws',
			environment: 'us-east-1'
		},
	},
}))
.setSystemMessage("Only include information provided to you, do not make up answers. If the information is not available, state that you do not know.")
.build();

// Below is commented out because it was previously loaded and upserted into Pinecone
// await ragApplication.addLoader(new LocalPathLoader({ path: './knowledge/Current' }))


const res = await ragApplication.query('What is the current treatment for pneumonia?')
console.log(res)

The error I receive:

.../node_modules/@llm-tools/embedjs-interfaces/src/interfaces/base-model.js:55
        const conversation = await BaseModel.cache.getConversation(conversationId);
                                                   ^
TypeError: Cannot read properties of undefined (reading 'getConversation')
    at OpenAi.query (file:///.../node_modules/@llm-tools/embedjs-interfaces/src/interfaces/base-model.js:55:52)
    at RAGApplication.query (file:.../node_modules/@llm-tools/embedjs/src/core/rag-application.js:347:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///.../embedJS/index.js:34:13

Node.js v18.17.0

Am I doing something wrong, or is this a bug? How do I fix it?

@adhityan adhityan added the bug Something isn't working label Nov 13, 2024
@adhityan
Copy link
Collaborator

adhityan commented Nov 13, 2024

I see a few things here. The first, the initialization of pinecone seems incorrect. This is the never syntax (using region instead of environment) -

const ragApplication = await new RAGApplicationBuilder()
    .setModel(new OpenAi({ model: 'gpt-4o-mini' }))
    .setEmbeddingModel(new OpenAiEmbeddings())
    .setVectorDatabase(
        new PineconeDb({
            projectName: 'test',
            namespace: 'dev',
            indexSpec: {
                serverless: {
                    cloud: 'aws',
                    region: 'us-east-1',
                },
            },
        }),
    )
    .setSystemMessage(
        'Only include information provided to you, do not make up answers. If the information is not available, state that you do not know.',
    )
    .build();

I think it is likely you are using an older version of embedJs which used an older version of Pinecone API. Could you update all embedjs libraries (npm packages) to version 0.1.18 and let me know if you still see this error?

Copy link

This issue is stale because it has been open for 14 days with no activity.

@github-actions github-actions bot added the stale label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

No branches or pull requests

2 participants