@node-llm/core 0.3.0 → 0.4.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 (90) hide show
  1. package/README.md +176 -25
  2. package/dist/chat/Chat.d.ts +26 -1
  3. package/dist/chat/Chat.d.ts.map +1 -1
  4. package/dist/chat/Chat.js +83 -1
  5. package/dist/chat/ChatOptions.d.ts +5 -0
  6. package/dist/chat/ChatOptions.d.ts.map +1 -1
  7. package/dist/chat/ChatResponse.d.ts +5 -0
  8. package/dist/chat/ChatResponse.d.ts.map +1 -1
  9. package/dist/chat/ChatResponse.js +12 -0
  10. package/dist/constants.d.ts +7 -0
  11. package/dist/constants.d.ts.map +1 -0
  12. package/dist/constants.js +6 -0
  13. package/dist/embedding/Embedding.d.ts +17 -0
  14. package/dist/embedding/Embedding.d.ts.map +1 -0
  15. package/dist/embedding/Embedding.js +24 -0
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/llm.d.ts +11 -1
  20. package/dist/llm.d.ts.map +1 -1
  21. package/dist/llm.js +55 -28
  22. package/dist/providers/Embedding.d.ts +20 -0
  23. package/dist/providers/Embedding.d.ts.map +1 -0
  24. package/dist/providers/Embedding.js +1 -0
  25. package/dist/providers/Provider.d.ts +11 -4
  26. package/dist/providers/Provider.d.ts.map +1 -1
  27. package/dist/providers/gemini/Capabilities.d.ts +30 -0
  28. package/dist/providers/gemini/Capabilities.d.ts.map +1 -0
  29. package/dist/providers/gemini/Capabilities.js +148 -0
  30. package/dist/providers/gemini/Chat.d.ts +8 -0
  31. package/dist/providers/gemini/Chat.d.ts.map +1 -0
  32. package/dist/providers/gemini/Chat.js +69 -0
  33. package/dist/providers/gemini/ChatUtils.d.ts +9 -0
  34. package/dist/providers/gemini/ChatUtils.d.ts.map +1 -0
  35. package/dist/providers/gemini/ChatUtils.js +83 -0
  36. package/dist/providers/gemini/Embeddings.d.ts +8 -0
  37. package/dist/providers/gemini/Embeddings.d.ts.map +1 -0
  38. package/dist/providers/gemini/Embeddings.js +44 -0
  39. package/dist/providers/gemini/Errors.d.ts +2 -0
  40. package/dist/providers/gemini/Errors.d.ts.map +1 -0
  41. package/dist/providers/gemini/Errors.js +34 -0
  42. package/dist/providers/gemini/GeminiProvider.d.ts +34 -0
  43. package/dist/providers/gemini/GeminiProvider.d.ts.map +1 -0
  44. package/dist/providers/gemini/GeminiProvider.js +55 -0
  45. package/dist/providers/gemini/Image.d.ts +8 -0
  46. package/dist/providers/gemini/Image.d.ts.map +1 -0
  47. package/dist/providers/gemini/Image.js +47 -0
  48. package/dist/providers/gemini/Models.d.ts +8 -0
  49. package/dist/providers/gemini/Models.d.ts.map +1 -0
  50. package/dist/providers/gemini/Models.js +38 -0
  51. package/dist/providers/gemini/Streaming.d.ts +8 -0
  52. package/dist/providers/gemini/Streaming.d.ts.map +1 -0
  53. package/dist/providers/gemini/Streaming.js +70 -0
  54. package/dist/providers/gemini/Transcription.d.ts +9 -0
  55. package/dist/providers/gemini/Transcription.d.ts.map +1 -0
  56. package/dist/providers/gemini/Transcription.js +63 -0
  57. package/dist/providers/gemini/index.d.ts +11 -0
  58. package/dist/providers/gemini/index.d.ts.map +1 -0
  59. package/dist/providers/gemini/index.js +24 -0
  60. package/dist/providers/gemini/types.d.ts +118 -0
  61. package/dist/providers/gemini/types.d.ts.map +1 -0
  62. package/dist/providers/gemini/types.js +1 -0
  63. package/dist/providers/openai/Capabilities.d.ts +7 -2
  64. package/dist/providers/openai/Capabilities.d.ts.map +1 -1
  65. package/dist/providers/openai/Capabilities.js +52 -214
  66. package/dist/providers/openai/Chat.d.ts.map +1 -1
  67. package/dist/providers/openai/Chat.js +3 -0
  68. package/dist/providers/openai/Embedding.d.ts +8 -0
  69. package/dist/providers/openai/Embedding.d.ts.map +1 -0
  70. package/dist/providers/openai/Embedding.js +48 -0
  71. package/dist/providers/openai/ModelDefinitions.d.ts +25 -0
  72. package/dist/providers/openai/ModelDefinitions.d.ts.map +1 -0
  73. package/dist/providers/openai/ModelDefinitions.js +211 -0
  74. package/dist/providers/openai/Moderation.d.ts.map +1 -1
  75. package/dist/providers/openai/Moderation.js +3 -2
  76. package/dist/providers/openai/OpenAIProvider.d.ts +7 -0
  77. package/dist/providers/openai/OpenAIProvider.d.ts.map +1 -1
  78. package/dist/providers/openai/OpenAIProvider.js +10 -0
  79. package/dist/providers/openai/Transcription.d.ts.map +1 -1
  80. package/dist/providers/openai/Transcription.js +5 -4
  81. package/dist/schema/Schema.d.ts +20 -0
  82. package/dist/schema/Schema.d.ts.map +1 -0
  83. package/dist/schema/Schema.js +22 -0
  84. package/dist/schema/to-json-schema.d.ts +3 -0
  85. package/dist/schema/to-json-schema.d.ts.map +1 -0
  86. package/dist/schema/to-json-schema.js +10 -0
  87. package/dist/utils/Binary.d.ts +12 -0
  88. package/dist/utils/Binary.d.ts.map +1 -0
  89. package/dist/utils/Binary.js +71 -0
  90. package/package.json +3 -2
