hazo_llm_api 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +202 -7
  2. package/config/hazo_llm_api_config.ini +224 -0
  3. package/dist/lib/database/init_database.d.ts +6 -6
  4. package/dist/lib/database/init_database.d.ts.map +1 -1
  5. package/dist/lib/database/init_database.js +143 -61
  6. package/dist/lib/database/init_database.js.map +1 -1
  7. package/dist/lib/database/utils.d.ts +13 -10
  8. package/dist/lib/database/utils.d.ts.map +1 -1
  9. package/dist/lib/database/utils.js +22 -13
  10. package/dist/lib/database/utils.js.map +1 -1
  11. package/dist/lib/hazo_logs/config_parser.d.ts +25 -0
  12. package/dist/lib/hazo_logs/config_parser.d.ts.map +1 -0
  13. package/dist/lib/hazo_logs/config_parser.js +90 -0
  14. package/dist/lib/hazo_logs/config_parser.js.map +1 -0
  15. package/dist/lib/hazo_logs/index.d.ts +25 -0
  16. package/dist/lib/hazo_logs/index.d.ts.map +1 -0
  17. package/dist/lib/hazo_logs/index.js +26 -0
  18. package/dist/lib/hazo_logs/index.js.map +1 -0
  19. package/dist/lib/hazo_logs/types.d.ts +25 -0
  20. package/dist/lib/hazo_logs/types.d.ts.map +1 -0
  21. package/dist/lib/hazo_logs/types.js +7 -0
  22. package/dist/lib/hazo_logs/types.js.map +1 -0
  23. package/dist/lib/hazo_logs/winston_logger.d.ts +16 -0
  24. package/dist/lib/hazo_logs/winston_logger.d.ts.map +1 -0
  25. package/dist/lib/hazo_logs/winston_logger.js +67 -0
  26. package/dist/lib/hazo_logs/winston_logger.js.map +1 -0
  27. package/dist/lib/index.d.ts +1 -1
  28. package/dist/lib/index.d.ts.map +1 -1
  29. package/dist/lib/index.js +1 -1
  30. package/dist/lib/index.js.map +1 -1
  31. package/dist/lib/llm_api/dynamic_extract_helpers.d.ts +132 -0
  32. package/dist/lib/llm_api/dynamic_extract_helpers.d.ts.map +1 -0
  33. package/dist/lib/llm_api/dynamic_extract_helpers.js +414 -0
  34. package/dist/lib/llm_api/dynamic_extract_helpers.js.map +1 -0
  35. package/dist/lib/llm_api/hazo_llm_document_text.d.ts +20 -0
  36. package/dist/lib/llm_api/hazo_llm_document_text.d.ts.map +1 -0
  37. package/dist/lib/llm_api/hazo_llm_document_text.js +92 -0
  38. package/dist/lib/llm_api/hazo_llm_document_text.js.map +1 -0
  39. package/dist/lib/llm_api/hazo_llm_dynamic_data_extract.d.ts +49 -0
  40. package/dist/lib/llm_api/hazo_llm_dynamic_data_extract.d.ts.map +1 -0
  41. package/dist/lib/llm_api/hazo_llm_dynamic_data_extract.js +367 -0
  42. package/dist/lib/llm_api/hazo_llm_dynamic_data_extract.js.map +1 -0
  43. package/dist/lib/llm_api/hazo_llm_image_text.d.ts.map +1 -1
  44. package/dist/lib/llm_api/hazo_llm_image_text.js +3 -0
  45. package/dist/lib/llm_api/hazo_llm_image_text.js.map +1 -1
  46. package/dist/lib/llm_api/index.d.ts +52 -2
  47. package/dist/lib/llm_api/index.d.ts.map +1 -1
  48. package/dist/lib/llm_api/index.js +85 -0
  49. package/dist/lib/llm_api/index.js.map +1 -1
  50. package/dist/lib/llm_api/jsonpath_helper.d.ts +58 -0
  51. package/dist/lib/llm_api/jsonpath_helper.d.ts.map +1 -0
  52. package/dist/lib/llm_api/jsonpath_helper.js +255 -0
  53. package/dist/lib/llm_api/jsonpath_helper.js.map +1 -0
  54. package/dist/lib/llm_api/types.d.ts +190 -4
  55. package/dist/lib/llm_api/types.d.ts.map +1 -1
  56. package/dist/lib/llm_api/types.js.map +1 -1
  57. package/dist/lib/prompts/get_prompt.d.ts +4 -4
  58. package/dist/lib/prompts/get_prompt.d.ts.map +1 -1
  59. package/dist/lib/prompts/get_prompt.js +24 -24
  60. package/dist/lib/prompts/get_prompt.js.map +1 -1
  61. package/dist/lib/prompts/index.d.ts +1 -1
  62. package/dist/lib/prompts/index.d.ts.map +1 -1
  63. package/dist/lib/prompts/index.js +1 -1
  64. package/dist/lib/prompts/index.js.map +1 -1
  65. package/dist/lib/prompts/prompt_cache.d.ts +6 -6
  66. package/dist/lib/prompts/prompt_cache.d.ts.map +1 -1
  67. package/dist/lib/prompts/prompt_cache.js +9 -9
  68. package/dist/lib/prompts/prompt_cache.js.map +1 -1
  69. package/dist/lib/providers/gemini/gemini_client.d.ts.map +1 -1
  70. package/dist/lib/providers/gemini/gemini_client.js +5 -3
  71. package/dist/lib/providers/gemini/gemini_client.js.map +1 -1
  72. package/dist/lib/providers/gemini/gemini_provider.d.ts +16 -1
  73. package/dist/lib/providers/gemini/gemini_provider.d.ts.map +1 -1
  74. package/dist/lib/providers/gemini/gemini_provider.js +56 -0
  75. package/dist/lib/providers/gemini/gemini_provider.js.map +1 -1
  76. package/dist/lib/providers/qwen/qwen_provider.d.ts +14 -1
  77. package/dist/lib/providers/qwen/qwen_provider.d.ts.map +1 -1
  78. package/dist/lib/providers/qwen/qwen_provider.js +33 -0
  79. package/dist/lib/providers/qwen/qwen_provider.js.map +1 -1
  80. package/dist/lib/providers/types.d.ts +11 -1
  81. package/dist/lib/providers/types.d.ts.map +1 -1
  82. package/dist/lib/providers/types.js +1 -0
  83. package/dist/lib/providers/types.js.map +1 -1
  84. package/dist/server.d.ts +6 -3
  85. package/dist/server.d.ts.map +1 -1
  86. package/dist/server.js +8 -2
  87. package/dist/server.js.map +1 -1
  88. package/package.json +6 -3
  89. package/techdoc.md +184 -0
