universal-llm-client 4.0.0 → 4.2.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 (127) hide show
  1. package/dist/ai-model.d.ts +20 -22
  2. package/dist/ai-model.d.ts.map +1 -1
  3. package/dist/ai-model.js +26 -23
  4. package/dist/ai-model.js.map +1 -1
  5. package/dist/client.d.ts +5 -5
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +17 -9
  8. package/dist/client.js.map +1 -1
  9. package/dist/http.d.ts +2 -0
  10. package/dist/http.d.ts.map +1 -1
  11. package/dist/http.js +1 -0
  12. package/dist/http.js.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +4 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/interfaces.d.ts +49 -11
  18. package/dist/interfaces.d.ts.map +1 -1
  19. package/dist/interfaces.js +14 -0
  20. package/dist/interfaces.js.map +1 -1
  21. package/dist/providers/anthropic.d.ts +56 -0
  22. package/dist/providers/anthropic.d.ts.map +1 -0
  23. package/dist/providers/anthropic.js +524 -0
  24. package/dist/providers/anthropic.js.map +1 -0
  25. package/dist/providers/google.d.ts +5 -0
  26. package/dist/providers/google.d.ts.map +1 -1
  27. package/dist/providers/google.js +64 -8
  28. package/dist/providers/google.js.map +1 -1
  29. package/dist/providers/index.d.ts +1 -0
  30. package/dist/providers/index.d.ts.map +1 -1
  31. package/dist/providers/index.js +1 -0
  32. package/dist/providers/index.js.map +1 -1
  33. package/dist/providers/ollama.d.ts.map +1 -1
  34. package/dist/providers/ollama.js +38 -11
  35. package/dist/providers/ollama.js.map +1 -1
  36. package/dist/providers/openai.d.ts.map +1 -1
  37. package/dist/providers/openai.js +9 -7
  38. package/dist/providers/openai.js.map +1 -1
  39. package/dist/router.d.ts +13 -33
  40. package/dist/router.d.ts.map +1 -1
  41. package/dist/router.js +33 -57
  42. package/dist/router.js.map +1 -1
  43. package/dist/stream-decoder.d.ts +29 -2
  44. package/dist/stream-decoder.d.ts.map +1 -1
  45. package/dist/stream-decoder.js +39 -11
  46. package/dist/stream-decoder.js.map +1 -1
  47. package/dist/structured-output.d.ts +107 -181
  48. package/dist/structured-output.d.ts.map +1 -1
  49. package/dist/structured-output.js +137 -192
  50. package/dist/structured-output.js.map +1 -1
  51. package/dist/zod-adapter.d.ts +44 -0
  52. package/dist/zod-adapter.d.ts.map +1 -0
  53. package/dist/zod-adapter.js +61 -0
  54. package/dist/zod-adapter.js.map +1 -0
  55. package/package.json +9 -1
  56. package/src/ai-model.ts +350 -0
  57. package/src/auditor.ts +213 -0
  58. package/src/client.ts +402 -0
  59. package/src/debug/debug-google-streaming.ts +97 -0
  60. package/src/debug/debug-tool-execution.ts +86 -0
  61. package/src/debug/test-lmstudio-tools.ts +155 -0
  62. package/src/demos/README.md +47 -0
  63. package/src/demos/basic/universal-llm-examples.ts +161 -0
  64. package/src/demos/mcp/astrid-memory-demo.ts +295 -0
  65. package/src/demos/mcp/astrid-persona-memory.ts +357 -0
  66. package/src/demos/mcp/mcp-mongodb-demo.ts +275 -0
  67. package/src/demos/mcp/simple-astrid-memory.ts +148 -0
  68. package/src/demos/mcp/simple-mcp-demo.ts +68 -0
  69. package/src/demos/mcp/working-mcp-demo.ts +62 -0
  70. package/src/demos/model-alias-demo.ts +0 -0
  71. package/src/demos/tools/RAG_MEMORY_INTEGRATION.md +267 -0
  72. package/src/demos/tools/astrid-memory-demo.ts +270 -0
  73. package/src/demos/tools/astrid-production-memory-clean.ts +785 -0
  74. package/src/demos/tools/astrid-production-memory.ts +558 -0
  75. package/src/demos/tools/basic-translation-test.ts +66 -0
  76. package/src/demos/tools/chromadb-similarity-tuning.ts +390 -0
  77. package/src/demos/tools/clean-multilingual-conversation.ts +209 -0
  78. package/src/demos/tools/clean-translation-test.ts +119 -0
  79. package/src/demos/tools/clean-universal-multilingual-test.ts +131 -0
  80. package/src/demos/tools/complete-rag-demo.ts +369 -0
  81. package/src/demos/tools/complete-tool-demo.ts +132 -0
  82. package/src/demos/tools/demo-tool-calling.ts +124 -0
  83. package/src/demos/tools/dynamic-language-switching-test.ts +251 -0
  84. package/src/demos/tools/hybrid-thinking-test.ts +154 -0
  85. package/src/demos/tools/memory-integration-test.ts +420 -0
  86. package/src/demos/tools/multilingual-memory-system.ts +802 -0
  87. package/src/demos/tools/ondemand-translation-demo.ts +655 -0
  88. package/src/demos/tools/production-tool-demo.ts +245 -0
  89. package/src/demos/tools/revolutionary-multilingual-test.ts +151 -0
  90. package/src/demos/tools/rigorous-language-analysis.ts +218 -0
  91. package/src/demos/tools/test-universal-memory-system.ts +126 -0
  92. package/src/demos/tools/translation-integration-guide.ts +346 -0
  93. package/src/demos/tools/universal-memory-system.ts +560 -0
  94. package/src/http.ts +247 -0
  95. package/src/index.ts +161 -0
  96. package/src/interfaces.ts +657 -0
  97. package/src/mcp.ts +345 -0
  98. package/src/providers/anthropic.ts +762 -0
  99. package/src/providers/google.ts +620 -0
  100. package/src/providers/index.ts +8 -0
  101. package/src/providers/ollama.ts +469 -0
  102. package/src/providers/openai.ts +392 -0
  103. package/src/router.ts +780 -0
  104. package/src/stream-decoder.ts +361 -0
  105. package/src/structured-output.ts +759 -0
  106. package/src/test-scripts/test-advanced-tools.ts +310 -0
  107. package/src/test-scripts/test-google-streaming-enhanced.ts +147 -0
  108. package/src/test-scripts/test-google-streaming.ts +63 -0
  109. package/src/test-scripts/test-google-system-prompt-comprehensive.ts +189 -0
  110. package/src/test-scripts/test-mcp-config.ts +28 -0
  111. package/src/test-scripts/test-mcp-connection.ts +29 -0
  112. package/src/test-scripts/test-system-message-positions.ts +163 -0
  113. package/src/test-scripts/test-system-prompt-improvement-demo.ts +83 -0
  114. package/src/test-scripts/test-tool-calling.ts +231 -0
  115. package/src/tests/ai-model.test.ts +1614 -0
  116. package/src/tests/auditor.test.ts +224 -0
  117. package/src/tests/http.test.ts +200 -0
  118. package/src/tests/interfaces.test.ts +117 -0
  119. package/src/tests/providers/google.test.ts +660 -0
  120. package/src/tests/providers/ollama.test.ts +954 -0
  121. package/src/tests/providers/openai.test.ts +1122 -0
  122. package/src/tests/router.test.ts +254 -0
  123. package/src/tests/stream-decoder.test.ts +179 -0
  124. package/src/tests/structured-output.test.ts +1450 -0
  125. package/src/tests/tools.test.ts +175 -0
  126. package/src/tools.ts +246 -0
  127. package/src/zod-adapter.ts +72 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Tests for tools.ts — ToolBuilder and ToolExecutor
3
+ */
4
+ import { describe, it, expect } from 'bun:test';
5
+ import { ToolBuilder, ToolExecutor, createTimeTool, createRandomNumberTool } from '../tools.js';
6
+
7
+ describe('ToolBuilder', () => {
8
+ it('builds a basic tool definition', () => {
9
+ const tool = new ToolBuilder('test_tool')
10
+ .description('A test tool')
11
+ .build();
12
+
13
+ expect(tool.type).toBe('function');
14
+ expect(tool.function.name).toBe('test_tool');
15
+ expect(tool.function.description).toBe('A test tool');
16
+ expect(tool.function.parameters.type).toBe('object');
17
+ });
18
+
19
+ it('adds required parameters', () => {
20
+ const tool = new ToolBuilder('search')
21
+ .description('Search')
22
+ .addParameter('query', 'string', 'Search query', true)
23
+ .build();
24
+
25
+ expect(tool.function.parameters.properties).toHaveProperty('query');
26
+ expect(tool.function.parameters.required).toEqual(['query']);
27
+ });
28
+
29
+ it('adds optional parameters', () => {
30
+ const tool = new ToolBuilder('search')
31
+ .description('Search')
32
+ .addParameter('query', 'string', 'Search query', true)
33
+ .addParameter('limit', 'number', 'Max results', false)
34
+ .build();
35
+
36
+ expect(tool.function.parameters.properties).toHaveProperty('limit');
37
+ expect(tool.function.parameters.required).toEqual(['query']);
38
+ });
39
+
40
+ it('adds parameters with extra schema properties', () => {
41
+ const tool = new ToolBuilder('config')
42
+ .description('Configure')
43
+ .addParameter('theme', 'string', 'Color theme', false, {
44
+ enum: ['light', 'dark'],
45
+ })
46
+ .build();
47
+
48
+ const themeParam = (tool.function.parameters.properties as Record<string, Record<string, unknown>>)?.['theme'];
49
+ expect(themeParam?.enum).toEqual(['light', 'dark']);
50
+ });
51
+
52
+ it('builds function definition only', () => {
53
+ const fn = new ToolBuilder('test')
54
+ .description('Test')
55
+ .buildFunction();
56
+
57
+ expect(fn.name).toBe('test');
58
+ expect(fn.description).toBe('Test');
59
+ });
60
+ });
61
+
62
+ describe('ToolExecutor', () => {
63
+ describe('withTimeout', () => {
64
+ it('resolves if handler completes in time', async () => {
65
+ const handler = async () => 'result';
66
+ const wrapped = ToolExecutor.withTimeout(handler, 1000);
67
+ expect(await wrapped({})).toBe('result');
68
+ });
69
+
70
+ it('rejects if handler exceeds timeout', async () => {
71
+ const handler = async () => {
72
+ await new Promise(r => setTimeout(r, 500));
73
+ return 'too late';
74
+ };
75
+ const wrapped = ToolExecutor.withTimeout(handler, 50);
76
+ expect(wrapped({})).rejects.toThrow('timeout');
77
+ });
78
+ });
79
+
80
+ describe('safe', () => {
81
+ it('returns result on success', async () => {
82
+ const handler = async () => 42;
83
+ const wrapped = ToolExecutor.safe(handler);
84
+ expect(await wrapped({})).toBe(42);
85
+ });
86
+
87
+ it('catches errors and returns error object', async () => {
88
+ const handler = async () => { throw new Error('boom'); };
89
+ const wrapped = ToolExecutor.safe(handler);
90
+ const result = await wrapped({}) as { error: string };
91
+ expect(result.error).toBe('boom');
92
+ });
93
+ });
94
+
95
+ describe('withValidation', () => {
96
+ it('passes through if all required fields present', async () => {
97
+ const handler = async (args: unknown) => args;
98
+ const wrapped = ToolExecutor.withValidation(handler, ['name']);
99
+ expect(await wrapped({ name: 'test' })).toEqual({ name: 'test' });
100
+ });
101
+
102
+ it('throws if required field is missing', async () => {
103
+ const handler = async () => 'ok';
104
+ const wrapped = ToolExecutor.withValidation(handler, ['name']);
105
+ expect(wrapped({ other: 'value' })).rejects.toThrow('Missing required argument: name');
106
+ });
107
+
108
+ it('throws if args is not an object', async () => {
109
+ const handler = async () => 'ok';
110
+ const wrapped = ToolExecutor.withValidation(handler, ['name']);
111
+ expect(wrapped(null)).rejects.toThrow('must be an object');
112
+ });
113
+ });
114
+
115
+ describe('timed', () => {
116
+ it('returns result with duration', async () => {
117
+ const handler = async () => 'hello';
118
+ const wrapped = ToolExecutor.timed(handler);
119
+ const result = await wrapped({}) as { result: string; duration: number };
120
+ expect(result.result).toBe('hello');
121
+ expect(result.duration).toBeGreaterThanOrEqual(0);
122
+ });
123
+ });
124
+
125
+ describe('compose', () => {
126
+ it('composes multiple wrappers', async () => {
127
+ const handler = async () => 'result';
128
+ const composed = ToolExecutor.compose(
129
+ handler,
130
+ h => ToolExecutor.safe(h),
131
+ h => ToolExecutor.withTimeout(h, 5000),
132
+ );
133
+ expect(await composed({})).toBe('result');
134
+ });
135
+ });
136
+ });
137
+
138
+ describe('Common Tools', () => {
139
+ describe('createTimeTool', () => {
140
+ it('returns a valid tool definition', () => {
141
+ const tool = createTimeTool();
142
+ expect(tool.name).toBe('get_current_time');
143
+ expect(tool.description).toBeTruthy();
144
+ expect(tool.parameters.type).toBe('object');
145
+ });
146
+
147
+ it('handler returns time info', async () => {
148
+ const tool = createTimeTool();
149
+ const result = await tool.handler({}) as { iso: string; timestamp: number };
150
+ expect(result.iso).toBeTruthy();
151
+ expect(result.timestamp).toBeGreaterThan(0);
152
+ });
153
+
154
+ it('handler respects timezone parameter', async () => {
155
+ const tool = createTimeTool();
156
+ const result = await tool.handler({ timezone: 'America/New_York' }) as { timezone: string };
157
+ expect(result.timezone).toBe('America/New_York');
158
+ });
159
+ });
160
+
161
+ describe('createRandomNumberTool', () => {
162
+ it('returns a valid tool definition', () => {
163
+ const tool = createRandomNumberTool();
164
+ expect(tool.name).toBe('random_number');
165
+ expect(tool.description).toBeTruthy();
166
+ });
167
+
168
+ it('handler returns number in range', async () => {
169
+ const tool = createRandomNumberTool();
170
+ const result = await tool.handler({ min: 1, max: 10 }) as { value: number };
171
+ expect(result.value).toBeGreaterThanOrEqual(1);
172
+ expect(result.value).toBeLessThanOrEqual(10);
173
+ });
174
+ });
175
+ });
package/src/tools.ts ADDED
@@ -0,0 +1,246 @@
1
+ /**
2
+ * Universal LLM Client v3 — Tool Utilities
3
+ *
4
+ * ToolBuilder: Type-safe tool definition builder with fluent API.
5
+ * ToolExecutor: Execution wrappers with timeout and validation.
6
+ */
7
+
8
+ import type { LLMFunction, LLMToolDefinition, ToolHandler } from './interfaces.js';
9
+
10
+ // ============================================================================
11
+ // ToolBuilder
12
+ // ============================================================================
13
+
14
+ /**
15
+ * Fluent builder for LLM tool definitions.
16
+ *
17
+ * Usage:
18
+ * const tool = new ToolBuilder('get_weather')
19
+ * .description('Get current weather for a location')
20
+ * .addParameter('location', 'string', 'City name', true)
21
+ * .addParameter('units', 'string', 'Temperature units', false, { enum: ['celsius', 'fahrenheit'] })
22
+ * .build();
23
+ */
24
+ export class ToolBuilder {
25
+ private name: string;
26
+ private desc: string = '';
27
+ private properties: Record<string, unknown> = {};
28
+ private required: string[] = [];
29
+
30
+ constructor(name: string) {
31
+ this.name = name;
32
+ }
33
+
34
+ description(desc: string): this {
35
+ this.desc = desc;
36
+ return this;
37
+ }
38
+
39
+ addParameter(
40
+ name: string,
41
+ type: string,
42
+ description: string,
43
+ isRequired: boolean = false,
44
+ extra?: Record<string, unknown>,
45
+ ): this {
46
+ this.properties[name] = {
47
+ type,
48
+ description,
49
+ ...extra,
50
+ };
51
+ if (isRequired) {
52
+ this.required.push(name);
53
+ }
54
+ return this;
55
+ }
56
+
57
+ build(): LLMToolDefinition {
58
+ return {
59
+ type: 'function',
60
+ function: {
61
+ name: this.name,
62
+ description: this.desc,
63
+ parameters: {
64
+ type: 'object',
65
+ properties: this.properties,
66
+ required: this.required.length > 0 ? this.required : undefined,
67
+ },
68
+ },
69
+ };
70
+ }
71
+
72
+ /** Build and return the function definition only */
73
+ buildFunction(): LLMFunction {
74
+ return this.build().function;
75
+ }
76
+ }
77
+
78
+ // ============================================================================
79
+ // ToolExecutor
80
+ // ============================================================================
81
+
82
+ /**
83
+ * Utility wrappers for creating safe tool handlers.
84
+ */
85
+ export class ToolExecutor {
86
+ /**
87
+ * Wrap a handler with a timeout.
88
+ * Rejects if the handler doesn't complete within the specified ms.
89
+ */
90
+ static withTimeout(handler: ToolHandler, timeoutMs: number): ToolHandler {
91
+ return async (args: unknown) => {
92
+ const result = await Promise.race([
93
+ Promise.resolve(handler(args)),
94
+ new Promise<never>((_, reject) =>
95
+ setTimeout(() => reject(new Error(`Tool execution timeout after ${timeoutMs}ms`)), timeoutMs),
96
+ ),
97
+ ]);
98
+ return result;
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Wrap a handler to catch errors and return them as strings
104
+ * instead of throwing.
105
+ */
106
+ static safe(handler: ToolHandler): ToolHandler {
107
+ return async (args: unknown) => {
108
+ try {
109
+ return await handler(args);
110
+ } catch (error) {
111
+ return {
112
+ error: error instanceof Error ? error.message : String(error),
113
+ };
114
+ }
115
+ };
116
+ }
117
+
118
+ /**
119
+ * Wrap a handler with argument validation.
120
+ * Checks that required fields are present before execution.
121
+ */
122
+ static withValidation(
123
+ handler: ToolHandler,
124
+ requiredFields: string[],
125
+ ): ToolHandler {
126
+ return async (args: unknown) => {
127
+ if (!args || typeof args !== 'object') {
128
+ throw new Error('Tool arguments must be an object');
129
+ }
130
+ const obj = args as Record<string, unknown>;
131
+ for (const field of requiredFields) {
132
+ if (obj[field] === undefined || obj[field] === null) {
133
+ throw new Error(`Missing required argument: ${field}`);
134
+ }
135
+ }
136
+ return handler(args);
137
+ };
138
+ }
139
+
140
+ /**
141
+ * Create a handler that measures execution time and
142
+ * returns both the result and duration.
143
+ */
144
+ static timed(handler: ToolHandler): ToolHandler {
145
+ return async (args: unknown) => {
146
+ const start = Date.now();
147
+ const result = await handler(args);
148
+ return {
149
+ result,
150
+ duration: Date.now() - start,
151
+ };
152
+ };
153
+ }
154
+
155
+ /**
156
+ * Compose multiple wrappers around a handler.
157
+ * Applied from right to left (innermost to outermost).
158
+ */
159
+ static compose(
160
+ handler: ToolHandler,
161
+ ...wrappers: Array<(h: ToolHandler) => ToolHandler>
162
+ ): ToolHandler {
163
+ return wrappers.reduceRight((h, wrapper) => wrapper(h), handler);
164
+ }
165
+ }
166
+
167
+ // ============================================================================
168
+ // Common Tool Definitions
169
+ // ============================================================================
170
+
171
+ /**
172
+ * Create a get_current_time tool definition and handler.
173
+ */
174
+ export function createTimeTool(): {
175
+ name: string;
176
+ description: string;
177
+ parameters: LLMFunction['parameters'];
178
+ handler: ToolHandler;
179
+ } {
180
+ return {
181
+ name: 'get_current_time',
182
+ description: 'Get the current date and time',
183
+ parameters: {
184
+ type: 'object',
185
+ properties: {
186
+ timezone: {
187
+ type: 'string',
188
+ description: 'IANA timezone (e.g. "America/New_York"). Defaults to UTC.',
189
+ },
190
+ },
191
+ },
192
+ handler: (args: unknown) => {
193
+ const { timezone } = (args ?? {}) as { timezone?: string };
194
+ const now = new Date();
195
+ try {
196
+ return {
197
+ iso: now.toISOString(),
198
+ formatted: now.toLocaleString('en-US', {
199
+ timeZone: timezone || 'UTC',
200
+ dateStyle: 'full',
201
+ timeStyle: 'long',
202
+ }),
203
+ timezone: timezone || 'UTC',
204
+ timestamp: now.getTime(),
205
+ };
206
+ } catch {
207
+ return {
208
+ iso: now.toISOString(),
209
+ formatted: now.toUTCString(),
210
+ timezone: 'UTC',
211
+ timestamp: now.getTime(),
212
+ };
213
+ }
214
+ },
215
+ };
216
+ }
217
+
218
+ /**
219
+ * Create a random_number tool definition and handler.
220
+ */
221
+ export function createRandomNumberTool(): {
222
+ name: string;
223
+ description: string;
224
+ parameters: LLMFunction['parameters'];
225
+ handler: ToolHandler;
226
+ } {
227
+ return {
228
+ name: 'random_number',
229
+ description: 'Generate a random number within a range',
230
+ parameters: {
231
+ type: 'object',
232
+ properties: {
233
+ min: { type: 'number', description: 'Minimum value (default 0)' },
234
+ max: { type: 'number', description: 'Maximum value (default 100)' },
235
+ },
236
+ },
237
+ handler: (args: unknown) => {
238
+ const { min = 0, max = 100 } = (args ?? {}) as { min?: number; max?: number };
239
+ return {
240
+ value: Math.floor(Math.random() * (max - min + 1)) + min,
241
+ min,
242
+ max,
243
+ };
244
+ },
245
+ };
246
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Zod Adapter for Universal LLM Client
3
+ *
4
+ * Optional entrypoint for projects that use Zod for schema validation.
5
+ * Import from 'universal-llm-client/zod' to use.
6
+ *
7
+ * @module universal-llm-client/zod
8
+ */
9
+
10
+ import { z } from 'zod';
11
+ import type { SchemaConfig } from './structured-output.js';
12
+
13
+ /**
14
+ * Create a SchemaConfig from a Zod schema.
15
+ *
16
+ * This bridges Zod's type-safe schema definitions to the library's
17
+ * generic SchemaConfig interface, using Zod 4's native `z.toJSONSchema()`.
18
+ *
19
+ * @template T The type inferred from the Zod schema
20
+ * @param schema The Zod schema
21
+ * @param options Optional name and description for LLM guidance
22
+ * @returns SchemaConfig ready for use with generateStructured, etc.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * import { fromZod } from 'universal-llm-client/zod';
27
+ * import { z } from 'zod';
28
+ *
29
+ * const UserSchema = z.object({
30
+ * name: z.string(),
31
+ * age: z.number(),
32
+ * });
33
+ *
34
+ * const config = fromZod(UserSchema, { name: 'User' });
35
+ *
36
+ * const user = await model.generateStructured(config, messages);
37
+ * // user.name: string, user.age: number (fully typed)
38
+ * ```
39
+ */
40
+ export function fromZod<T>(
41
+ schema: z.ZodType<T>,
42
+ options?: { name?: string; description?: string },
43
+ ): SchemaConfig<T> {
44
+ // Convert Zod schema to JSON Schema using Zod 4's native method
45
+ const rawJsonSchema = z.toJSONSchema(schema, {
46
+ target: 'draft-07',
47
+ unrepresentable: 'any',
48
+ });
49
+
50
+ // Clean up — remove $schema since providers don't need it
51
+ const jsonSchema = { ...rawJsonSchema } as Record<string, unknown>;
52
+ delete jsonSchema.$schema;
53
+
54
+ return {
55
+ jsonSchema: jsonSchema as import('./structured-output.js').JSONSchema,
56
+ validate: (data: unknown): T => {
57
+ const result = schema.safeParse(data);
58
+ if (!result.success) {
59
+ throw result.error;
60
+ }
61
+ return result.data;
62
+ },
63
+ name: options?.name,
64
+ description: options?.description,
65
+ };
66
+ }
67
+
68
+ // Re-export z for convenience (users importing from /zod likely want it)
69
+ export { z } from 'zod';
70
+
71
+ // Re-export SchemaConfig for type usage
72
+ export type { SchemaConfig } from './structured-output.js';