nat.plugins.weave.fastapi_plugin_worker#
Attributes#
Classes#
Payload for adding feedback to a Weave trace. |
|
Response for feedback submission. |
|
FastAPI plugin worker that adds Weave-specific routes. |
Module Contents#
- logger#
- class WeaveFeedbackPayload(/, **data: Any)#
Bases:
pydantic.BaseModelPayload 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.selfis explicitly positional-only to allowselfas a field name.
- class WeaveFeedbackResponse(/, **data: Any)#
Bases:
pydantic.BaseModelResponse 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.selfis explicitly positional-only to allowselfas a field name.
- class WeaveFastAPIPluginWorker(config: nat.data_models.config.Config)#
Bases:
nat.front_ends.fastapi.fastapi_front_end_plugin_worker.FastApiFrontEndPluginWorkerFastAPI 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,
Add routes including Weave feedback endpoint if Weave is configured.
- async _add_weave_feedback_route(
- app: fastapi.FastAPI,
- builder: nat.builder.workflow_builder.WorkflowBuilder,
Add the Weave feedback endpoint if Weave telemetry is configured.