Metadata-Version: 2.1
Name: openai-toolgen
Version: 0.2.0
Summary: A library for generating tools for OpenAI projects
Home-page: https://github.com/visendi-labs/openai-toolgen
Author: Rasmus Nordström
Author-email: nordstrom.rasmus@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

A clean way to generate tools to be used with openai projects

Example using Openai Completions:

```python
from typing import Annotated
from enum import Enum
import json
from openai import OpenAI
from openai_toolgen import tool

class Unit(str, Enum):
    Celcius = "c"
    Farenheit = "f"

@tool
def get_temperature(
        location: Annotated[str, "Location to fetch the tempereature from"],
        unit: Annotated[Unit, "Temperature will be returned in this unit"] = Unit.Celcius
    ):
    """Call this function when the user wants to know the temperature"""

    return { "temperature": 32, "unit": unit.value, "location": location }

client = OpenAI()
messages = [{"role": "user", "content": "What's the temperature in Stockholm today?"}]
completion = client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=tool.export_all(),
    tool_choice="required"
)
```
Check out the tests for more details
