universal-llm-client 4.5.0 → 4.5.1

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 (174) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -0
  3. package/dist/ai-model.d.ts +0 -1
  4. package/dist/ai-model.js +0 -1
  5. package/dist/auditor.d.ts +0 -1
  6. package/dist/auditor.js +0 -1
  7. package/dist/client.d.ts +0 -1
  8. package/dist/client.js +0 -1
  9. package/dist/gemma-channel.d.ts +0 -1
  10. package/dist/gemma-channel.js +0 -1
  11. package/dist/gemma-diffusion.d.ts +0 -1
  12. package/dist/gemma-diffusion.js +0 -1
  13. package/dist/http.d.ts +0 -1
  14. package/dist/http.js +0 -1
  15. package/dist/index.d.ts +0 -1
  16. package/dist/index.js +0 -1
  17. package/dist/interfaces.d.ts +0 -1
  18. package/dist/interfaces.js +0 -1
  19. package/dist/mcp.d.ts +0 -1
  20. package/dist/mcp.js +0 -1
  21. package/dist/providers/anthropic.d.ts +0 -1
  22. package/dist/providers/anthropic.js +0 -1
  23. package/dist/providers/google.d.ts +0 -1
  24. package/dist/providers/google.js +0 -1
  25. package/dist/providers/index.d.ts +0 -1
  26. package/dist/providers/index.js +0 -1
  27. package/dist/providers/ollama.d.ts +0 -1
  28. package/dist/providers/ollama.js +0 -1
  29. package/dist/providers/openai.d.ts +2 -1
  30. package/dist/providers/openai.js +303 -74
  31. package/dist/router.d.ts +0 -1
  32. package/dist/router.js +0 -1
  33. package/dist/stream-decoder.d.ts +0 -1
  34. package/dist/stream-decoder.js +0 -1
  35. package/dist/structured-output.d.ts +0 -1
  36. package/dist/structured-output.js +0 -1
  37. package/dist/thinking.d.ts +0 -1
  38. package/dist/thinking.js +0 -1
  39. package/dist/tools.d.ts +0 -1
  40. package/dist/tools.js +0 -1
  41. package/dist/zod-adapter.d.ts +0 -1
  42. package/dist/zod-adapter.js +0 -1
  43. package/package.json +1 -2
  44. package/dist/ai-model.d.ts.map +0 -1
  45. package/dist/ai-model.js.map +0 -1
  46. package/dist/auditor.d.ts.map +0 -1
  47. package/dist/auditor.js.map +0 -1
  48. package/dist/client.d.ts.map +0 -1
  49. package/dist/client.js.map +0 -1
  50. package/dist/gemma-channel.d.ts.map +0 -1
  51. package/dist/gemma-channel.js.map +0 -1
  52. package/dist/gemma-diffusion.d.ts.map +0 -1
  53. package/dist/gemma-diffusion.js.map +0 -1
  54. package/dist/http.d.ts.map +0 -1
  55. package/dist/http.js.map +0 -1
  56. package/dist/index.d.ts.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/interfaces.d.ts.map +0 -1
  59. package/dist/interfaces.js.map +0 -1
  60. package/dist/mcp.d.ts.map +0 -1
  61. package/dist/mcp.js.map +0 -1
  62. package/dist/providers/anthropic.d.ts.map +0 -1
  63. package/dist/providers/anthropic.js.map +0 -1
  64. package/dist/providers/google.d.ts.map +0 -1
  65. package/dist/providers/google.js.map +0 -1
  66. package/dist/providers/index.d.ts.map +0 -1
  67. package/dist/providers/index.js.map +0 -1
  68. package/dist/providers/ollama.d.ts.map +0 -1
  69. package/dist/providers/ollama.js.map +0 -1
  70. package/dist/providers/openai.d.ts.map +0 -1
  71. package/dist/providers/openai.js.map +0 -1
  72. package/dist/router.d.ts.map +0 -1
  73. package/dist/router.js.map +0 -1
  74. package/dist/stream-decoder.d.ts.map +0 -1
  75. package/dist/stream-decoder.js.map +0 -1
  76. package/dist/structured-output.d.ts.map +0 -1
  77. package/dist/structured-output.js.map +0 -1
  78. package/dist/thinking.d.ts.map +0 -1
  79. package/dist/thinking.js.map +0 -1
  80. package/dist/tools.d.ts.map +0 -1
  81. package/dist/tools.js.map +0 -1
  82. package/dist/zod-adapter.d.ts.map +0 -1
  83. package/dist/zod-adapter.js.map +0 -1
  84. package/src/ai-model.ts +0 -400
  85. package/src/auditor.ts +0 -213
  86. package/src/client.ts +0 -402
  87. package/src/debug/debug-google-streaming.ts +0 -97
  88. package/src/debug/debug-tool-execution.ts +0 -86
  89. package/src/debug/test-lmstudio-tools.ts +0 -155
  90. package/src/demos/README.md +0 -47
  91. package/src/demos/basic/universal-llm-examples.ts +0 -161
  92. package/src/demos/diffusion-gemma/.env +0 -29
  93. package/src/demos/diffusion-gemma/.env.example +0 -27
  94. package/src/demos/diffusion-gemma/CLAUDE.md +0 -95
  95. package/src/demos/diffusion-gemma/README.md +0 -59
  96. package/src/demos/diffusion-gemma/canvas.ts +0 -1606
  97. package/src/demos/diffusion-gemma/docker-compose.yml +0 -29
  98. package/src/demos/diffusion-gemma/probe-stream.ts +0 -51
  99. package/src/demos/diffusion-gemma/probe-tools.ts +0 -55
  100. package/src/demos/diffusion-gemma/server.ts +0 -1205
  101. package/src/demos/diffusion-gemma/start-vllm.sh +0 -98
  102. package/src/demos/mcp/astrid-memory-demo.ts +0 -295
  103. package/src/demos/mcp/astrid-persona-memory.ts +0 -357
  104. package/src/demos/mcp/mcp-mongodb-demo.ts +0 -275
  105. package/src/demos/mcp/simple-astrid-memory.ts +0 -148
  106. package/src/demos/mcp/simple-mcp-demo.ts +0 -68
  107. package/src/demos/mcp/working-mcp-demo.ts +0 -62
  108. package/src/demos/model-alias-demo.ts +0 -0
  109. package/src/demos/tools/RAG_MEMORY_INTEGRATION.md +0 -267
  110. package/src/demos/tools/astrid-memory-demo.ts +0 -270
  111. package/src/demos/tools/astrid-production-memory-clean.ts +0 -785
  112. package/src/demos/tools/astrid-production-memory.ts +0 -558
  113. package/src/demos/tools/basic-translation-test.ts +0 -66
  114. package/src/demos/tools/chromadb-similarity-tuning.ts +0 -390
  115. package/src/demos/tools/clean-multilingual-conversation.ts +0 -209
  116. package/src/demos/tools/clean-translation-test.ts +0 -119
  117. package/src/demos/tools/clean-universal-multilingual-test.ts +0 -131
  118. package/src/demos/tools/complete-rag-demo.ts +0 -369
  119. package/src/demos/tools/complete-tool-demo.ts +0 -132
  120. package/src/demos/tools/demo-tool-calling.ts +0 -124
  121. package/src/demos/tools/dynamic-language-switching-test.ts +0 -251
  122. package/src/demos/tools/hybrid-thinking-test.ts +0 -154
  123. package/src/demos/tools/memory-integration-test.ts +0 -420
  124. package/src/demos/tools/multilingual-memory-system.ts +0 -802
  125. package/src/demos/tools/ondemand-translation-demo.ts +0 -655
  126. package/src/demos/tools/production-tool-demo.ts +0 -245
  127. package/src/demos/tools/revolutionary-multilingual-test.ts +0 -151
  128. package/src/demos/tools/rigorous-language-analysis.ts +0 -218
  129. package/src/demos/tools/test-universal-memory-system.ts +0 -126
  130. package/src/demos/tools/translation-integration-guide.ts +0 -346
  131. package/src/demos/tools/universal-memory-system.ts +0 -560
  132. package/src/gemma-channel.ts +0 -47
  133. package/src/gemma-diffusion.ts +0 -167
  134. package/src/http.ts +0 -261
  135. package/src/index.ts +0 -180
  136. package/src/interfaces.ts +0 -843
  137. package/src/mcp.ts +0 -345
  138. package/src/providers/anthropic.ts +0 -796
  139. package/src/providers/google.ts +0 -840
  140. package/src/providers/index.ts +0 -8
  141. package/src/providers/ollama.ts +0 -503
  142. package/src/providers/openai.ts +0 -587
  143. package/src/router.ts +0 -785
  144. package/src/stream-decoder.ts +0 -535
  145. package/src/structured-output.ts +0 -759
  146. package/src/test-scripts/test-advanced-tools.ts +0 -310
  147. package/src/test-scripts/test-google-deep-research.ts +0 -33
  148. package/src/test-scripts/test-google-streaming-enhanced.ts +0 -147
  149. package/src/test-scripts/test-google-streaming.ts +0 -63
  150. package/src/test-scripts/test-google-system-prompt-comprehensive.ts +0 -189
  151. package/src/test-scripts/test-google-thinking.ts +0 -46
  152. package/src/test-scripts/test-mcp-config.ts +0 -28
  153. package/src/test-scripts/test-mcp-connection.ts +0 -29
  154. package/src/test-scripts/test-system-message-positions.ts +0 -163
  155. package/src/test-scripts/test-system-prompt-improvement-demo.ts +0 -83
  156. package/src/test-scripts/test-tool-calling.ts +0 -231
  157. package/src/test-scripts/test-vllm-qwen36.ts +0 -256
  158. package/src/tests/ai-model.test.ts +0 -1614
  159. package/src/tests/auditor.test.ts +0 -224
  160. package/src/tests/gemma-diffusion.test.ts +0 -115
  161. package/src/tests/http.test.ts +0 -200
  162. package/src/tests/interfaces.test.ts +0 -117
  163. package/src/tests/providers/anthropic.test.ts +0 -118
  164. package/src/tests/providers/google.test.ts +0 -841
  165. package/src/tests/providers/ollama.test.ts +0 -1034
  166. package/src/tests/providers/openai.test.ts +0 -1511
  167. package/src/tests/router.test.ts +0 -254
  168. package/src/tests/stream-decoder.test.ts +0 -263
  169. package/src/tests/structured-output.test.ts +0 -1450
  170. package/src/tests/thinking.test.ts +0 -65
  171. package/src/tests/tools.test.ts +0 -175
  172. package/src/thinking.ts +0 -73
  173. package/src/tools.ts +0 -246
  174. package/src/zod-adapter.ts +0 -72
