-
-
Notifications
You must be signed in to change notification settings - Fork 590
Add support for Responses API #541
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
Draft
momostafa
wants to merge
66
commits into
openai-php:main
Choose a base branch
from
momostafa:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,677
−1
Draft
Changes from 51 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
d9f8bbb
Add support for Responses API
momostafa 3cea3dc
Updated miss placed files that occurred during first upload
momostafa 99a3ed5
Heavy refactoring to match codebase pattern, added testing files
momostafa 8ea527a
fixed some phpstan errors
momostafa 412f35c
fixing minor bugs after live testing now all models work during live …
momostafa 2c4c3fb
Merge branch 'openai-php:main' into dev
momostafa 29436e8
Fixed lint errors
momostafa 63c8c7c
Merge branch 'dev' of github.com:momostafa/openai-client into dev
momostafa dd263ac
Fixed all PHPStan Errors and all other tests Pass 100%
momostafa 5585119
Completed missing Tests, Created ClientFakeResponses, Modified Fakeable
momostafa caf4413
Updated Test files, Fixed Lint errors, all tests pass except test:unit
momostafa a8d5ac9
chore: remove log file
iBotPeaches 780ce1a
chore: pint
iBotPeaches fa48f22
chore: inline Responses doc to readme
iBotPeaches f41bec2
Merge remote-tracking branch 'upstream/main' into dev
iBotPeaches b1f5217
chore: align client contract to pattern
iBotPeaches dc444b8
docs: re-order chat/completion
iBotPeaches 69c7a13
fix: use longer replacement to not clobber Responses/*
iBotPeaches 1f68d23
fix: parse metadata (optionally)
iBotPeaches 5c28547
test: don't assert on plain arrays
iBotPeaches 3bc814b
test: assert stream properly on responses
iBotPeaches d533727
chore: add missing docblock property
iBotPeaches b982826
fix: add metadata into Responses payload
iBotPeaches 779446e
test: fix double nesting on delete attrs
iBotPeaches 56dd359
test: correct bad assertions on tests
iBotPeaches bec19fb
fix: remove ResponseObject
iBotPeaches 18bf40e
feat: split out usage into classes
iBotPeaches e9d3d95
feat: split out error into classes
iBotPeaches b21aca2
Merge remote-tracking branch 'origin/main' into dev
iBotPeaches d06d33b
feat: split out incomplete_details into classes
iBotPeaches 5792dea
chore(wip): introduction of 'output' typing
iBotPeaches 7fff62e
fix: correct OutputMessageContentOutputText + child classes
iBotPeaches d8ce1a6
OutputMessage
iBotPeaches b9db0a1
chore: continued work on output message
iBotPeaches 26990e2
chore: start of ComputerToolActions
iBotPeaches 4dda791
feat: complete "computer tool call"
iBotPeaches c9c5a56
fix: add response contract to existing classes
iBotPeaches 501d61f
fix: more fixes to typing on CreateResponse
iBotPeaches 314e189
feat: add 'reasoning' prop for response
iBotPeaches 63f6c10
feat: add 'text' (format) to create
iBotPeaches 788752b
feat: add 'tool_choice'
iBotPeaches 8798fbf
fix: add 'truncation'
iBotPeaches 5181077
feat: add tool: FileSearch response
iBotPeaches 219c6b8
feat: add tool: FunctionTool response
iBotPeaches 0701c15
feat: add tool 'ComputerUse'
iBotPeaches e56f9e9
fix: wire up 'tools' to CreateResponse
iBotPeaches e811af7
Added InputMessage types, refactored ListInputItems
momostafa 2c7f014
Merge branch 'dev' of github.com:momostafa/openai-client into dev
momostafa 323b5a4
Merge branch 'openai-php:main' into dev
momostafa 2952a02
Merge branch 'dev' of github.com:momostafa/openai-client into dev
momostafa efeb8d7
Corrected some properties to use camelCase
momostafa 1d20ee8
fix: cleanup docblock on CreateResponse
iBotPeaches 96c7fa0
chore: remove unused test response object
iBotPeaches f8c94d1
chore: remove extra newline
iBotPeaches 7a61c8b
fix: 'role' is always 'assistant'
iBotPeaches 697145a
test: augment tests with single click
iBotPeaches 30ef112
chore: add missing int for computer single click
iBotPeaches ac7868d
test: progression towards 100% coverage on create response
iBotPeaches 274498a
test: assertion on OutputFileSearchToolCall
iBotPeaches d4170aa
chore: ints for x/y on click event
iBotPeaches e14b07c
fix: further cleanup on CreateResponse
iBotPeaches 130f74b
feat: add computer tool call output
iBotPeaches 84cbb39
feat: add function tool call output
iBotPeaches 60bcce4
fix: city, region and timezone can return null
iBotPeaches 09d00e5
fix: json_schema description can be missing
iBotPeaches cc27c28
Lint Test Pass, Fixed Array map at ListInputItems
momostafa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenAI\Contracts\Resources; | ||
|
||
use OpenAI\Responses\Responses\CreateResponse; | ||
use OpenAI\Responses\Responses\CreateStreamedResponse; | ||
use OpenAI\Responses\Responses\DeleteResponse; | ||
use OpenAI\Responses\Responses\ListInputItems; | ||
use OpenAI\Responses\Responses\RetrieveResponse; | ||
use OpenAI\Responses\StreamResponse; | ||
|
||
interface ResponsesContract | ||
{ | ||
/** | ||
* Creates a model response. | ||
* Provide text or image inputs to generate text or JSON outputs. | ||
* Have the model call your own custom code or use built-in tools | ||
* like web search or file search to use your own data as input for the model's response. | ||
* | ||
* @see https://platform.openai.com/docs/api-reference/responses/create | ||
* | ||
* @param array<string, mixed> $parameters | ||
*/ | ||
public function create(array $parameters): CreateResponse; | ||
|
||
/** | ||
* Create a streamed response. | ||
* | ||
* @see https://platform.openai.com/docs/api-reference/responses/create | ||
* | ||
* @param array<string, mixed> $parameters | ||
* @return StreamResponse<CreateStreamedResponse> | ||
*/ | ||
public function createStreamed(array $parameters): StreamResponse; | ||
|
||
/** | ||
* Retrieves a model response with the given ID. | ||
* | ||
* @see https://platform.openai.com/docs/api-reference/responses/retrieve | ||
*/ | ||
public function retrieve(string $id): RetrieveResponse; | ||
|
||
/** | ||
* Deletes a model response with the given ID. | ||
* | ||
* @see https://platform.openai.com/docs/api-reference/responses/delete | ||
*/ | ||
public function delete(string $id): DeleteResponse; | ||
|
||
/** | ||
* Returns a list of input items for a given response. | ||
* | ||
* @see https://platform.openai.com/docs/api-reference/responses/input-items | ||
* | ||
* @param array<string, mixed> $parameters | ||
*/ | ||
public function list(string $id, array $parameters = []): ListInputItems; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document both the array and string based input