@fonoster/autopilot 0.16.2 → 0.16.6
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.
- package/dist/knowledge/AbstractKnowledgeBase.js +3 -3
- package/dist/models/AbstractLanguageModel.d.ts +1 -1
- package/dist/models/anthropic/Anthropic.js +1 -3
- package/dist/models/anthropic/types.d.ts +3 -2
- package/dist/models/anthropic/types.js +3 -2
- package/dist/models/chatHistory.d.ts +1 -1
- package/dist/models/chatHistory.js +2 -2
- package/dist/models/createChain.d.ts +1 -1
- package/dist/models/google/types.d.ts +5 -1
- package/dist/models/google/types.js +5 -1
- package/dist/models/groq/Groq.js +1 -3
- package/dist/models/groq/types.d.ts +0 -1
- package/dist/models/groq/types.js +0 -1
- package/dist/models/ollama/Ollama.js +1 -3
- package/dist/models/openai/OpenAI.js +1 -3
- package/dist/tools/convertToolToLangchainTool.d.ts +7 -2
- package/package.json +17 -16
|
@@ -20,9 +20,9 @@ exports.AbstractKnowledgeBase = void 0;
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
const logger_1 = require("@fonoster/logger");
|
|
23
|
+
const memory_1 = require("@langchain/classic/vectorstores/memory");
|
|
23
24
|
const openai_1 = require("@langchain/openai");
|
|
24
|
-
const
|
|
25
|
-
const memory_1 = require("langchain/vectorstores/memory");
|
|
25
|
+
const textsplitters_1 = require("@langchain/textsplitters");
|
|
26
26
|
const envs_1 = require("../envs");
|
|
27
27
|
const logger = (0, logger_1.getLogger)({ service: "autopilot", filePath: __filename });
|
|
28
28
|
class AbstractKnowledgeBase {
|
|
@@ -41,7 +41,7 @@ class AbstractKnowledgeBase {
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
const loadedDocs = await Promise.all(loaders.map((loader) => loader.load()));
|
|
44
|
-
const textSplitter = new
|
|
44
|
+
const textSplitter = new textsplitters_1.RecursiveCharacterTextSplitter({
|
|
45
45
|
chunkSize: 1000,
|
|
46
46
|
chunkOverlap: 200
|
|
47
47
|
});
|
|
@@ -10,6 +10,6 @@ declare abstract class AbstractLanguageModel implements LanguageModel {
|
|
|
10
10
|
private readonly transferOptions;
|
|
11
11
|
constructor(params: LanguageModelParams, voice: Voice, telephonyContext: TelephonyContext);
|
|
12
12
|
invoke(text: string, isReentry: boolean): Promise<InvocationResult>;
|
|
13
|
-
getChatHistoryMessages(): Promise<import("@langchain/core/messages").BaseMessage[]>;
|
|
13
|
+
getChatHistoryMessages(): Promise<import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
14
14
|
}
|
|
15
15
|
export { AbstractLanguageModel };
|
|
@@ -28,9 +28,7 @@ class Anthropic extends AbstractLanguageModel_1.AbstractLanguageModel {
|
|
|
28
28
|
constructor(params, voice, telephonyContext) {
|
|
29
29
|
const model = new anthropic_1.ChatAnthropic({
|
|
30
30
|
...params
|
|
31
|
-
}).
|
|
32
|
-
tools: params.tools.map(tools_1.convertToolToOpenAITool)
|
|
33
|
-
});
|
|
31
|
+
}).bindTools(params.tools.map(tools_1.convertToolToOpenAITool));
|
|
34
32
|
super({
|
|
35
33
|
...params,
|
|
36
34
|
model
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { BaseModelParams } from "../types";
|
|
20
20
|
declare enum AnthropicModel {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
CLAUDE_SONNET_4_5 = "claude-sonnet-4-5",
|
|
22
|
+
CLAUDE_HAIKU_4_5 = "claude-haiku-4-5",
|
|
23
|
+
CLAUDE_OPUS_4_5 = "claude-opus-4-5"
|
|
23
24
|
}
|
|
24
25
|
type AnthropicParams = BaseModelParams & {
|
|
25
26
|
model: AnthropicModel;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AnthropicModel = void 0;
|
|
4
4
|
var AnthropicModel;
|
|
5
5
|
(function (AnthropicModel) {
|
|
6
|
-
AnthropicModel["
|
|
7
|
-
AnthropicModel["
|
|
6
|
+
AnthropicModel["CLAUDE_SONNET_4_5"] = "claude-sonnet-4-5";
|
|
7
|
+
AnthropicModel["CLAUDE_HAIKU_4_5"] = "claude-haiku-4-5";
|
|
8
|
+
AnthropicModel["CLAUDE_OPUS_4_5"] = "claude-opus-4-5";
|
|
8
9
|
})(AnthropicModel || (exports.AnthropicModel = AnthropicModel = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function createChatHistory(): {
|
|
2
|
-
getMessages: () => Promise<import("@langchain/core/messages").BaseMessage[]>;
|
|
2
|
+
getMessages: () => Promise<import("@langchain/core/messages").BaseMessage<import("@langchain/core/messages").MessageStructure, import("@langchain/core/messages").MessageType>[]>;
|
|
3
3
|
addUserMessage: (text: string) => Promise<void>;
|
|
4
4
|
addAIMessage: (text: string) => Promise<void>;
|
|
5
5
|
clear: () => Promise<void>;
|
|
@@ -19,10 +19,10 @@ exports.createChatHistory = createChatHistory;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
+
const chat_history_1 = require("@langchain/core/chat_history");
|
|
22
23
|
const messages_1 = require("@langchain/core/messages");
|
|
23
|
-
const in_memory_1 = require("langchain/stores/message/in_memory");
|
|
24
24
|
function createChatHistory() {
|
|
25
|
-
const chatHistory = new
|
|
25
|
+
const chatHistory = new chat_history_1.InMemoryChatMessageHistory();
|
|
26
26
|
return {
|
|
27
27
|
getMessages: () => chatHistory.getMessages(),
|
|
28
28
|
addUserMessage: (text) => chatHistory.addMessage(new messages_1.HumanMessage(text)),
|
|
@@ -21,5 +21,5 @@ import { RunnableSequence } from "@langchain/core/runnables";
|
|
|
21
21
|
import { KnowledgeBase } from "../knowledge";
|
|
22
22
|
import { createChatHistory } from "./chatHistory";
|
|
23
23
|
import { createPromptTemplate } from "./createPromptTemplate";
|
|
24
|
-
declare function createChain(model: BaseChatModel, knowledgeBase: KnowledgeBase, promptTemplate: ReturnType<typeof createPromptTemplate>, chatHistory: ReturnType<typeof createChatHistory>): RunnableSequence<any, import("@langchain/core/messages").AIMessageChunk
|
|
24
|
+
declare function createChain(model: BaseChatModel, knowledgeBase: KnowledgeBase, promptTemplate: ReturnType<typeof createPromptTemplate>, chatHistory: ReturnType<typeof createChatHistory>): RunnableSequence<any, import("@langchain/core/messages").AIMessageChunk<import("@langchain/core/messages").MessageStructure>>;
|
|
25
25
|
export { createChain };
|
|
@@ -20,7 +20,11 @@ import { BaseModelParams } from "../types";
|
|
|
20
20
|
declare enum GoogleModel {
|
|
21
21
|
GEMINI_2_0_FLASH = "gemini-2.0-flash",
|
|
22
22
|
GEMINI_2_0_FLASH_LITE = "gemini-2.0-flash-lite",
|
|
23
|
-
|
|
23
|
+
GEMINI_2_5_PRO = "gemini-2.5-pro",
|
|
24
|
+
GEMINI_2_5_FLASH = "gemini-2.5-flash",
|
|
25
|
+
GEMINI_2_5_FLASH_LITE = "gemini-2.5-flash-lite",
|
|
26
|
+
GEMINI_3_PRO_PREVIEW = "gemini-3-pro-preview",
|
|
27
|
+
GEMINI_3_FLASH_PREVIEW = "gemini-3-flash-preview"
|
|
24
28
|
}
|
|
25
29
|
type GoogleParams = BaseModelParams & {
|
|
26
30
|
model: GoogleModel;
|
|
@@ -5,5 +5,9 @@ var GoogleModel;
|
|
|
5
5
|
(function (GoogleModel) {
|
|
6
6
|
GoogleModel["GEMINI_2_0_FLASH"] = "gemini-2.0-flash";
|
|
7
7
|
GoogleModel["GEMINI_2_0_FLASH_LITE"] = "gemini-2.0-flash-lite";
|
|
8
|
-
GoogleModel["
|
|
8
|
+
GoogleModel["GEMINI_2_5_PRO"] = "gemini-2.5-pro";
|
|
9
|
+
GoogleModel["GEMINI_2_5_FLASH"] = "gemini-2.5-flash";
|
|
10
|
+
GoogleModel["GEMINI_2_5_FLASH_LITE"] = "gemini-2.5-flash-lite";
|
|
11
|
+
GoogleModel["GEMINI_3_PRO_PREVIEW"] = "gemini-3-pro-preview";
|
|
12
|
+
GoogleModel["GEMINI_3_FLASH_PREVIEW"] = "gemini-3-flash-preview";
|
|
9
13
|
})(GoogleModel || (exports.GoogleModel = GoogleModel = {}));
|
package/dist/models/groq/Groq.js
CHANGED
|
@@ -10,9 +10,7 @@ class Groq extends AbstractLanguageModel_1.AbstractLanguageModel {
|
|
|
10
10
|
constructor(params, voice, telephonyContext) {
|
|
11
11
|
const model = new groq_1.ChatGroq({
|
|
12
12
|
...params
|
|
13
|
-
}).
|
|
14
|
-
tools: params.tools.map(tools_1.convertToolToOpenAITool)
|
|
15
|
-
});
|
|
13
|
+
}).bindTools(params.tools.map(tools_1.convertToolToOpenAITool));
|
|
16
14
|
super({
|
|
17
15
|
...params,
|
|
18
16
|
model
|
|
@@ -3,6 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GroqModel = void 0;
|
|
4
4
|
var GroqModel;
|
|
5
5
|
(function (GroqModel) {
|
|
6
|
-
GroqModel["LLAMA3_3_3_70B_SPECDEC"] = "llama-3.3-70b-specdec";
|
|
7
6
|
GroqModel["LLAMA3_3_3_70B_VERSATILE"] = "llama-3.3-70b-versatile";
|
|
8
7
|
})(GroqModel || (exports.GroqModel = GroqModel = {}));
|
|
@@ -10,9 +10,7 @@ class Ollama extends AbstractLanguageModel_1.AbstractLanguageModel {
|
|
|
10
10
|
constructor(params, voice, telephonyContext) {
|
|
11
11
|
const model = new ollama_1.ChatOllama({
|
|
12
12
|
...params
|
|
13
|
-
}).
|
|
14
|
-
tools: params.tools.map(tools_1.convertToolToOpenAITool)
|
|
15
|
-
});
|
|
13
|
+
}).bindTools(params.tools.map(tools_1.convertToolToOpenAITool));
|
|
16
14
|
super({
|
|
17
15
|
...params,
|
|
18
16
|
model
|
|
@@ -10,9 +10,7 @@ class OpenAI extends AbstractLanguageModel_1.AbstractLanguageModel {
|
|
|
10
10
|
constructor(params, voice, telephonyContext) {
|
|
11
11
|
const model = new openai_1.ChatOpenAI({
|
|
12
12
|
...params
|
|
13
|
-
}).
|
|
14
|
-
tools: params.tools.map(tools_1.convertToolToOpenAITool)
|
|
15
|
-
});
|
|
13
|
+
}).bindTools(params.tools.map(tools_1.convertToolToOpenAITool));
|
|
16
14
|
super({
|
|
17
15
|
...params,
|
|
18
16
|
model
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
import { Tool } from "./types";
|
|
3
|
-
|
|
3
|
+
type LangchainToolParams = {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
schema: z.ZodObject<z.ZodRawShape>;
|
|
7
|
+
};
|
|
8
|
+
declare function convertToolToLangchainTool(customTool: Tool): LangchainToolParams;
|
|
4
9
|
export { convertToolToLangchainTool };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/autopilot",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
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",
|
|
@@ -34,28 +34,29 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@aws-sdk/client-s3": "^3.712.0",
|
|
36
36
|
"@dmitryrechkin/json-schema-to-zod": "^1.0.1",
|
|
37
|
-
"@fonoster/common": "^0.16.
|
|
38
|
-
"@fonoster/logger": "^0.16.
|
|
39
|
-
"@fonoster/sdk": "^0.16.
|
|
40
|
-
"@fonoster/types": "^0.16.
|
|
41
|
-
"@fonoster/voice": "^0.16.
|
|
42
|
-
"@langchain/anthropic": "^
|
|
43
|
-
"@langchain/community": "^
|
|
44
|
-
"@langchain/core": "^
|
|
45
|
-
"@langchain/google-genai": "^
|
|
46
|
-
"@langchain/groq": "^0.
|
|
47
|
-
"@langchain/ollama": "^
|
|
48
|
-
"@langchain/openai": "^
|
|
37
|
+
"@fonoster/common": "^0.16.6",
|
|
38
|
+
"@fonoster/logger": "^0.16.6",
|
|
39
|
+
"@fonoster/sdk": "^0.16.6",
|
|
40
|
+
"@fonoster/types": "^0.16.6",
|
|
41
|
+
"@fonoster/voice": "^0.16.6",
|
|
42
|
+
"@langchain/anthropic": "^1.3.3",
|
|
43
|
+
"@langchain/community": "^1.1.1",
|
|
44
|
+
"@langchain/core": "^1.1.8",
|
|
45
|
+
"@langchain/google-genai": "^2.1.3",
|
|
46
|
+
"@langchain/groq": "^1.0.2",
|
|
47
|
+
"@langchain/ollama": "^1.1.0",
|
|
48
|
+
"@langchain/openai": "^1.2.0",
|
|
49
|
+
"@langchain/textsplitters": "^1.0.1",
|
|
49
50
|
"cheerio": "^1.0.0",
|
|
50
51
|
"dotenv": "^16.4.5",
|
|
51
52
|
"js-yaml": "^4.1.0",
|
|
52
|
-
"langchain": "^
|
|
53
|
+
"langchain": "^1.2.3",
|
|
53
54
|
"moment": "^2.30.1",
|
|
54
55
|
"onnxruntime-node": "1.21.1",
|
|
55
56
|
"pdf-parse": "^1.1.1",
|
|
56
57
|
"uuid": "^11.0.3",
|
|
57
58
|
"xstate": "^5.17.3",
|
|
58
|
-
"zod": "^3.
|
|
59
|
+
"zod": "^3.25.76"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "25e4c9da3bf18462aef501184b8a73aad65c11be"
|
|
61
62
|
}
|