Skip to content

docs(dart/models): use new top-level system parameter for system prompts#281

Open
chrisraygill wants to merge 1 commit into
genkit-ai:mainfrom
chrisraygill:docs/dart-system-param
Open

docs(dart/models): use new top-level system parameter for system prompts#281
chrisraygill wants to merge 1 commit into
genkit-ai:mainfrom
chrisraygill:docs/dart-system-param

Conversation

@chrisraygill

@chrisraygill chrisraygill commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Bug fix. The Dart variant of the Models / generating content docs previously showed config: GeminiOptions(systemInstruction: ...) as the way to set a system prompt. That is a Gemini-specific config option, not the framework-level way to specify a system prompt — it doesn't work with non-Gemini models and bypasses Genkit's role-based message system. The snippet was incorrect for a section meant to document the cross-model ai.generate() API.

This PR replaces it with the new top-level system parameter on ai.generate(), which matches the JS and Go SDK surface.

Depends on

genkit-ai/genkit-dart#289 — adds the system parameter to Genkit.generate, Genkit.generateStream, lite.generate, lite.generateStream, and generateHelper. This docs change should land after that PR ships in a release that the docs target.

Before (incorrect)

final response = await ai.generate(
  model: googleAI.gemini('gemini-2.5-flash'),
  prompt: 'Invent a menu item for a pirate themed restaurant.',
  config: GeminiOptions(
    systemInstruction: 'You are a food industry marketing consultant.',
  ),
);

After

final response = await ai.generate(
  model: googleAI.gemini('gemini-2.5-flash'),
  system: 'You are a food industry marketing consultant.',
  prompt: 'Invent a menu item for a pirate themed restaurant.',
);

Test plan

  • pnpm generate-language-pages regenerates src/content/docs/docs/dart/models.mdx with the new snippet (verified locally; that path is gitignored).
  • Reviewer checks the rendered Dart Models page looks right.

…ompts

Replaces the GeminiOptions.systemInstruction workaround with the new
top-level `system` parameter added in genkit-ai/genkit-dart#289, which
matches the JS and Go SDK surface.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Dart documentation in models.mdx to show how to provide a system prompt using the direct system parameter instead of configuring it through GeminiOptions. There are no review comments to address, and the changes look correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant