Commit 27f9329
Add support for Responses API (#541)
* Add support for Responses API
Full support to the new Responses API https://platform.openai.com/docs/api-reference/responses
* Updated miss placed files that occurred during first upload
* Heavy refactoring to match codebase pattern, added testing files
* fixed some phpstan errors
* fixing minor bugs after live testing now all models work during live testing
* Fixed lint errors
* Fixed all PHPStan Errors and all other tests Pass 100%
* Completed missing Tests, Created ClientFakeResponses, Modified Fakeable
I had to modify OpenAI\Testing\Responses\Concerns\Fakeable
as $class = str_replace('Responses\\', 'Testing\\Responses\\Fixtures\\', static::class).'Fixture';
was conflicting with newly added Responses folder and added docblock explaining the modification and tested against all files.
Updated readme can be found at README-RESPONSES.md
Added dedicated ClientFake for Responses tests/Testing/ClientFakeResponses.php
* Updated Test files, Fixed Lint errors, all tests pass except test:unit
* chore: remove log file
* chore: pint
* chore: inline Responses doc to readme
* chore: align client contract to pattern
* docs: re-order chat/completion
* fix: use longer replacement to not clobber Responses/*
* fix: parse metadata (optionally)
* test: don't assert on plain arrays
* test: assert stream properly on responses
* chore: add missing docblock property
* fix: add metadata into Responses payload
* test: fix double nesting on delete attrs
* test: correct bad assertions on tests
* fix: remove ResponseObject
* feat: split out usage into classes
* feat: split out error into classes
* feat: split out incomplete_details into classes
* chore(wip): introduction of 'output' typing
* fix: correct OutputMessageContentOutputText + child classes
* OutputMessage
* chore: continued work on output message
* chore: start of ComputerToolActions
* feat: complete "computer tool call"
* fix: add response contract to existing classes
* fix: more fixes to typing on CreateResponse
* feat: add 'reasoning' prop for response
* feat: add 'text' (format) to create
* feat: add 'tool_choice'
* fix: add 'truncation'
* feat: add tool: FileSearch response
* feat: add tool: FunctionTool response
* feat: add tool 'ComputerUse'
* fix: wire up 'tools' to CreateResponse
* Added InputMessage types, refactored ListInputItems
- Added Classes related to InputMessage types
- refactored ListInputItems to reflect the newly added classes
* Corrected some properties to use camelCase
* fix: cleanup docblock on CreateResponse
* chore: remove unused test response object
* chore: remove extra newline
* fix: 'role' is always 'assistant'
* test: augment tests with single click
* chore: add missing int for computer single click
* test: progression towards 100% coverage on create response
* test: assertion on OutputFileSearchToolCall
* chore: ints for x/y on click event
* fix: further cleanup on CreateResponse
* feat: add computer tool call output
* feat: add function tool call output
* fix: city, region and timezone can return null
* fix: json_schema description can be missing
* Lint Test Pass, Fixed Array map at ListInputItems
* chore: rework text format typing on create response
* feat: rework into phpstan-types
* fix: work on ListInputItems for phpstan-types
* fix: wire up RetrieveResponse
* fix: migrate to phpstan-type for delete
* fix: wip towards stream responses
* chore: add typing props for delete
* test: correct tests for retrieve response
* fix: add outputItem types for streaming
* fix: contentPart/textDelta/textAnnotation added
* fix: outputrefusal*/outputText wired up
* chore: rename Refusal types
* feat: finish typing for streaming
* Wired all classes under Responses/Input
* chore: type ListInputItems
* fix: finalize ListInputItems
* test: ListInputItem tests
* test: stream testing
* fix: shove mock meta object into stream
* test: correct streaming tests
* chore: use local type
* docs: cleanup readme
* chore: align constructors
* fix: mark 'status' as optional in reasoning
* fix: add encrypted_content to reasoning
* fix: file search filters can be null
---------
Co-authored-by: Connor Tumbleson <[email protected]>
Co-authored-by: Connor Tumbleson <[email protected]>1 parent 2241ae0 commit 27f9329
File tree
102 files changed
+6847
-2
lines changed- src
- Contracts
- Resources
- Resources
- Responses
- Responses
- Format
- Input
- Output
- ComputerAction
- Streaming
- ToolChoice
- Tool
- Testing
- Resources
- Responses
- Concerns
- Fixtures/Responses
- tests
- Fixtures
- Streams
- Resources
- Responses/Responses
- Output
- Tool
- Testing
- Resources
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
102 files changed
+6847
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
157 | 351 | | |
158 | 352 | | |
159 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
0 commit comments