Closed ahm750 closed 4 months ago
This is a resolved issue, please wait for the new version of langchainjs
.
This is not yet solved. Here's my langchain packages.
"@langchain/community": "^0.0.54",
"@langchain/groq": "^0.0.9",
"@langchain/langgraph": "^0.0.12",
"@langchain/openai": "^0.0.29",
NEED THE UPDATE TO BE RELEASED........
@jacoblee93 Any ETA on the new release?
Hey the fix should be live if you update to the latest @langchain/core! The tiktoken dep is there.
Hi,
Now, It's working for me!
Thanks!
Thank you, it works now!
guys I have only installed langchain npm. does this install langchain core?
guys I have only installed langchain npm. does this install langchain core?
It does as a dependency, yes. See this guide:
https://js.langchain.com/v0.2/docs/how_to/installation/#installing-integration-packages
@jacoblee93 even though I have updated to version 0.2.6, I still get weird context length errors which are not valid, as the context len for gpt-4o is 128k.
I have also raise an issue here. https://github.com/langchain-ai/langchainjs/issues/5888
it seems to start at version of langchain 0.1.37
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Failed to calculate number of tokens, falling back to approximate count Error: Unknown model at getEncodingNameForModel (file:///node_modules/js-tiktoken/dist/chunk-HXW345QN.js:224:13) at encodingForModel (file:///node_modules/@langchain/core/dist/utils/tiktoken.js:19:24) at ChatOpenAI.getNumTokens (file:///node_modules/@langchain/core/dist/language_models/base.js:174:40) at file:///node_modules/@langchain/openai/dist/chat_models.js:642:42 at Array.map ()
at ChatOpenAI.getNumTokensFromMessages (file:///node_modules/@langchain/openai/dist/chat_models.js:641:60)
at ChatOpenAI.getEstimatedTokenCountFromPrompt (file:///node_modules/@langchain/openai/dist/chat_models.js:589:34)
at ChatOpenAI._generate (file:///node_modules/@langchain/openai/dist/chat_models.js:536:49)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.allSettled (index 0)
Failed to calculate number of tokens, falling back to approximate count Error: Unknown model
at getEncodingNameForModel (file:///node_modules/js-tiktoken/dist/chunk-HXW345QN.js:224:13)
at encodingForModel (file:///node_modules/@langchain/core/dist/utils/tiktoken.js:19:24)
at ChatOpenAI.getNumTokens (file:///node_modules/@langchain/core/dist/language_models/base.js:174:40)
at file:///node_modules/@langchain/openai/dist/chat_models.js:643:42
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async ChatOpenAI.getNumTokensFromMessages (file:///node_modules/@langchain/openai/dist/chat_models.js:641:33)
at async ChatOpenAI.getEstimatedTokenCountFromPrompt (file:///node_modules/@langchain/openai/dist/chat_models.js:589:23)
at async ChatOpenAI._generate (file:///node_modules/@langchain/openai/dist/chat_models.js:536:38)
at async Promise.allSettled (index 0)
Failed to calculate number of tokens, falling back to approximate count Error: Unknown model
at getEncodingNameForModel (file:///node_modules/js-tiktoken/dist/chunk-HXW345QN.js:224:13)
at encodingForModel (file:///node_modules/@langchain/core/dist/utils/tiktoken.js:19:24)
at ChatOpenAI.getNumTokens (file:///node_modules/@langchain/core/dist/language_models/base.js:174:40)
at file:///node_modules/@langchain/openai/dist/chat_models.js:623:35
at Array.map ()
at ChatOpenAI.getNumTokensFromGenerations (file:///node_modules/@langchain/openai/dist/chat_models.js:617:64)
at ChatOpenAI._generate (file:///node_modules/@langchain/openai/dist/chat_models.js:537:53)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.allSettled (index 0)
at async ChatOpenAI._generateUncached (file:///node_modules/@langchain/core/dist/language_models/chat_models.js:114:25)
Description
Hi, OpenAI just released GPT-4o and langchain needs to be updated to support this model. At the moment, it throws the above error when using the new model.
System Info
Langchain: 0.1.37 Platform: macos Node: 21.7.3 Yarn: 4.2.2