Metadata-Version: 2.2
Name: toolregistry
Version: 0.2.0
Summary: A library for managing tool registries
Home-page: https://github.com/Oaklight/ToolRegistry
Author: Oaklight
Author-email: oaklight@gmx.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=1.5.1
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ToolRegistry

A Python library for managing and executing tools in a structured way.

## Features

- Tool registration and management
- JSON Schema generation for tool parameters
- Tool execution and result handling
- Support for both synchronous and asynchronous tools

## Installation

```bash
pip install toolregistry
```

## Usage

## Examples

### OpenAI Implementation

The [openai_tool_usage_example.py](example/openai_tool_usage_example.py) shows how to integrate ToolRegistry with OpenAI's API.

### Cicada Implementation

The [cicada_tool_usage_example.py](example/cicada_tool_usage_example.py) demonstrates how to use ToolRegistry with the Cicada MultiModalModel.

## OpenAI Integration

The ToolRegistry integrates seamlessly with OpenAI's API. Here are some common usage patterns:

### Getting Tools JSON for OpenAI

```python
tools_json = registry.get_tools_json()
# Use this with OpenAI's API to provide available tools
```

### Executing Tool Calls

```python
# Assuming tool_calls is received from OpenAI's API
tool_responses = registry.execute_tool_calls(tool_calls)
```

### Recovering Assistant Messages

```python
# After executing tool calls
messages = registry.recover_tool_call_assistant_message(tool_calls, tool_responses)
# Use these messages to continue the conversation
```

### Manual Tool Execution

```python
# Get a callable function
add_fn = registry.get_callable("add")
result = add_fn(a=1, b=2)  # Output: 3
```

## Documentation

Full documentation is available at [https://github.com/Oaklight/ToolRegistry](https://github.com/Oaklight/ToolRegistry)

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
