Skip to content

Structured outputs #944

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Chris-Bowers
Copy link

@Chris-Bowers Chris-Bowers commented Apr 3, 2025

Adding response_format to allow for Structure Output when using some OpenAi models

What changes are proposed in this pull request?

Adding a variable response_format to allow response_format to be passed to openAI models such as gpt4o.

Example: https://community.openai.com/t/how-do-i-use-the-new-json-mode/475890/2

Specifically, try to answer the two following questions:

  • WHAT changes are being made in the PR? This should be a summary of the
    major changes to allow the reader to quickly understand the PR without having
    to look at the code.
    A variable response_format has been added to both query functions. If statements have been added to both query functions to handle the case when response_format is not passed.
  • WHY are these changes needed? This should provide the context that the
    reader might be missing. For example, were there any decisions behind the
    change that are not reflected in the code itself?
    Adding the response_format variable in this way will allow a response_format to be passed to openAI models such as gpt4o.

The “why part” is the most important of the two as it usually cannot be
inferred from the code itself. A well-written PR description will help future
developers (including your future self) to know how to interact and update your
code.

How is this tested?

Describe any tests you have done; especially if test tests are not part of
the unit tests (e.g. local tests).

I have NOT tested this edit.

ALWAYS ANSWER THIS QUESTION: Answer with "N/A" if tests are not applicable
to your PR (e.g. if the PR only modifies comments). Do not be afraid of
answering "Not tested" if the PR has not been tested. Being clear about what
has been done and not done provides important context to the reviewers.

NO_CHANGELOG=true

Adding response_format to allow for Structure Output when using some OpenAi models

Signed-off-by: Chris Bowers <[email protected]>
Adding response_format variable

Signed-off-by: Chris Bowers <[email protected]>
Copy link

github-actions bot commented Apr 3, 2025

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 944
  • Commit SHA: ec234fbea565df74621987b961faf42e32a927fe

Checks will be approved automatically on success.

Copy link

github-actions bot commented Apr 3, 2025

Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes.
If this is not necessary for your PR, please include the following in your PR description:
NO_CHANGELOG=true
and rerun the job.

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.

1 participant