Skip to content

Syntactic return type check is imprecise and should be disabled/replaced with a proper type checking pass #535

@kiranandcode

Description

@kiranandcode

Inside EncodableCallable we have a validation process wherein we check that the synthesized function has the right type signature. This check is done syntactically on the ast of the annotation.

In practice this is causing LLM calls to fail unnecessarily:

def foo() -> Optional[dict]:
   pass

Will raise an exception of the LLM generates a program dict | None however mypy would not complain. We should either drop this syntactic checking, or switch to a proper mypy based validation.

@matthew9671 can produce a reproducible example

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions