You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NOTE: I get the type mismatch error if I do not manually find and choose the version of langchain/groq that uses the exact same version of langchain/core.
Code Usage
constopenAi=newChatOpenAI(...);constgroq=newChatGroq(...);constprompt=ChatPromptTemplate.fromMessages([...]);// TYPE MISMATCH ERROR constwontCompileChain=prompt.pipe(openAi);constcompilingChain=prompt.pipe(groq);
Error Message and Stack Trace (if applicable)
I get what appears to be a type mismatch because my openai import uses a different version langchain/core ...
Argument of type 'ChatOpenAI' is not assignable to parameter of type 'RunnableLike<ChatPromptValueInterface, AIMessageChunk>'.
Type 'ChatOpenAI' is not assignable to type 'RunnableInterface<ChatPromptValueInterface, AIMessageChunk, RunnableConfig> | RunnableMapLike<ChatPromptValueInterface, AIMessageChunk>'.
Type 'ChatOpenAI' is missing the following properties from type 'RunnableMapLike<ChatPromptValueInterface, AIMessageChunk>': _getType, _printableFields, concat, text, and 6 more.
Hey @fjnoyp! 👋 I'm here to help you with bug fixes, answer questions, and guide you to become a contributor. Let's squash those bugs together!
To resolve the type mismatch error in Deno when using different versions of @langchain/core with ChatOpenAI and ChatGroq, you need to ensure that all related packages are using the same version of @langchain/core. In your import_map.json, you have specified @langchain/core as version 0.2.29, but it seems that ChatOpenAI is still using a different version.
Update your import_map.json to ensure that both langchain/ and @langchain/core/ are using the same version. For example, you can set both to 0.2.29:
Additionally, ensure that the imports for ChatOpenAI and ChatGroq are correctly aligned with the same version of @langchain/core. The _initChatModelHelper function in langchain/src/chat_models/universal.ts dynamically imports the appropriate chat model based on the provider, ensuring that the correct version is used. This should help in maintaining consistency across different chat models and avoid type mismatches [1][2].
For more information on installation and ensuring consistent versions, refer to the LangChain installation guide. It is crucial to ensure that all packages in the LangChain ecosystem depend on the same version of @langchain/core to avoid type errors [3].
Checked other resources
Example Code
Deno import_map.json
NOTE: I get the type mismatch error if I do not manually find and choose the version of langchain/groq that uses the exact same version of langchain/core.
Code Usage
Error Message and Stack Trace (if applicable)
I get what appears to be a type mismatch because my openai import uses a different version langchain/core ...
Description
I'm trying to import langchain as part of my supabase edge function deno environment. Despite using scopes to force a common version of langchain/core the type mismatch error persists (https://js.langchain.com/docs/how_to/installation/#installing-integration-packages).
I've read online trying many different variations on scopes to fix this but keep getting the same type mismatch. I wrote a detailed stack overflow question with the other variations I tried as well: https://stackoverflow.com/questions/78941151/langchain-deno-import-map-cannot-use-common-langchain-core
When I go into ChatOpenAI class such as:
https://esm.sh/v135/@langchain/[email protected]/dist/chat_model.d.ts
I see it always using:
import { Runnable } from "https://esm.sh/v135/@langchain/[email protected]/runnables.d.ts";
Even though I specified the scope:
I have reloaded and cleared the deno cache multiple times:
deno cache --reload ./ai_logic.ts --import-map=../../import_map.json
I'm unsure if this is a bug with deno or langchain but it does not seem possible to properly resolve to the same version of langchain/core.
Thank you in advance for your help and consideration here.
System Info
.vscode/settings.json
full import_map.json
The text was updated successfully, but these errors were encountered: