langchain-ai / langchainjs

🦜🔗 Build context-aware reasoning applications 🦜🔗
https://js.langchain.com/docs/
MIT License
12.28k stars 2.08k forks source link

Multi version of node module #2391

Closed BitVoyagerMan closed 9 months ago

BitVoyagerMan commented 1 year ago

I was trying to integrate my custom LLM. In my code, I have to use axios@1.14.0 And in Openai llm code which is already exists, it uses axios@0.26.1 So multi version of axios module is needed. So I fixed langchain/package.json file like this.

"devDependencies": {
...
"axios" : "^0.26.0",
"axios-bittensor": "npm:axios@^1.4.0"
...
}

Almost tests, I passed but at Environment tests, I failed. Cannot find package 'axios-bittensor' imported from /app/node_modules/langchain/dist/llms/bittensor.js

How can I solve this issue? Here's my PR. PR for my custom llm integration which has got errors

dosubot[bot] commented 1 year ago

🤖

Hello,

Based on the context provided, it seems like you're trying to use two different versions of axios in your project. However, the error message suggests that the 'axios-bittensor' package is not found in your project dependencies.

From your package.json file, it appears that 'axios-bittensor' is an alias for axios version 1.4.0. However, the error message suggests that the package is not being recognized correctly.

One possible solution could be to ensure that the alias is correctly defined and used in your project. Here's how you can do it:

  1. Install the required axios versions as devDependencies:
npm install axios@0.26.1 axios@1.14.0 --save-dev
  1. In your package.json, define the aliases:
"devDependencies": {
  "axios": "^0.26.1",
  "axios-bittensor": "npm:axios@^1.14.0"
}
  1. In your code, import the axios versions using the defined aliases:
const axios = require('axios'); // This will be version 0.26.1
const axiosBittensor = require('axios-bittensor'); // This will be version 1.14.0

Please note that the aliasing feature is available in npm version 6.9.0 and above, so ensure that you're using a compatible version.

If you're still facing issues, it would be helpful if you could provide more details about your project setup and the exact steps you're following to integrate your custom LLM.

I hope this helps! Let me know if you have any other questions.

Best, Dosu

Sources


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.

jacoblee93 commented 1 year ago

We'll be removing the Axios dependence from OpenAI soon (watch #2353) which should fix this!

BitVoyagerMan commented 1 year ago

Thank you man. I've already fixed my code as old axios version. And is working well now. Here's my PR: https://github.com/hwchase17/langchainjs/pull/2385 I have made NIBittensorLLM integration powered by Bittensor network. As same with https://github.com/langchain-ai/langchain/pull/9250 from python version. (Already integrated to python repository.) Can you check my PR, please?

dosubot[bot] commented 9 months ago

Hi, @BitVoyagerMan! I'm Dosu, and I'm here to help the langchainjs team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, the issue you raised was about needing to use two different versions of the axios module in your code. You attempted to fix it by modifying the package.json file, but encountered an error during the environment tests. Dosu-bot suggested a solution involving aliasing the axios versions in the package.json file. Jacoblee93 mentioned that OpenAI will be removing the Axios dependence soon, which should fix the issue.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the langchainjs repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution and for bringing this issue to our attention. We appreciate your patience and understanding. Let us know if you have any further questions or concerns.

Best regards, Dosu