nat.front_ends.fastapi.fastapi_front_end_config#

Attributes#

Classes#

EvaluateRequest

Request model for the evaluate endpoint.

BaseAsyncResponse

Base model for async responses.

EvaluateResponse

Response model for the evaluate endpoint.

AsyncGenerateResponse

Response model for the async generation endpoint.

BaseAsyncStatusResponse

Base model for async status responses.

EvaluateStatusResponse

Response model for the evaluate status endpoint.

AsyncGenerationStatusResponse

Base model for async status responses.

FastApiFrontEndConfig

A FastAPI based front end that allows a NAT workflow to be served as a microservice.

Module Contents#

logger#
YAML_EXTENSIONS = ('.yaml', '.yml')#
class EvaluateRequest(/, **data: Any)#

Bases: pydantic.BaseModel

Request model for the evaluate endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

config_file: str = None#
job_id: str | None = None#
reps: int = None#
expiry_seconds: int = None#
classmethod validate_job_id(job_id: str)#
classmethod validate_config_file(config_file: str)#
class BaseAsyncResponse(/, **data: Any)#

Bases: pydantic.BaseModel

Base model for async responses.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

job_id: str = None#
status: str = None#
class EvaluateResponse(/, **data: Any)#

Bases: BaseAsyncResponse

Response model for the evaluate endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class AsyncGenerateResponse(/, **data: Any)#

Bases: BaseAsyncResponse

Response model for the async generation endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class BaseAsyncStatusResponse(/, **data: Any)#

Bases: pydantic.BaseModel

Base model for async status responses.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

job_id: str = None#
status: str = None#
error: str | None = None#
created_at: datetime.datetime = None#
updated_at: datetime.datetime = None#
expires_at: datetime.datetime | None = None#
class EvaluateStatusResponse(/, **data: Any)#

Bases: BaseAsyncStatusResponse

Response model for the evaluate status endpoint.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

config_file: str = None#
output_path: str | None = None#
class AsyncGenerationStatusResponse(/, **data: Any)#

Bases: BaseAsyncStatusResponse

Base model for async status responses.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

output: dict | None = None#
class FastApiFrontEndConfig(/, **data: Any)#

Bases: nat.data_models.front_end.FrontEndBaseConfig

A FastAPI based front end that allows a NAT workflow to be served as a microservice.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

class EndpointBase(/, **data: Any)#

Bases: pydantic.BaseModel

method: Literal['GET', 'POST', 'PUT', 'DELETE']#
description: str#
path: str | None = None#
websocket_path: str | None = None#
openai_api_path: str | None = None#
openai_api_v1_path: str | None = None#
class Endpoint(/, **data: Any)#

Bases: EndpointBase

function_name: str = None#
class CrossOriginResourceSharing(/, **data: Any)#

Bases: pydantic.BaseModel

allow_origins: list[str] | None = None#
allow_origin_regex: str | None = None#
allow_methods: list[str] | None = None#
allow_headers: list[str] | None = None#
allow_credentials: bool | None = None#
expose_headers: list[str] | None = None#
max_age: int | None = None#
root_path: str = None#
host: str = None#
port: int = None#
reload: bool = None#
workers: int = None#
max_running_async_jobs: int = None#
step_adaptor: nat.data_models.step_adaptor.StepAdaptorConfig#
workflow: Annotated[FastApiFrontEndConfig.EndpointBase, Field(description='Endpoint for the default workflow.')]#
evaluate: Annotated[FastApiFrontEndConfig.EndpointBase, Field(description='Endpoint for evaluating workflows.')]#
oauth2_callback_path: str | None = None#
endpoints: list[FastApiFrontEndConfig.Endpoint] = None#
cors: FastApiFrontEndConfig.CrossOriginResourceSharing = None#
use_gunicorn: bool = None#
runner_class: str | None = None#
object_store: nat.data_models.component_ref.ObjectStoreRef | None = None#
AIQEvaluateRequest#
AIQEvaluateResponse#
AIQAsyncGenerateResponse#
AIQEvaluateStatusResponse#
AIQAsyncGenerationStatusResponse#