package/README.md CHANGED
@@ -42,9 +42,11 @@ import { LLM } from "@node-llm/core";
42
42
  import "dotenv/config";
43
43
 
44
44
  LLM.configure({
45
- provider: "openai", // Uses OPENAI_API_KEY from env
45
+ provider: "openai", // or "gemini" (Uses GEMINI_API_KEY)
46
46
  retry: { attempts: 3, delayMs: 500 },
47
- defaultModerationModel: "text-moderation-latest"
47
+ defaultModerationModel: "text-moderation-latest",
48
+ defaultTranscriptionModel: "whisper-1",
49
+ defaultEmbeddingModel: "text-embedding-3-small"
48
50
  });
49
51
  ```
50
52
 
@@ -105,7 +107,37 @@ console.log(response.output_tokens); // 5
105
107
  console.log(chat.totalUsage.total_tokens);
106
108
  ```
107
109
 
108
- ### 6. Audio Transcription (Transcribe)
110
+ ### 6. Embeddings
111
+
112
+ Generate vector representations of text for semantic search, clustering, and similarity comparisons.
113
+
114
+ ```ts
115
+ // Single text embedding
116
+ const embedding = await LLM.embed("Ruby is a programmer's best friend");
117
+
118
+ console.log(embedding.vector); // Array of floats (e.g., 1536 dimensions)
119
+ console.log(embedding.dimensions); // 1536
120
+ console.log(embedding.model); // "text-embedding-3-small"
121
+ console.log(embedding.input_tokens); // Token count
122
+
123
+ // Batch embeddings
124
+ const embeddings = await LLM.embed([
125
+ "First text",
126
+ "Second text",
127
+ "Third text"
128
+ ]);
129
+
130
+ console.log(embeddings.vectors); // Array of vectors
131
+ console.log(embeddings.vectors.length); // 3
132
+
133
+ // Custom model and dimensions
134
+ const customEmbedding = await LLM.embed("Semantic search text", {
135
+ model: "text-embedding-3-large",
136
+ dimensions: 256 // Reduce dimensions for faster processing
137
+ });
138
+ ```
139
+
140
+ ### 7. Audio Transcription (Transcribe)
109
141
 
110
142
  Convert audio files to text using specialized models like Whisper.
111
143
 
@@ -127,7 +159,7 @@ if (result.flagged) {
127
159
  }
