langchain-ai / langchain

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

ChatOllama does not support bind_tools #22165

Open Harsh-Kesharwani opened 3 months ago

Harsh-Kesharwani commented 3 months ago

Checked other resources

Example Code

ChatOllama does not support bind_tools

Error Message and Stack Trace (if applicable)

No response

Description

ChatOllama does not support bind_tools

System Info

ChatOllama does not support bind_tools

keenborder786 commented 3 months ago

You can use OllamaFunctions from langchain_experimental.llms.ollama_functions

Harsh-Kesharwani commented 3 months ago

@keenborder786 But i have to use function calling along with chat messages as open ai support in there API v1/completion.

noshila commented 3 months ago

nothing except for openai, mistral, google or others like that work. I tried with llama.cpp (original, python and server), ollama, kobold but now I am certain no opensource model or library works exactly like openai api.

keenborder786 commented 3 months ago

I am afraid that is not possible because Function Calling is a special capability offered only by OpenAI

keenborder786 commented 3 months ago

But you can always use tool calling by any llm using React agent.

lalanikarim commented 2 months ago

Take a look at #22339 which should have addressed this issue. The PR was approved and merged yesterday but a release is yet to be cut from it and should happen in the next few days.

In the meantime, you may try and install langchain-experimental directly from langchain's source like this:

pip install git+https://github.com/langchain-ai/langchain.git\#egg=langchain-experimental\&subdirectory=libs/experimental

I hope this helps.