Skip to content

ResponseInputFileExample.java #446

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

Merged

Conversation

nuclear-bean
Copy link
Contributor

An example for uploading PDF content with ResponseInputFile #440

@nuclear-bean nuclear-bean requested a review from a team as a code owner April 18, 2025 11:23
Copy link
Collaborator

@TomerAberbach TomerAberbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: run ./scripts/format to fix the CI lint error

OpenAIClient client = OpenAIOkHttpClient.fromEnv();

// Read file content and construct data URI String
File file = new File("/absolute/path/to/your/file.pdf");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if there's an actual PDF we can add to the resources directory, like we have for other examples, so that this example is runnable

Maybe this one? https://github.com/py-pdf/sample-files/blob/main/003-pdflatex-image/pdflatex-image.pdf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I've added it to the PR. Class now runnable and lint was fixed.

@TomerAberbach TomerAberbach changed the base branch from main to next April 23, 2025 20:35
@TomerAberbach TomerAberbach merged commit b94d404 into openai:next Apr 23, 2025
@stainless-app stainless-app bot mentioned this pull request Apr 23, 2025
TomerAberbach added a commit that referenced this pull request Apr 28, 2025
* chore(ci): run on more branches and use depot runners

* chore(ci): only use depot for staging repos

* docs: add responses input file example (#446)

* ResponseInputFileExample.java

* add example PDF file and fix lint

* refactor: rename example file

* refactor: slight example chnages

---------

Co-authored-by: Tomer Aberbach <[email protected]>

* fix(client): add missing convenience methods
chore(internal): use `byteInputStream()` in tests

* chore: run formatter

* chore(internal): java 17 -> 21 on ci

* release: 1.5.1

---------

Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
Co-authored-by: nuclear bean <[email protected]>
Co-authored-by: Tomer Aberbach <[email protected]>
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