128
160
  ```
129
161
 
130
- Learn how to implement [custom risk thresholds](https://github.com/eshaiju/node-llm/blob/main/examples/openai/12-risk-assessment.mjs) for more granular control.
162
+ Learn how to implement [custom risk thresholds](../../examples/openai/12-risk-assessment.mjs) for more granular control.
131
163
 
132
164
  ### 8. Chat Event Handlers
133
165
 
@@ -174,29 +206,76 @@ const creative = LLM.chat("gpt-4o").withTemperature(0.9);
174
206
 
175
207
  ## 📚 Examples
176
208
 
177
- Check the [examples](./examples) directory for focused scripts organized by provider:
209
+ Check the [examples](../../examples) directory for focused scripts organized by provider:
178
210
 
179
211
  ### OpenAI Examples
212
+
213
+ #### 💬 Chat
214
+ | Example | Description |
215
+ | :--- | :--- |
216
+ | [Basic & Streaming](../../examples/openai/chat/basic.mjs) | Standard completions and real-time streaming |
217
+ | [System Instructions](../../examples/openai/chat/instructions.mjs) | Tuning behavior with system prompts and temperature |
218
+ | [Tool Calling](../../examples/openai/chat/tools.mjs) | Automatic execution of model-requested functions |
219
+ | [Parallel Tool Calling](../../examples/openai/chat/parallel-tools.mjs) | Executing multiple tools in a single turn |
220
+ | [Lifecycle Events](../../examples/openai/chat/events.mjs) | Hooks for specific chat events (onNewMessage, onToolCall) |
221
+ | [Token Usage](../../examples/openai/chat/usage.mjs) | Tracking costs and token counts |
222
+ | [Max Tokens](../../examples/openai/chat/max-tokens.mjs) | Limiting response length with `maxTokens` |
223
+
224
+ #### 🖼️ Multimodal
180
225
  | Example | Description |
181
226
  | :--- | :--- |
182
- | [Basic Chat](https://github.com/eshaiju/node-llm/blob/main/examples/openai/01-basic-chat.mjs) | Simple completion request |
183
- | [Streaming](https://github.com/eshaiju/node-llm/blob/main/examples/openai/02-streaming.mjs) | Real-time token streaming |
184
- | [Tool Calling](https://github.com/eshaiju/node-llm/blob/main/examples/openai/03-tool-calling.mjs) | Automatic tool execution loop |
185
- | [Vision](https://github.com/eshaiju/node-llm/blob/main/examples/openai/04-vision.mjs) | Image analysis |
186
- | [List Models](https://github.com/eshaiju/node-llm/blob/main/examples/openai/05-list-models.mjs) | Enumerate available models |
187
- | [Paint](https://github.com/eshaiju/node-llm/blob/main/examples/openai/06-paint.mjs) | Image generation with DALL-E |
188
- | [Image Features](https://github.com/eshaiju/node-llm/blob/main/examples/openai/07-image-features.mjs) | Saving and processing generated images |
189
- | [Token Usage](https://github.com/eshaiju/node-llm/blob/main/examples/openai/08-token-usage.mjs) | Detailed stats for turns and conversations |
190
- | [Transcribe](https://github.com/eshaiju/node-llm/blob/main/examples/openai/09-transcribe.mjs) | Audio to text transcription |
191
- | [Capabilities](https://github.com/eshaiju/node-llm/blob/main/examples/openai/10-capabilities.mjs) | Dynamic model specs and pricing |
192
- | [Moderate](https://github.com/eshaiju/node-llm/blob/main/examples/openai/11-moderate.mjs) | Content safety moderation |
193
- | [Risk Assessment](https://github.com/eshaiju/node-llm/blob/main/examples/openai/12-risk-assessment.mjs) | Custom thresholds and risk levels |
194
- | [Chat Events](https://github.com/eshaiju/node-llm/blob/main/examples/openai/13-chat-events.mjs) | Lifecycle hooks (onNewMessage, onToolCall etc) |
195
- | [System Prompts](https://github.com/eshaiju/node-llm/blob/main/examples/openai/15-system-prompts.mjs) | Dynamic system instructions |
196
- | [Temperature](https://github.com/eshaiju/node-llm/blob/main/examples/openai/16-temperature.mjs) | Control creativity vs determinism |
197
- | [Multi-File](https://github.com/eshaiju/node-llm/blob/main/examples/openai/17-multi-file.mjs) | Analyze multiple files at once |
198
-
199
- To run an example (from the project root):
227
+ | [Vision Analysis](../../examples/openai/multimodal/vision.mjs) | Analyzing images via URLs |
228
+ | [Multi-Image Analysis](../../examples/openai/multimodal/multi-image.mjs) | Comparing multiple images in one request |
229
+ | [File Context](../../examples/openai/multimodal/files.mjs) | Reading and analyzing local project files |
230
+ | [Audio Transcription](../../examples/openai/multimodal/transcribe.mjs) | Converting audio files to text (Whisper) |
231
+
232
+ #### 🎨 Images
233
+ | Example | Description |
234
+ | :--- | :--- |
235
+ | [Generate & Save](../../examples/openai/images/generate.mjs) | Creating images with DALL-E 3 and saving to disk |
236
+
237
+ #### 🛡️ Safety
238
+ | Example | Description |
239
+ | :--- | :--- |
240
+ | [Moderation](../../examples/openai/safety/moderation.mjs) | Content safety checks and risk assessment |
241
+
242
+ #### 🧠 Discovery
243
+ | Example | Description |
244
+ | :--- | :--- |
245
+ | [Models & Capabilities](../../examples/openai/discovery/models.mjs) | Listing models and inspecting their specs |
246
+ | [Embeddings](../../examples/openai/embeddings/create.mjs) | Generating semantic vector embeddings |
247
+
248
+ ### Gemini Examples
249
+
250
+ #### 💬 Chat
251
+ | Example | Description |
252
+ | :--- | :--- |
253
+ | [Basic & Streaming](../../examples/gemini/chat/basic.mjs) | Standard completions and real-time streaming |
254
+ | [System Instructions](../../examples/gemini/chat/instructions.mjs) | Behavior tuning and creativity control |
255
+ | [Tool Calling](../../examples/gemini/chat/tools.mjs) | Function calling with automatic execution |
256
+ | [Lifecycle Events](../../examples/gemini/chat/events.mjs) | Event hooks for chat interactions |
257
+ | [Token Usage](../../examples/gemini/chat/usage.mjs) | Tracking conversation costs |
258
+
259
+ #### 🖼️ Multimodal
260
+ | Example | Description |
261
+ | :--- | :--- |
262
+ | [Vision Analysis](../../examples/gemini/multimodal/vision.mjs) | Understanding images |
263
+ | [File Context](../../examples/gemini/multimodal/files.mjs) | Reading multiple local files |
264
+ | [Audio Transcription](../../examples/gemini/multimodal/transcribe.mjs) | Native audio understanding |
265
+
266
+ #### 🎨 Images
267
+ | Example | Description |
268
+ | :--- | :--- |
269
+ | [Generate & Save](../../examples/gemini/images/generate.mjs) | Creating images with Imagen |
270
+
271
+ #### 🧠 Discovery
272
+ | Example | Description |
273
+ | :--- | :--- |
274
+ | [Models & Capabilities](../../examples/gemini/discovery/models.mjs) | Listing models and capabilities |
275
+ | [Embeddings](../../examples/gemini/embeddings/create.mjs) | Creating vector embeddings |
276
+
277
+
278
+ To run an example:
200
279
  ```bash
