langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
95.04k stars 15.4k forks source link

bind_tools function fails with AzureMLChatOnlineEndpoint #28214

Open azraimahadan opened 10 hours ago

azraimahadan commented 10 hours ago

Checked other resources

Example Code

from langchain_community.chat_models.azureml_endpoint import AzureMLChatOnlineEndpoint

llm = AzureMLChatOnlineEndpoint(#AzureMLOnlineEndpoint(
    endpoint_url="https://your-endpoint",
    endpoint_api_type=AzureMLEndpointApiType.dedicated,
    endpoint_api_key="",
    model_kwargs={"temperature": 0.3, "max_new_tokens": 400},
        content_formatter=CustomOpenAIChatContentFormatter(),
)
llm_with_tools = llm.bind_tools(tools)

Error Message and Stack Trace (if applicable)


NotImplementedError Traceback (most recent call last) Cell In[17], line 1 ----> 1 llm_with_tools = llm.bind_tools(tools)

File [~\AppData\Local\anaconda3\envs\llm\Lib\site-packages\langchain_core\language_models\chat_models.py:1115] /anaconda3/envs/llm/Lib/site-packages/langchain_core/language_models/chat_models.py#line=1114), in BaseChatModel.bind_tools(self, tools, kwargs) 1108 def bind_tools( 1109 self, 1110 tools: Sequence[ (...) 1113 kwargs: Any, 1114 ) -> Runnable[LanguageModelInput, BaseMessage]: -> 1115 raise NotImplementedError

NotImplementedError:

Description

The function should support bind_tool since it is a chat model but got the error as above.

System Info

Name: langchain-core Version: 0.3.19

Name: langchain Version: 0.3.7

informatica92 commented 5 hours ago

I reported the same issue here: https://github.com/langchain-ai/langchain/issues/28129