Skip to content

bug: Gemini provider drops system-message semantics #28

Description

@JNK234

Problem

The Gemini provider currently converts every non-assistant role into user, so system messages are not preserved as system instructions.

Current behavior

GeminiProvider.createProviderRequest() maps roles like this:

  • assistant -> model
  • everything else -> user

That means any system message created by:

  • llm:chat-with-template
  • manually injected history via llm:set-history
  • future prompt-steering features

is downgraded to a plain user message before it reaches Gemini.

Why this matters

System prompts are part of the extension’s advertised interaction model. Other providers preserve them, but Gemini currently does not. That creates provider-specific behavior differences for the same NetLogo code:

  • template steering becomes weaker or inconsistent on Gemini
  • system persona/history instructions are interpreted as ordinary user text
  • cross-provider experiments are no longer comparable

Affected code

  • src/main/providers/GeminiProvider.scala

Suggested fix directions

  1. Handle system prompts using Gemini’s dedicated instruction mechanism instead of flattening them into user messages.
  2. If Gemini requires a different request shape, split system instructions from conversational contents before serialization.
  3. Add provider-level tests covering a request with system, user, and assistant messages so the serialized request can be validated without live API calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions