Pydantic Models

Smarter API Vectorsearch Manifest Constants.

Smarter API Manifest - Vectorsearch.metadata.

class smarter.apps.vectorsearch.manifest.models.vectorsearch.metadata.SAMVectorsearchMetadata(*, name: str, description: str | None, version: str | None, tags: List[str] | None = <factory>, annotations: dict[str, str] | None=<factory>)[source]

Bases: AbstractSAMMetadataBase

Smarter API Vectorsearch Manifest - Metadata class.

class_identifier: ClassVar[str] = 'Vectorsearch.metadata'
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

Smarter API Manifest - Vectorsearch.spec.

class smarter.apps.vectorsearch.manifest.models.vectorsearch.spec.SAMVectorsearchSpec(*, config: SAMVectorsearchSpecConfig)[source]

Bases: AbstractSAMSpecBase

Smarter API Vectorsearch Manifest Vectorsearch.spec.

class_identifier: ClassVar[str] = 'Vectorsearch.spec'
config: SAMVectorsearchSpecConfig
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

class smarter.apps.vectorsearch.manifest.models.vectorsearch.spec.SAMVectorsearchSpecConfig(*, vectorstore_name: str, auth_secret_name: str | None = None, search_type: VectorsearchSearchType = VectorsearchSearchType.SIMILARITY, k: Annotated[int, Gt(gt=0)] = 4, score_threshold: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, fetch_k: Annotated[int | None, Gt(gt=0)] = None, lambda_mult: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, metadata_filter: dict | None = None, is_enabled: bool = True)[source]

Bases: AbstractSAMSpecBase

Smarter API Vectorsearch Manifest Vectorsearch.spec.config.

auth_secret_name: str | None
class_identifier: ClassVar[str] = 'Vectorsearch.spec.configuration'
fetch_k: int | None
is_enabled: bool
k: int
lambda_mult: float | None
metadata_filter: dict | None
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

score_threshold: float | None
search_type: VectorsearchSearchType
classmethod strip_and_validate_name(value)[source]

Strip whitespace from vectorstore_name and auth_secret_name, and reject blank names.

Parameters:

value (str | None) – The name, or None.

Return type:

str | None

Returns:

The stripped name, or None if it was None.

Raises:

ValueError – when the name is blank.

validate_search_type_constraints()[source]

Check that the search parameters suit search_type.

score_threshold is required for, and only valid with, similarity_score_threshold. fetch_k and lambda_mult are only valid with mmr, where fetch_k must be at least k.

Return type:

SAMVectorsearchSpecConfig

Returns:

The config, unchanged.

Raises:

ValueError – when a parameter does not suit the search type.

vectorstore_name: str

Smarter API Manifest - Vectorsearch.status.

class smarter.apps.vectorsearch.manifest.models.vectorsearch.status.SAMVectorsearchStatus(*, recordLocator: str, created: datetime, modified: datetime, dependencies: List[SAMDependency] | None = None, accountNumber: str, username: str)[source]

Bases: AbstractSAMStatusBase

Smarter API Vectorsearch Manifest - Status class.

accountNumber: str
class_identifier: ClassVar[str] = 'Vectorsearch.status'
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

username: str

Smarter API Vectorsearch Manifest.

class smarter.apps.vectorsearch.manifest.models.vectorsearch.model.SAMVectorsearch(*, apiVersion: str, kind: str, metadata: SAMVectorsearchMetadata, spec: SAMVectorsearchSpec, status: SAMVectorsearchStatus | None = None)[source]

Bases: AbstractSAMBase

Smarter API Manifest - Vectorsearch.

class_identifier: ClassVar[str] = 'Vectorsearch'
metadata: SAMVectorsearchMetadata
model_config = {'arbitrary_types_allowed': True, 'from_attributes': True, 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)

This function is meant to behave like a BaseModel method to initialize private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self (BaseModel) – The BaseModel instance.

  • context (Any) – The context.

Return type:

None

spec: SAMVectorsearchSpec
status: SAMVectorsearchStatus | None