|
| 1 | +-- Seed data for local Ollama LLM development with t3x-cowriter |
| 2 | +-- This creates a pre-configured Ollama provider, models, and sample configurations |
| 3 | +-- Run with: ddev seed-ollama |
| 4 | + |
| 5 | +-- Provider: Local Ollama instance |
| 6 | +INSERT INTO tx_nrllm_provider ( |
| 7 | + pid, identifier, name, description, adapter_type, endpoint_url, api_key, |
| 8 | + api_timeout, max_retries, is_active, priority, sorting, tstamp, crdate |
| 9 | +) VALUES ( |
| 10 | + 0, |
| 11 | + 'ollama-local', |
| 12 | + 'Local Ollama', |
| 13 | + 'Local Ollama LLM server running in DDEV container. No API key required.', |
| 14 | + 'ollama', |
| 15 | + 'http://ollama:11434', |
| 16 | + '', |
| 17 | + 30, |
| 18 | + 3, |
| 19 | + 1, |
| 20 | + 100, |
| 21 | + 10, |
| 22 | + UNIX_TIMESTAMP(), |
| 23 | + UNIX_TIMESTAMP() |
| 24 | +) ON DUPLICATE KEY UPDATE |
| 25 | + name = VALUES(name), |
| 26 | + description = VALUES(description), |
| 27 | + endpoint_url = VALUES(endpoint_url), |
| 28 | + priority = VALUES(priority), |
| 29 | + tstamp = UNIX_TIMESTAMP(); |
| 30 | + |
| 31 | +-- Get the provider UID for the model relation |
| 32 | +SET @ollama_provider_uid = (SELECT uid FROM tx_nrllm_provider WHERE identifier = 'ollama-local' AND deleted = 0 LIMIT 1); |
| 33 | + |
| 34 | +-- Model: Qwen 3 0.6B (default small model) |
| 35 | +INSERT INTO tx_nrllm_model ( |
| 36 | + pid, identifier, name, description, provider_uid, model_id, |
| 37 | + context_length, max_output_tokens, capabilities, default_timeout, |
| 38 | + cost_input, cost_output, is_active, is_default, sorting, tstamp, crdate |
| 39 | +) VALUES ( |
| 40 | + 0, |
| 41 | + 'qwen3-0.6b', |
| 42 | + 'Qwen 3 0.6B', |
| 43 | + 'Alibaba Qwen 3 with 600M parameters. Fast, efficient for development and testing.', |
| 44 | + @ollama_provider_uid, |
| 45 | + 'qwen3:0.6b', |
| 46 | + 32768, |
| 47 | + 4096, |
| 48 | + 'chat,completion,streaming', |
| 49 | + 60, |
| 50 | + 0, |
| 51 | + 0, |
| 52 | + 1, |
| 53 | + 1, |
| 54 | + 10, |
| 55 | + UNIX_TIMESTAMP(), |
| 56 | + UNIX_TIMESTAMP() |
| 57 | +) ON DUPLICATE KEY UPDATE |
| 58 | + name = VALUES(name), |
| 59 | + description = VALUES(description), |
| 60 | + provider_uid = @ollama_provider_uid, |
| 61 | + model_id = VALUES(model_id), |
| 62 | + tstamp = UNIX_TIMESTAMP(); |
| 63 | + |
| 64 | +-- Model: Gemma 3 1B (alternative small model) |
| 65 | +INSERT INTO tx_nrllm_model ( |
| 66 | + pid, identifier, name, description, provider_uid, model_id, |
| 67 | + context_length, max_output_tokens, capabilities, default_timeout, |
| 68 | + cost_input, cost_output, is_active, is_default, sorting, tstamp, crdate |
| 69 | +) VALUES ( |
| 70 | + 0, |
| 71 | + 'gemma3-1b', |
| 72 | + 'Gemma 3 1B', |
| 73 | + 'Google Gemma 3 with 1B parameters. Good quality for its size.', |
| 74 | + @ollama_provider_uid, |
| 75 | + 'gemma3:1b', |
| 76 | + 32768, |
| 77 | + 4096, |
| 78 | + 'chat,completion,streaming', |
| 79 | + 60, |
| 80 | + 0, |
| 81 | + 0, |
| 82 | + 1, |
| 83 | + 0, |
| 84 | + 20, |
| 85 | + UNIX_TIMESTAMP(), |
| 86 | + UNIX_TIMESTAMP() |
| 87 | +) ON DUPLICATE KEY UPDATE |
| 88 | + name = VALUES(name), |
| 89 | + description = VALUES(description), |
| 90 | + provider_uid = @ollama_provider_uid, |
| 91 | + model_id = VALUES(model_id), |
| 92 | + tstamp = UNIX_TIMESTAMP(); |
| 93 | + |
| 94 | +-- Model: SmolLM2 360M (ultra-small model) |
| 95 | +INSERT INTO tx_nrllm_model ( |
| 96 | + pid, identifier, name, description, provider_uid, model_id, |
| 97 | + context_length, max_output_tokens, capabilities, default_timeout, |
| 98 | + cost_input, cost_output, is_active, is_default, sorting, tstamp, crdate |
| 99 | +) VALUES ( |
| 100 | + 0, |
| 101 | + 'smollm2-360m', |
| 102 | + 'SmolLM2 360M', |
| 103 | + 'Hugging Face SmolLM2 with 360M parameters. Ultra-fast, minimal resources.', |
| 104 | + @ollama_provider_uid, |
| 105 | + 'smollm2:360m', |
| 106 | + 8192, |
| 107 | + 2048, |
| 108 | + 'chat,completion', |
| 109 | + 30, |
| 110 | + 0, |
| 111 | + 0, |
| 112 | + 1, |
| 113 | + 0, |
| 114 | + 30, |
| 115 | + UNIX_TIMESTAMP(), |
| 116 | + UNIX_TIMESTAMP() |
| 117 | +) ON DUPLICATE KEY UPDATE |
| 118 | + name = VALUES(name), |
| 119 | + description = VALUES(description), |
| 120 | + provider_uid = @ollama_provider_uid, |
| 121 | + model_id = VALUES(model_id), |
| 122 | + tstamp = UNIX_TIMESTAMP(); |
| 123 | + |
| 124 | +-- Get the default model UID for configurations |
| 125 | +SET @default_model_uid = (SELECT uid FROM tx_nrllm_model WHERE identifier = 'qwen3-0.6b' AND deleted = 0 LIMIT 1); |
| 126 | + |
| 127 | +-- Configuration: General Purpose (default for Cowriter) |
| 128 | +INSERT INTO tx_nrllm_configuration ( |
| 129 | + pid, identifier, name, description, model_uid, |
| 130 | + system_prompt, temperature, max_tokens, top_p, timeout, |
| 131 | + is_active, is_default, sorting, tstamp, crdate |
| 132 | +) VALUES ( |
| 133 | + 0, |
| 134 | + 'local-general', |
| 135 | + 'Local General Purpose', |
| 136 | + 'General-purpose configuration for Cowriter content editing and generation.', |
| 137 | + @default_model_uid, |
| 138 | + 'You are a professional writing assistant integrated into a CMS editor. Your task is to improve, enhance, or generate text based on the user''s request. Respond ONLY with the improved/generated text.', |
| 139 | + 0.7, |
| 140 | + 2048, |
| 141 | + 0.9, |
| 142 | + 0, |
| 143 | + 1, |
| 144 | + 1, |
| 145 | + 10, |
| 146 | + UNIX_TIMESTAMP(), |
| 147 | + UNIX_TIMESTAMP() |
| 148 | +) ON DUPLICATE KEY UPDATE |
| 149 | + name = VALUES(name), |
| 150 | + description = VALUES(description), |
| 151 | + model_uid = @default_model_uid, |
| 152 | + tstamp = UNIX_TIMESTAMP(); |
| 153 | + |
| 154 | +-- Configuration: Content Summarizer |
| 155 | +INSERT INTO tx_nrllm_configuration ( |
| 156 | + pid, identifier, name, description, model_uid, |
| 157 | + system_prompt, temperature, max_tokens, top_p, timeout, |
| 158 | + is_active, is_default, sorting, tstamp, crdate |
| 159 | +) VALUES ( |
| 160 | + 0, |
| 161 | + 'local-summarizer', |
| 162 | + 'Local Content Summarizer', |
| 163 | + 'Optimized for summarizing articles, documents, and CMS content.', |
| 164 | + @default_model_uid, |
| 165 | + 'You are a content summarizer. Create clear, concise summaries that capture the key points. Focus on the most important information and maintain the original meaning.', |
| 166 | + 0.3, |
| 167 | + 1024, |
| 168 | + 0.85, |
| 169 | + 0, |
| 170 | + 1, |
| 171 | + 0, |
| 172 | + 20, |
| 173 | + UNIX_TIMESTAMP(), |
| 174 | + UNIX_TIMESTAMP() |
| 175 | +) ON DUPLICATE KEY UPDATE |
| 176 | + name = VALUES(name), |
| 177 | + description = VALUES(description), |
| 178 | + model_uid = @default_model_uid, |
| 179 | + tstamp = UNIX_TIMESTAMP(); |
| 180 | + |
| 181 | +-- Configuration: Creative Writing |
| 182 | +INSERT INTO tx_nrllm_configuration ( |
| 183 | + pid, identifier, name, description, model_uid, |
| 184 | + system_prompt, temperature, max_tokens, top_p, timeout, |
| 185 | + is_active, is_default, sorting, tstamp, crdate |
| 186 | +) VALUES ( |
| 187 | + 0, |
| 188 | + 'local-creative', |
| 189 | + 'Local Creative Writing', |
| 190 | + 'Higher temperature for creative content generation in CMS.', |
| 191 | + @default_model_uid, |
| 192 | + 'You are a creative writing assistant. Help generate engaging, imaginative content with varied vocabulary and interesting prose.', |
| 193 | + 0.9, |
| 194 | + 2048, |
| 195 | + 0.95, |
| 196 | + 120, |
| 197 | + 1, |
| 198 | + 0, |
| 199 | + 30, |
| 200 | + UNIX_TIMESTAMP(), |
| 201 | + UNIX_TIMESTAMP() |
| 202 | +) ON DUPLICATE KEY UPDATE |
| 203 | + name = VALUES(name), |
| 204 | + description = VALUES(description), |
| 205 | + model_uid = @default_model_uid, |
| 206 | + tstamp = UNIX_TIMESTAMP(); |
| 207 | + |
| 208 | +SELECT 'Ollama seed data imported successfully!' AS status; |
| 209 | +SELECT CONCAT('Provider: ', name, ' (', identifier, ')') AS created FROM tx_nrllm_provider WHERE identifier = 'ollama-local' AND deleted = 0; |
| 210 | +SELECT CONCAT('Models: ', COUNT(*), ' configured') AS created FROM tx_nrllm_model WHERE provider_uid = @ollama_provider_uid AND deleted = 0; |
| 211 | +SELECT CONCAT('Configurations: ', COUNT(*), ' configured') AS created FROM tx_nrllm_configuration WHERE model_uid = @default_model_uid AND deleted = 0; |
0 commit comments