@fonoster/autopilot 0.43.0 → 0.44.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.
@@ -24,9 +24,10 @@ function createLanguageModel(params) {
24
24
  const { voice, agentConfig, knowledgeBase, telephonyContext } = params;
25
25
  const { languageModel, conversationSettings } = agentConfig;
26
26
  // The transfer tool is only added if the transfer options exist
27
- const tools = languageModel.tools.concat(conversationSettings.transferOptions
27
+ // Built-in tools have no HTTP operation; the models only read their name and parameters.
28
+ const tools = languageModel.tools.concat((conversationSettings.transferOptions
28
29
  ? [__1.hangupToolDefinition, __1.transferToolDefinition]
29
- : [__1.hangupToolDefinition]);
30
+ : [__1.hangupToolDefinition]));
30
31
  return __1.LanguageModelFactory.getLanguageModel(languageModel.provider, {
31
32
  ...languageModel,
32
33
  ...conversationSettings,
@@ -1,9 +1,28 @@
1
+ import { BuiltInTool } from "../../tools/types";
1
2
  import { Voice } from "../../voice";
2
3
  import { AbstractLanguageModel } from "../AbstractLanguageModel";
3
4
  import { TelephonyContext } from "../types";
4
5
  import { GoogleParams } from "./types";
5
6
  declare const LANGUAGE_MODEL_NAME = "llm.google";
7
+ /**
8
+ * A tool as LangChain's structured tool params, with the tool's JSON Schema as is:
9
+ * @langchain/google-genai turns it into a Gemini function declaration (and drops the
10
+ * parameters of a tool that has none).
11
+ */
12
+ declare function toGoogleTool(tool: BuiltInTool): {
13
+ name: string;
14
+ description: string;
15
+ schema: {
16
+ type: "object" | "array";
17
+ properties: Record<string, {
18
+ type: string;
19
+ format?: "enum" | "date-time";
20
+ pattern?: string;
21
+ }>;
22
+ required?: string[];
23
+ };
24
+ };
6
25
  declare class Google extends AbstractLanguageModel {
7
26
  constructor(params: GoogleParams, voice: Voice, telephonyContext: TelephonyContext);
8
27
  }
9
- export { Google, LANGUAGE_MODEL_NAME };
28
+ export { Google, LANGUAGE_MODEL_NAME, toGoogleTool };
@@ -1,16 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LANGUAGE_MODEL_NAME = exports.Google = void 0;
4
+ exports.toGoogleTool = toGoogleTool;
4
5
  const google_genai_1 = require("@langchain/google-genai");
5
- const convertToolToLangchainTool_1 = require("../../tools/convertToolToLangchainTool");
6
6
  const AbstractLanguageModel_1 = require("../AbstractLanguageModel");
7
7
  const LANGUAGE_MODEL_NAME = "llm.google";
8
8
  exports.LANGUAGE_MODEL_NAME = LANGUAGE_MODEL_NAME;
9
+ /**
10
+ * A tool as LangChain's structured tool params, with the tool's JSON Schema as is:
11
+ * @langchain/google-genai turns it into a Gemini function declaration (and drops the
12
+ * parameters of a tool that has none).
13
+ */
14
+ function toGoogleTool(tool) {
15
+ return {
16
+ name: tool.name,
17
+ description: tool.description,
18
+ schema: tool.parameters ?? { type: "object", properties: {} }
19
+ };
20
+ }
9
21
  class Google extends AbstractLanguageModel_1.AbstractLanguageModel {
10
22
  constructor(params, voice, telephonyContext) {
11
23
  const model = new google_genai_1.ChatGoogleGenerativeAI({
12
24
  ...params
13
- }).bindTools(params.tools.map(convertToolToLangchainTool_1.convertToolToLangchainTool));
25
+ }).bindTools(params.tools.map(toGoogleTool));
14
26
  super({
15
27
  ...params,
16
28
  model
@@ -115,27 +115,27 @@ export declare class Agent {
115
115
  send: (event: AgentEvent) => void;
116
116
  constructor(session: Session, agent: SessionAgent, think: Think, tools: ToolPort, recorder?: Recorder, knowledge?: KnowledgePort);
117
117
  get settings(): {
118
+ systemPrompt: string;
119
+ goodbyeMessage: string;
120
+ systemErrorMessage: string;
121
+ maxSessionDuration: number;
122
+ allowUserBargeIn: boolean;
123
+ patience: "low" | "normal" | "high";
118
124
  firstMessage?: string;
119
- systemPrompt?: string;
120
- goodbyeMessage?: string;
121
- systemErrorMessage?: string;
122
125
  initialDtmf?: string;
123
- maxSessionDuration?: number;
124
126
  transferOptions?: {
125
- message?: string;
126
- phoneNumber?: string;
127
+ phoneNumber: string;
128
+ message: string;
127
129
  failedMessage?: string;
128
130
  };
129
131
  idleOptions?: {
130
- message?: string;
131
- timeout?: number;
132
- maxTimeoutCount?: number;
132
+ message: string;
133
+ timeout: number;
134
+ maxTimeoutCount: number;
133
135
  };
134
- allowUserBargeIn?: boolean;
135
- patience?: "low" | "normal" | "high";
136
136
  hints?: string[];
137
137
  filler?: {
138
- url?: string;
138
+ url: string;
139
139
  };
140
140
  voice?: string;
141
141
  language?: string;
@@ -9,354 +9,68 @@ import { UsageSink } from "./meteredThink";
9
9
  export declare const hostedConfigSchema: z.ZodObject<{
10
10
  host: z.ZodDefault<z.ZodString>;
11
11
  port: z.ZodDefault<z.ZodNumber>;
12
- /**
13
- * Private destinations HTTP tools may call (host names, IPs, CIDRs; RV-B2); defaults to
14
- * FONOSTER_ALLOWED_DESTINATIONS.
15
- */
16
- allowedDestinations: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
17
- /** The secret AppBridge signs Autopilot sessions with (one for every Autopilot app). */
18
- signingSecret: z.ZodUnion<[z.ZodObject<{
12
+ allowedDestinations: z.ZodOptional<z.ZodArray<z.ZodString>>;
13
+ signingSecret: z.ZodUnion<readonly [z.ZodObject<{
19
14
  env: z.ZodString;
20
- }, "strict", z.ZodTypeAny, {
21
- env?: string;
22
- }, {
23
- env?: string;
24
- }>, z.ZodObject<{
15
+ }, z.core.$strict>, z.ZodObject<{
25
16
  value: z.ZodString;
26
- }, "strict", z.ZodTypeAny, {
27
- value?: string;
28
- }, {
29
- value?: string;
30
- }>]>;
31
- /**
32
- * The URL Autopilot apps point to, exactly as the apps have it (the apiserver's
33
- * `apps.autopilotUrl`, e.g. ws://autopilot:3000), or several. Signatures are checked against
34
- * it, never against the request's Host header.
35
- */
36
- publicUrl: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
37
- /**
38
- * Apps and their agents: a file `{apps: {<appRef>: {workspaceRef?, agent}}}` (JSON or
39
- * YAML), or `database`: the apps' Intelligence rows, cached for `cacheMs` (CP-B11).
40
- */
41
- agents: z.ZodUnion<[z.ZodObject<{
17
+ }, z.core.$strict>]>;
18
+ publicUrl: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
19
+ agents: z.ZodUnion<readonly [z.ZodObject<{
42
20
  file: z.ZodString;
43
- }, "strict", z.ZodTypeAny, {
44
- file?: string;
45
- }, {
46
- file?: string;
47
- }>, z.ZodObject<{
21
+ }, z.core.$strict>, z.ZodObject<{
48
22
  source: z.ZodLiteral<"database">;
49
23
  cacheMs: z.ZodDefault<z.ZodNumber>;
50
- }, "strict", z.ZodTypeAny, {
51
- source?: "database";
52
- cacheMs?: number;
53
- }, {
54
- source?: "database";
55
- cacheMs?: number;
56
- }>]>;
57
- /** The provider registry's catalog: the JSON file fonoster-registry writes, or the tables. */
58
- registry: z.ZodUnion<[z.ZodObject<{
24
+ }, z.core.$strict>]>;
25
+ registry: z.ZodUnion<readonly [z.ZodObject<{
59
26
  file: z.ZodString;
60
- }, "strict", z.ZodTypeAny, {
61
- file?: string;
62
- }, {
63
- file?: string;
64
- }>, z.ZodObject<{
27
+ }, z.core.$strict>, z.ZodObject<{
65
28
  source: z.ZodLiteral<"database">;
66
29
  refreshMs: z.ZodDefault<z.ZodNumber>;
67
- }, "strict", z.ZodTypeAny, {
68
- source?: "database";
69
- refreshMs?: number;
70
- }, {
71
- source?: "database";
72
- refreshMs?: number;
73
- }>]>;
74
- /** Platform keys by credentialRef. */
75
- credentials: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
30
+ }, z.core.$strict>]>;
31
+ credentials: z.ZodPrefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
76
32
  env: z.ZodString;
77
- }, "strict", z.ZodTypeAny, {
78
- env?: string;
79
- }, {
80
- env?: string;
81
- }>, z.ZodObject<{
33
+ }, z.core.$strict>, z.ZodObject<{
82
34
  value: z.ZodString;
83
- }, "strict", z.ZodTypeAny, {
84
- value?: string;
85
- }, {
86
- value?: string;
87
- }>]>>>;
88
- /**
89
- * Workspace Secrets (bring your own key): a JSON file by workspace and credentialRef, or
90
- * `database`: the workspace's vendor keys (workspace_provider_keys).
91
- */
92
- workspaceSecrets: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
35
+ }, z.core.$strict>]>>>;
36
+ workspaceSecrets: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
93
37
  file: z.ZodString;
94
- }, "strict", z.ZodTypeAny, {
95
- file?: string;
96
- }, {
97
- file?: string;
98
- }>, z.ZodObject<{
38
+ }, z.core.$strict>, z.ZodObject<{
99
39
  source: z.ZodLiteral<"database">;
100
- }, "strict", z.ZodTypeAny, {
101
- source?: "database";
102
- }, {
103
- source?: "database";
104
- }>, z.ZodObject<{
40
+ }, z.core.$strict>, z.ZodObject<{
105
41
  cellSecrets: z.ZodObject<{
106
42
  file: z.ZodOptional<z.ZodString>;
107
43
  dir: z.ZodOptional<z.ZodString>;
108
44
  keyEnv: z.ZodOptional<z.ZodString>;
109
- }, "strict", z.ZodTypeAny, {
110
- file?: string;
111
- dir?: string;
112
- keyEnv?: string;
113
- }, {
114
- file?: string;
115
- dir?: string;
116
- keyEnv?: string;
117
- }>;
118
- }, "strict", z.ZodTypeAny, {
119
- cellSecrets?: {
120
- file?: string;
121
- dir?: string;
122
- keyEnv?: string;
123
- };
124
- }, {
125
- cellSecrets?: {
126
- file?: string;
127
- dir?: string;
128
- keyEnv?: string;
129
- };
130
- }>]>>;
131
- /**
132
- * The control-plane database (the apiserver's), for any `source: database`. The URL comes
133
- * from this file only, usually as a placeholder: `url: "${APISERVER_DATABASE_URL}"`.
134
- */
45
+ }, z.core.$strict>;
46
+ }, z.core.$strict>]>>;
135
47
  database: z.ZodOptional<z.ZodObject<{
136
48
  url: z.ZodString;
137
- /** A client generated from the apiserver schema (default `@prisma/client`). */
138
49
  clientModule: z.ZodOptional<z.ZodString>;
139
- }, "strict", z.ZodTypeAny, {
140
- url?: string;
141
- clientModule?: string;
142
- }, {
143
- url?: string;
144
- clientModule?: string;
145
- }>>;
146
- /** Endpoint overrides by provider or adapter id (e.g. a local ollama); the catalog's otherwise. */
147
- endpoints: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
148
- /** The S3 + Unstructured knowledge bases; keys by credentialRef (task 4.1). */
50
+ }, z.core.$strict>>;
51
+ endpoints: z.ZodPrefault<z.ZodRecord<z.ZodString, z.ZodString>>;
149
52
  knowledge: z.ZodOptional<z.ZodObject<{
150
53
  s3: z.ZodObject<{
151
54
  endpoint: z.ZodString;
152
55
  region: z.ZodDefault<z.ZodString>;
153
56
  accessKeyIdRef: z.ZodString;
154
57
  secretAccessKeyRef: z.ZodString;
155
- }, "strip", z.ZodTypeAny, {
156
- endpoint?: string;
157
- region?: string;
158
- accessKeyIdRef?: string;
159
- secretAccessKeyRef?: string;
160
- }, {
161
- endpoint?: string;
162
- region?: string;
163
- accessKeyIdRef?: string;
164
- secretAccessKeyRef?: string;
165
- }>;
58
+ }, z.core.$strip>;
166
59
  unstructured: z.ZodObject<{
167
60
  url: z.ZodString;
168
61
  apiKeyRef: z.ZodString;
169
- }, "strip", z.ZodTypeAny, {
170
- url?: string;
171
- apiKeyRef?: string;
172
- }, {
173
- url?: string;
174
- apiKeyRef?: string;
175
- }>;
62
+ }, z.core.$strip>;
176
63
  embeddings: z.ZodObject<{
177
64
  apiKeyRef: z.ZodString;
178
- }, "strip", z.ZodTypeAny, {
179
- apiKeyRef?: string;
180
- }, {
181
- apiKeyRef?: string;
182
- }>;
183
- }, "strip", z.ZodTypeAny, {
184
- s3?: {
185
- endpoint?: string;
186
- region?: string;
187
- accessKeyIdRef?: string;
188
- secretAccessKeyRef?: string;
189
- };
190
- unstructured?: {
191
- url?: string;
192
- apiKeyRef?: string;
193
- };
194
- embeddings?: {
195
- apiKeyRef?: string;
196
- };
197
- }, {
198
- s3?: {
199
- endpoint?: string;
200
- region?: string;
201
- accessKeyIdRef?: string;
202
- secretAccessKeyRef?: string;
203
- };
204
- unstructured?: {
205
- url?: string;
206
- apiKeyRef?: string;
207
- };
208
- embeddings?: {
209
- apiKeyRef?: string;
210
- };
211
- }>>;
212
- /**
213
- * The apiserver's encryption key (fonoster.yaml `encryption.key`; vendor keys are encrypted
214
- * Secrets). Usually "${ENCRYPTION_KEY}".
215
- */
65
+ }, z.core.$strip>;
66
+ }, z.core.$strip>>;
216
67
  encryption: z.ZodOptional<z.ZodObject<{
217
68
  key: z.ZodString;
218
- }, "strict", z.ZodTypeAny, {
219
- key?: string;
220
- }, {
221
- key?: string;
222
- }>>;
223
- /** OTLP export (empty = off): `otlpEndpoint: "${OTEL_EXPORTER_OTLP_ENDPOINT:-}"`. */
69
+ }, z.core.$strict>>;
224
70
  telemetry: z.ZodOptional<z.ZodObject<{
225
71
  otlpEndpoint: z.ZodOptional<z.ZodString>;
226
- }, "strip", z.ZodTypeAny, {
227
- otlpEndpoint?: string;
228
- }, {
229
- otlpEndpoint?: string;
230
- }>>;
231
- }, "strict", z.ZodTypeAny, {
232
- registry?: {
233
- file?: string;
234
- } | {
235
- source?: "database";
236
- refreshMs?: number;
237
- };
238
- host?: string;
239
- port?: number;
240
- allowedDestinations?: string[];
241
- signingSecret?: {
242
- env?: string;
243
- } | {
244
- value?: string;
245
- };
246
- publicUrl?: string | string[];
247
- agents?: {
248
- file?: string;
249
- } | {
250
- source?: "database";
251
- cacheMs?: number;
252
- };
253
- database?: {
254
- url?: string;
255
- clientModule?: string;
256
- };
257
- credentials?: Record<string, {
258
- env?: string;
259
- } | {
260
- value?: string;
261
- }>;
262
- workspaceSecrets?: {
263
- file?: string;
264
- } | {
265
- source?: "database";
266
- } | {
267
- cellSecrets?: {
268
- file?: string;
269
- dir?: string;
270
- keyEnv?: string;
271
- };
272
- };
273
- endpoints?: Record<string, string>;
274
- knowledge?: {
275
- s3?: {
276
- endpoint?: string;
277
- region?: string;
278
- accessKeyIdRef?: string;
279
- secretAccessKeyRef?: string;
280
- };
281
- unstructured?: {
282
- url?: string;
283
- apiKeyRef?: string;
284
- };
285
- embeddings?: {
286
- apiKeyRef?: string;
287
- };
288
- };
289
- encryption?: {
290
- key?: string;
291
- };
292
- telemetry?: {
293
- otlpEndpoint?: string;
294
- };
295
- }, {
296
- registry?: {
297
- file?: string;
298
- } | {
299
- source?: "database";
300
- refreshMs?: number;
301
- };
302
- host?: string;
303
- port?: number;
304
- allowedDestinations?: string[];
305
- signingSecret?: {
306
- env?: string;
307
- } | {
308
- value?: string;
309
- };
310
- publicUrl?: string | string[];
311
- agents?: {
312
- file?: string;
313
- } | {
314
- source?: "database";
315
- cacheMs?: number;
316
- };
317
- database?: {
318
- url?: string;
319
- clientModule?: string;
320
- };
321
- credentials?: Record<string, {
322
- env?: string;
323
- } | {
324
- value?: string;
325
- }>;
326
- workspaceSecrets?: {
327
- file?: string;
328
- } | {
329
- source?: "database";
330
- } | {
331
- cellSecrets?: {
332
- file?: string;
333
- dir?: string;
334
- keyEnv?: string;
335
- };
336
- };
337
- endpoints?: Record<string, string>;
338
- knowledge?: {
339
- s3?: {
340
- endpoint?: string;
341
- region?: string;
342
- accessKeyIdRef?: string;
343
- secretAccessKeyRef?: string;
344
- };
345
- unstructured?: {
346
- url?: string;
347
- apiKeyRef?: string;
348
- };
349
- embeddings?: {
350
- apiKeyRef?: string;
351
- };
352
- };
353
- encryption?: {
354
- key?: string;
355
- };
356
- telemetry?: {
357
- otlpEndpoint?: string;
358
- };
359
- }>;
72
+ }, z.core.$strip>>;
73
+ }, z.core.$strict>;
360
74
  export type HostedConfig = z.infer<typeof hostedConfigSchema>;
361
75
  /** Where Autopilot looks for its file when none is named (autopilot.yaml, then the older name). */
362
76
  export declare const AUTOPILOT_CONFIG_DIRS: string[];
@@ -96,13 +96,14 @@ exports.hostedConfigSchema = zod_1.z
96
96
  * it, never against the request's Host header.
97
97
  */
98
98
  publicUrl: zod_1.z.union([wsUrl, zod_1.z.array(wsUrl).min(1)], {
99
- errorMap: (issue, ctx) => ({
100
- message: issue.code !== "invalid_union"
101
- ? ctx.defaultError
102
- : ctx.data === undefined
103
- ? "is required: the URL Autopilot apps point to (the apiserver's apps.autopilotUrl)"
99
+ // A string that isn't a ws URL gets the URL's own message, as before the union.
100
+ error: (issue) => issue.code !== "invalid_union"
101
+ ? undefined
102
+ : issue.input === undefined
103
+ ? "is required: the URL Autopilot apps point to (the apiserver's apps.autopilotUrl)"
104
+ : typeof issue.input === "string"
105
+ ? "must be a ws:// or wss:// URL"
104
106
  : "must be a ws:// or wss:// URL, or a list of them"
105
- })
106
107
  }),
107
108
  /**
108
109
  * Apps and their agents: a file `{apps: {<appRef>: {workspaceRef?, agent}}}` (JSON or
@@ -128,7 +129,7 @@ exports.hostedConfigSchema = zod_1.z
128
129
  .strict()
129
130
  ]),
130
131
  /** Platform keys by credentialRef. */
