docs: add .env.example examples for Ollama and OpenAI-compatible - #110
Conversation
Summary of ChangesHello @BroccoliFin, 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 enhances the project's documentation by providing explicit examples for setting up local Large Language Model (LLM) providers. It specifically addresses configurations for Ollama and OpenAI-compatible servers, making it easier for developers to integrate and test local LLMs by clarifying the necessary environment variables. Highlights
Changelog
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request adds helpful examples to .env.example for configuring local LLM providers like Ollama and other OpenAI-compatible servers. The added documentation accurately reflects the current implementation.
I've added one suggestion to improve the consistency of environment variable names for the openai_compatible backend. Using backend-specific prefixes, similar to other providers like OLLAMA_ and OPENAI_, would enhance clarity and reduce potential user confusion.
| LLM_MODEL=llama-3.2-3b-instruct-q4_K_M | ||
| LLM_BACKEND=openai_compatible | ||
| LLM_BASE_URL=http://localhost:1234/v1 | ||
| LLM_API_KEY=sk-... # optional for local servers |
There was a problem hiding this comment.
For consistency with other LLM backend configurations (e.g., OLLAMA_MODEL, OPENAI_MODEL), it would be clearer to use backend-specific environment variables for the OpenAI-compatible provider. The current generic names like LLM_MODEL and LLM_BASE_URL could be confusing, as they might imply a global setting when they are specific to this backend.
I suggest using prefixed variables. This would require corresponding updates in src/config.rs:
- In
LlmConfig::resolve(), to read these new variable names. - In
inject_llm_keys_from_secrets(), to update the mapping forLLM_API_KEY.
OPENAI_COMPATIBLE_MODEL=llama-3.2-3b-instruct-q4_K_M
LLM_BACKEND=openai_compatible
OPENAI_COMPATIBLE_BASE_URL=http://localhost:1234/v1
OPENAI_COMPATIBLE_API_KEY=sk-... # optional for local servers
There was a problem hiding this comment.
Thanks for the review!
This is a pure documentation PR to document the current implementation (which uses LLM_* variables for the openai_compatible backend).
The prefix change (OPENAI_COMPATIBLE_*) is a great idea for consistency — happy to do it in a follow-up code PR if you want.
ilblackdragon
left a comment
There was a problem hiding this comment.
Review: docs: add .env.example examples for Ollama and OpenAI-compatible
Thanks for adding documentation for local LLM providers -- this is genuinely useful for users wanting to run with Ollama or LM Studio.
However, there is a correctness issue that would cause breakage for users who copy-paste from this file, and a usability issue with the structure.
1. Wrong environment variable names for openai_compatible backend (blocking)
The PR currently uses OPENAI_COMPATIBLE_MODEL, OPENAI_COMPATIBLE_BASE_URL, and OPENAI_COMPATIBLE_API_KEY, but the actual code in src/config.rs (lines 523-529) reads LLM_MODEL, LLM_BASE_URL, and LLM_API_KEY:
let base_url = optional_env("LLM_BASE_URL")?
...
let api_key = optional_env("LLM_API_KEY")?.map(SecretString::from);
let model = optional_env("LLM_MODEL")?If a user sets OPENAI_COMPATIBLE_BASE_URL, the code will not find it and will return an error: "Set LLM_BASE_URL when LLM_BACKEND=openai_compatible".
It looks like Gemini suggested renaming these for consistency, and you adopted the names in the .env.example, but without a corresponding code change, the documentation is now incorrect. Since this is a docs-only PR, the variable names should match what the code actually reads today. Please revert to LLM_MODEL, LLM_BASE_URL, and LLM_API_KEY.
(Renaming the env vars in code for consistency is a good idea, but that belongs in a separate code PR.)
2. Both backends are uncommented simultaneously (minor)
Both the Ollama and OpenAI-compatible sections set LLM_BACKEND= as uncommented lines. Since .env files are read top-to-bottom with last-value-wins semantics, this means:
OLLAMA_MODEL,OLLAMA_BASE_URLare set butLLM_BACKEND=ollamais silently overridden byLLM_BACKEND=openai_compatiblebelow.- A user copying the whole file would get
openai_compatibleas the backend, but would also have the Ollama vars set (which are ignored).
I'd suggest commenting out the lines in both sections (except possibly the header comments), so users explicitly uncomment the one they want. For example:
# === Ollama ===
# OLLAMA_MODEL=llama3.2
# LLM_BACKEND=ollama
# OLLAMA_BASE_URL=http://localhost:11434 # default
# === OpenAI-compatible (LM Studio, vLLM, Anything-LLM) ===
# LLM_MODEL=llama-3.2-3b-instruct-q4_K_M
# LLM_BACKEND=openai_compatible
# LLM_BASE_URL=http://localhost:1234/v1
# LLM_API_KEY=sk-... # optional for local serversThis follows the convention already used in the file (e.g., # NEARAI_SESSION_PATH=...).
Summary
Issue 1 is blocking -- the env var names must match the code or users will get runtime errors. Issue 2 is a usability improvement.
Batch 2 PR Review: nearai/ironclaw PRs 111, 110, 109, 103, 95, 74Reviewer: AI Sub-Agent PR #111: Fix backwards compatibility for nearai.session_tokenSummaryThis PR adds backwards compatibility for the nearai session management by implementing a fallback mechanism. When Pros
Concerns
Suggestions
PR #110: Add env docs for local LLM providersSummaryThis PR updates the Pros
Concerns
Suggestions
PR #109: Normalize memory search query and update marked.jsSummaryThis PR addresses two security and stability issues in the web interface. First, it adds input normalization for memory search queries to prevent excessive query lengths and invalid input types. Second, it updates the marked.js dependency to a specific version with integrity hashing for supply chain security. The changes are defensive in nature, preventing potential DoS attacks and ensuring the integrity of third-party JavaScript dependencies. Pros
Concerns
Suggestions
PR #103: Per-request model override for OpenAI-compatible APISummaryThis is a significant feature PR that adds per-request model override capability across the entire LLM provider ecosystem. Previously, all requests used the active model, but now clients can specify a different model per request. The changes span multiple modules: request structs now include optional Pros
Concerns
Suggestions
PR #95: Add Venice AI provider and embeddingsSummaryThis PR adds comprehensive support for Venice AI as both an LLM provider and an embeddings provider. It introduces a new Pros
Concerns
Suggestions
PR #74: Security fix: Enhanced HTTP response size validationSummaryThis PR strengthens the HTTP tool's defense against OOM attacks by implementing two-stage response size validation. First, it checks the Pros
Concerns
Suggestions
Overall RecommendationsHigh Priority
Medium Priority
Low Priority
General Observations
|
|
Illia, thanks for the review! I've updated the .env.example with the requested changes (all examples are now fully commented out for safety). Let me know if anything else needs tweaking. |
…rai#110) * docs: add .env.example examples for Ollama and OpenAI-compatible * docs: update .env.example with commented examples --------- Co-authored-by: BroccoliFin <mikhailsadovoy@MacBook-Air-MacMike.local>
…rai#110) * docs: add .env.example examples for Ollama and OpenAI-compatible * docs: update .env.example with commented examples --------- Co-authored-by: BroccoliFin <mikhailsadovoy@MacBook-Air-MacMike.local>
Added clear, commented examples of environment variables for local LLM models.
LLM_BACKEND=ollamaLLM_BACKEND=openai_compatible(LM Studio, vLLM, LiteLLM, Anything-LLM and any other OpenAI-compatible server)Support for both backends was already fully implemented in code (see the previous PR that updated FEATURE_PARITY.md).
This is a pure documentation PR.