Skip to content

Fix API key and model prompt integration with Devstral model#9

Open
GuardianAngelWw wants to merge 3 commits intomainfrom
fix/api-integration
Open

Fix API key and model prompt integration with Devstral model#9
GuardianAngelWw wants to merge 3 commits intomainfrom
fix/api-integration

Conversation

@GuardianAngelWw
Copy link
Copy Markdown
Owner

@GuardianAngelWw GuardianAngelWw commented Jun 20, 2025

Description

This PR fixes the integration issues between the Devstral backend (Ollama) and the OpenHands frontend, particularly focusing on the API key and model prompt handling.

Problem

Without the correct environment variables, users were being prompted for API keys or model selection even though direct integration was intended. This created unnecessary friction in the user experience when the system was designed to work with the Devstral model directly.

Solution

Added several environment variables to the Docker Compose configurations to properly handle API keys and model prompts:

  1. LLM_API_KEY: Provides a default API key to skip the prompt
  2. SKIP_API_KEY_VALIDATION: Bypasses API key validation
  3. AUTO_CONNECT_MODEL: Automatically connects to the model without prompting
  4. DEFAULT_MODEL: Sets default model to use
  5. DIRECT_MODEL_INTEGRATION: Enables direct model integration path

Changes Made

  1. Updated ollama-setup/docker-compose.yml with the new environment variables
  2. Updated examples/quick-start-ollama.yml with the same configuration
  3. Added documentation in docs/API_INTEGRATION.md explaining the changes and how they solve the issue

Testing

The changes have been tested to ensure OpenHands now connects directly to the Devstral model without prompting for API keys or model selection.

Related Issues

Resolves the integration issues between Devstral backend and OpenHands frontend.

Summary by CodeRabbit

  • Documentation

    • Added a new integration guide detailing environment variable configuration for seamless Devstral model integration with the OpenHands frontend and Ollama backend.
  • Chores

    • Updated Docker Compose files to automate API key handling, model selection, and direct integration for the OpenHands service.
    • Switched to a prebuilt frontend image and updated container naming for improved deployment consistency.
    • Added UI customization for the Ollama web interface.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 20, 2025

Walkthrough

A new integration guide was added, and both Docker Compose files were updated for the OpenHands frontend to support direct Devstral model integration with the Ollama backend. The changes automate API key handling, model selection, and connection by setting specific environment variables and switching to a prebuilt OpenHands image.

Changes

File(s) Change Summary
docs/API_INTEGRATION.md Added a new guide detailing environment variable setup and integration steps for Devstral model with OpenHands.
examples/quick-start-ollama.yml Updated openhands service: added environment variables to automate API key/model handling and direct integration.
ollama-setup/docker-compose.yml Switched openhands to prebuilt image, renamed container, added integration environment variables; updated ollama-webui with UI name variable.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant OpenHands Frontend
    participant Ollama Backend
    participant Devstral Model

    User->>OpenHands Frontend: Access UI
    OpenHands Frontend->>OpenHands Frontend: Read env vars (API key, model, integration mode)
    OpenHands Frontend->>Ollama Backend: Auto-connect using env vars
    Ollama Backend->>Devstral Model: Route requests
    Devstral Model-->>Ollama Backend: Respond
    Ollama Backend-->>OpenHands Frontend: Respond
    OpenHands Frontend-->>User: Display results (no API key/model prompt)
Loading

Possibly related PRs

Poem

🐰
In the warren, configs bloom anew,
With keys and models set—no prompts for you!
Compose files aligned, docs in the sun,
Devstral and OpenHands now work as one.
Rabbits rejoice, integration’s begun!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@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.

Summary of Changes

Hello @GuardianAngelWw, 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 improves the user experience for integrating the Devstral model with the OpenHands frontend. My changes eliminate unnecessary prompts for API keys and model selection by configuring direct model integration through new environment variables in the Docker Compose setups. This ensures a seamless and automated connection, making it easier for users to get started with the Devstral model.

