Tool call chun not able to import #24249
Replies: 2 comments
-
Hello, @sarthakkar99! I'm here to help you with any bugs, questions, or contributions you may have. Let's work together to solve this issue. To resolve the
Here is an example of how you might use the from langchain._api.module_import import create_importer
# Define the module lookup for the required import
module_lookup = {
"tool_call_chunk": "langchain_core.messages.tool"
}
# Create the importer function
importer = create_importer(__package__, module_lookup=module_lookup)
# Use the importer to get the required object
tool_call_chunk = importer("tool_call_chunk") Ensure that you have the pip install langchain-core If the module |
Beta Was this translation helpful? Give feedback.
-
Having the same issue as well, but on mistral
Packages:
|
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
ImportError Traceback (most recent call last)
Cell In[111], line 2
1 from langchain_core.prompts import PromptTemplate
----> 2 from langchain_openai import OpenAI
File c:\Users\sarth\VSCODE\GenerativeAI\venv\Lib\site-packages\langchain_openai_init_.py:1
----> 1 from langchain_openai.chat_models import AzureChatOpenAI, ChatOpenAI
2 from langchain_openai.embeddings import AzureOpenAIEmbeddings, OpenAIEmbeddings
3 from langchain_openai.llms import AzureOpenAI, OpenAI
File c:\Users\sarth\VSCODE\GenerativeAI\venv\Lib\site-packages\langchain_openai\chat_models_init_.py:1
----> 1 from langchain_openai.chat_models.azure import AzureChatOpenAI
2 from langchain_openai.chat_models.base import ChatOpenAI
4 all = ["ChatOpenAI", "AzureChatOpenAI"]
File c:\Users\sarth\VSCODE\GenerativeAI\venv\Lib\site-packages\langchain_openai\chat_models\azure.py:40
37 from langchain_core.utils import convert_to_secret_str, get_from_dict_or_env
38 from langchain_core.utils.function_calling import convert_to_openai_tool
---> 40 from langchain_openai.chat_models.base import BaseChatOpenAI
42 logger = logging.getLogger(name)
45 _BM = TypeVar("_BM", bound=BaseModel)
File c:\Users\sarth\VSCODE\GenerativeAI\venv\Lib\site-packages\langchain_openai\chat_models\base.py:66
47 from langchain_core.messages import (
...
---> 66 from langchain_core.messages.tool import tool_call_chunk
67 from langchain_core.output_parsers import JsonOutputParser, PydanticOutputParser
68 from langchain_core.output_parsers.base import OutputParserLike
ImportError: cannot import name 'tool_call_chunk' from 'langchain_core.messages.tool' (c:\Users\sarth\VSCODE\GenerativeAI\venv\Lib\site-packages\langchain_core\messages\tool.py)
Tried everything uninstall and then install still not be able to fix but the function is present at the respective location
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
Beta Was this translation helpful? Give feedback.
All reactions