@umituz/react-native-ai-gemini-provider 1.14.27 → 1.14.29

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/domain/README.md +232 -0
  3. package/src/domain/constants/README.md +191 -0
  4. package/src/domain/entities/README.md +238 -0
  5. package/src/infrastructure/README.md +252 -0
  6. package/src/infrastructure/cache/CACHE_SYSTEM.md +213 -0
  7. package/src/infrastructure/cache/README.md +213 -0
  8. package/src/infrastructure/content/CONTENT_BUILDER.md +175 -0
  9. package/src/infrastructure/content/README.md +175 -0
  10. package/src/infrastructure/interceptors/README.md +226 -0
  11. package/src/infrastructure/interceptors/REQUEST_INTERCEPTORS.md +171 -0
  12. package/src/infrastructure/job/JOB_MANAGER.md +174 -0
  13. package/src/infrastructure/job/README.md +194 -0
  14. package/src/infrastructure/response/README.md +187 -0
  15. package/src/infrastructure/response/RESPONSE_FORMATTER.md +185 -0
  16. package/src/infrastructure/services/CORE_CLIENT_SERVICE.md +202 -0
  17. package/src/infrastructure/services/FEATURE_MODEL_SELECTOR_SERVICE.md +206 -0
  18. package/src/infrastructure/services/GENERATION_EXECUTOR_SERVICE.md +176 -0
  19. package/src/infrastructure/services/IMAGE_EDIT_SERVICE.md +169 -0
  20. package/src/infrastructure/services/IMAGE_GENERATION_SERVICE.md +166 -0
  21. package/src/infrastructure/services/JOB_PROCESSOR_SERVICE.md +174 -0
  22. package/src/infrastructure/services/PROVIDER_INITIALIZER_SERVICE.md +176 -0
  23. package/src/infrastructure/services/README.md +233 -0
  24. package/src/infrastructure/services/RETRY_SERVICE.md +178 -0
  25. package/src/infrastructure/services/STREAMING_SERVICE.md +166 -0
  26. package/src/infrastructure/services/STRUCTURED_TEXT_SERVICE.md +175 -0
  27. package/src/infrastructure/services/TEXT_GENERATION_SERVICE.md +160 -0
  28. package/src/infrastructure/services/VEO_HTTP_CLIENT_SERVICE.md +179 -0
  29. package/src/infrastructure/services/VEO_POLLING_SERVICE.md +173 -0
  30. package/src/infrastructure/services/VIDEO_DOWNLOADER_SERVICE.md +166 -0
  31. package/src/infrastructure/services/VIDEO_ERROR_HANDLER_SERVICE.md +185 -0
  32. package/src/infrastructure/services/VIDEO_GENERATION_SERVICE.md +176 -0
  33. package/src/infrastructure/services/VIDEO_URL_EXTRACTOR_SERVICE.md +186 -0
  34. package/src/infrastructure/telemetry/README.md +203 -0
  35. package/src/infrastructure/telemetry/TELEMETRY_SYSTEM.md +200 -0
  36. package/src/infrastructure/utils/DATA_TRANSFORMER_UTILS.md +175 -0
  37. package/src/infrastructure/utils/ERROR_MAPPER.md +170 -0
  38. package/src/infrastructure/utils/ERROR_UTILITIES.md +208 -0
  39. package/src/infrastructure/utils/IMAGE_PREPARER_UTILS.md +185 -0
  40. package/src/infrastructure/utils/INPUT_BUILDERS.md +214 -0
  41. package/src/infrastructure/utils/MODEL_VALIDATION_UTILS.md +189 -0
  42. package/src/infrastructure/utils/PERFORMANCE_UTILITIES.md +477 -0
  43. package/src/infrastructure/utils/PERFORMANCE_UTILS.md +219 -0
  44. package/src/infrastructure/utils/README.md +289 -0
  45. package/src/presentation/README.md +187 -0
  46. package/src/presentation/hooks/README.md +188 -0
  47. package/src/presentation/hooks/USE_GEMINI_HOOK.md +226 -0
  48. package/src/providers/README.md +247 -0
