mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 09:05:23 -04:00
[PR #234] [CLOSED] Add Tool Registry Feature #426
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ollama/ollama-python/pull/234
Author: @synacktraa
Created: 7/26/2024
Status: ❌ Closed
Base:
main← Head:main📝 Commits (3)
dc2acd6Add tool registry for tool-calling automatione9b8aabremove ipykernel dev dependency637f9a9remove pydantic dependency📊 Changes
9 files changed (+951 additions, -53 deletions)
View changed files
📝
README.md(+95 -0)📝
examples/tools/main.py(+54 -43)📝
ollama/__init__.py(+5 -0)📝
ollama/_types.py(+4 -4)➕
ollama/tool_calling/__init__.py(+171 -0)➕
ollama/tool_calling/_utils.py(+461 -0)📝
poetry.lock(+16 -5)📝
pyproject.toml(+1 -0)📝
tests/test_client.py(+144 -1)📄 Description
Description
This PR introduces a new
ToolRegistryclass to the Ollama library. The Tool Registry is designed to manage various tools, including functions (both synchronous and asynchronous),pydantic.BaseModel,typing.TypedDict, andtyping.NamedTuple. It provides functionality to generate schemas for these tools, which are essential for LLM tool-calling, and allows for the invocation of tools using their metadata.Features
Changes I've made:
tool_callingwhich stores all functionality of tool registry.ToolRegistryclass. (All tests passed)How to use this functionality?
Creating a tool registry
Adding tools to the registry instance
Get tool schema list
Invoking the tool
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.