131
- credentials: zod_1.z.record(secretRef).default({}),
132
+ credentials: zod_1.z.record(zod_1.z.string(), secretRef).prefault({}),
132
133
  /**
133
134
  * Workspace Secrets (bring your own key): a JSON file by workspace and credentialRef, or
134
135
  * `database`: the workspace's vendor keys (workspace_provider_keys).
@@ -165,7 +166,7 @@ exports.hostedConfigSchema = zod_1.z
165
166
  .strict()
166
167
  .optional(),
167
168
  /** Endpoint overrides by provider or adapter id (e.g. a local ollama); the catalog's otherwise. */
168
- endpoints: zod_1.z.record(zod_1.z.string()).default({}),
169
+ endpoints: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).prefault({}),
169
170
  /** The S3 + Unstructured knowledge bases; keys by credentialRef (task 4.1). */
170
171
  knowledge: zod_1.z
171
172
  .object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.43.0",
3
+ "version": "0.44.0",
4
4
  "description": "Voice AI for the Fonoster platform",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -32,12 +32,11 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@aws-sdk/client-s3": "^3.958.0",
35
- "@dmitryrechkin/json-schema-to-zod": "^1.0.1",
36
- "@fonoster/common": "^0.43.0",
37
- "@fonoster/community": "^0.43.0",
38
- "@fonoster/logger": "^0.43.0",
39
- "@fonoster/types": "^0.43.0",
40
- "@fonoster/voice": "^0.43.0",
35
+ "@fonoster/common": "^0.44.0",
36
+ "@fonoster/community": "^0.44.0",
37
+ "@fonoster/logger": "^0.44.0",
38
+ "@fonoster/types": "^0.44.0",
39
+ "@fonoster/voice": "^0.44.0",
41
40
  "@grpc/grpc-js": "~1.14.6",
