nat.plugins.weave.fastapi_plugin_worker#

Attributes#

Classes#

WeaveFeedbackPayload

Payload for adding feedback to a Weave trace.

WeaveFeedbackResponse

Response for feedback submission.

WeaveFastAPIPluginWorker

FastAPI plugin worker that adds Weave-specific routes.

Module Contents#

logger#
class WeaveFeedbackPayload(/, **data: Any)#

Bases: pydantic.BaseModel

Payload for adding feedback to a Weave trace.

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.

observability_trace_id: str#
reaction_type: str#
class WeaveFeedbackResponse(/, **data: Any)#

Bases: pydantic.BaseModel

Response for feedback submission.

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.

message: str#
class WeaveFastAPIPluginWorker(config: nat.data_models.config.Config)#

Bases: nat.front_ends.fastapi.fastapi_front_end_plugin_worker.FastApiFrontEndPluginWorker

FastAPI plugin worker that adds Weave-specific routes.

This worker extends the default FastAPI worker to automatically add Weave feedback endpoints when Weave telemetry is configured.

Usage:

Configure your workflow to use this worker:

general:
  front_end:
    _type: fastapi
    runner_class: nat.plugins.weave.fastapi_plugin_worker.WeaveFastAPIPluginWorker
async add_routes(
app: fastapi.FastAPI,
builder: nat.builder.workflow_builder.WorkflowBuilder,
) None#

Add routes including Weave feedback endpoint if Weave is configured.

async _add_weave_feedback_route(
app: fastapi.FastAPI,
builder: nat.builder.workflow_builder.WorkflowBuilder,
) None#

Add the Weave feedback endpoint if Weave telemetry is configured.