Closed Santy1422 closed 10 months ago
π€
Hello again @Santy1422!
Nice to see you here. I remember our last interaction. I'm currently looking into the issue you're facing and will get back to you with a comprehensive response shortly.
π€
Hello @Santy1422! Good to see you again.
Based on the error you're encountering, it seems like the OpenAIEmbeddings
class is not being exported from the openai.ts
file in the langchain
package. This is a common issue that has been reported by other users as well, and you can find similar solved issues in the langchainjs repository here, here, and here.
To resolve this issue, you need to add an export statement for the OpenAIEmbeddings
class in the openai.ts
file. Here's how you can do it:
export class OpenAIEmbeddings
extends Embeddings
implements OpenAIEmbeddingsParams, AzureOpenAIInput
{
// ... rest of the class definition
}
After adding the export
keyword before the class definition, you should be able to import OpenAIEmbeddings
from langchain/embeddings/openai
without any issues.
This solution is based on the information provided in the langchainjs codebase, specifically the openai.ts file.
Please try this solution and let me know if it resolves your issue or if you need further assistance.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a π if this is helpful and π if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
i fixed "langchain": "git+https://github.com/Santy1422/lanchain-embeding.fix.git#main",
Hello, I've been here for 3 days with the error in that function, I tried importing the library anyway and it doesn't work.It used to work before
` import { pineIndex } from "./init"; import { OPENAI_API_KEY } from "../../config/env"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; const {OpenAIEmbeddings} = require("langchain/embeddings/openai")
export default async (docs, company: string) => { for (const doc of docs) { console.log(
Procesando doc: ${doc.metadata.pdf_originalname}
); const pdfFileName = doc.metadata.pdf_originalname; const text = doc.pageContent;} }; `
Packet Json { "name": "whatsapp-botgpt", "version": "1.0.0", "description": "Chat de whatsapp bot", "main": "index.js", "directories": { "doc": "docs", "test": "test" }, "engines": { "node": "v18.17.1" }, "scripts": { "test": "jest --detectOpenHandles", "postinstall": "npm run tsc", "tsc": "tsc", "dev": "nodemon ./src/index.ts", "start": "npm run tsc && NODE_ENV=PRODUCTION node build/index.js", "lint": "eslint src/*/.js --fix", "whatsapp": "npm run tsc && NODE_ENV=PRODUCTION node build/Whatsapp-MicroService/index.js" }, "keywords": [], "author": "", "license": "ISC", "bugs": { "url": "https://github.com/Santy1422/WhatsappBot/issues" }, "homepage": "https://github.com/Santy1422/WhatsappBot", "devDependencies": { "@types/bcrypt": "^5.0.0", "@types/express": "^4.17.17", "@types/jest": "^29.5.2", "@types/multer": "^1.4.7", "@types/node": "^20.4.1", "@types/validator": "^13.7.17", "@types/xml2js": "^0.4.11", "@typescript-eslint/parser": "^5.61.0", "eslint": "^7.9.0", "eslint-config-airbnb": "^18.2.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-config-prettier": "^6.11.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-prettier": "^3.1.4", "jest": "^26.4.2", "nodemon": "^2.0.4", "prettier": "^2.1.2", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", "typescript": "^5.1.6" }, "dependencies": { "@pinecone-database/pinecone": "^0.1.6", "async": "^3.2.4", "axios": "^1.3.0", "axios-rate-limit": "^1.3.0", "bcrypt": "^5.1.0", "body-parser": "^1.20.2", "cors": "^2.8.5", "dotenv": "^8.6.0", "express": "^4.18.2", "express-jwt": "^8.3.0", "express-openid-connect": "^2.11.0", "express-rate-limit": "^6.7.0", "firebase-admin": "^11.9.0", "fs": "^0.0.1-security", "jsonwebtoken": "^9.0.0", "jspdf": "^2.5.1", "jwks-rsa": "^3.0.1", "langchain": "0.0.144", "mongodb": "^5.2.0", "mongoose": "^6.11.3", "morgan": "^1.10.0", "multer": "^1.4.5-lts.1", "openai": "^4.0.0", "path": "^0.12.7", "pdf-parse": "^1.1.1", "qrcode-terminal": "^0.12.0", "socket.io-client": "^4.7.2", "stripe": "^13.4.0", "uuid": "^9.0.1", "validator": "^13.7.0" }, "peerDependencies": { "mongodb": "^5.2.0" }, "prettier": { "printWidth": 900, "semi": true, "singleQuote": true, "trailingComma": "es5" } }