Skip to content

Commit b7c9824

Browse files
feat: enhance API functionality with new endpoints and request structures
- Added methods for tenant management: create, update, and retrieve tenants. - Introduced new endpoints for collection management: create, update, delete, and query collections. - Updated existing methods to improve clarity and functionality, including health checks and user identity retrieval. - Enhanced request classes with detailed parameter documentation for better usability. - Refactored existing methods to align with new naming conventions for consistency.
1 parent 36cbd51 commit b7c9824

12 files changed

Lines changed: 371 additions & 207 deletions

src/Api.php

Lines changed: 286 additions & 43 deletions
Large diffs are not rendered by default.

src/Requests/AddEmbeddingRequest.php

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,18 @@
1010
*/
1111
class AddEmbeddingRequest
1212
{
13+
/**
14+
* @param float[][] $embeddings Optional embeddings of the items to add.
15+
* @param array<array<string, string>> $metadatas Optional metadatas of the items to add.
16+
* @param string[] $ids IDs of the items to add.
17+
* @param string[] $documents Optional documents of the items to add.
18+
* @param string[] $images Optional images of the items to add.
19+
*/
1320
public function __construct(
14-
/**
15-
* Optional embeddings of the items to add.
16-
*
17-
* @var float[][]
18-
*/
1921
public readonly ?array $embeddings,
20-
21-
/**
22-
* Optional metadatas of the items to add.
23-
*
24-
* @var array<array<string, string>>
25-
*/
2622
public readonly ?array $metadatas,
27-
28-
/**
29-
* IDs of the items to add.
30-
*
31-
* @var string[]
32-
*/
3323
public readonly array $ids,
34-
35-
/**
36-
* Optional documents of the items to add.
37-
*
38-
* @var string[]
39-
*/
4024
public readonly ?array $documents,
41-
4225
public readonly ?array $images,
4326

4427
) {}

src/Requests/CreateCollectionRequest.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,14 @@
1010
*/
1111
class CreateCollectionRequest
1212
{
13+
/**
14+
* @param string $name The name of the collection
15+
* @param array<string, string> $metadata The metadata of the collection
16+
* @param bool $getOrCreate If true, will return existing collection if it exists, otherwise will throw an exception.
17+
*/
1318
public function __construct(
14-
/**
15-
* The name of the collection
16-
*/
1719
public readonly string $name,
18-
19-
/**
20-
* The metadata of the collection
21-
*
22-
* @var array<string, string>
23-
*/
2420
public readonly ?array $metadata,
25-
26-
/**
27-
* If true, will return existing collection if it exists.
28-
*/
2921
public readonly bool $getOrCreate = false,
3022
) {}
3123

src/Requests/CreateDatabaseRequest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
class CreateDatabaseRequest
99
{
10+
/**
11+
* @param string $name The name of the database
12+
*/
1013
public function __construct(
1114
public readonly string $name,
1215
) {}

src/Requests/CreateTenantRequest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
class CreateTenantRequest
99
{
10+
/**
11+
* @param string $name The name of the tenant
12+
*/
1013
public function __construct(
1114
public readonly string $name,
1215
) {}

src/Requests/DeleteEmbeddingRequest.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,14 @@
77

88
class DeleteEmbeddingRequest
99
{
10+
/**
11+
* @param string[] $ids Optional IDs of the items to delete.
12+
* @param array<string, string> $where Optional query condition to filter items to delete based on metadata values.
13+
* @param array<string, string> $whereDocument Optional query condition to filter items to delete based on document content.
14+
*/
1015
public function __construct(
11-
/**
12-
* Optional IDs of the items to delete.
13-
*
14-
* @var string[]
15-
*/
1616
public readonly ?array $ids,
17-
18-
/**
19-
* Optional query condition to filter items to delete based on metadata values.
20-
*
21-
* @var array<string, string>
22-
*/
2317
public readonly ?array $where,
24-
25-
/**
26-
* Optional query condition to filter items to delete based on document content.
27-
*
28-
* @var array<string, string>
29-
*/
3018
public readonly ?array $whereDocument,
3119
) {}
3220

src/Requests/GetEmbeddingRequest.php

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,22 @@
1010
*/
1111
class GetEmbeddingRequest
1212
{
13+
/**
14+
* @param string[] $ids Optional IDs of the items to get.
15+
* @param array<string, mixed> $where Optional where clause to filter items by.
16+
* @param array<string, mixed> $whereDocument Optional where clause to filter items by.
17+
* @param string $sort Optional sort items.
18+
* @param int $limit Optional limit on the number of items to get.
19+
* @param int $offset Optional offset on the number of items to get.
20+
* @param string[] $include Optional list of items to include in the response.
21+
*/
1322
public function __construct(
14-
/**
15-
* Optional IDs of the items to get.
16-
*
17-
* @var string[]
18-
*/
1923
public readonly ?array $ids = null,
20-
21-
/**
22-
* Optional where clause to filter items by.
23-
*
24-
* @var array<string, mixed>
25-
*/
2624
public readonly ?array $where = null,
27-
28-
/**
29-
* Optional where clause to filter items by.
30-
*
31-
* @var array<string, mixed>
32-
*/
3325
public readonly ?array $whereDocument = null,
34-
35-
/**
36-
* Sort items.
37-
*/
3826
public readonly ?string $sort = null,
39-
40-
/**
41-
* Optional limit on the number of items to get.
42-
*/
4327
public readonly ?int $limit = null,
44-
45-
/**
46-
* Optional offset on the number of items to get.
47-
*/
4828
public readonly ?int $offset = null,
49-
50-
/**
51-
* Optional list of items to include in the response.
52-
*
53-
* @var string[]
54-
*/
5529
public readonly ?array $include = null,
5630
) {}
5731

src/Requests/QueryEmbeddingRequest.php

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,18 @@
77

88
class QueryEmbeddingRequest
99
{
10+
/**
11+
* @param array<string, string> $where Optional query condition to filter results based on metadata values.
12+
* @param array<string, mixed> $whereDocument Optional query condition to filter results based on document content.
13+
* @param float[][] $queryEmbeddings Optional query condition to filter results based on embedding content.
14+
* @param int $nResults Optional number of results to return. Defaults to 10.
15+
* @param string[] $include Optional list of items to include in the response.
16+
*/
1017
public function __construct(
11-
/**
12-
* Optional query condition to filter results based on metadata values.
13-
*
14-
* @var array<string, string>
15-
*/
1618
public readonly ?array $where,
17-
18-
/**
19-
* Optional query condition to filter results based on document content.
20-
*
21-
* @var array<string, mixed>
22-
*/
2319
public readonly ?array $whereDocument,
24-
25-
/**
26-
* Optional query condition to filter results based on embedding content.
27-
*
28-
* @var float[][]
29-
*/
3020
public readonly ?array $queryEmbeddings,
31-
32-
/**
33-
* Optional number of results to return. Defaults to 10.
34-
*/
3521
public readonly ?int $nResults,
36-
37-
/**
38-
* Optional list of items to include in the response.
39-
*
40-
* @var string[]
41-
*/
4222
public readonly ?array $include,
4323
) {}
4424

src/Requests/UpdateCollectionRequest.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@
77

88
class UpdateCollectionRequest
99
{
10+
/**
11+
* @param mixed $newName New name of the collection.
12+
* @param mixed $newMetadata New metadata of the collection.
13+
*/
1014
public function __construct(
11-
/**
12-
* New name of the collection.
13-
*/
1415
public readonly ?string $newName,
15-
16-
/**
17-
* New metadata of the collection.
18-
*
19-
* @var array<string, string>
20-
*/
2116
public readonly ?array $newMetadata,
22-
2317
) {}
2418

2519
public static function create(array $data): self

src/Requests/UpdateEmbeddingRequest.php

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,18 @@
77

88
class UpdateEmbeddingRequest
99
{
10+
/**
11+
* @param float[][] $embeddings Optional embeddings of the items to update.
12+
* @param string[] $ids IDs of the items to update.
13+
* @param array<string, string> $metadatas Optional metadatas of the items to update.
14+
* @param string[] $documents Optional documents of the items to update.
15+
* @param string[] $images Optional images of the items to update.
16+
*/
1017
public function __construct(
11-
/**
12-
* Optional embeddings of the items to update.
13-
*
14-
* @var float[][]
15-
*/
1618
public readonly ?array $embeddings,
17-
18-
19-
/**
20-
* IDs of the items to update.
21-
*
22-
* @var string[]
23-
*/
2419
public readonly array $ids,
25-
26-
/**
27-
* Optional metadatas of the items to update.
28-
*
29-
* @var array<string, string>[]
30-
*/
3120
public readonly ?array $metadatas,
32-
33-
/**
34-
* Optional documents of the items to update.
35-
*
36-
* @var string[]
37-
*/
3821
public readonly ?array $documents,
39-
40-
/**
41-
* Optional uris of the items to update.
42-
*
43-
* @var string[]
44-
*/
4522
public readonly ?array $images,
4623
) {}
4724

0 commit comments

Comments
 (0)