Pydantic Models
Smarter API Proxy Manifest Constants.
Smarter API Manifest - Proxy.metadata.
- class smarter.apps.proxy.manifest.models.proxy.metadata.SAMProxyMetadata(*, name: str, description: str | None, version: str | None, tags: List[str] | None = <factory>, annotations: List[dict[str, str | int | float | bool | ~datetime.date | ~datetime.datetime | ~decimal.Decimal | ~uuid.UUID | bytes | list | dict]] | None=<factory>)[source]
Bases:
AbstractSAMMetadataBaseSmarter API Proxy Manifest - Metadata class.
Smarter API Manifest - Proxy.spec.
A Proxy forwards requests, as they are, to an LLM provider’s native API, and adds the provider’s API key, which Smarter keeps in a Secret. Callers authenticate with a Smarter API key instead, and so never see the provider’s.
spec:
provider: anthropic # the name of a Provider
apiKey: anthropic_api_key # the name of a Secret. Optional: defaults to the Provider's.
baseUrl: https://api.anthropic.com/v1/ # Optional: defaults to the Provider's.
auth:
header: x-api-key # where the provider expects its API key
scheme: "" # its prefix, e.g. Bearer. Empty for none.
headers:
anthropic-version: "2023-06-01" # added to every request
allowedPaths: # glob patterns. Empty allows every path.
- messages
- messages/count_tokens
- models
- models/*
timeout: 120 # seconds
isActive: true
A request to /api/v1/proxy/<name>/messages is forwarded to
https://api.anthropic.com/v1/messages.
- class smarter.apps.proxy.manifest.models.proxy.spec.SAMProxySpec(*, provider: str, apiKey: str | None = None, baseUrl: str | None = None, auth: SAMProxySpecAuth = <factory>, headers: dict[str, str]=<factory>, allowedPaths: list[str] = <factory>, timeout: Annotated[int, ~annotated_types.Ge(ge=1), ~annotated_types.Le(le=600)] = 120, isActive: bool = True)[source]
Bases:
ProxyBaseModelSmarter API Proxy Manifest Proxy.spec.
- auth: SAMProxySpecAuth
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', '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.
- Return type:
- Parameters:
self – The BaseModel instance.
context – The context.
- class smarter.apps.proxy.manifest.models.proxy.spec.SAMProxySpecAuth(*, header: str = 'Authorization', scheme: str | None = 'Bearer')[source]
Bases:
ProxyBaseModelSpec.auth: how the provider expects its API key.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', '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.
- Return type:
- Parameters:
self – The BaseModel instance.
context – The context.
Smarter API Manifest - Proxy.status.
- class smarter.apps.proxy.manifest.models.proxy.status.SAMProxyStatus(*, recordLocator: str, created: datetime, modified: datetime, accountNumber: str, username: str, url: str | None = None, upstreamUrl: str | None = None, apiKeySecret: str | None = None)[source]
Bases:
AbstractSAMStatusBaseSmarter API Proxy Manifest - Status class.
Read only. Besides ownership, it reports where the Proxy is, and where it forwards to.
- model_config: ClassVar[ConfigDict] = {'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.
- Return type:
- Parameters:
self – The BaseModel instance.
context – The context.
Smarter API Proxy Manifest.
- class smarter.apps.proxy.manifest.models.proxy.model.SAMProxy(*, apiVersion: str, kind: str, metadata: SAMProxyMetadata, spec: SAMProxySpec, status: SAMProxyStatus | None = None)[source]
Bases:
AbstractSAMBaseSmarter API Manifest - Proxy.
- metadata: SAMProxyMetadata
- model_config: ClassVar[ConfigDict] = {'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.
- Return type:
- Parameters:
self – The BaseModel instance.
context – The context.
- spec: SAMProxySpec
- status: SAMProxyStatus | None