@fonoster/autopilot 0.9.47 → 0.9.49

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.
@@ -1,26 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LANGUAGE_MODEL_NAME = exports.Google = void 0;
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
- // import { BaseChatModel } from "@langchain/core/language_models/chat_models";
23
4
  const google_genai_1 = require("@langchain/google-genai");
5
+ const convertToolToLangchainTool_1 = require("../../tools/convertToolToLangchainTool");
24
6
  const AbstractLanguageModel_1 = require("../AbstractLanguageModel");
25
7
  const LANGUAGE_MODEL_NAME = "llm.google";
26
8
  exports.LANGUAGE_MODEL_NAME = LANGUAGE_MODEL_NAME;
@@ -28,13 +10,7 @@ class Google extends AbstractLanguageModel_1.AbstractLanguageModel {
28
10
  constructor(params, voice, telephonyContext) {
29
11
  const model = new google_genai_1.ChatGoogleGenerativeAI({
30
12
  ...params
31
- });
32
- // TODO: Add tools to the model
33
- // const model = new ChatGoogleGenerativeAI({
34
- // ...params
35
- // }).bind({
36
- // tools: params.tools.map(convertToolToOpenAITool)
37
- // }) as unknown as BaseChatModel;
13
+ }).bindTools(params.tools.map(convertToolToLangchainTool_1.convertToolToLangchainTool));
38
14
  super({
39
15
  ...params,
40
16
  model
@@ -6,8 +6,13 @@ const hangupToolDefinition = {
6
6
  description: "Hangup the call and end the conversation",
7
7
  parameters: {
8
8
  type: "object",
9
- properties: {},
10
- required: []
9
+ properties: {
10
+ // FIXME: Workaround for Google LLMs issue
11
+ // GenerateContentRequest.tools[0].function_declarations[1].parameters.properties: should be non-empty for OBJECT type
12
+ noop: {
13
+ type: "boolean"
14
+ }
15
+ }
11
16
  }
12
17
  };
13
18
  exports.hangupToolDefinition = hangupToolDefinition;
@@ -6,8 +6,13 @@ const transferToolDefinition = {
6
6
  description: "Transfer the call to a live agent",
7
7
  parameters: {
8
8
  type: "object",
9
- properties: {},
10
- required: []
9
+ properties: {
10
+ // FIXME: Workaround for Google LLMs issue
11
+ // GenerateContentRequest.tools[0].function_declarations[1].parameters.properties: should be non-empty for OBJECT type
12
+ noop: {
13
+ type: "boolean"
14
+ }
15
+ }
11
16
  }
12
17
  };
13
18
  exports.transferToolDefinition = transferToolDefinition;
@@ -0,0 +1,4 @@
1
+ import { StructuredToolParams } from "@langchain/core/tools";
2
+ import { Tool } from "./types";
3
+ declare function convertToolToLangchainTool(customTool: Tool): StructuredToolParams;
4
+ export { convertToolToLangchainTool };
@@ -0,0 +1,32 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/autopilot",
3
- "version": "0.9.47",
3
+ "version": "0.9.49",
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",
@@ -33,11 +33,12 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-s3": "^3.712.0",
36
- "@fonoster/common": "^0.9.47",
37
- "@fonoster/logger": "^0.9.46",
38
- "@fonoster/sdk": "^0.9.47",
39
- "@fonoster/types": "^0.9.46",
40
- "@fonoster/voice": "^0.9.47",
36
+ "@dmitryrechkin/json-schema-to-zod": "^1.0.1",
37
+ "@fonoster/common": "^0.9.49",
38
+ "@fonoster/logger": "^0.9.49",
39
+ "@fonoster/sdk": "^0.9.49",
40
+ "@fonoster/types": "^0.9.49",
41
+ "@fonoster/voice": "^0.9.49",
41
42
  "@langchain/anthropic": "^0.3.15",
42
43
  "@langchain/community": "^0.3.32",
43
44
  "@langchain/core": "^0.3.40",
@@ -58,5 +59,5 @@
58
59
  "xstate": "^5.17.3",
59
60
  "zod": "^3.23.8"
60
61
  },
61
- "gitHead": "fa7a06ca67fb6ed718396d7381927c80c49d8da2"
62
+ "gitHead": "8f176f86f5ed02c7e8d87e275d14e6b34fa116bd"
62
63
  }