package/README.md CHANGED
@@ -23,6 +23,7 @@ A wrapper package for calling different LLMs with built-in prompt management and
23
23
  - **Extensible Architecture**: Provider-based design with simple registration system
24
24
  - **Type-Safe**: Full TypeScript support with comprehensive type definitions
25
25
  - **Auto-Initialization**: Database initializes automatically on import
26
+ - **File-Based Logging**: Built-in Winston logger with daily file rotation
26
27
 
27
28
  ## Installation
28
29
 
@@ -65,15 +66,22 @@ import {
65
66
  hazo_llm_image_text,
66
67
  hazo_llm_text_image,
67
68
  hazo_llm_image_image,
69
+ // Built-in Winston logger
70
+ create_hazo_logger,
71
+ parse_logging_config,
68
72
  } from 'hazo_llm_api/server';
69
73
 
70
- // Create a logger (Winston-compatible)
71
- const logger = {
72
- error: console.error,
73
- info: console.log,
74
- warn: console.warn,
75
- debug: console.debug,
76
- };
74
+ // Option A: Use built-in Winston logger with file rotation
75
+ const config = parse_logging_config('./config/hazo_llm_api_config.ini');
76
+ const logger = create_hazo_logger(config);
77
+
78
+ // Option B: Use a simple console logger
79
+ // const logger = {
80
+ // error: console.error,
81
+ // info: console.log,
82
+ // warn: console.warn,
83
+ // debug: console.debug,
84
+ // };
77
85
 
