Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions src/Resources/VectorStores.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function create(array $parameters): VectorStoreResponse
{
$payload = Payload::create('vector_stores', $parameters);

/** @var Response<array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
/** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
$response = $this->transporter->requestObject($payload);

return VectorStoreResponse::from($response->data(), $response->meta());
Expand All @@ -46,7 +46,7 @@ public function list(array $parameters = []): VectorStoreListResponse
{
$payload = Payload::list('vector_stores', $parameters);

/** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}> $response */
/** @var Response<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}> $response */
$response = $this->transporter->requestObject($payload);

return VectorStoreListResponse::from($response->data(), $response->meta());
Expand All @@ -61,7 +61,7 @@ public function retrieve(string $vectorStoreId): VectorStoreResponse
{
$payload = Payload::retrieve('vector_stores', $vectorStoreId);

/** @var Response<array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
/** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
$response = $this->transporter->requestObject($payload);

return VectorStoreResponse::from($response->data(), $response->meta());
Expand All @@ -78,7 +78,7 @@ public function modify(string $vectorStoreId, array $parameters): VectorStoreRes
{
$payload = Payload::modify('vector_stores', $vectorStoreId, $parameters);

/** @var Response<array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
/** @var Response<array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}> $response */
$response = $this->transporter->requestObject($payload);

return VectorStoreResponse::from($response->data(), $response->meta());
Expand Down
6 changes: 3 additions & 3 deletions src/Responses/VectorStores/VectorStoreListResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use OpenAI\Testing\Responses\Concerns\Fakeable;

/**
* @implements ResponseContract<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}>
* @implements ResponseContract<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}>
*/
final class VectorStoreListResponse implements ResponseContract, ResponseHasMetaInformationContract
{
/**
* @use ArrayAccessible<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}>
* @use ArrayAccessible<array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool}>
*/
use ArrayAccessible;

Expand All @@ -39,7 +39,7 @@ private function __construct(
/**
* Acts as static factory, and returns a new Response instance.
*
* @param array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool} $attributes
* @param array{object: string, data: array<int, array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>, first_id: ?string, last_id: ?string, has_more: bool} $attributes
*/
public static function from(array $attributes, MetaInformation $meta): self
{
Expand Down
11 changes: 7 additions & 4 deletions src/Responses/VectorStores/VectorStoreResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
use OpenAI\Testing\Responses\Concerns\Fakeable;

/**
* @implements ResponseContract<array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>
* @implements ResponseContract<array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>
*/
final class VectorStoreResponse implements ResponseContract, ResponseHasMetaInformationContract
{
/**
* @use ArrayAccessible<array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>
* @use ArrayAccessible<array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>}>
*/
use ArrayAccessible;

Expand All @@ -32,6 +32,7 @@ private function __construct(
public readonly string $object,
public readonly int $createdAt,
public readonly ?string $name,
public readonly ?string $description,
public readonly int $usageBytes,
public readonly VectorStoreResponseFileCounts $fileCounts,
public readonly string $status,
Expand All @@ -45,7 +46,7 @@ private function __construct(
/**
* Acts as static factory, and returns a new Response instance.
*
* @param array{id: string, object: string, created_at: int, name: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>} $attributes
* @param array{id: string, object: string, created_at: int, name: ?string, description: ?string, usage_bytes: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, status: string, expires_after: ?array{anchor: string, days: int}, expires_at: ?int, last_active_at: ?int, metadata: array<string, string>} $attributes
*/
public static function from(array $attributes, MetaInformation $meta): self
{
Expand All @@ -54,6 +55,7 @@ public static function from(array $attributes, MetaInformation $meta): self
$attributes['object'],
$attributes['created_at'],
$attributes['name'],
$attributes['description'],
$attributes['usage_bytes'],
VectorStoreResponseFileCounts::from($attributes['file_counts']),
$attributes['status'],
Expand All @@ -68,14 +70,15 @@ public static function from(array $attributes, MetaInformation $meta): self
/**
* {@inheritDoc}
*
* @return array{id: string, object: string, name: string|null, status: string, usage_bytes: int, created_at: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, metadata: mixed[], expires_after: array{anchor: string, days: int}|null, expires_at: int|null, last_active_at: int|null}
* @return array{id: string, object: string, name: string|null, description: string|null, status: string, usage_bytes: int, created_at: int, file_counts: array{in_progress: int, completed: int, failed: int, cancelled: int, total: int}, metadata: mixed[], expires_after: array{anchor: string, days: int}|null, expires_at: int|null, last_active_at: int|null}
*/
public function toArray(): array
{
return [
'id' => $this->id,
'object' => $this->object,
'name' => $this->name,
'description' => $this->description,
'status' => $this->status,
'usage_bytes' => $this->usageBytes,
'created_at' => $this->createdAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ final class VectorStoreListResponseFixture
'id' => 'vs_8VE2cQq1jTFlH7FizhYCzUz0',
'object' => 'vector_store',
'name' => 'Product Knowledge Base',
'description' => 'A knowledge base for product information.',
'status' => 'completed',
'attributes' => [],
'usage_bytes' => 29882,
Expand All @@ -31,6 +32,7 @@ final class VectorStoreListResponseFixture
'id' => 'vs_xzlnkCbIQE50B9A8RzmcFmtP',
'object' => 'vector_store',
'name' => null,
'description' => null,
'status' => 'completed',
'attributes' => [],
'usage_bytes' => 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class VectorStoreResponseFixture
'id' => 'vs_8VE2cQq1jTFlH7FizhYCzUz0',
'object' => 'vector_store',
'name' => 'Product Knowledge Base',
'description' => 'A knowledge base for product information.',
'status' => 'in_progress',
'usage_bytes' => 0,
'created_at' => 1_715_953_317,
Expand Down
2 changes: 2 additions & 0 deletions tests/Fixtures/VectorStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function vectorStoreResource(): array
'id' => 'vs_8VE2cQq1jTFlH7FizhYCzUz0',
'object' => 'vector_store',
'name' => 'Product Knowledge Base',
'description' => 'A knowledge base for product information.',
'status' => 'completed',
'usage_bytes' => 29882,
'created_at' => 1715953317,
Expand All @@ -35,6 +36,7 @@ function vectorStoreWithExpiresAfterResource(): array
'id' => 'vs_8VE2cQq1jTFlH7FizhYCzUz0',
'object' => 'vector_store',
'name' => 'Product Knowledge Base',
'description' => 'A knowledge base for product information.',
'status' => 'completed',
'usage_bytes' => 29882,
'created_at' => 1715953317,
Expand Down