diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-06 11:57:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-06 11:57:45 +0300 |
| commit | a48079fae6bb19d7c931f275901670cd5839ab5c (patch) | |
| tree | 5788a3e8cac34ffca9d39b0c4b5df720e869b578 /docs/configuration.md | |
| parent | fb267966f7840df222338f57023273a993a73c9a (diff) | |
chore(version): bump to 0.6.0; configurable prompts via config + testsv0.6.0
Diffstat (limited to 'docs/configuration.md')
| -rw-r--r-- | docs/configuration.md | 133 |
1 files changed, 15 insertions, 118 deletions
diff --git a/docs/configuration.md b/docs/configuration.md index d52323c..d6c3f4b 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -1,84 +1,16 @@ # Hexai configuration -This document covers all configuration options for Hexai, including the config file, -environment overrides, provider selection, and temperature behavior. +This page explains where the config lives and how to choose a style; the authoritative list of options and comments lives in the example file. -## Config file - -The config file is optional. +Config file - Location: `$XDG_CONFIG_HOME/hexai/config.toml` (usually `~/.config/hexai/config.toml`). -- Example: - -```toml -max_tokens = 4000 -context_mode = "always-full" -context_window_lines = 120 -max_context_tokens = 4000 -log_preview_limit = 100 -completion_debounce_ms = 200 -completion_throttle_ms = 0 -# no_disk_io is reserved for future use -trigger_characters = [".", ":", "/", "_", " "] -inline_open = ">" -inline_close = ">" -chat_suffix = ">" -chat_prefixes = ["?", "!", ":", ";"] -coding_temperature = 0.2 - -# choose one provider: openai | copilot | ollama -provider = "ollama" - -copilot_model = "gpt-4o-mini" -copilot_base_url = "https://api.githubcopilot.com" -copilot_temperature = 0.2 - -openai_model = "gpt-4.1" -openai_base_url = "https://api.openai.com/v1" -openai_temperature = 0.2 - -ollama_model = "qwen3-coder:30b-a3b-q4_K_M" -ollama_base_url = "http://localhost:11434" -ollama_temperature = 0.2 -``` - -Key fields: - -- max_tokens: upper bound for a single LLM response. -- context_mode: `minimal` | `window` | `file-on-new-func` | `always-full`. -- context_window_lines: line count for `window` mode. -- max_context_tokens: hard cap for sent context tokens. -- log_preview_limit: max characters of context preview logged. -- completion_debounce_ms: minimum idle time before sending completion requests. -- completion_throttle_ms: minimum spacing between completion requests (0 disables). -- manual_invoke_min_prefix: minimum typed identifier chars required for manual invoke to proceed without structural triggers (0 allows always). -- no_disk_io: avoid reading files from disk when building context. -- trigger_characters: LSP completion trigger characters. -- inline_open / inline_close: characters that bracket inline prompts (default `>`/`>`). Inline prompts support `>text>` and a double-open variant `>>text>`. Single-character markers are required. -- chat_suffix / chat_prefixes: in-editor chat triggers (default suffix `>` and prefixes `["?","!",":",";"]`). A line ending with one of these prefixes immediately followed by the suffix triggers a chat reply (e.g., `What?>`). Prefixes must be single characters. -- coding_temperature: optional override for LSP calls. -- provider: `openai` | `copilot` | `ollama`. - -### Trigger customization - -Defaults use `>` for inline prompts and chat suffix. You can change them, e.g.: - -```toml -inline_open = "<" -inline_close = ">" -chat_suffix = "/" -chat_prefixes = ["?", "!"] -trigger_characters = [".", ":", "/", "_", " "] -``` - -Notes: -- `inline_open`/`inline_close` must be single characters; `>>text>` is the double‑open variant. -- `chat_prefixes` items must be single characters. +- Style: sectioned tables only — see `config.toml.example` for a complete, commented reference. -## Environment overrides +Environment overrides -- All config-file options can be overridden by environment variables prefixed with `HEXAI_`. -- Env values take precedence over `config.toml`. +- All options can be overridden by environment variables prefixed with `HEXAI_`. +- Env values take precedence over the config file. - Examples: - `HEXAI_PROVIDER`, `HEXAI_MAX_TOKENS`, `HEXAI_CONTEXT_MODE`, `HEXAI_CONTEXT_WINDOW_LINES`, `HEXAI_MAX_CONTEXT_TOKENS`, `HEXAI_LOG_PREVIEW_LIMIT` - `HEXAI_CODING_TEMPERATURE` @@ -95,33 +27,15 @@ API keys: - OpenAI: prefer `HEXAI_OPENAI_API_KEY`, falling back to `OPENAI_API_KEY`. - Copilot: prefer `HEXAI_COPILOT_API_KEY`, falling back to `COPILOT_API_KEY`. -## Selecting a provider +Selecting a provider -- Set `provider` in the config to `openai`, `copilot`, or `ollama`. +- Sectioned: set `[provider] name = "openai" | "copilot" | "ollama"`. +- Flat: set `provider = "openai" | "copilot" | "ollama"`. - If omitted, Hexai defaults to `openai`. -### OpenAI configuration - -- Required: `HEXAI_OPENAI_API_KEY` (or `OPENAI_API_KEY`). -- Options: - - `openai_model` — model name (default: `gpt-4.1`). - - `openai_base_url` — API base (default: `https://api.openai.com/v1`). - - `openai_temperature` — default temperature (coding-friendly `0.2`). - -### GitHub Copilot configuration - -- Required: `COPILOT_API_KEY`. -- Options: - - `copilot_model` — model name (default: `gpt-4o-mini`). - - `copilot_base_url` — API base (default: `https://api.githubcopilot.com`). - - `copilot_temperature` — default temperature (coding-friendly `0.2`). +Provider-specific options -### Ollama configuration - -- Options: - - `ollama_model` — model name/tag (default: `qwen3-coder:30b-a3b-q4_K_M`). - - `ollama_base_url` — base URL (default: `http://localhost:11434`). - - `ollama_temperature` — default temperature (coding-friendly `0.2`). +- See `config.toml.example` for the per-provider tables and defaults. Notes: @@ -129,27 +43,10 @@ Notes: - Alternatively, run Ollama in OpenAI‑compatible mode and use the OpenAI provider with `openai_base_url` pointed at your local endpoint. -## LSP completion tuning - -- Debounce: `completion_debounce_ms` waits until there has been no recent input for at least this many milliseconds before sending a completion request. Recommended 150–300 ms to balance responsiveness and API usage. -- Throttle: `completion_throttle_ms` enforces a minimum spacing between completion requests, across both chat and provider-native paths. Set to 0 to disable. Recommended 300–600 ms if you still see excessive requests with just debounce. -- Manual invoke prefix: `manual_invoke_min_prefix` requires this many identifier characters before a manual completion (TriggerKind=1) proceeds without other triggers. Use 0 to always allow manual invoke. - -Environment variables mirror these settings: `HEXAI_COMPLETION_DEBOUNCE_MS`, `HEXAI_COMPLETION_THROTTLE_MS`, `HEXAI_MANUAL_INVOKE_MIN_PREFIX`. - -## Temperature behavior - -- What it is: controls randomness/creativity of outputs. -- Default for coding: `0.2` for all providers unless overridden. -- Per-provider overrides: `openai_temperature`, `copilot_temperature`, `ollama_temperature`. - -Recommended ranges: +LSP completion tuning -- 0.0–0.3: deterministic and precise; best for refactors, tests, and bug fixes. -- 0.4–0.7: balanced; general Q&A and writing. -- 0.8–1.2+: creative; brainstorming; may increase tangents. +- See the [completion] section in `config.toml.example`. -Guidance: +Temperature behavior -- Lower temperature increases consistency, but can be terse or repetitive. -- Higher temperature increases diversity, but can wander or introduce mistakes. +- Defaults and recommended ranges are commented inline in `config.toml.example` under [general] and provider tables. |
