Vectorstor ORM Models
Vectorstore models.
- class smarter.apps.vectorstore.models.EmbeddingsInterface(*args, **kwargs)[source]
Bases:
TimestampedModelModel representing the SAMEmbeddingsInterface configuration for a vector database.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
config (Unknown) – Config. Additional configuration settings for the embeddings interface.
dimensions (Unknown) – Dimensions. Number of embedding dimensions.
deployment (Unknown) – Deployment. Deployment name or model name.
api_version (Unknown) – Api version. OpenAI API version.
base_url (Unknown) – Base url. Base URL for OpenAI API.
openai_api_type (Unknown) – Openai api type. OpenAI API type.
openai_api_proxy (Unknown) – Openai api proxy. Proxy URL for OpenAI API.
embedding_ctx_length (Unknown) – Embedding ctx length. Embedding context length.
api_key (Unknown) – Api key. OpenAI API key or secret reference.
organization (Unknown) – Organization. OpenAI organization ID.
allowed_special (Unknown) – Allowed special. Allowed special tokens (set[str] or ‘all’).
disallowed_special (Unknown) – Disallowed special. Disallowed special tokens (set, sequence, or ‘all’).
chunk_size (Unknown) – Chunk size. Chunk size for embedding requests.
max_retries (Unknown) – Max retries. Maximum number of retries for API calls.
timeout (Unknown) – Timeout. Timeout for API requests (float, tuple, or other).
headers (Unknown) – Headers. Custom headers for API requests.
tiktoken_enabled (Unknown) – Tiktoken enabled. Enable tiktoken for tokenization.
tiktoken_model_name (Unknown) – Tiktoken model name. Tiktoken model name.
show_progress_bar (Unknown) – Show progress bar. Show progress bar during embedding.
model_kwargs (Unknown) – Model kwargs. Additional model keyword arguments.
skip_empty (Unknown) – Skip empty. Skip empty inputs.
default_headers (Unknown) – Default headers. Default headers for API requests.
default_query (Unknown) – Default query. Default query parameters for API requests.
retry_min_seconds (Unknown) – Retry min seconds. Minimum seconds between retries.
retry_max_seconds (Unknown) – Retry max seconds. Maximum seconds between retries.
check_ctx_length (Unknown) – Check ctx length. Check embedding context length.
Relationship fields:
- Parameters:
vectorestore_meta (Unknown) – Vectorestore meta. The associated VectorestoreMeta object for this EmbeddingsInterface configuration. (related name:
embeddings_interface)provider (Unknown) – Provider. The provider associated with this vector database. (related name:
vector_databases)provider_model (Unknown) – Provider model. The provider model associated with this vector database. (related name:
vector_databases)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- check_ctx_length
-
Check ctx length. Check embedding context length.
- Type:
Type
- chunk_size
-
Chunk size. Chunk size for embedding requests.
- Type:
Type
- config
-
Config. Additional configuration settings for the embeddings interface.
- Type:
Type
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- dimensions
-
Dimensions. Number of embedding dimensions.
- Type:
Type
- disallowed_special
-
Disallowed special. Disallowed special tokens (set, sequence, or ‘all’).
- Type:
Type
- embedding_ctx_length
-
Embedding ctx length. Embedding context length.
- Type:
Type
- id
-
Primary key: ID
- Type:
Type
- max_retries
-
Max retries. Maximum number of retries for API calls.
- Type:
Type
- objects = <django.db.models.Manager object>
- provider
-
Provider. The provider associated with this vector database. (related name:
vector_databases)- Type:
Type
- provider_model
-
Provider model. The provider model associated with this vector database. (related name:
vector_databases)- Type:
Type
- provider_model_id
Internal field, use
provider_modelinstead.
- retry_max_seconds
-
Retry max seconds. Maximum seconds between retries.
- Type:
Type
- retry_min_seconds
-
Retry min seconds. Minimum seconds between retries.
- Type:
Type
- save(*args, **kwargs)[source]
Override the save method to include validation for the embeddings provider model’s embedding support.
- show_progress_bar
-
Show progress bar. Show progress bar during embedding.
- Type:
Type
- skip_empty
-
Skip empty. Skip empty inputs.
- Type:
Type
- tiktoken_enabled
-
Tiktoken enabled. Enable tiktoken for tokenization.
- Type:
Type
- timeout
-
Timeout. Timeout for API requests (float, tuple, or other).
- Type:
Type
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- vectorestore_meta
OneToOneFieldtoVectorestoreMetaVectorestore meta. The associated VectorestoreMeta object for this EmbeddingsInterface configuration. (related name:
embeddings_interface)- Type:
Type
- vectorestore_meta_id
Internal field, use
vectorestore_metainstead.
- class smarter.apps.vectorstore.models.IndexModelInterface(*args, **kwargs)[source]
Bases:
TimestampedModelModel representing the SAMIndexModelInterface configuration for a vector database.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
spec (Unknown) – Spec. Index deployment spec. Accepts a dict, ServerlessSpec, PodSpec, or ByocSpec. Example: ServerlessSpec(cloud=CloudProvider.AWS, region=AwsRegion.US_EAST_1)
dimension (Unknown) – Dimension. Number of dimensions for the index. Must be between 1 and 20,000, or None. Example: 1536.
metric (Unknown) – Metric. Distance metric for similarity search. Accepts Metric enum or string. Default: ‘cosine’.
timeout (Unknown) – Timeout. Timeout in seconds for index operations. Must be greater than zero or None.
deletion_protection (Unknown) – Deletion protection. Deletion protection setting. Accepts DeletionProtection enum or string. Default: ‘disabled’.
vector_type (Unknown) – Vector type. Type of vector. Accepts VectorType enum or string. Default: ‘dense’.
Relationship fields:
- Parameters:
vectorestore_meta (Unknown) – Vectorestore meta. The associated VectorestoreMeta object for this IndexModelInterface configuration. (related name:
index_model_interface)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- deletion_protection
-
Deletion protection. Deletion protection setting. Accepts DeletionProtection enum or string. Default: ‘disabled’.
- Type:
Type
- dimension
-
Dimension. Number of dimensions for the index. Must be between 1 and 20,000, or None. Example: 1536.
- Type:
Type
- id
-
Primary key: ID
- Type:
Type
- metric
-
Metric. Distance metric for similarity search. Accepts Metric enum or string. Default: ‘cosine’.
- Type:
Type
- objects = <django.db.models.Manager object>
- spec
-
Spec. Index deployment spec. Accepts a dict, ServerlessSpec, PodSpec, or ByocSpec. Example: ServerlessSpec(cloud=CloudProvider.AWS, region=AwsRegion.US_EAST_1)
- Type:
Type
- timeout
-
Timeout. Timeout in seconds for index operations. Must be greater than zero or None.
- Type:
Type
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- vector_type
-
Vector type. Type of vector. Accepts VectorType enum or string. Default: ‘dense’.
- Type:
Type
- vectorestore_meta
OneToOneFieldtoVectorestoreMetaVectorestore meta. The associated VectorestoreMeta object for this IndexModelInterface configuration. (related name:
index_model_interface)- Type:
Type
- vectorestore_meta_id
Internal field, use
vectorestore_metainstead.
- class smarter.apps.vectorstore.models.VectorestoreMeta(*args, **kwargs)[source]
Bases:
MetaDataWithOwnershipModelModel representing a vector database.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
name (Unknown) – Name. Name in camelCase, e.g., ‘apiKey’, no special characters.
description (Unknown) – Description. A brief description of this resource. Be verbose, but not too verbose.
version (Unknown) – Version. Semantic version in the format MAJOR.MINOR.PATCH, e.g., ‘1.0.0’.
annotations (Unknown) – Annotations. Key-value pairs for annotating this resource.
backend (Unknown) – Backend. The backend type for the vector database (e.g., qdrant, weaviate, pinecone).
is_active (Unknown) – Is active. Indicates whether the vector database is active.
status (Unknown) – Status. The current status of the vector database (e.g., provisioning, ready, failed, deleting).
Relationship fields:
- Parameters:
user_profile (Unknown) – User profile (related name:
vectorestoremeta)connection (Unknown) – Connection. The Smarter Connection object containing connection details for the vector database. If provided, this connection will be used instead of the host, port, auth_config, and password fields to establish the connection. The Connection object must be owned by the authenticated API user and must contain the necessary information to connect to the vector database. (related name:
vector_databases)tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name:
vectorestoremeta)tagged_items (Unknown) – Tagged items (related name:
+)
Reverse relationships:
- Parameters:
embeddings_interface (Unknown) – The embeddings interface of this Vectorstore Metadata (related name of
vectorestore_meta)index_model_interface (Unknown) – The index model interface of this Vectorstore Metadata (related name of
vectorestore_meta)vectorstore_interface (Unknown) – The vectorstore interface of this Vectorstore Metadata (related name of
vectorestore_meta)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- backend
-
Backend. The backend type for the vector database (e.g., qdrant, weaviate, pinecone).
Choices:
qdrantweaviatepinecone
- Type:
Type
- connection
ForeignKeytoApiConnectionConnection. The Smarter Connection object containing connection details for the vector database. If provided, this connection will be used instead of the host, port, auth_config, and password fields to establish the connection. The Connection object must be owned by the authenticated API user and must contain the necessary information to connect to the vector database. (related name:
vector_databases)- Type:
Type
- connection_id
Internal field, use
connectioninstead.
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- description
-
Description. A brief description of this resource. Be verbose, but not too verbose.
- Type:
Type
- embeddings_interface
Reverse
OneToOneFieldfromEmbeddingsInterfaceThe embeddings interface of this Vectorstore Metadata (related name of
vectorestore_meta)- Type:
Type
- get_backend_display(*, field=<django.db.models.CharField: backend>)
Shows the label of the
backend. Seeget_FOO_display()for more information.
- classmethod get_cached_object(*args, backend=None, **kwargs)[source]
Retrieve a cached VectorestoreMeta object based on the provided name and backend. This method is used to optimize backend retrieval by caching database objects.
- Return type:
- Parameters:
backend (str) – The backend kind of the vector database.
- Returns:
The cached VectorestoreMeta object matching the name and backend.
- Return type:
- classmethod get_cached_vectorstores_for_user(user, invalidate=False)[source]
Return a list of all instances of
VectorestoreMeta.This method retrieves all vector store objects associated with the user’s account. It is useful for enumerating all available vector stores for a given user.
- Parameters:
user (
User) – The user whose vector stores should be retrieved.- Returns:
A list of all vector store instances for the user’s account.
- Return type:
Example:
vectorstores = VectorestoreMeta.get_cached_vectorstores_for_user(user) # returns [<VectorestoreMeta ...>, <VectorestoreMeta ...>, ...]
See also:
- get_status_display(*, field=<django.db.models.CharField: status>)
Shows the label of the
status. Seeget_FOO_display()for more information.
- id
-
Primary key: ID
- Type:
Type
- index_model_interface
Reverse
OneToOneFieldfromIndexModelInterfaceThe index model interface of this Vectorstore Metadata (related name of
vectorestore_meta)- Type:
Type
- is_active
-
Is active. Indicates whether the vector database is active.
- Type:
Type
- objects: MetaDataWithOwnershipModelManager = <smarter.apps.account.models.metadata_with_ownership.MetaDataWithOwnershipModelManager object>
- status
-
Status. The current status of the vector database (e.g., provisioning, ready, failed, deleting).
Choices:
provisioningreadyfaileddeleting
- Type:
Type
- tagged_items
Reverse
GenericRelationfromVectorestoreMetaAll + of this tagged item (related name of
tagged_items)- Type:
Type
- tags = <taggit.managers._TaggableManager object>
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- user_profile
-
User profile (related name:
vectorestoremeta)- Type:
Type
- user_profile_id
Internal field, use
user_profileinstead.
- vectorstore_interface
Reverse
OneToOneFieldfromVectorstoreInterfaceThe vectorstore interface of this Vectorstore Metadata (related name of
vectorestore_meta)- Type:
Type
- class smarter.apps.vectorstore.models.VectorstoreBackendKind(*values)[source]
Bases:
TextChoicesEnum representing the supported backend kinds for the vector database.
- PINECONE = 'pinecone'
- QDRANT = 'qdrant'
- WEAVIATE = 'weaviate'
- class smarter.apps.vectorstore.models.VectorstoreInterface(*args, **kwargs)[source]
Bases:
TimestampedModelModel representing the VectorstoreInterface configuration for a vector database.
- Parameters:
id (Unknown) – Primary key: ID
created_at (Unknown) – Created at
updated_at (Unknown) – Updated at
text_key (Unknown) – Text key. The key in the vector database where the original text is stored, if applicable.
namespace (Unknown) – Namespace. The namespace to use for the vector database, if applicable.
distance_strategy (Unknown) – Distance strategy. The distance strategy to use for similarity search (e.g., cosine, euclidean, dot_product), if applicable.
Relationship fields:
- Parameters:
vectorestore_meta (Unknown) – Vectorestore meta. The associated VectorestoreMeta object for this VectorstoreInterface configuration. (related name:
vectorstore_interface)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- created_at
-
Created at
Timestamp indicating when the model instance was created.
This field is automatically set to the current date and time when the instance is first created. It is indexed in the database for efficient querying.
- Type:
Type
- distance_strategy
-
Distance strategy. The distance strategy to use for similarity search (e.g., cosine, euclidean, dot_product), if applicable.
- Type:
Type
- id
-
Primary key: ID
- Type:
Type
- namespace
-
Namespace. The namespace to use for the vector database, if applicable.
- Type:
Type
- objects = <django.db.models.Manager object>
- text_key
-
Text key. The key in the vector database where the original text is stored, if applicable.
- Type:
Type
- updated_at
-
Updated at
Timestamp indicating when the model instance was last updated.
This field is automatically updated to the current date and time whenever the instance is saved. It is indexed in the database for efficient querying.
- Type:
Type
- vectorestore_meta
OneToOneFieldtoVectorestoreMetaVectorestore meta. The associated VectorestoreMeta object for this VectorstoreInterface configuration. (related name:
vectorstore_interface)- Type:
Type
- vectorestore_meta_id
Internal field, use
vectorestore_metainstead.