Decorator used to dynamically generate system prompts for the model.
This is a convenience decorator that creates middleware using wrap_model_call
specifically for dynamic prompt generation. The decorated function should return
a string that will be set as the system prompt for the model request.
dynamic_prompt(
func: _CallableReturningSystemMessage[StateT, ContextT] | None = None
) -> Callable[[_CallableReturningSystemMessage[StateT, ContextT]], AgentMiddleware[StateT, ContextT]] | AgentMiddleware[StateT, ContextT]The decorated function should return:
str – The system prompt string to use for the model requestSystemMessage – A complete system message to use for the model request