42
41
  "@langchain/anthropic": "^1.3.3",
43
42
  "@langchain/community": "^1.1.1",
@@ -53,9 +52,9 @@
53
52
  "pdf-parse": "^1.1.1",
54
53
  "undici": "^7.30.1",
55
54
  "xstate": "^5.17.3",
56
- "zod": "^3.25.76"
55
+ "zod": "^4.6.7"
57
56
  },
58
- "gitHead": "091231327ebe27c11d882b8ea2e2deadea916697",
57
+ "gitHead": "2dbe93e2d836a33e58764f12081cd1e6bb654a3e",
59
58
  "devDependencies": {
60
59
  "yaml": "^2.9.0"
61
60
  }
@@ -1,9 +0,0 @@
1
- import { z } from "zod";
2
- import { Tool } from "./types";
3
- type LangchainToolParams = {
4
- name: string;
5
- description: string;
6
- schema: z.ZodObject<z.ZodRawShape>;
7
- };
8
- declare function convertToolToLangchainTool(customTool: Tool): LangchainToolParams;
9
- export { convertToolToLangchainTool };
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertToolToLangchainTool = convertToolToLangchainTool;
4
- /**
5
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
6
- * http://github.com/fonoster/fonoster
7
- *
8
- * This file is part of Fonoster
9
- *
10
- * Licensed under the MIT License (the "License");
11
- * you may not use this file except in compliance with
12
- * the License. You may obtain a copy of the License at
13
- *
14
- * https://opensource.org/licenses/MIT
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- */
22
- const json_schema_to_zod_1 = require("@dmitryrechkin/json-schema-to-zod");
23
- const zod_1 = require("zod");
24
- function convertToolToLangchainTool(customTool) {
25
- return {
26
- name: customTool.name,
27
- description: customTool.description,
28
- schema: customTool.parameters?.properties
29
- ? json_schema_to_zod_1.JSONSchemaToZod.convert(customTool.parameters)
30
- : zod_1.z.object({})
31
- };
32
- }