Class SimulateSystemPromptMiddleware

java.lang.Object
com.google.genkit.ai.middleware.BaseGenerationMiddleware
com.google.genkit.plugins.middleware.SimulateSystemPromptMiddleware
All Implemented Interfaces:
GenerationMiddleware

public class SimulateSystemPromptMiddleware extends BaseGenerationMiddleware
Rewrites a system message into a user/model exchange, for models that do not natively support system prompts.

Wraps the wrapGenerate hook: each system message is replaced by a user message (SimulateSystemPromptMiddleware.Options.preface followed by the original system content) and a model message (SimulateSystemPromptMiddleware.Options.acknowledgement). Non-system messages are passed through unchanged.

Mirrors the JS simulateSystemPrompt model middleware.