Django ORM
All models for the Vectorsearch app.
- class smarter.apps.vectorsearch.models.Vectorsearch(*args, **kwargs)[source]
Bases:
MetaDataWithOwnershipModelImplements the Vectorsearch API model.
A Vectorsearch is a named, ownable configuration describing how to execute a semantic search against a single VectorstoreMeta. It does not itself hold embeddings/documents – it references a VectorstoreMeta for that – and it does not generate text. Combine a Vectorsearch with a Smarter LLMClient to build a RAG pipeline: the top-k results returned by the Vectorsearch are injected into the LLMClient’s system prompt at inference time.
- 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’.
search_type (Unknown) – Search type. The retrieval strategy to use when querying the VectorstoreMeta.
k (Unknown) –
Number of top results to return from the search.
score_threshold (Unknown) – Score threshold. Minimum relevance score (0.0-1.0) a result must meet to be included. Only applicable when search_type=’similarity_score_threshold’.
fetch_k (Unknown) – Fetch k. Number of candidate documents to fetch before applying MMR re-ranking. Only applicable when search_type=’mmr’.
lambda_mult (Unknown) – Lambda mult. Diversity vs. relevance trade-off for MMR, between 0.0 (max diversity) and 1.0 (max relevance). Only applicable when search_type=’mmr’.
metadata_filter (Unknown) – Metadata filter. Optional metadata filter applied to the VectorstoreMeta query, e.g. {‘source’: ‘faq’}.
is_enabled (Unknown) – Is enabled. Whether this Vectorsearch is active and eligible to be queried.
Relationship fields:
- Parameters:
user_profile (Unknown) – User profile (related name:
vectorsearch)vectorstore (Unknown) – Vectorstore. The locally-hosted VectorstoreMeta this search queries against. (related name:
vectorsearches)auth_secret (Unknown) – Auth secret. Optional credential used to authenticate against the VectorstoreMeta, if required. (related name:
vectorsearches)tags (Unknown) – Tags. Tags for categorizing and organizing this resource. (related name:
vectorsearch)tagged_items (Unknown) – Tagged items (related name:
+)
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- exception NotUpdated
Bases:
ObjectNotUpdated,DatabaseError
- auth_secret
ForeignKeytoSecretAuth secret. Optional credential used to authenticate against the VectorstoreMeta, if required. (related name:
vectorsearches)- Type:
Type
- auth_secret_id
Internal field, use
auth_secretinstead.
- clean()[source]
Validate the search parameters against
search_type.kmust be positive.score_thresholdis required for, and only valid with,similarity_score_threshold.fetch_kandlambda_multare only valid withmmr, wherefetch_kmust be at leastkandlambda_multbetween 0.0 and 1.0.- Raises:
ValidationError – when a parameter does not suit the search 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
- description
-
Description. A brief description of this resource. Be verbose, but not too verbose.
- Type:
Type
- fetch_k
-
Fetch k. Number of candidate documents to fetch before applying MMR re-ranking. Only applicable when search_type=’mmr’.
- Type:
Type
- get_search_type_display(*, field=<django.db.models.CharField: search_type>)
Shows the label of the
search_type. Seeget_FOO_display()for more information.
- id: int
-
Primary key: ID
The row’s primary key, which Django adds to every concrete model. Declared, without a value, only so that type checkers know it: Django ignores a bare annotation.
- Type:
Type
- is_enabled
-
Is enabled. Whether this Vectorsearch is active and eligible to be queried.
- Type:
Type
- k
-
Number of top results to return from the search.
- Type:
Type
- lambda_mult
-
Lambda mult. Diversity vs. relevance trade-off for MMR, between 0.0 (max diversity) and 1.0 (max relevance). Only applicable when search_type=’mmr’.
- Type:
Type
- metadata_filter
-
Metadata filter. Optional metadata filter applied to the VectorstoreMeta query, e.g. {‘source’: ‘faq’}.
- Type:
Type
- score_threshold
-
Score threshold. Minimum relevance score (0.0-1.0) a result must meet to be included. Only applicable when search_type=’similarity_score_threshold’.
- Type:
Type
- search_type
-
Search type. The retrieval strategy to use when querying the VectorstoreMeta.
Choices:
similaritysimilarity_score_thresholdmmr
- Type:
Type
- tagged_items
Reverse
GenericRelationfromVectorsearchAll + 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:
vectorsearch)- Type:
Type
- user_profile_id
Internal field, use
user_profileinstead.
- vectorstore
-
Vectorstore. The locally-hosted VectorstoreMeta this search queries against. (related name:
vectorsearches)- Type:
Type
- vectorstore_id
Internal field, use
vectorstoreinstead.