201
280
  node examples/openai/01-basic-chat.mjs
202
281
  ```
@@ -230,6 +309,64 @@ const reply = await chat
230
309
  .ask("What is the weather in London?");
231
310
  ```
232
311
 
312
+ ### Structured Output (Schemas)
313
+
314
+ Ensure the AI returns data exactly matching a specific structure. Supports strict schema validation using Zod.
315
+
316
+ **Using Zod (Recommended):**
317
+
318
+ ```ts
319
+ import { z } from "zod";
320
+
321
+ const personSchema = z.object({
322
+ name: z.string(),
323
+ age: z.number(),
324
+ hobbies: z.array(z.string())
325
+ });
326
+
327
+ const response = await chat
328
+ .withSchema(personSchema)
329
+ .ask("Generate a person named Alice who likes hiking");
330
+
331
+ // Type-safe access to parsed data
332
+ const person = response.parsed;
333
+ console.log(person.name); // "Alice"
334
+ ```
335
+
336
+ **Using Manual JSON Schema:**
337
+
338
+ ```ts
339
+ const schema = {
340
+ type: "object",
341
+ properties: {
342
+ name: { type: "string" },
343
+ age: { type: "integer" }
344
+ },
345
+ required: ["name", "age"],
346
+ additionalProperties: false // Required for strict mode in OpenAI
347
+ };
348
+
349
+ const response = await chat
350
+ .withSchema(schema)
351
+ .ask("Generate a person");
352
+
353
+ console.log(response.parsed); // { name: "...", age: ... }
354
+ ```
355
+
356
+ ### JSON Mode
357
+
358
+ Guarantee valid JSON output without enforcing a strict schema.
359
+
360
+ ```ts
361
+ chat.withRequestOptions({
362
+ responseFormat: { type: "json_object" }
363
+ });
364
+
365
+ const response = await chat.ask("Generate a JSON object with a greeting");
366
+ console.log(response.parsed); // { greeting: "..." }
367
+ ```
368
+
369
+
233
370
  ### Multi-modal & File Support
