-
Notifications
You must be signed in to change notification settings - Fork 35
Adds DTO array transformation and JSON serialization #30
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
Merged
Changes from 4 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
13aaba0
chore: simplifies type
JasonTheAdams 0b52ffd
feat: adds json serialization to DTOs
JasonTheAdams 0c0407c
refactor: moves enum trait to traits directory
JasonTheAdams 03f66ff
test: adds serialization tests
JasonTheAdams a350b57
feat: improves fromJson validation and documenting
JasonTheAdams f6a1605
refactor: clean up typing with generics
JasonTheAdams cf5b304
refactor: further cleaning up of types
JasonTheAdams 404699a
refactor: improves Message::toJson types
JasonTheAdams 18ffdb4
refactor: changes to array terminology over json
JasonTheAdams cb4406e
refactor: adds abstract DTO with json serialization
JasonTheAdams f17f662
refactor: simplifies File::fromArray
JasonTheAdams 1f77a32
refactor: simplifies Message::fromArray
JasonTheAdams 3bc7064
refactor: simplifies MessagePart::fromArray
JasonTheAdams a9629c4
refactor: simplifies GenerativeAiResult
JasonTheAdams 0f8f66d
fix: corrects incorrect types
JasonTheAdams 18afbb5
refactor: simplifies GenerativeAiResult::fromArray
JasonTheAdams a66a56b
fix: corrects TokenUsage types
JasonTheAdams 5bef6fb
refactor: simplifies FunctionCall
JasonTheAdams eac5146
refactor: simplifies Tool::fromArray
JasonTheAdams 2811597
refactor: simplifies WebSearch
JasonTheAdams 3e36f0f
refactor: simplifies Fiel and MessagePart toArray
JasonTheAdams b6890c8
chore: corrects too specific Message return type
JasonTheAdams cb985cc
fix: adds missing imports
JasonTheAdams 25f0491
feat: adds fromArray key validation
JasonTheAdams 87d9c67
fix: corrects linting issue
JasonTheAdams 30ee59c
refactor: adds schema constants
JasonTheAdams 59514c3
test: adds missing import
JasonTheAdams 59e586c
refactor: removes need for final DTOs
JasonTheAdams c4c6452
fix: checks for key existence, allowing null values
JasonTheAdams 342c07a
refacor: removes non-required key validation
JasonTheAdams 8ded94d
feat: validates that successful oepration has result
JasonTheAdams 6b48bef
refactor: removes potentially problematic schema condition
JasonTheAdams 3eb5279
fix: corrects either id or name to be required
JasonTheAdams 7d53157
fix: removes unnecessary Tool type validation
JasonTheAdams 75a8034
chore: marks mimeType required
JasonTheAdams 19b4692
chore: fixes since tags
JasonTheAdams 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 hidden or 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,25 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace WordPress\AiClient\Common\Contracts; | ||
|
|
||
| use JsonSerializable; | ||
|
|
||
| /** | ||
| * Interface for objects that support JSON serialization and deserialization. | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
| interface WithJsonSerialization extends JsonSerializable | ||
| { | ||
| /** | ||
| * Creates an instance from JSON data. | ||
| * | ||
| * @since 1.0.0 | ||
| * | ||
| * @param array<string, mixed> $json The JSON data. | ||
| * @return self The created instance. | ||
| */ | ||
| public static function fromJson(array $json); | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.