Skip to content

fix!: always return structured outputs as dicts#76

Merged
cjumel merged 1 commit into
mainfrom
cj/better_types
Jun 1, 2026
Merged

fix!: always return structured outputs as dicts#76
cjumel merged 1 commit into
mainfrom
cj/better_types

Conversation

@cjumel
Copy link
Copy Markdown
Contributor

@cjumel cjumel commented May 29, 2026

This commit removes the output conversion to a pydantic.BaseModel when one is passed as structured output schema. This is done for consistency with the task and research methods (where the same conversion cannot be implemented simply). This will also simplify the code and method signatures.

With the simplification of the type hints, this was also an opportunity to rework and improve the type hinting of the client's main methods, especially to enforce accurate type hinting per output type and include sources parameter. Doing so required enforcing a limit in the number of positional arguments, which I set quite aggressively to prefer a long term solution.

I also enforced the google style guide import
recommendation
, that is to only import modules, for pydantic imports in the files I changed.

Description

Checklist

  • I have installed prek on this project (for instance with the make install-dev command)
    before creating any commit, or I have run successfully the make lint command on my changes.
  • I have run successfully the make typecheck test command on my changes.
  • I have updated the README.md if my changes affected it.

This commit removes the output conversion to a `pydantic.BaseModel` when
one is passed as structured output schema. This is done for consistency
with the task and research methods (where the same conversion cannot be
implemented simply). This will also simplify the code and method
signatures.

With the simplification of the type hints, this was also an opportunity
to rework and improve the type hinting of the client's main methods,
especially to enforce accurate type hinting per output type and include
sources parameter. Doing so required enforcing a limit in the number of
positional arguments, which I set quite aggressively to prefer a long
term solution.

I also enforced the [google style guide import
recommendation](https://google.github.io/styleguide/pyguide.html#22-imports),
that is to only import modules, for pydantic imports in the files I
changed.
@cjumel cjumel force-pushed the cj/better_types branch from e62279f to 17ba353 Compare June 1, 2026 12:09
@cjumel cjumel merged commit 0cded9d into main Jun 1, 2026
3 checks passed
@cjumel cjumel deleted the cj/better_types branch June 1, 2026 12:27
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 this pull request may close these issues.

2 participants