234
371
 
235
372
  Pass local paths or URLs directly. The library handles reading, MIME detection, and encoding for a wide variety of file types.
@@ -277,6 +414,21 @@ chat.withRequestOptions({
277
414
  });
278
415
  ```
279
416
 
417
+ ### Model Capabilities & Pricing
418
+
419
+ Get up-to-date information about context windows, pricing, and capabilities directly from the Parsera API.
420
+
421
+ ```javascript
422
+ // Refresh model information from the API
423
+ await LLM.models.refresh();
424
+
425
+ // Use the data programmatically
426
+ const model = LLM.models.find("gpt-4o-mini");
427
+ console.log(model.context_window); // => 128000
428
+ console.log(model.capabilities); // => ["function_calling", "structured_output", "streaming", "batch"]
429
+ console.log(model.pricing.text_tokens.standard.input_per_million); // => 0.15
430
+ ```
431
+
280
432
  ---
281
433
 
282
434
  ## 📋 Supported Providers
@@ -284,6 +436,7 @@ chat.withRequestOptions({
284
436
  | Provider | Status | Notes |
285
437
  | :--- | :--- | :--- |
286
438
  | **OpenAI** | ✅ Supported | Chat, Streaming, Tools, Vision, Audio, Images, Transcription, Moderation |
439
+ | **Gemini** | ✅ Supported | Chat, Streaming, Tools, Vision, Audio, Video, Embeddings, Transcription |
287
440
  | **Anthropic** | 🏗️ Roadmap | Coming soon |
288
441
  | **Azure OpenAI** | 🏗️ Roadmap | Coming soon |
289
442
 
@@ -302,8 +455,6 @@ chat.withRequestOptions({
302
455
 
303
456
  `node-llm` uses VCR-style testing (via Polly.js) for robust, deterministic integration tests. This allows us to record real LLM provider interactions once and replay them during tests without making actual API calls.
304
457
 
305
- ### Running Tests
306
-
307
458
  - **Replay Mode (Default)**: Runs tests using recorded cassettes. Fast, deterministic, and requires no API keys.
308
459
  ```bash
309
460
  npm test
@@ -1,6 +1,9 @@
1
1
  import { Message } from "./Message.js";
2
2
  import { ChatOptions } from "./ChatOptions.js";
3
3
  import { Provider, Usage } from "../providers/Provider.js";