Highlights

  • Streamlined Devstral/OpenHands Integration: I've introduced several new environment variables (LLM_API_KEY, SKIP_API_KEY_VALIDATION, AUTO_CONNECT_MODEL, DEFAULT_MODEL, DIRECT_MODEL_INTEGRATION) to Docker Compose configurations. These variables automate the API key and model selection process, allowing OpenHands to connect directly to the Devstral model without user prompts.
  • Docker Compose Configuration Updates: The new environment variables have been applied to both ollama-setup/docker-compose.yml and examples/quick-start-ollama.yml to ensure consistent and direct integration across different setup methods. Additionally, the openhands service in ollama-setup/docker-compose.yml now uses a pre-built image and has been renamed to devstral-openhands for clarity.
  • New Integration Documentation: A new documentation file, docs/API_INTEGRATION.md, has been added. This document provides a comprehensive guide to the Devstral OpenHands integration, explaining the purpose of each new environment variable, implementation details, testing procedures, and troubleshooting tips.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

Copy link
Copy Markdown

@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 effectively addresses the integration issues by introducing necessary environment variables to bypass API key and model prompts for the Devstral/Ollama setup. The addition of the API_INTEGRATION.md document is valuable for explaining these changes and the required configuration. The changes in the Docker Compose files correctly apply these variables. I've provided a couple of medium-severity comments regarding potential clarity improvements around the documentation of the placeholder API key and the impact of changing the openhands service from build to image in the ollama-setup/docker-compose.yml file, which affects the user setup workflow.

Comment on lines +22 to +23
image: docker.all-hands.dev/all-hands-ai/openhands:0.40
container_name: devstral-openhands
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Changing from build to image means users of this specific docker-compose.yml will now pull a pre-built image instead of building the frontend locally. This simplifies setup for running the service but changes the workflow for users who might have been using this file for local frontend development. Consider adding a note about this change in the PR description or documentation if this is a significant shift in the intended use of this specific compose file.

Comment thread docs/API_INTEGRATION.md

### Explanation

1. **LLM_API_KEY**: Provides a default API key, which prevents OpenHands from prompting the user for an API key. The value doesn't matter for Ollama integration, but must be present.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The documentation mentions the LLM_API_KEY value doesn't matter but must be present. While clear here, using a placeholder like sk-devstral-integration might be slightly confusing as it looks like a specific key format. Perhaps a more generic placeholder or explicitly stating 'any non-empty string will work' could enhance clarity, although the current explanation is also functional.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
examples/quick-start-ollama.yml (1)

35-40: Use a clear API key placeholder or .env file for secrets
The hard-coded value sk-devstral-integration is meant as a dummy key but may be mistaken for a real secret. Consider replacing it with a placeholder like YOUR_DEVSTRAL_API_KEY and loading it from a .env to avoid accidental leakage.

docs/API_INTEGRATION.md (2)

3-3: Add missing article “the” for clarity
Change “integrates with OpenHands frontend” to “integrates with the OpenHands frontend” to improve readability.


14-18: Clarify placeholder usage for environment variables
These entries (especially LLM_API_KEY) are examples. Add a note that real values should be pulled from a .env file or secrets manager, and update placeholders accordingly.

ollama-setup/docker-compose.yml (1)

32-37: Centralize secret management and harmonize defaults
While these env vars enable direct integration, the dummy key may be misused. Consider sourcing LLM_API_KEY from a .env file and, for consistency with the quick-start example, using fallback syntax (e.g. ${DEFAULT_MODEL:-devstral}).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44d09c8 and 9ce0dc6.

📒 Files selected for processing (3)
  • docs/API_INTEGRATION.md (1 hunks)
  • examples/quick-start-ollama.yml (1 hunks)
  • ollama-setup/docker-compose.yml (3 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/API_INTEGRATION.md

[uncategorized] ~3-~3: You might be missing the article “the” here.
Context: ... how the Devstral model integrates with OpenHands frontend, particularly focusing on the ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 markdownlint-cli2 (0.17.2)
docs/API_INTEGRATION.md

51-51: Bare URL used
null

(MD034, no-bare-urls)

🔇 Additional comments (2)
ollama-setup/docker-compose.yml (2)

22-23: Approve: Switched to prebuilt OpenHands image
Using docker.all-hands-ai/openhands:0.40 and renaming the container to devstral-openhands ensures version consistency and removes the need for a local build.


56-56: Approve: Customized Web UI name
Setting WEBUI_NAME=Devstral Model Manager provides a clearer label for users managing multiple interfaces.

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