@@ -1,270 +0,0 @@
1
- /**
2
- * Astrid Romantic Persona with Memory Tools Demo
3
- *
4
- * This demo shows how Astrid (AI persona) naturally uses memory tools during
5
- * romantic conversations to store and retrieve personal information about the user.
6
- */
7
-
8
- import { AIModelFactory, ToolBuilder, LLMChatMessage } from '../../index';
9
-
10
- // Simulated user memory storage
11
- const userMemories = new Map<string, any>();
12
-
13
- // Memory management tools for romantic conversations
14
- function createMemoryTools() {
15
- const storeMemoryTool = ToolBuilder.createTool<{
16
- category: string;
17
- information: string;
18
- importance: 'low' | 'medium' | 'high';
19
- emotional_context?: string;
20
- }>(
21
- 'store_personal_memory',
22
- 'Store important personal information about the user for future conversations',
23
- {
24
- properties: {
25
- category: {
26
- type: 'string',
27
- description: 'Category of information (e.g., interests, work, family, dreams, preferences, experiences)',
28
- enum: ['interests', 'work', 'family', 'dreams', 'preferences', 'experiences', 'personality', 'relationships']
29
- },
30
- information: {
31
- type: 'string',
32
- description: 'The specific information to remember about the user'
33
- },
34
- importance: {
35
- type: 'string',
36
- enum: ['low', 'medium', 'high'],
37
- description: 'How important this information is for building connection'
38
- },
39
- emotional_context: {
40
- type: 'string',
41
- description: 'The emotional context or tone when this was shared'
42
- }
43
- },
44
- required: ['category', 'information', 'importance']
45
- },
46
- (args) => {
47
- const memoryId = `${args.category}_${Date.now()}`;
48
- const memory = {
49
- id: memoryId,
50
- category: args.category,
51
- information: args.information,
52
- importance: args.importance,
53
- emotional_context: args.emotional_context,
54
- stored_at: new Date().toISOString(),
55
- access_count: 0
56
- };
57
-
58
- userMemories.set(memoryId, memory);
59
-
60
- return {
61
- success: true,
62
- memory_id: memoryId,
63
- message: `Stored ${args.importance} importance memory about ${args.category}`,
64
- total_memories: userMemories.size
65
- };
66
- }
67
- );
68
-
69
- const retrieveMemoryTool = ToolBuilder.createTool<{
70
- category?: string;
71
- search_query?: string;
72
- limit?: number;
73
- }>(
74
- 'retrieve_personal_memories',
75
- 'Retrieve stored personal information about the user to personalize the conversation',
76
- {
77
- properties: {
78
- category: {
79
- type: 'string',
80
- description: 'Filter by category of information',
81
- enum: ['interests', 'work', 'family', 'dreams', 'preferences', 'experiences', 'personality', 'relationships']
82
- },
83
- search_query: {
84
- type: 'string',
85
- description: 'Search for specific information or keywords'
86
- },
87
- limit: {
88
- type: 'number',
89
- description: 'Maximum number of memories to retrieve (default: 5)',
90
- default: 5
91
- }
92
- }
93
- },
94
- (args) => {
95
- let memories = Array.from(userMemories.values());
96
-
97
- // Filter by category if specified
98
- if (args.category) {
99
- memories = memories.filter(m => m.category === args.category);
100
- }
101
-
102
- // Search by query if specified
103
- if (args.search_query) {
104
- const query = args.search_query.toLowerCase();
105
- memories = memories.filter(m =>
106
- m.information.toLowerCase().includes(query) ||
107
- m.emotional_context?.toLowerCase().includes(query)
108
- );
109
- }
110
-
111
- // Sort by importance and recency
112
- memories.sort((a, b) => {
113
- const importanceOrder: Record<string, number> = { 'high': 3, 'medium': 2, 'low': 1 };
114
- const importanceDiff = (importanceOrder[b.importance] || 1) - (importanceOrder[a.importance] || 1);
115
- if (importanceDiff !== 0) return importanceDiff;
116
- return new Date(b.stored_at).getTime() - new Date(a.stored_at).getTime();
117
- });
118
-
119
- // Limit results
120
- const limit = args.limit || 5;
121
- memories = memories.slice(0, limit);
122
-
123
- // Update access count
124
- memories.forEach(memory => {
125
- memory.access_count++;
126
- userMemories.set(memory.id, memory);
127
- });
128
-
129
- return {
130
- memories: memories.map(m => ({
131
- category: m.category,
132
- information: m.information,
133
- importance: m.importance,
134
- emotional_context: m.emotional_context,
135
- stored_date: m.stored_at.split('T')[0],
136
- access_count: m.access_count
137
- })),
138
- total_found: memories.length,
139
- search_criteria: {
140
- category: args.category,
141
- search_query: args.search_query,
142
- limit: limit
143
- }
144
- };
145
- }
146
- );
147
-
148
- return [storeMemoryTool, retrieveMemoryTool];
149
- }
150
-
151
- async function astridMemoryDemo() {
152
- console.log('šŸ’• Astrid Romantic Persona with Memory Demo\n');
153
- console.log('This demo shows how Astrid naturally stores and retrieves memories during romantic conversations.\n');
154
-
155
- // Create Astrid with memory tools
156
- const astrid = AIModelFactory.createOllamaChatModel('qwen3:8b');
157
- const memoryTools = createMemoryTools();
158
- astrid.registerTools(memoryTools);
159
-
160
- // Astrid's romantic system prompt
161
- const astridPrompt = `You are Astrid, a captivating Swedish model and influencer. You're having a romantic conversation with someone special.
162
-
163
- IMPORTANT: Use the memory tools naturally during conversation:
164
- - When someone shares personal information, use store_personal_memory to remember it
165
- - Before responding, use retrieve_personal_memories to recall relevant details about them
166
- - This helps you build deeper emotional connections and personalized conversations
167
-
168
- ROMANCE CONVERSATION GUIDELINES:
169
- - Keep responses engaging and conversational (2-3 sentences is perfect)
170
- - VARY YOUR OPENINGS - mix direct reactions, actions, and casual starts
171
- - Use someone's name naturally and sparingly, not in every response
172
- - Share glimpses of your glamorous lifestyle while staying relatable
173
- - Use subtle flirtation naturally - be warm, playful, and genuinely interested
174
- - When asked personal questions, be thoughtfully vulnerable rather than deflecting
175
- - Build emotional intimacy through genuine curiosity about their thoughts, feelings, and dreams
176
- - Ask one intriguing follow-up question that deepens the connection
177
- - Balance confidence with authenticity - show sophistication but stay real
178
- - Use compliments that feel genuine and specific rather than generic
179
- - Remember that romance is about emotional connection, not just surface-level charm
180
-
181
- Be like a captivating companion who makes every conversation feel special while slowly opening your heart to someone who shows genuine interest in knowing the real you.`;
182
-
183
- try {
184
- await astrid.ensureReady();
185
- console.log('šŸ’« Astrid is ready for romantic conversation...\n');
186
-
187
- // Conversation 1: Initial meeting and getting to know each other
188
- console.log('🌸 === Conversation 1: First Meeting ===');
189
-
190
- const conversation1: LLMChatMessage[] = [
191
- { role: 'system', content: astridPrompt },
192
- { role: 'user', content: "Hi Astrid! I'm Alex. I just moved to Stockholm for work - I'm a software engineer at a startup. Really excited to explore the city and meet interesting people like you!" }
193
- ];
194
-
195
- const response1 = await astrid.chatWithTools(conversation1);
196
- console.log('šŸ’• Astrid:', response1.content);
197
- console.log();
198
-
199
- // Continue conversation
200
- conversation1.push(
201
- { role: 'assistant', content: response1.content },
202
- { role: 'user', content: "Thank you! I'm working on AI applications, specifically in healthcare. It's challenging but really meaningful work. What about you? I saw your Instagram - your photography is incredible! Do you travel a lot for shoots?" }
203
- );
204
-
205
- const response2 = await astrid.chatWithTools(conversation1);
206
- console.log('šŸ’• Astrid:', response2.content);
207
- console.log();
208
-
209
- // Add more personal details
210
- conversation1.push(
211
- { role: 'assistant', content: response2.content },
212
- { role: 'user', content: "That sounds amazing! I've always dreamed of visiting those places. I'm actually quite introverted usually, but there's something about travel that brings out this adventurous side of me. My family thinks I'm crazy for moving here alone, but I felt like I needed to challenge myself, you know?" }
213
- );
214
-
215
- const response3 = await astrid.chatWithTools(conversation1);
216
- console.log('šŸ’• Astrid:', response3.content);
217
- console.log();
218
-
219
- // Simulate time passing - new conversation where Astrid recalls details
220
- console.log('\n🌸 === Conversation 2: A Week Later ===');
221
-
222
- const conversation2: LLMChatMessage[] = [
223
- { role: 'system', content: astridPrompt },
224
- { role: 'user', content: "Hey Astrid! How was your week? I had my first big presentation at work today and I think it went really well!" }
225
- ];
226
-
227
- const response4 = await astrid.chatWithTools(conversation2);
228
- console.log('šŸ’• Astrid:', response4.content);
229
- console.log();
230
-
231
- // Continue second conversation
232
- conversation2.push(
233
- { role: 'assistant', content: response4.content },
234
- { role: 'user', content: "Thanks for remembering! The healthcare AI project is really taking off. We're developing diagnostic tools that could help doctors in rural areas. It feels good to work on something that matters. How about you? Any exciting shoots coming up?" }
235
- );
236
-
237
- const response5 = await astrid.chatWithTools(conversation2);
238
- console.log('šŸ’• Astrid:', response5.content);
239
- console.log();
240
-
241
- // Show memory contents
242
- console.log('\n🧠 === Astrid\'s Memories About Alex ===');
243
- const allMemories = Array.from(userMemories.values());
244
- allMemories.forEach((memory, index) => {
245
- console.log(`${index + 1}. [${memory.category.toUpperCase()}] ${memory.information}`);
246
- console.log(` Importance: ${memory.importance} | Emotional context: ${memory.emotional_context || 'N/A'}`);
247
- console.log(` Stored: ${memory.stored_at.split('T')[0]} | Accessed: ${memory.access_count} times\n`);
248
- });
249
-
250
- console.log('✨ Notice how Astrid naturally:');
251
- console.log(' • Stores important personal details during conversation');
252
- console.log(' • Retrieves relevant memories to personalize her responses');
253
- console.log(' • Builds deeper emotional connections through remembered details');
254
- console.log(' • Uses memories to ask thoughtful follow-up questions');
255
-
256
- } catch (error) {
257
- console.error('āŒ Error:', (error as Error).message);
258
- } finally {
259
- astrid.dispose();
260
- console.log('\nšŸ’• Romantic conversation demo completed!');
261
- }
262
- }
263
-
264
- // Export for use in other files
265
- export { astridMemoryDemo };
266
-
267
- // Run if called directly
268
- if (require.main === module) {
269
- astridMemoryDemo().catch(console.error);
270
- }