Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pydantic issues a cryptic warning when functions are registered #141

Closed
cvaske opened this issue Mar 1, 2024 · 1 comment
Closed

Pydantic issues a cryptic warning when functions are registered #141

cvaske opened this issue Mar 1, 2024 · 1 comment

Comments

@cvaske
Copy link
Collaborator

cvaske commented Mar 1, 2024

  • ChatLab version: 2.0
  • Python version: 3.12
  • Operating System: macOS

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
Copy link
Owner

rgbkrk commented Mar 4, 2024

Closed by #142

@rgbkrk rgbkrk closed this as completed Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants