rgbkrk / chatlab

⚡️🧪 Fast LLM Tool Calling Experimentation, big and smol
https://chatlab.dev
Other
138 stars 12 forks source link

Pydantic issues a cryptic warning when functions are registered #141

Closed cvaske closed 7 months ago

cvaske commented 8 months ago

Description

When starting a new chat with a registered function, under many situations I get this warning:

/Users/cvaske/.pyenv/versions/3.12.1/lib/python3.12/site-packages/pydantic/main.py:1406: RuntimeWarning: fields may not start with an underscore, ignoring "__required__"
  warnings.warn(f'fields may not start with an underscore, ignoring "{f_name}"', RuntimeWarning)

What I Did

import chatlab

def add_two_numbers(a: float, b: float) -> float:
    """Add two numbers together. Raises an exception when the numbers are in the wrong order."""
    if b < a:
        return a + b
    raise Exception("I can't do math")

chat = chatlab.Chat(model=chatlab.models.GPT_4_0125_PREVIEW, chat_functions=[add_two_numbers])
await chat("Please add 1 + 2 for me")
rgbkrk commented 7 months ago

Closed by #142