pipeworks_mud_mapper.layout.ollama_panel
Ollama LLM Assistant panel component.
The Ollama panel provides an interface for generating room descriptions using local LLM models via Ollama. It includes template selection for pre-configured system prompts, model management, seed control for reproducible generation, and configurable model parameters.
Component Structure
┌────────────────────────────────────────────────────────────────────┐
│ 🤖 LLM Assistant (Ollama) │
├────────────────────────────────────────────────────────────────────┤
│ Server: [http://...] [↻] Model: [dropdown] Template: [dropdown] │
│ ○ Connected │
│ │
│ ▶ System Prompt ▶ Parameters │
│ │
│ User Prompt: [Preset ▾] [Use Description] │
│ [________________________] │
│ │
│ [Generate ✨] │
│ │
│ Response: │
│ [________________________] │
│ [Send to Description] [Copy] │
└────────────────────────────────────────────────────────────────────┘
Component IDs
Server and Model Selection:
ollama-server-url: Input for Ollama server URLollama-model-dropdown: Dropdown to select Ollama modelollama-refresh-models-btn: Button to refresh model listollama-refresh-icon: Icon inside refresh button (for spinning animation)ollama-connection-status: Connection status indicatorollama-template-dropdown: Dropdown to select prompt template
System Prompt Section (collapsible, hidden by default):
ollama-system-prompt-toggle: Button to toggle system prompt visibilityollama-system-prompt-chevron: Chevron icon for collapse stateollama-system-prompt-collapse: Collapsible wrapper for system promptollama-system-prompt: Textarea for system prompt (read-only when template selected)ollama-copy-system-prompt-btn: Clipboard component to copy system prompt
Parameters Section (collapsible, hidden by default):
ollama-params-toggle: Button to toggle parameters visibilityollama-params-chevron: Chevron icon for params collapse stateollama-params-collapse: Collapsible wrapper for parameters
Seed Controls:
ollama-seed-value: Input for seed value (-1 for random, 0+ for fixed)ollama-seed-decrease: Button to decrement seedollama-seed-increase: Button to increment seedollama-seed-random-check: Checkbox for random mode (sets seed to -1)
Model Parameters:
ollama-temperature: Input for temperature (creativity/randomness, 0.0-2.0)ollama-top-k: Input for top_k (vocabulary filtering, 1-100)ollama-top-p: Input for top_p (nucleus sampling threshold, 0.0-1.0)ollama-num-ctx: Input for num_ctx (context window in tokens, 512-8192)ollama-num-predict: Input for num_predict (max output tokens, 30-2048)
User Prompt and Generation:
ollama-user-prompt: Textarea for user promptollama-populate-prompt-btn: Button to populate prompt from room descriptionollama-generate-btn: Button to generate descriptionollama-generate-icon: Icon inside generate button (for loading state)ollama-generate-text: Text inside generate button (changes during generation)
Response and Actions:
ollama-response: Textarea for LLM responseollama-send-to-description-btn: Button to send response to room descriptionollama-clipboard: Clipboard component for copying responseollama-clipboard-feedback: Clipboard copy feedback messageollama-status: Status message area
Parameter Defaults
The following default values are used for model parameters:
Parameter |
Default |
Range |
Purpose |
|---|---|---|---|
seed |
-1 |
-1 or 0+ |
-1 = random seed, 0+ = reproducible |
temperature |
0.7 |
0.0-2.0 |
Controls creativity/randomness of output |
top_k |
40 |
1-100 |
Limits vocabulary to top K probable tokens |
top_p |
0.9 |
0.0-1.0 |
Nucleus sampling threshold (cumulative prob) |
num_ctx |
4096 |
512-8192 |
Context window size in tokens |
num_predict |
512 |
30-2048 |
Maximum number of tokens to generate |
See also
-, -, -
Functions
Create the Ollama LLM Assistant panel component. |
Module Contents
- pipeworks_mud_mapper.layout.ollama_panel.create_ollama_panel()[source]
Create the Ollama LLM Assistant panel component.
The Ollama panel provides:
Server connection management (URL input, refresh button, status indicator)
Model selection dropdown (populated from connected Ollama server)
Template selection for pre-configured system prompts
Collapsible system prompt viewer (read-only when using templates)
Collapsible parameters section with seed control and model parameters
User prompt input with “Use Description” button
Generate button with loading state feedback
Response display with copy and send-to-description actions
- Returns:
Bootstrap Card containing the complete Ollama LLM interface.
- Return type:
dbc.Card
Notes
System prompt and parameters sections are hidden by default for a cleaner UI
System prompt is read-only when a template is selected (enforces template integrity)
Templates are loaded from data/ollama/templates/ directory
Uses /api/chat endpoint for proper system/user message separation
Seed of -1 means random (uses isolated RNG to avoid poisoning global state)
Callback changes button state during generation for user feedback
Examples
The Ollama panel is typically used within the main layout:
>>> from pipeworks_mud_mapper.layout.ollama_panel import create_ollama_panel >>> panel = create_ollama_panel() >>> # Panel contains all ollama-* component IDs