@@ -0,0 +1,187 @@
1
+ # Response Module
2
+
3
+ Response formatting and transformation utilities for Gemini API responses. Provides consistent response structures.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import {
9
+ ResponseFormatter
10
+ } from '@umituz/react-native-ai-gemini-provider';
11
+ ```
12
+
13
+ ## 🎯 Purpose
14
+
15
+ Use response module to format and transform Gemini API responses consistently. Extracts text and image data from responses.
16
+
17
+ **When to use:**
18
+ - Format API responses consistently
19
+ - Extract text from responses
20
+ - Extract image data from multimodal responses
21
+ - Normalize response structures
22
+ - Handle response types safely
23
+
24
+ ## 📌 Strategy
25
+
26
+ Response formatting ensures consistency. This module:
27
+ - Extracts text content automatically
28
+ - Handles image data in responses
29
+ - Provides typed response structures
30
+ - Preserves original response
31
+ - Simplifies response handling
32
+
33
+ **Key Decision**: Always format responses before using. Provides consistent interface for different response types.
34
+
35
+ ## ⚠️ Rules
36
+
37
+ ### Formatting Rules
38
+ - **MUST** format all API responses
39
+ - **SHOULD** specify expected response type
40
+ - **MUST** check for optional fields
41
+ - **SHOULD** preserve original response
42
+ - **MUST NOT** assume response structure
43
+
44
+ ### Type Safety Rules
45
+ - **SHOULD** use generic type parameter
46
+ - **MUST** check for optional fields
47
+ - **SHOULD** use type guards
48
+ - **MUST** handle undefined values
49
+ - **SHOULD NOT** use non-null assertion
50
+
51
+ ### Data Extraction Rules
52
+ - **MUST** handle missing text gracefully
53
+ - **SHOULD** validate image data
54
+ - **MUST** check for image presence
55
+ - **SHOULD** extract MIME type correctly
56
+ - **MUST NOT** fail on partial data
57
+
58
+ ### Error Handling Rules
59
+ - **SHOULD** wrap formatting in try-catch
60
+ - **MUST** handle malformed responses
61
+ - **SHOULD** log formatting errors
62
+ - **MUST** provide fallback values
63
+ - **SHOULD NOT** throw formatting errors
64
+
65
+ ## 🤖 AI Agent Guidelines
66
+
67
+ ### When Formatting Responses
68
+ 1. **CREATE** ResponseFormatter instance
69
+ 2. **CALL** formatResponse() with type
70
+ 3. **CHECK** for optional fields
71
+ 4. **EXTRACT** needed data
72
+ 5. **HANDLE** missing data gracefully
73
+
74
+ ### When Handling Text Responses
75
+ 1. **FORMAT** response with text type
76
+ 2. **CHECK** text field exists
77
+ 3. **VALIDATE** text not empty
78
+ 4. **USE** text value
79
+ 5. **HANDLE** empty text case
80
+
81
+ ### When Handling Image Responses
82
+ 1. **FORMAT** response with image type
83
+ 2. **CHECK** imageUrl exists
84
+ 3. **EXTRACT** imageBase64 if needed
85
+ 4. **USE** MIME type correctly
86
+ 5. **HANDLE** missing image case
87
+
88
+ ### Code Style Rules
89
+ - **USE** generic type parameter
90
+ - **CHECK** optional fields before use
91
+ - **PROVIDE** fallback values
92
+ - **LOG** formatting issues
93
+ - **PRESERVE** original response
94
+
95
+ ## 📦 Available Classes
96
+
97
+ ### ResponseFormatter
98
+
99
+ **Refer to**: [`ResponseFormatter.ts`](./ResponseFormatter.ts)
100
+
101
+ **Methods:**
102
+ - `formatResponse<T>(response, input)` - Format response to typed structure
103
+
104
+ ## 🔗 Related Modules
105
+
106
+ - **Text Generation**: [`../services/TEXT_GENERATION_SERVICE.md`](../services/TEXT_GENERATION_SERVICE.md)
107
+ - **Image Generation**: [`../services/IMAGE_GENERATION_SERVICE.md`](../services/IMAGE_GENERATION_SERVICE.md)
108
+ - **Data Transformer**: [`../utils/DATA_TRANSFORMER_UTILS.md`](../utils/DATA_TRANSFORMER_UTILS.md)
109
+
110
+ ## 📋 Response Types
111
+
112
+ ### Text Response
113
+ ```typescript
114
+ {
115
+ text: string; // Extracted text content
116
+ response: unknown; // Original API response
117
+ }
118
+ ```
119
+
120
+ ### Multimodal Response
121
+ ```typescript
122
+ {
123
+ text: string; // Extracted text content
124
+ imageUrl: string; // Data URL (data:image/png;base64,...)
125
+ imageBase64: string; // Base64 image data
126
+ mimeType: string; // Image MIME type
127
+ response: unknown; // Original API response
128
+ }
129
+ ```
130
+
131
+ ## 🎓 Usage Patterns
132
+
133
+ ### Basic Formatting
134
+ 1. Create ResponseFormatter instance
135
+ 2. Call formatResponse() with type
136
+ 3. Extract needed fields
137
+ 4. Check for optional data
138
+ 5. Handle response appropriately
139
+
140
+ ### Text Response Handling
141
+ 1. Format response as text type
142
+ 2. Check text field exists
143
+ 3. Validate text content
144
+ 4. Use text in application
145
+ 5. Handle empty text case
146
+
147
+ ### Image Response Handling
148
+ 1. Format response with image type
149
+ 2. Check imageUrl exists
150
+ 3. Extract imageBase64 if needed
151
+ 4. Use imageUrl for display
152
+ 5. Handle missing image case
153
+
154
+ ### Multimodal Handling
155
+ 1. Format response
156
+ 2. Check for both text and image
157
+ 3. Handle different response types
158
+ 4. Display appropriate content
159
+ 5. Fallback to available data
160
+
161
+ ### Type-Safe Formatting
162
+ 1. Define response interface
163
+ 2. Format with generic type
164
+ 3. Use type guards
165
+ 4. Narrow response type
166
+ 5. Use typed data safely
167
+
168
+ ## 🚨 Common Pitfalls
169
+
170
+ ### Don't
171
+ - Assume text field always exists
172
+ - Use imageUrl without checking
173
+ - Discard original response
174
+ - Use non-null assertions
175
+ - Skip type checking
176
+
177
+ ### Do
178
+ - Always check optional fields
179
+ - Validate data before use
180
+ - Preserve original response
181
+ - Use type guards
182
+ - Handle missing data gracefully
183
+
184
+ ---
185
+
186
+ **Last Updated**: 2025-01-08
187
+ **See Also**: [AI_GUIDELINES.md](../../../../AI_GUIDELINES.md)
@@ -0,0 +1,185 @@
1
+ # Response Formatter
2
+
3
+ Utility for formatting Gemini API responses into consistent output structures. Handles text and image data extraction from API responses.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import { ResponseFormatter } from '@umituz/react-native-ai-gemini-provider';
9
+ ```
10
+
11
+ ## 🎯 Purpose
12
+
13
+ Use ResponseFormatter to convert raw Gemini API responses into consistent, typed structures. Extracts text and image data automatically.
14
+
15
+ **When to use:**
16
+ - Format API responses consistently
17
+ - Extract text from responses
18
+ - Extract image data from multimodal responses
19
+ - Normalize response structures
20
+ - Handle response types safely
21
+
22
+ ## 📌 Strategy
23
+
24
+ Response formatting ensures consistency. This utility:
25
+ - Extracts text content automatically
26
+ - Handles image data in responses
27
+ - Provides typed response structures
28
+ - Preserves original response
29
+ - Simplifies response handling
30
+
31
+ **Key Decision**: Always format responses before using. Provides consistent interface for different response types.
32
+
33
+ ## ⚠️ Rules
34
+
35
+ ### Formatting Rules
36
+ - **MUST** format all API responses
37
+ - **SHOULD** specify expected response type
38
+ - **MUST** check for optional fields
39
+ - **SHOULD** preserve original response
40
+ - **MUST NOT** assume response structure
41
+
42
+ ### Type Safety Rules
43
+ - **SHOULD** use generic type parameter
44
+ - **MUST** check for optional fields
45
+ - **SHOULD** use type guards
46
+ - **MUST** handle undefined values
47
+ - **SHOULD NOT** use non-null assertion
48
+
49
+ ### Data Extraction Rules
50
+ - **MUST** handle missing text gracefully
51
+ - **SHOULD** validate image data
52
+ - **MUST** check for image presence
53
+ - **SHOULD** extract MIME type correctly
54
+ - **MUST NOT** fail on partial data
55
+
56
+ ### Error Handling Rules
57
+ - **SHOULD** wrap formatting in try-catch
58
+ - **MUST** handle malformed responses
59
+ - **SHOULD** log formatting errors
60
+ - **MUST** provide fallback values
61
+ - **SHOULD NOT** throw formatting errors
62
+
63
+ ## 🤖 AI Agent Guidelines
64
+
65
+ ### When Formatting Responses
66
+ 1. **CREATE** ResponseFormatter instance
67
+ 2. **CALL** formatResponse() with type
68
+ 3. **CHECK** for optional fields
69
+ 4. **EXTRACT** needed data
70
+ 5. **HANDLE** missing data gracefully
71
+
72
+ ### When Handling Text Responses
73
+ 1. **FORMAT** response with text type
74
+ 2. **CHECK** text field exists
75
+ 3. **VALIDATE** text not empty
76
+ 4. **USE** text value
77
+ 5. **HANDLE** empty text case
78
+
79
+ ### When Handling Image Responses
80
+ 1. **FORMAT** response with image type
81
+ 2. **CHECK** imageUrl exists
82
+ 3. **EXTRACT** imageBase64 data
83
+ 4. **USE** MIME type correctly
84
+ 5. **HANDLE** missing image case
85
+
86
+ ### Code Style Rules
87
+ - **USE** generic type parameter
88
+ - **CHECK** optional fields before use
89
+ - **PROVIDE** fallback values
90
+ - **LOG** formatting issues
91
+ - **PRESERVE** original response
92
+
93
+ ## 📦 Available Class
94
+
95
+ ### ResponseFormatter
96
+
97
+ **Refer to**: [`ResponseFormatter.ts`](./ResponseFormatter.ts)
98
+
99
+ **Methods:**
100
+ - `formatResponse<T>(response, input)` - Format response to typed structure
101
+
102
+ ## 🔗 Related Modules
103
+
104
+ - **Text Generation Service**: [`../services/TEXT_GENERATION_SERVICE.md`](../services/TEXT_GENERATION_SERVICE.md)
105
+ - **Image Generation Service**: [`../services/IMAGE_GENERATION_SERVICE.md`](../services/IMAGE_GENERATION_SERVICE.md)
106
+ - **Generation Executor**: [`../services/GENERATION_EXECUTOR_SERVICE.md`](../services/GENERATION_EXECUTOR_SERVICE.md)
107
+
108
+ ## 📋 Response Types
109
+
110
+ ### Text Response
111
+ ```typescript
112
+ {
113
+ text: string; // Extracted text content
114
+ response: unknown; // Original API response
115
+ }
116
+ ```
117
+
118
+ ### Multimodal Response
119
+ ```typescript
120
+ {
121
+ text: string; // Extracted text content
122
+ imageUrl: string; // Data URL (data:image/png;base64,...)
123
+ imageBase64: string; // Base64 image data
124
+ mimeType: string; // Image MIME type
125
+ response: unknown; // Original API response
126
+ }
127
+ ```
128
+
129
+ ## 🎓 Usage Patterns
130
+
131
+ ### Basic Formatting
132
+ 1. Create ResponseFormatter instance
133
+ 2. Call formatResponse() with type
134
+ 3. Extract needed fields
135
+ 4. Check for optional data
136
+ 5. Handle response appropriately
137
+
138
+ ### Text Response Handling
139
+ 1. Format response as text type
140
+ 2. Check text field exists
141
+ 3. Validate text content
142
+ 4. Use text in application
143
+ 5. Handle empty text case
144
+
145
+ ### Image Response Handling
146
+ 1. Format response with image type
147
+ 2. Check imageUrl exists
148
+ 3. Extract imageBase64 if needed
149
+ 4. Use imageUrl for display
150
+ 5. Handle missing image case
151
+
152
+ ### Multimodal Handling
153
+ 1. Format response
154
+ 2. Check for both text and image
155
+ 3. Handle different response types
156
+ 4. Display appropriate content
157
+ 5. Fallback to available data
158
+
159
+ ### Type-Safe Formatting
160
+ 1. Define response interface
161
+ 2. Format with generic type
162
+ 3. Use type guards
163
+ 4. Narrow response type
164
+ 5. Use typed data safely
165
+
166
+ ## 🚨 Common Pitfalls
167
+
168
+ ### Don't
169
+ - Assume text field always exists
170
+ - Use imageUrl without checking
171
+ - Discard original response
172
+ - Use non-null assertions
173
+ - Skip type checking
174
+
175
+ ### Do
176
+ - Always check optional fields
177
+ - Validate data before use
178
+ - Preserve original response
179
+ - Use type guards
180
+ - Handle missing data gracefully
181
+
182
+ ---
183
+
184
+ **Last Updated**: 2025-01-08
185
+ **See Also**: [AI_GUIDELINES.md](../../../../AI_GUIDELINES.md)
@@ -0,0 +1,202 @@
1
+ # Core Client Service
2
+
3
+ Low-level communication with Google Gemini SDK. Handles model loading, configuration, and SDK management.
4
+
5
+ ## 📍 Import Path
6
+
7
+ ```
8
+ import { geminiClientCoreService } from '@umituz/react-native-ai-gemini-provider';
9
+ ```
10
+
11
+ ## 🎯 Purpose
12
+
13
+ Use this service to initialize and configure the Gemini SDK. Manages the underlying Gemini client instance and provides access to configured models.
14
+
15
+ **When to use:**
16
+ - Initialize Gemini SDK with API key
17
+ - Configure default models for different features
18
+ - Access Gemini model instances directly
19
+ - Update SDK configuration at runtime
20
+ - Validate SDK initialization status
21
+
22
+ ## 📌 Strategy
23
+
24
+ Core client acts as the foundation for all Gemini operations. This service:
25
+ - Implements singleton pattern for single SDK instance
26
+ - Manages SDK lifecycle (initialization, configuration)
27
+ - Provides typed model instances
28
+ - Handles API key and endpoint configuration
29
+ - Validates initialization before operations
30
+
31
+ **Key Decision**: Use singleton pattern to ensure single Gemini SDK instance. All other services use this core client for model access.
32
+
33
+ ## ⚠️ Rules
34
+
35
+ ### Usage Rules
36
+ - **MUST** initialize before any Gemini operations
37
+ - **MUST** provide valid API key in configuration
38
+ - **SHOULD** initialize once at application startup
39
+ - **MUST NOT** create multiple instances (use singleton)
40
+ - **SHOULD** validate initialization before use
41
+
42
+ ### Configuration Rules
43
+ - **MUST** set API key (required field)
44
+ - **SHOULD** configure appropriate models for features
45
+ - **MUST NOT** expose API keys in logs or errors
46
+ - **SHOULD** set reasonable retry limits
47
+ - **MUST** use valid model IDs
48
+
49
+ ### Error Handling Rules
50
+ - **MUST** validate configuration before initialization
51
+ - **MUST** handle initialization errors appropriately
52
+ - **SHOULD** provide clear error messages
53
+ - **MUST** throw errors for invalid API keys
54
+ - **SHOULD** log initialization status in development
55
+
56
+ ## 🤖 AI Agent Guidelines
57
+
58
+ ### When Modifying This Service
59
+ 1. **READ** the implementation file first
60
+ 2. **UNDERSTAND** singleton pattern
61
+ 3. **MAINTAIN** backward compatibility
62
+ 4. **ADD** tests for new functionality
63
+ 5. **UPDATE** type definitions
64
+
65
+ ### When Adding New Features
66
+ 1. **CHECK** if feature exists in other services
67
+ 2. **FOLLOW** existing initialization patterns
68
+ 3. **USE** established error handling
69
+ 4. **DOCUMENT** in type definitions
70
+ 5. **ADD** examples to tests (not docs)
71
+
72
+ ### When Fixing Bugs
73
+ 1. **REPRODUCE** bug locally first
74
+ 2. **IDENTIFY** root cause
75
+ 3. **FIX** with minimal changes
76
+ 4. **ADD** regression test
77
+ 5. **VERIFY** all tests pass
78
+
79
+ ### Code Style Rules
80
+ - **USE** singleton pattern
81
+ - **VALIDATE** all inputs
82
+ - **THROW** typed errors
83
+ - **LOG** important operations
84
+ - **COMMENT** complex logic only
85
+
86
+ ## 📦 Available Methods
87
+
88
+ ### `initialize(config)`
89
+
90
+ Initialize Gemini client with configuration.
91
+
92
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
93
+
94
+ ### `getModel(model)`
95
+
96
+ Get Gemini model instance by ID.
97
+
98
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
99
+
100
+ ### `getConfig()`
101
+
102
+ Get current configuration.
103
+
104
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
105
+
106
+ ### `isInitialized()`
107
+
108
+ Check if service is initialized.
109
+
110
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
111
+
112
+ ### `validateInitialization()`
113
+
114
+ Validate initialization, throw error if not initialized.
115
+
116
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
117
+
118
+ ### `updateConfig(config)`
119
+
120
+ Update configuration at runtime.
121
+
122
+ **Refer to**: [`gemini-client-core.service.ts`](./gemini-client-core.service.ts)
123
+
124
+ ## 🔗 Related Modules
125
+
126
+ - **Domain Types**: [`domain/entities/README.md`](../domain/entities/README.md)
127
+ - **Text Generation**: [`TEXT_GENERATION_SERVICE.md`](./TEXT_GENERATION_SERVICE.md)
128
+ - **Image Generation**: [`IMAGE_GENERATION_SERVICE.md`](./IMAGE_GENERATION_SERVICE.md)
129
+ - **Video Generation**: [`VIDEO_GENERATION_SERVICE.md`](./VIDEO_GENERATION_SERVICE.md)
130
+
131
+ ## 📋 Configuration Reference
132
+
133
+ ### GeminiConfig
134
+
135
+ Configuration interface definition found in: [`domain/entities/README.md`](../domain/entities/README.md)
136
+
137
+ **Required Fields:**
138
+ - `apiKey`: string - API key from Google Cloud Console
139
+
140
+ **Optional Fields:**
141
+ - `baseUrl`: string - Custom base URL for API requests
142
+ - `maxRetries`: number - Maximum retry attempts (default: 3)
143
+ - `baseDelay`: number - Initial retry delay in ms (default: 1000)
144
+ - `maxDelay`: number - Maximum retry delay in ms (default: 10000)
145
+ - `defaultTimeoutMs`: number - Request timeout in ms
146
+ - `textModel`: string - Default text generation model
147
+ - `textToImageModel`: string - Default image generation model
148
+ - `imageEditModel`: string - Default image editing model
149
+ - `videoGenerationModel`: string - Default video generation model
150
+
151
+ ### Supported Models
152
+
153
+ See model IDs in: [`domain/constants/README.md`](../domain/constants/README.md)
154
+
155
+ ## 🎓 Usage Patterns
156
+
157
+ ### Basic Initialization
158
+ 1. Import service
159
+ 2. Call `initialize()` with API key
160
+ 3. Verify initialization with `isInitialized()`
161
+ 4. Use services normally
162
+
163
+ ### Advanced Configuration
164
+ 1. Prepare configuration object with all settings
165
+ 2. Include model IDs for each feature
166
+ 3. Set retry and timeout parameters
167
+ 4. Call `initialize()` with configuration
168
+ 5. Validate initialization succeeded
169
+
170
+ ### Runtime Configuration Updates
171
+ 1. Check current configuration with `getConfig()`
172
+ 2. Prepare partial config update
173
+ 3. Call `updateConfig()` with new values
174
+ 4. Verify changes applied
175
+
176
+ ### Direct Model Access
177
+ 1. Ensure service is initialized
178
+ 2. Call `getModel()` with model ID
179
+ 3. Use returned model instance directly
180
+ 4. Handle model errors appropriately
181
+
182
+ ## 🚨 Common Pitfalls
183
+
184
+ ### Don't
185
+ - Initialize multiple times
186
+ - Create new instances (use singleton)
187
+ - Skip initialization validation
188
+ - Expose API keys in logs
189
+ - Use uninitialized service
190
+
191
+ ### Do
192
+ - Initialize once at app startup
193
+ - Use singleton instance
194
+ - Validate before use
195
+ - Handle initialization errors
196
+ - Set appropriate model IDs
197
+ - Configure reasonable timeouts
198
+
199
+ ---
200
+
201
+ **Last Updated**: 2025-01-08
202
+ **See Also**: [AI_GUIDELINES.md](../../AI_GUIDELINES.md)