Skip to content

Schema generation fails for recursive type aliases #761

Description

@eb8680

The following code

import pydantic
from effectful.handlers.llm.harness.serialization import _inline_refs

type A[T] = T | list[A[T]]
_inline_refs(pydantic.TypeAdapter(A).json_schema())

fails with a RecursionError:

...
  File "/Users/eli/development/effectful/effectful/handlers/llm/harness/serialization.py", line 305, in _resolve
    return [_resolve(item) for item in obj]
            ~~~~~~~~^^^^^^
RecursionError: maximum recursion depth exceeded

This is a bug in the _inline_refs helper.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions