Gives user ability to 'print' the assistants messages, which I found useful to better understand how the Assistant works and/or to test a tool.
Note that Ollama gives me a 404 error me even though there appears to be support for it, and it works from another application.
Shouldn't this work?
# Use local Ollama. See https://ollama.com/search?c=tools for models that support tools.
llm = Langchain::LLM::Ollama.new(default_options: {chat_model: "mistral"})
Welcome to your Meteorological assistant!
(multiline input; type 'end' on its own line when done. or 'print' to print messages, or 'exit' to exit)
Query: Boston?
Query: end
D, [2024-11-10T06:27:11.902641 #34124] DEBUG -- [Langchain.rb]: Langchain::Assistant - Sending a call to Langchain::LLM::Ollama
W, [2024-11-10T06:27:11.902826 #34124] WARN -- [Langchain.rb]: WARNING: `parallel_tool_calls:` is not supported by Ollama currently
W, [2024-11-10T06:27:11.902856 #34124] WARN -- [Langchain.rb]: WARNING: `tool_choice:` is not supported by Ollama currently
I, [2024-11-10T06:27:11.904720 #34124] INFO -- [request]: POST http://localhost:11434/api/chat
I, [2024-11-10T06:27:11.904778 #34124] INFO -- [request]: User-Agent: "Faraday v2.12.0"
Content-Type: "application/json"
I, [2024-11-10T06:27:11.904804 #34124] INFO -- [request]: {"messages":[{"role":"system","content":"You are a Meteorologist Assistant that is able to report the weather for any city in metric units."},{"role":"user","content":"Boston?"}],"model":"mistral","stream":false,"tools":[{"type":"function","function":{"name":"langchain_tool_weather__get_current_weather","description":"Returns current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"State code"},"country_code":{"type":"string","description":"Country code"},"units":{"type":"string","description":"Units for temperature (imperial or metric). Default: \"imperial\"","enum":["imperial","metric","standard"]}},"required":["city","state_code"]}}}],"temperature":0.0}
I, [2024-11-10T06:27:11.909847 #34124] INFO -- [response]: Status 404
I, [2024-11-10T06:27:11.909904 #34124] INFO -- [response]: content-type: "application/json; charset=utf-8"
date: "Sun, 10 Nov 2024 11:27:11 GMT"
content-length: "61"
I, [2024-11-10T06:27:11.909932 #34124] INFO -- [response]:
/Users/mattlindsey/.rvm/gems/ruby-3.2.1/gems/faraday-2.12.0/lib/faraday/response/raise_error.rb:30:in `on_complete': the server responded with status 404 (Faraday::ResourceNotFound)
from /Users/mattlindsey/.rvm/gems/ruby-3.2.1/gems/faraday-2.12.0/lib/faraday/middleware.rb:57:in `block in call'
Gives user ability to 'print' the assistants messages, which I found useful to better understand how the Assistant works and/or to test a tool.
Note that Ollama gives me a 404 error me even though there appears to be support for it, and it works from another application. Shouldn't this work?
I do see it hitting it in the Ollama log: