Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
65f041e
feat: adds implementor DTOs
Jul 22, 2025
550acc2
refactor: resolves linting errors
Jul 22, 2025
9875f84
refactor: uses inheritDoct to reduce redundancy
Jul 22, 2025
928b311
Merge branch 'feature/unit-tests' into feature/data-transfer-objects
Jul 23, 2025
5414454
refactor: removes embedding DTOs for now
Jul 23, 2025
5821bb2
chore: fixes doc formatting
Jul 23, 2025
f1ace57
refactor: cleans up mime type and json schema
Jul 24, 2025
cb20ce1
refactor: swaps file parameter order
Jul 24, 2025
ac3c9e7
feat: parses mime type from base64 data
Jul 24, 2025
ec93ff4
feat: parses mime type from extension
Jul 24, 2025
f9d19af
feat: parses mime type from url extension
Jul 24, 2025
11c3c03
refactor: getValues returns only values
Jul 24, 2025
ab0cc93
refactor: cleans up Message DTO
Jul 24, 2025
109c17f
refactor: cleans up MessagePart static methods
Jul 24, 2025
7ca0389
test: fixes getValues enum tests
Jul 24, 2025
eb386cf
refactor: improves type inferrence and json schema
Jul 24, 2025
6f51c80
refactor: removes role-message text methods
Jul 24, 2025
fefab6e
chore: adds property-read for nameand value
Jul 24, 2025
c213c49
feat: validates message role
Jul 24, 2025
4e04fb5
refactor: improves schema accuracy
Jul 24, 2025
d51a35f
refactor: improves Result structure
Jul 24, 2025
05b57c6
refactor: switches to mime type VO pattern
Jul 24, 2025
f99535e
refactor: consolidates mime type schema
Jul 24, 2025
c5b632e
refactor: renames candidate count method
Jul 24, 2025
0540ea8
feat: adds toFiles() method
Jul 24, 2025
a80601e
refactor: cleans up Tool to work like MessagePart
Jul 24, 2025
b5bb8ee
feat: adds response type to FunctionResponse
Jul 24, 2025
849558c
fix: adds missing parameter types
Jul 24, 2025
a1867dc
refactor: uses enum for json enum values
Jul 24, 2025
af53eaf
feat: adds pure base64 support to InlineFile
Jul 24, 2025
76f6b7b
fix: normalizes mime type value for comparison
Jul 24, 2025
cbd489d
chore: adjusts doc type to appease PHPStan bug
Jul 25, 2025
4c25a86
feat: adds file type checking
Jul 25, 2025
980a880
refactor: consolidates down to a single File class
Jul 25, 2025
c19aa8d
refactor: removes FileInterface
Jul 25, 2025
e93e2ee
refactor: returns null for non-type getters
Jul 25, 2025
b7b7b63
refactor: splits up data and url parameters
Jul 25, 2025
314e9f4
refactor: renames data to base64Data
Jul 25, 2025
e7a58d0
feat: adds file type to json schema
Jul 25, 2025
f87fcde
refactor: moves document types to static property
Jul 25, 2025
e4d5c3f
refactore: updates phpstan to not treat doc types as certain
Jul 25, 2025
62b8776
refactor: adjusts function requirements
Jul 25, 2025
82e6c8f
test: adds unit tests
Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ parameters:
level: max
paths:
- src
treatPhpDocTypesAsCertain: false
7 changes: 5 additions & 2 deletions src/Common/AbstractEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
* $enum->is(PersonEnum::firstName()); // Returns true
* PersonEnum::cases(); // Returns array of all enum instances
*
* @property-read string $value The value of the enum instance.
* @property-read string $name The name of the enum constant.
*
* @since n.e.x.t
*/
abstract class AbstractEnum
Expand Down Expand Up @@ -195,11 +198,11 @@ final public function is(self $other): bool
*
* @since n.e.x.t
*
* @return array<string, string> Map of constant names to values.
* @return string[] List of all enum values.
*/
final public static function getValues(): array
{
return self::getConstants();
return array_values(self::getConstants());
}

/**
Expand Down
25 changes: 25 additions & 0 deletions src/Common/Contracts/WithJsonSchemaInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace WordPress\AiClient\Common\Contracts;

/**
* Interface for objects that can provide their JSON schema representation.
*
* This interface is implemented by DTOs to provide a consistent way to retrieve
* their JSON schema for validation and serialization purposes.
*
* @since n.e.x.t
*/
interface WithJsonSchemaInterface
{
/**
* Gets the JSON schema representation of the object.
*
* @since n.e.x.t
*
* @return array<string, mixed> The JSON schema as an associative array.
*/
public static function getJsonSchema(): array;
}
Loading