NetLogo / NetLogo/Netlogo-LLM-Extension

bug: Gemini provider drops system-message semantics

Open
#28 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Scala
Stars
1
Forks
0
Avg merge
3d 1h
Merged PRs (30d)
4

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/main/providers/GeminiProvider.scala at GeminiProvider.createProviderRequest(), then inspect how Gemini serializes system, user, and assistant roles. Add provider-level coverage for all three message types without live API calls, and consider the request complete when system instructions remain distinct rather than being flattened into user messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
ai, api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.