Skip to content

Conversation

@simakmak
Copy link

@simakmak simakmak commented Jan 2, 2026

Description

Add support for runtime generation options and thinking modes in Ollama integration.

  • Introduces GenerateContentConfig with:

    • Think (Ollama: true/false; GPT-OSS: "low" | "medium" | "high")
    • Runtime options: Temperature, TopK, TopP, MinP, Stop, NumCtx, NumPredict
    • Ollama-specific: KeepAlive
  • Adds applyGenerateConfigToOllama to map config into ollamaChatRequest (Think + Options)

  • Ensures Thinking content from model is mapped into ai.ReasoningPart

Example usage:

genkit.Generate(ctx, g,
    ai.WithSystem(systemPostPrompt),
    ai.WithPrompt(in),
    ai.WithModel(llm),
    ai.WithTools(tools...),
    ai.WithConfig(
        ollama.GenerateContentConfig{
            Think:       true,
            Temperature: genai.Ptr[float64](0.2),
        },
    ),
)

Checklist

  • PR title follows [[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)]
  • Tested (manually)
  • Docs updated (runtime options / thinking mode documentation)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @simakmak, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the Ollama plugin by providing granular control over model generation parameters and integrating the model's internal 'thinking' process into the Genkit AI response structure. It introduces a dedicated configuration object for runtime options and ensures that the model's reasoning is captured and exposed, offering developers more flexibility and deeper insights into the AI's operation.

Highlights

  • Enhanced Ollama Configuration: Introduced a new GenerateContentConfig struct for the Ollama plugin, allowing users to specify a wide range of runtime generation options such as Temperature, TopK, TopP, MinP, Stop sequences, NumCtx, NumPredict, and an Ollama-specific KeepAlive duration.
  • Thinking Mode Support: Added support for 'thinking modes' in Ollama integration, enabling the model to provide internal reasoning. This includes a Think field in GenerateContentConfig and the ollamaChatRequest, and the Thinking content from the model's response is now mapped to ai.ReasoningPart.
  • Configuration Mapping Utility: Implemented applyGenerateConfigToOllama, a new utility function responsible for translating the generic GenerateContentConfig into the specific Think mode and Options map required by the ollamaChatRequest.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@simakmak simakmak changed the title ollama plugin: add options feat(go): ollama plugin: add options Jan 2, 2026
Copy link
Contributor

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

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 introduces support for runtime generation options and thinking modes in the Ollama integration. The changes are well-structured, adding a GenerateContentConfig to specify these options and logic to apply them to the Ollama request. The handling of 'thinking' responses from the model is also correctly implemented.

I've found one critical issue that could lead to a runtime panic and one omission where a newly added configuration option is not being used. My comments provide suggestions to address these points. Once these are fixed, the PR should be in good shape.

@simakmak
Copy link
Author

simakmak commented Jan 2, 2026

/gemini review

Copy link
Contributor

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

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 is a great addition, introducing support for runtime generation options and thinking modes to the Ollama plugin. The implementation correctly defines new configuration structures and integrates them into the request flow. I've identified a couple of significant issues that could lead to unexpected behavior: one is an incomplete implementation for handling reasoning parts in the input, and the other is an inconsistency in how different configuration types are handled, which could confuse users. I've also included a medium-severity suggestion to enhance the type safety of the new Think configuration field.

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

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant