Skip to content

API Reference parrot.bots.middleware

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.bots.middleware

View source

Prompt middleware pipeline for query transformation.

Class PromptMiddleware

Single transformation step in the prompt pipeline.

Parameter Type Default Description
name str
priority int 0
transform Callable[[str, Dict[str, Any]], Awaitable[str]] None
enabled bool True

Fields:

Field Type Default Description
name str
priority int 0
transform Callable[[str, Dict[str, Any]], Awaitable[str]] None
enabled bool True

Method PromptMiddleware.apply

apply(query: str, context: Dict[str, Any]) -> str

Parameter Type Default Description
query str
context Dict[str, Any]

Returns: str

Class PromptPipeline

Ordered chain of prompt transformations applied before LLM call.

Attributes:

Attribute Type Description
has_middlewares bool

Method PromptPipeline.add

add(middleware: PromptMiddleware) -> None

Parameter Type Default Description
middleware PromptMiddleware

Method PromptPipeline.remove

remove(name: str) -> None

Parameter Type Default Description
name str

Method PromptPipeline.apply

apply(query: str, context: Dict[str, Any] = None) -> str

Parameter Type Default Description
query str
context Dict[str, Any] None

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally