From 75045ffd58673fad7ec92cac7367056e18d95cfb Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Wed, 12 Nov 2025 16:28:15 +0530 Subject: [PATCH] added constants for the vector dimension --- src/Appwrite/Platform/Modules/Databases/Constants.php | 3 +++ .../Modules/Databases/Http/VectorDB/Collections/Create.php | 2 +- .../Modules/Databases/Http/VectorDB/Collections/Update.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Modules/Databases/Constants.php b/src/Appwrite/Platform/Modules/Databases/Constants.php index 8735f4b981..34142b57b0 100644 --- a/src/Appwrite/Platform/Modules/Databases/Constants.php +++ b/src/Appwrite/Platform/Modules/Databases/Constants.php @@ -26,3 +26,6 @@ const COLLECTIONS = 'collection'; const TABLESDB = 'tablesdb'; const DOCUMENTSDB = 'documentsdb'; const VECTORDB = 'vectordb'; + +const MIN_VECTOR_DIMENSION = 1; +const MAX_VECTOR_DIMENSION = 16000; \ No newline at end of file diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Create.php index e1c9998323..34e81dec3e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Create.php @@ -69,7 +69,7 @@ class Create extends CollectionAction ->param('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) ->param('collectionId', '', fn (Database $dbForProject) => new CustomId(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.', false, ['dbForProject']) ->param('name', '', new Text(128), 'Collection name. Max length: 128 chars.') - ->param('dimensions', null, new Range(1, 16000), 'Embedding dimensions.') + ->param('dimensions', null, new Range(MIN_VECTOR_DIMENSION, MAX_VECTOR_DIMENSION), 'Embedding dimensions.') ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true) diff --git a/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Update.php b/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Update.php index b2b0d8e57b..06ba3fdc2e 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Update.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/VectorDB/Collections/Update.php @@ -59,7 +59,7 @@ class Update extends CollectionAction ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID.') ->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.') - ->param('dimensions', null, new Range(1, 16000), 'Embedding dimensions.', true) + ->param('dimensions', null, new Range(MIN_VECTOR_DIMENSION, MAX_VECTOR_DIMENSION), 'Embedding dimensions.', true) ->param('permissions', null, new Permissions(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('documentSecurity', false, new Boolean(true), 'Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions).', true) ->param('enabled', true, new Boolean(), 'Is collection enabled? When set to \'disabled\', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled.', true)