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

Why are the __init__ types different than the object attribute types? #7630

Open
ryanpeach opened this issue Jan 8, 2025 · 0 comments · May be fixed by #7632
Open

Why are the __init__ types different than the object attribute types? #7630

ryanpeach opened this issue Jan 8, 2025 · 0 comments · May be fixed by #7632

Comments

@ryanpeach
Copy link

ryanpeach commented Jan 8, 2025

role: Literal["assistant"] = "assistant",

I'm getting

Argument of type "Literal['system']" cannot be assigned to parameter "role" of type "Literal['assistant']" in function "__init__"
   │     │      "Literal['system']" is not assignable to type "Literal['assistant']" Pyright (reportArgumentType) [180, 31]

For doing

Message(role="system", content="foo")

Because __init__(role: Literal['assistant'], ...) vs Message.role: Literal['assistant', 'system', ...]

@ryanpeach ryanpeach linked a pull request Jan 8, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant