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

Add support for GPT-4o #5346

Closed
5 tasks done
ahm750 opened this issue May 13, 2024 · 8 comments
Closed
5 tasks done

Add support for GPT-4o #5346

ahm750 opened this issue May 13, 2024 · 8 comments
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@ahm750
Copy link

ahm750 commented May 13, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

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

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label May 13, 2024
@jeasonnow
Copy link
Contributor

jeasonnow commented May 14, 2024

#5354
This is a resolved issue, please wait for the new version of langchainjs.

@sanjiv-upgiant
Copy link

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",

@sanjiv-upgiant
Copy link

NEED THE UPDATE TO BE RELEASED........

@ahm750
Copy link
Author

ahm750 commented May 17, 2024

@jacoblee93 Any ETA on the new release?

@jacoblee93
Copy link
Collaborator

Hey the fix should be live if you update to the latest @langchain/core! The tiktoken dep is there.

@jacoblee93
Copy link
Collaborator

https://x.com/philippec_me/status/1790142477141147884?s=46&t=pBOviutddr6W7u_gV0VQqg

@maikosantos
Copy link

Hi,

Now, It's working for me!

Thanks!

@ahm750
Copy link
Author

ahm750 commented May 17, 2024

Thank you, it works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

5 participants