4
+ import { Tool } from "./Tool.js";
5
+ import { Schema } from "../schema/Schema.js";
6
+ import { z } from "zod";
4
7
  export interface AskOptions {
5
8
  images?: string[];
6
9
  files?: string[];
@@ -11,7 +14,7 @@ export interface AskOptions {
11
14
  import { ChatResponseString } from "./ChatResponse.js";
12
15
  export declare class Chat {
13
16
  private readonly provider;
14
- private readonly model;
17
+ private model;
15
18
  private readonly options;
16
19
  private messages;
17
20
  private executor;
@@ -26,8 +29,20 @@ export declare class Chat {
26
29
  get totalUsage(): Usage;
27
30
  /**
28
31
  * Add a tool to the chat session (fluent API)
32
+ * Supports passing a tool instance or a tool class (which will be instantiated).
29
33
  */
30
34
  withTool(tool: any): this;
35
+ /**
36
+ * Add multiple tools to the chat session.
37
+ * Supports passing tool instances or classes (which will be instantiated).
38
+ * Can replace existing tools if options.replace is true.
39
+ *
40
+ * @example
41
+ * chat.withTools([WeatherTool, new CalculatorTool()], { replace: true });
42
+ */
43
+ withTools(tools: (Tool | any)[], options?: {
44
+ replace?: boolean;
45
+ }): this;
31
46
  /**
32
47
  * Add instructions (system prompt) to the chat.
33
48
  * By default, it appends a new system message.
@@ -47,13 +62,23 @@ export declare class Chat {
47
62
  * Controls randomness: 0.0 (deterministic) to 1.0 (creative).
48
63
  */
49
64
  withTemperature(temp: number): this;
65
+ /**
66
+ * Switch the model used for this chat session.
67
+ */
68
+ withModel(model: string): this;
50
69
  /**
51
70
  * Set custom headers for the chat session.
52
71
  * Merges with existing headers.
53
72
  */
54
73
  withRequestOptions(options: {
55
74
  headers?: Record<string, string>;
75
+ responseFormat?: any;
56
76
  }): this;
77
+ /**
78
+ * Enforce a specific schema for the output.
79
+ * Can accept a Schema object or a Zod schema/JSON Schema directly.
80
+ */
81
+ withSchema(schema: Schema | z.ZodType<any> | Record<string, any> | null): this;
57
82
  onNewMessage(handler: () => void): this;
58
83
  onEndMessage(handler: (message: ChatResponseString) => void): this;
59
84
  onToolCall(handler: (toolCall: any) => void): this;
@@ -1 +1 @@
1
- {"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../src/chat/Chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAK3D,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,qBAAa,IAAI;IAKb,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,QAAQ,CAAW;gBAGR,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,WAAgB;IAmB5C;;OAEG;IACH,IAAI,OAAO,IAAI,SAAS,OAAO,EAAE,CAEhC;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,KAAK,CAatB;IAED;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAQzB;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAmB5E;;OAEG;IACH,gBAAgB,CAAC,WAA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AC,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,cAAc,CAAC,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI;IAU7F;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI;IAkB9E,YAAY,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI;IAKvC,YAAY,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,GAAG,IAAI;IAKlE,UAAU,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAKlD,YAAY,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAKlD;;OAEG;IACG,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8K7E;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,MAAM;CAI9B"}
package/dist/chat/Chat.js CHANGED
@@ -2,6 +2,9 @@ import { FileLoader } from "../utils/FileLoader.js";
2
2
  import { Executor } from "../executor/Executor.js";
3
3
  import { LLM } from "../llm.js";
4
4
  import { Stream } from "./Stream.js";
5
+ import { Schema } from "../schema/Schema.js";
6
+ import { toJsonSchema } from "../schema/to-json-schema.js";
7
+ import { z } from "zod";
5
8
  import { ChatResponseString } from "./ChatResponse.js";
6
9
  export class Chat {
7
10
  provider;
@@ -46,12 +49,43 @@ export class Chat {
46
49
  }
47
50
  /**
48
51
  * Add a tool to the chat session (fluent API)
52
+ * Supports passing a tool instance or a tool class (which will be instantiated).
49
53
  */
50
54
  withTool(tool) {
55
+ return this.withTools([tool]);
56
+ }
57
+ /**
58
+ * Add multiple tools to the chat session.
59
+ * Supports passing tool instances or classes (which will be instantiated).
60
+ * Can replace existing tools if options.replace is true.
61
+ *
62
+ * @example
63
+ * chat.withTools([WeatherTool, new CalculatorTool()], { replace: true });
64
+ */
65
+ withTools(tools, options) {
66
+ if (options?.replace) {
67
+ this.options.tools = [];
68
+ }
51
69
  if (!this.options.tools) {
52
70
  this.options.tools = [];
53
71
  }
54
- this.options.tools.push(tool);
72
+ for (const tool of tools) {
73
+ if (typeof tool === "function") {
74
+ try {
75
+ // Attempt to instantiate if it's a class
76
+ this.options.tools.push(new tool());
77
+ }
78
+ catch (e) {
79
+ // If instantiation fails, it might be a function tool or require args?
80
+ // For now, assuming classes with no-arg constructors as per convention.
81
+ console.warn("Attempted to instantiate tool class but failed, adding as-is", e);
82
+ this.options.tools.push(tool);
83
+ }
84
+ }
85
+ else {
86
+ this.options.tools.push(tool);
87
+ }
88
+ }
55
89
  return this;
56
90
  }
57
91
  /**
@@ -90,6 +124,13 @@ export class Chat {
90
124
  this.options.temperature = temp;
91
125
  return this;
92
126
  }
127
+ /**
128
+ * Switch the model used for this chat session.
129
+ */
130
+ withModel(model) {
131
+ this.model = model;
132
+ return this;
133
+ }
93
134
  /**
94
135
  * Set custom headers for the chat session.
95
136
  * Merges with existing headers.
@@ -98,6 +139,29 @@ export class Chat {
98
139
  if (options.headers) {
99
140
  this.options.headers = { ...this.options.headers, ...options.headers };
100
141
  }
142
+ if (options.responseFormat) {
143
+ this.options.responseFormat = options.responseFormat;
144
+ }
145
+ return this;
146
+ }
147
+ /**
148
+ * Enforce a specific schema for the output.
149
+ * Can accept a Schema object or a Zod schema/JSON Schema directly.
150
+ */
151
+ withSchema(schema) {
152
+ if (schema === null) {
153
+ this.options.schema = undefined;
154
+ return this;
155
+ }
156
+ if (schema instanceof Schema) {
157
+ this.options.schema = schema;
158
+ }
159
+ else if (schema instanceof z.ZodType) {
160
+ this.options.schema = Schema.fromZod("output", schema);
161
+ }
162
+ else {
163
+ this.options.schema = Schema.fromJson("output", schema);
164
+ }
101
165
  return this;
102
166
  }
103
167
  // --- Event Handlers ---
@@ -158,6 +222,23 @@ export class Chat {
158
222
  role: "user",
159
223
  content: messageContent,
160
224
  });
225
+ // Process Schema/Structured Output
226
+ let responseFormat = this.options.responseFormat;
227
+ if (this.options.schema) {
228
+ if (this.provider.capabilities && !this.provider.capabilities.supportsStructuredOutput(this.model)) {
229
+ throw new Error(`Model ${this.model} does not support structured output.`);
230
+ }
231
+ const jsonSchema = toJsonSchema(this.options.schema.definition.schema);
232
+ responseFormat = {
233
+ type: "json_schema",
234
+ json_schema: {
235
+ name: this.options.schema.definition.name,
236
+ description: this.options.schema.definition.description,
237
+ strict: this.options.schema.definition.strict ?? true,
238
+ schema: jsonSchema,
239
+ }
240
+ };
241
+ }
161
242
  const executeOptions = {
162
243
  model: this.model,
163
244
  messages: this.messages,
@@ -165,6 +246,7 @@ export class Chat {
165
246
  temperature: options?.temperature ?? this.options.temperature,
166
247
  max_tokens: options?.maxTokens ?? this.options.maxTokens,
167
248
  headers: { ...this.options.headers, ...options?.headers },
249
+ response_format: responseFormat, // Pass to provider
168
250
  };
169
251
  let totalUsage = { input_tokens: 0, output_tokens: 0, total_tokens: 0 };
170
252
  const trackUsage = (u) => {
@@ -1,5 +1,6 @@
1
1
  import { Message } from "./Message.js";
2
2
  import { Tool } from "./Tool.js";
3
+ import { Schema } from "../schema/Schema.js";
3
4
  export interface ChatOptions {
4
5
  systemPrompt?: string;
5
6
  messages?: Message[];
@@ -11,5 +12,9 @@ export interface ChatOptions {
11
12
  onToolCall?: (toolCall: any) => void;
12
13
  onToolResult?: (result: any) => void;
13
14
  headers?: Record<string, string>;
15
+ schema?: Schema;
16
+ responseFormat?: {
17
+ type: "json_object" | "text";
18
+ };
14
19
  }
15
20
  //# sourceMappingURL=ChatOptions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatOptions.d.ts","sourceRoot":"","sources":["../../src/chat/ChatOptions.ts"],"names":[],"mappings":"A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GAAG,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,aAAa,GAAG,MAAM,CAAA;KAAE,CAAC;CACnD"}
@@ -14,5 +14,10 @@ export declare class ChatResponseString extends String {
14
14
  get content(): string;
15
15
  get model_id(): string;
16
16
  toString(): string;
17
+ /**
18
+ * Attempt to parse the content as JSON.
19
+ * Returns the parsed object or null if parsing fails.
20
+ */
21
+ get parsed(): any;
17
22
  }
18
23
  //# sourceMappingURL=ChatResponse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatResponse.d.ts","sourceRoot":"","sources":["../../src/chat/ChatResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,MAAM;aAG1B,KAAK,EAAE,KAAK;aACZ,KAAK,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM;IAK/B,IAAI,YAAY,WAAsC;IACtD,IAAI,aAAa,WAAuC;IACxD,IAAI,YAAY,WAAsC;IACtD,IAAI,aAAa,uBAAuC;IAExD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,QAAQ;CAGT"}
1
+ {"version":3,"file":"ChatResponse.d.ts","sourceRoot":"","sources":["../../src/chat/ChatResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,MAAM;aAG1B,KAAK,EAAE,KAAK;aACZ,KAAK,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM;IAK/B,IAAI,YAAY,WAAsC;IACtD,IAAI,aAAa,WAAuC;IACxD,IAAI,YAAY,WAAsC;IACtD,IAAI,aAAa,uBAAuC;IAExD,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,QAAQ;IAIR;;;OAGG;IACH,IAAI,MAAM,IAAI,GAAG,CAMhB;CACF"}
@@ -23,4 +23,16 @@ export class ChatResponseString extends String {
23
23
  toString() {
24
24
  return this.valueOf();
25
25
  }
26
+ /**
27
+ * Attempt to parse the content as JSON.
28
+ * Returns the parsed object or null if parsing fails.
29
+ */
30
+ get parsed() {
31
+ try {
32
+ return JSON.parse(this.valueOf());
33
+ }
34
+ catch (e) {
35
+ return null;
36
+ }
37
+ }
26
38
  }
@@ -0,0 +1,7 @@
1
+ export declare const DEFAULT_MODELS: {
2
+ readonly TRANSCRIPTION: "whisper-1";
3
+ readonly MODERATION: "omni-moderation-latest";
4
+ readonly EMBEDDING: "text-embedding-3-small";
5
+ readonly IMAGE: "dall-e-3";
6
+ };
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export const DEFAULT_MODELS = {
2
+ TRANSCRIPTION: "whisper-1",
3
+ MODERATION: "omni-moderation-latest",
4
+ EMBEDDING: "text-embedding-3-small",
5
+ IMAGE: "dall-e-3",
6
+ };
@@ -0,0 +1,17 @@
1
+ import { EmbeddingResponse } from "../providers/Embedding.js";
2
+ export declare class Embedding {
3
+ readonly vectors: number[][];
4
+ readonly model: string;
5
+ readonly input_tokens: number;
6
+ readonly dimensions: number;
7
+ constructor(response: EmbeddingResponse);
8
+ /**
9
+ * Get the first vector (useful for single-input embeddings)
10
+ */
11
+ get vector(): number[];
12
+ /**
13
+ * Convert to string representation (shows dimensions and token count)
14
+ */
15
+ toString(): string;
16
+ }
17
+ //# sourceMappingURL=Embedding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Embedding.d.ts","sourceRoot":"","sources":["../../src/embedding/Embedding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qBAAa,SAAS;IACpB,SAAgB,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IACpC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,QAAQ,EAAE,iBAAiB;IAOvC;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,EAAE,CAErB;IAED;;OAEG;IACH,QAAQ,IAAI,MAAM;CAGnB"}
@@ -0,0 +1,24 @@
1
+ export class Embedding {
2
+ vectors;
3
+ model;
4
+ input_tokens;
5
+ dimensions;
6
+ constructor(response) {
7
+ this.vectors = response.vectors;
8
+ this.model = response.model;
9
+ this.input_tokens = response.input_tokens;
10
+ this.dimensions = response.dimensions;
11
+ }
12
+ /**
13
+ * Get the first vector (useful for single-input embeddings)
14
+ */
15
+ get vector() {
16
+ return this.vectors[0] || [];
17
+ }
18
+ /**
19
+ * Convert to string representation (shows dimensions and token count)
20
+ */
21
+ toString() {
22
+ return `Embedding(model=${this.model}, dimensions=${this.dimensions}, tokens=${this.input_tokens}, count=${this.vectors.length})`;
23
+ }
24
+ }
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export type { Role } from "./chat/Role.js";
6
6
  export type { ChatOptions } from "./chat/ChatOptions.js";
7
7
  export type { Tool, ToolCall } from "./chat/Tool.js";
8
8
  export type { MessageContent, ContentPart } from "./chat/Content.js";
9
- export { LLM, Transcription, Moderation } from "./llm.js";
9
+ export { LLM, Transcription, Moderation, Embedding } from "./llm.js";
10
10
  export { providerRegistry } from "./providers/registry.js";
11
11
  export { OpenAIProvider } from "./providers/openai/OpenAIProvider.js";
12
12
  export { registerOpenAIProvider } from "./providers/openai/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC3E,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC3E,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { Chat } from "./chat/Chat.js";
2
2
  export { Stream } from "./chat/Stream.js";
3
3
  export { GeneratedImage } from "./image/GeneratedImage.js";
4
- export { LLM, Transcription, Moderation } from "./llm.js";
4
+ export { LLM, Transcription, Moderation, Embedding } from "./llm.js";
5
5
  export { providerRegistry } from "./providers/registry.js";
6
6
  export { OpenAIProvider } from "./providers/openai/OpenAIProvider.js";
7
7
  export { registerOpenAIProvider } from "./providers/openai/index.js";