Ollama Python library 0.4 with function calling improvements
Blog post from Ollama
The latest release of the Ollama Python library introduces the ability to pass Python functions as tools, offering full typing support and updated examples to enhance user experience. Developers can define Python functions with annotated parameter and return value types, which can then be passed to Ollama's chat interface to be executed as part of model responses. The library now supports using existing functions from Python libraries as tools, exemplified by using the requests library to fetch web content. Additionally, the library automatically generates JSON schemas for functions using Pydantic and docstring parsing, streamlining a process that previously required manual input. These enhancements in version 0.4, along with improved examples and typing support, aim to simplify and expand the functionality of the Ollama Python library.