78
86
  // Initialize - reads config from config/hazo_llm_api_config.ini
79
87
  await initialize_llm_api({ logger });
@@ -439,6 +447,130 @@ const response = await hazo_llm_text_text({
439
447
  });
440
448
  ```
441
449
 
450
+ ### Prompt Import/Export Format
451
+
452
+ The test application supports bulk import/export of prompts via JSON files. This enables backup, migration, and sharing of prompt libraries.
453
+
454
+ #### Export Format
455
+
456
+ When exporting prompts, the JSON file follows this structure:
457
+
458
+ ```json
459
+ {
460
+ "version": "1.0",
461
+ "exported_at": "2024-01-15T10:30:00.000Z",
462
+ "prompts": [
463
+ {
464
+ "prompt_area": "marketing",
465
+ "prompt_key": "greeting",
466
+ "local_1": null,
467
+ "local_2": null,
468
+ "local_3": null,
469
+ "user_id": null,
470
+ "scope_id": null,
471
+ "prompt_text": "Hello {{name}}, welcome to {{service}}.",
472
+ "prompt_variables": [
473
+ { "name": "name", "description": "Customer name" },
474
+ { "name": "service", "description": "Service name" }
475
+ ],
476
+ "prompt_notes": "Standard greeting for marketing emails"
477
+ }
478
+ ]
479
+ }
480
+ ```
481
+
482
+ #### Required Fields for Import
483
+
484
+ | Field | Type | Required | Description |
485
+ |-------|------|----------|-------------|
486
+ | `prompt_area` | string | Yes | Category/area for the prompt |
487
+ | `prompt_key` | string | Yes | Unique key within the area |
488
+ | `prompt_text` | string | Yes | The prompt template text |
489
+ | `local_1` | string \| null | No | Local filter 1 (e.g., region) |
490
+ | `local_2` | string \| null | No | Local filter 2 (e.g., department) |
491
+ | `local_3` | string \| null | No | Local filter 3 (e.g., sub-category) |
492
+ | `user_id` | string \| null | No | User-specific identifier |
493
+ | `scope_id` | string \| null | No | Scope-specific identifier |
494
+ | `prompt_variables` | array | No | Array of `{ name, description }` objects |
495
+ | `prompt_notes` | string | No | Documentation/notes for the prompt |
496
+
497
+ #### Import Behavior
498
+
499
+ - Each imported prompt receives a new UUID automatically
500
+ - `created_at` is set to the import timestamp
501
+ - `changed_at` is set to the import timestamp
502
+ - Duplicate `prompt_area`/`prompt_key` combinations create new entries (no automatic deduplication)
503
+ - Invalid prompts (missing required fields) are skipped with errors reported
504
+
505
+ #### Bulk Operations UI
506
+
507
+ The test application's Prompt Configuration page (`/prompt-config`) provides a user interface for bulk operations:
508
+
509
+ **Selection:**
510
+ - Individual row selection via checkbox
511
+ - Select all/deselect all checkbox in table header
512
+ - Visual indication of selected rows
513
+
514
+ **Export:**
515
+ 1. Select one or more prompts using checkboxes
516
+ 2. Click "Export" button (Download icon)
517
+ 3. JSON file downloads automatically with filename: `prompts_export_YYYY-MM-DD.json`
518
+
519
+ **Import:**
520
+ 1. Click "Import" button (Upload icon)
521
+ 2. Select a JSON file matching the export format
522
+ 3. Prompts are validated and imported automatically
523
+ 4. Success/error messages display import results
524
+
525
+ **Delete:**
526
+ 1. Select one or more prompts using checkboxes
527
+ 2. Click "Delete Selected" button
528
+ 3. Confirm deletion in dialog
529
+ 4. Selected prompts are removed permanently
530
+
531
+ #### API Endpoints
532
+
533
+ The test application provides bulk operation endpoints:
534
+
535
+ | Method | Endpoint | Description |
536
+ |--------|----------|-------------|
537
+ | `POST` | `/api/prompts/bulk` | Import prompts from JSON |
538
+ | `DELETE` | `/api/prompts/bulk` | Delete multiple prompts by ID |
539
+
540
+ **Import Request:**
541
+ ```json
542
+ {
543
+ "prompts": [
544
+ { "prompt_area": "...", "prompt_key": "...", "prompt_text": "..." }
545
+ ]
546
+ }
547
+ ```
548
+
549
+ **Import Response:**
550
+ ```json
551
+ {
552
+ "success": true,
553
+ "imported_count": 5,
554
+ "errors": ["Optional array of error messages for failed imports"]
555
+ }
556
+ ```
557
+
558
+ **Delete Request:**
559
+ ```json
560
+ {
561
+ "ids": ["uuid-1", "uuid-2", "uuid-3"]
562
+ }
563
+ ```
564
+
565
+ **Delete Response:**
566
+ ```json
567
+ {
568
+ "success": true,
569
+ "deleted_count": 3,
570
+ "errors": ["Optional array of error messages for failed deletions"]
571
+ }
572
+ ```
573
+
442
574
  ## Server-Side Only
443
575
 
444
576
  **Important**: All LLM API functions must be used server-side only.
@@ -510,6 +642,69 @@ if (!response.success) {
510
642
 
511
643
  ## Configuration
512
644
 
645
+ ### File-Based Logging (hazo_logs)
646
+
647
+ The package includes a built-in Winston-based logger with daily file rotation. Configure logging in your `config/hazo_llm_api_config.ini`:
648
+
649
+ ```ini
650
+ [logging]
651
+ # Log file path (relative to config directory parent)
652
+ logfile=logs/hazo_llm_api.log
653
+ # Minimum log level: debug, info, warn, error
654
+ level=info
655
+ # Max file size before rotation (e.g., '10m', '100k')
656
+ max_size=10m
657
+ # Max number of rotated files to keep
658
+ max_files=5
659
+ # Also log to console (true/false)
660
+ console_enabled=true
661
+ ```
662
+
663
+ #### Using the Built-in Logger
664
+
665
+ ```typescript
666
+ import { create_hazo_logger, parse_logging_config } from 'hazo_llm_api/server';
667
+
668
+ // Parse config from INI file
669
+ const config = parse_logging_config('./config/hazo_llm_api_config.ini');
670
+
671
+ // Create logger instance
672
+ const logger = create_hazo_logger(config);
673
+
674
+ // Pass to initialize_llm_api
675
+ await initialize_llm_api({ logger });
676
+
677
+ // Use directly for application logging
678
+ logger.info('Application started');
679
+ logger.debug('Debug information', { key: 'value' });
680
+ logger.error('Error occurred', { error: err.message });
681
+ ```
682
+
683
+ #### Log Output Format
684
+
685
+ ```
686
+ 2026-01-18 08:22:00.885 [INFO] Logger initialized {"config_path":"..."}
687
+ 2026-01-18 08:22:01.123 [DEBUG] API call started {"provider":"gemini"}
688
+ 2026-01-18 08:22:02.456 [ERROR] Request failed {"error":"timeout"}
689
+ ```
690
+
691
+ #### Log File Rotation
692
+
693
+ Log files are automatically rotated:
694
+ - Daily rotation with date suffix: `hazo_llm_api-2026-01-18.log`
695
+ - Size-based rotation when `max_size` is exceeded
696
+ - Old files are deleted when `max_files` limit is reached
697
+
698
+ #### HazoLoggerConfig Options
699
+
700
+ | Option | Type | Default | Description |
701
+ |--------|------|---------|-------------|
702
+ | `log_file` | string | Required | Full path to log file |
703
+ | `log_level` | LogLevel | 'info' | Minimum log level (debug, info, warn, error) |
704
+ | `max_size` | string | '10m' | Max file size before rotation |
705
+ | `max_files` | number | 5 | Max rotated files to keep |
706
+ | `console_enabled` | boolean | true | Also log to console |
707
+
513
708
  ### Logger Interface
514
709
 
515
710
  The logger must implement these methods (Winston-compatible):
@@ -0,0 +1,224 @@
1
+ # Configuration file for hazo_llm_api package
2
+ # All configurable values should be stored here
3
+
4
+ [logging]
5
+ # Log file path for winston logging
6
+ logfile=logs/hazo_llm_api.log
7
+ # Minimum log level: debug, info, warn, error
8
+ level=info
9
+ # Max file size before rotation (e.g., '10m', '100k')
10
+ max_size=10m
11
+ # Max number of rotated files to keep
12
+ max_files=5
13
+ # Also log to console (true/false)
14
+ console_enabled=true
15
+
16
+ [package]
17
+ # Package build configuration
18
+ build_dir=dist
19
+ source_dir=src
20
+
21
+ [test_app]
22
+ # Test application configuration
23
+ port=3000
24
+ host=localhost
25
+
26
+ [ui]
27
+ # UI component defaults
28
+ default_theme=light
29
+ sidebar_width=256
30
+
31
+ [llm]
32
+ # LLM API global configuration
33
+ # Comma-separated list of enabled LLM providers (e.g., gemini,openai)
34
+ # Or JSON array format: ["gemini", "openai"]
35
+ enabled_llms=["gemini", "qwen"]
36
+ # Primary/default LLM to use when not specified in function calls
37
+ primary_llm=gemini
38
+ # SQLite database path relative to app root
39
+ sqlite_path=prompt_library.sqlite
40
+
41
+ # =============================================================================
42
+ # DEPRECATED: Legacy sections below kept for backward compatibility
43
+ # Migrate to new [llm_gemini] section below
44
+ # =============================================================================
45
+ ; [gemini]
46
+ ; # Legacy: Gemini API configuration - MIGRATED to [llm_gemini] section below
47
+ ; api_url=https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent
48
+ ; api_url_image=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent
49
+
50
+ ; [gemini_text_api]
51
+ ; # Legacy: Gemini Text API generation configuration - MIGRATED to [llm_gemini] section below
52
+
53
+ ; [gemini_image_api]
54
+ ; # Legacy: Gemini Image API generation configuration - MIGRATED to [llm_gemini] section below
55
+
56
+ [llm_gemini]
57
+ # Gemini Provider Configuration
58
+ # Note: API key must be in .env.local as GEMINI_API_KEY (not in config for security)
59
+ # Base API URL for text generation
60
+ api_url=https://generativelanguage.googleapis.com/v1/models/gemini-2.5-flash:generateContent
61
+ # API URL for image generation (optional, uses api_url if not set)
62
+ api_url_image=https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent
63
+ ; api_url_image=https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent
64
+ # Per-service model configuration (optional, uses model in URL if not specified)
65
+ # Model for text_text service
66
+ ; model_text_text=gemini-2.5-flash
67
+ # Model for image_text service
68
+ ; model_image_text=gemini-2.5-flash
69
+ # Model for text_image service
70
+ ; model_text_image=gemini-2.5-flash-image
71
+ # Model for image_image service
72
+ ; model_image_image=gemini-2.5-flash-image
73
+ # Model for document_text service (PDF analysis)
74
+ ; model_document_text=gemini-2.5-flash
75
+ # Capabilities this provider supports (JSON array)
76
+ # Options: text_text, image_text, text_image, image_image, document_text
77
+ capabilities=["text_text", "image_text", "text_image", "image_image", "document_text"]
78
+ # Generation config for text API calls
79
+ # These parameters are optional - only include them in API calls if uncommented
80
+ #
81
+ # temperature - Controls randomness in output (0.0-2.0)
82
+ # Lower values = more deterministic, higher values = more creative
83
+ ; text_temperature=0.7
84
+ #
85
+ # maxOutputTokens - Maximum number of tokens in the response
86
+ # Limits response length to control costs and output size
87
+ ; text_maxOutputTokens=1024
88
+ #
89
+ # topP - Nucleus sampling probability (0.0-1.0)
90
+ # Considers tokens with cumulative probability up to topP
91
+ ; text_topP=0.95
92
+ #
93
+ # topK - Top-k sampling
94
+ # Considers only the top K most probable tokens
95
+ ; text_topK=40
96
+ #
97
+ # candidateCount - Number of response candidates to generate
98
+ # Returns multiple alternative responses (1-8)
99
+ ; text_candidateCount=1
100
+ #
101
+ # stopSequences - JSON array of sequences that stop generation
102
+ # Generation stops when any of these sequences is encountered
103
+ ; text_stopSequences=["###END"]
104
+ #
105
+ # responseMimeType - Format of the response
106
+ # Options: text/plain, application/json
107
+ ; text_responseMimeType=text/plain
108
+ # Generation config for image API calls (text_image, image_image, image_text)
109
+ # These parameters are optional - only include them in API calls if uncommented
110
+ #
111
+ # temperature - Controls randomness in output (0.0-2.0)
112
+ # For image analysis, lower values (0.3-0.5) typically provide more accurate descriptions
113
+ image_temperature=0.1
114
+ #
115
+ # maxOutputTokens - Maximum number of tokens in the response
116
+ # For image descriptions, 300-500 is usually sufficient
117
+ ; image_maxOutputTokens=300
118
+ #
119
+ # topP - Nucleus sampling probability (0.0-1.0)
120
+ # Considers tokens with cumulative probability up to topP
121
+ ; image_topP=0.8
122
+ #
123
+ # topK - Top-k sampling
124
+ # Considers only the top K most probable tokens
125
+ ; image_topK=20
126
+ #
127
+ # candidateCount - Number of response candidates to generate
128
+ # Returns multiple alternative responses (1-8)
129
+ ; image_candidateCount=1
130
+ #
131
+ # stopSequences - JSON array of sequences that stop generation
132
+ # Generation stops when any of these sequences is encountered
133
+ ; image_stopSequences=["###END"]
134
+ #
135
+ # responseMimeType - Format of the response
136
+ # Options: text/plain, application/json
137
+ ; image_responseMimeType=text/plain
138
+
139
+ [llm_qwen]
140
+ # Qwen Provider Configuration
141
+ # Note: API key must be in .env.local as QWEN_API_KEY (not in config for security)
142
+ # Base API URL (default: DashScope endpoint)
143
+ # Used as fallback if service-specific URLs are not configured
144
+ api_url=https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
145
+ # Per-service model configuration (required for each service you want to use)
146
+ # Model for text_text service (e.g., qwen-max, qwen-plus)
147
+ model_text_text=qwen-max
148
+ # Model for image_text service (e.g., qwen-vl-max, qwen-vl-plus)
149
+ model_image_text=qwen-vl-max
150
+ model_text_image=qwen-image
151
+ ; model_image_image=qwen-image-edit
152
+ model_image_image=qwen-image-edit-plus
153
+ # Model for text_image service (if supported)
154
+ ; model_text_image=qwen-vl-max
155
+ # Model for image_image service (if supported)
156
+ ; model_image_image=qwen-vl-max
157
+ # Per-service API URL configuration (optional, uses api_url if not specified)
158
+ # API URL for text_text service
159
+ ; api_url_text_text=https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
160
+ # API URL for image_text service
161
+ ; api_url_image_text=https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
162
+ # API URL for text_image service (image generation)
163
+ ; api_url_text_image=https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis
164
+ # API URL for image_image service (image editing)
165
+ # Try multimodal generation endpoint for qwen-image-edit
166
+ api_url_image_image=https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation
167
+ # Capabilities this provider supports (JSON array)
168
+ # Options: text_text, image_text, text_image, image_image
169
+ # Note: Qwen typically supports text_text and image_text, image generation/transformation may not be available
170
+ capabilities=["text_text", "image_text", "text_image", "image_image"]
171
+ # Default system instruction (optional)
172
+ ; system_instruction=You are a helpful and friendly assistant.
173
+ # Generation config for text API calls
174
+ # These parameters are optional - only include them in API calls if uncommented
175
+ #
176
+ # temperature - Controls randomness in output (0.0-2.0)
177
+ # Lower values = more deterministic, higher values = more creative
178
+ ; text_temperature=0.8
179
+ #
180
+ # max_tokens - Maximum number of tokens in the response
181
+ # Limits response length to control costs and output size
182
+ ; text_max_tokens=1024
183
+ #
184
+ # top_p - Nucleus sampling probability (0.0-1.0)
185
+ # Considers tokens with cumulative probability up to top_p
186
+ ; text_top_p=0.95
187
+ #
188
+ # top_k - Top-k sampling
189
+ # Considers only the top K most probable tokens
190
+ ; text_top_k=40
191
+ #
192
+ # stop - JSON array of sequences that stop generation
193
+ # Generation stops when any of these sequences is encountered
194
+ ; text_stop=["###END"]
195
+ # Generation config for image API calls (image_text, text_image, image_image)
196
+ # These parameters are optional - only include them in API calls if uncommented
197
+ #
198
+ # temperature - Controls randomness in output (0.0-2.0)
199
+ # For image analysis, lower values (0.3-0.5) typically provide more accurate descriptions
200
+ ; image_temperature=0.4
201
+ #
202
+ # max_tokens - Maximum number of tokens in the response
203
+ # For image descriptions, 300-500 is usually sufficient
204
+ ; image_max_tokens=500
205
+ #
206
+ # top_p - Nucleus sampling probability (0.0-1.0)
207
+ # Considers tokens with cumulative probability up to top_p
208
+ ; image_top_p=0.8
209
+ #
210
+ # top_k - Top-k sampling
211
+ # Considers only the top K most probable tokens
212
+ ; image_top_k=20
213
+ #
214
+ # stop - JSON array of sequences that stop generation
215
+ # Generation stops when any of these sequences is encountered
216
+ ; image_stop=["###END"]
217
+
218
+ [database]
219
+ # Database configuration
220
+ # Enable WAL mode for better SQLite performance
221
+ wal_mode=true
222
+ # Table name for prompts
223
+ prompts_table=prompts_library
224
+
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Initializes and manages the SQLite database for prompt storage.
5
5
  * Uses sql.js for database operations (pure JavaScript SQLite).
6
- * Creates the prompts_library table if it doesn't exist.
6
+ * Creates the hazo_prompts table if it doesn't exist.
7
7
  */
8
8
  import { Database as SqlJsDatabase } from 'sql.js';
9
9
  import type { Logger, PromptRecord } from '../llm_api/types.js';
@@ -97,22 +97,22 @@ export declare function close_database(logger: Logger): void;
97
97
  * @param logger - Logger instance
98
98
  * @returns The inserted prompt record
99
99
  */
100
- export declare function insert_prompt(db: SqlJsDatabase, prompt: Omit<PromptRecord, 'uuid' | 'created_at' | 'changed_by'>, logger: Logger): PromptRecord;
100
+ export declare function insert_prompt(db: SqlJsDatabase, prompt: Omit<PromptRecord, 'id' | 'created_at' | 'changed_at'>, logger: Logger): PromptRecord;
101
101
  /**
102
102
  * Update an existing prompt in the database
103
103
  * @param db - Database instance
104
- * @param uuid - UUID of the prompt to update
104
+ * @param id - ID (UUID) of the prompt to update
105
105
  * @param updates - Fields to update
106
106
  * @param logger - Logger instance
107
107
  * @returns The updated prompt record
108
108
  */
109
- export declare function update_prompt(db: SqlJsDatabase, uuid: string, updates: Partial<Omit<PromptRecord, 'uuid' | 'created_at' | 'changed_by'>>, logger: Logger): PromptRecord | null;
109
+ export declare function update_prompt(db: SqlJsDatabase, id: string, updates: Partial<Omit<PromptRecord, 'id' | 'created_at' | 'changed_at'>>, logger: Logger): PromptRecord | null;
110
110
  /**
111
111
  * Delete a prompt from the database
112
112
  * @param db - Database instance
113
- * @param uuid - UUID of the prompt to delete
113
+ * @param id - ID (UUID) of the prompt to delete
114
114
  * @param logger - Logger instance
115
115
  * @returns True if deleted successfully, false if not found
116
116
  */
117
- export declare function delete_prompt(db: SqlJsDatabase, uuid: string, logger: Logger): boolean;
117
+ export declare function delete_prompt(db: SqlJsDatabase, id: string, logger: Logger): boolean;
118
118
  //# sourceMappingURL=init_database.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init_database.d.ts","sourceRoot":"","sources":["../../../src/lib/database/init_database.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAkB,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,QAAQ,CAAC;AAK9D,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAYhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAmBrD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAA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