@fonoster/autopilot 0.7.57 → 0.8.4
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/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
autopilot
|
|
2
2
|
=================
|
|
3
3
|
|
|
4
|
-
[](https://fonoster.com)
|
|
5
5
|
[](https://npmjs.org/package/@fonoster/autopilot)
|
|
6
6
|
[](https://npmjs.org/package/@fonoster/autopilot)
|
|
7
7
|
[](https://github.com/fonoster/fonoster/blob/main/package.json)
|
|
@@ -89,35 +89,12 @@ The Autopilot supports multiple language model providers. The following is a lis
|
|
|
89
89
|
| Provider | Description | Supported models
|
|
90
90
|
|------------|------------------------------------------------------------|------------------------------------------------------------------------------|
|
|
91
91
|
| OpenAI | OpenAI provides various GPT models for conversational AI | `gpt-4o`, `gpt-4o-mini`, `gpt-3.5-turbo`, `gpt-4-turbo` |
|
|
92
|
-
| Groq | Groq offers high-performance AI models optimized for speed | `gemm-7b-it`, `llama3-groq-70b-8192-tool-use-preview`, `llama3-1-8b-instant
|
|
93
|
-
| Ollama | Self-hosted Ollama models | `
|
|
92
|
+
| Groq | Groq offers high-performance AI models optimized for speed | `gemm-7b-it`, `llama3-groq-70b-8192-tool-use-preview`, `llama3-1-8b-instant` |
|
|
93
|
+
| Ollama | Self-hosted Ollama models | `lama3.1` |
|
|
94
94
|
|
|
95
95
|
## Adding Knowledge Base
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Currently, we support retrieving documents from an S3 bucket.
|
|
100
|
-
|
|
101
|
-
To add a knowledge base, include a new entry in the `knowledgeBase` array in the configuration file. Below is an example of a knowledge for a menu PDF.
|
|
102
|
-
|
|
103
|
-
```json
|
|
104
|
-
{
|
|
105
|
-
"conversationSettings": { ... },
|
|
106
|
-
"languageModel": {
|
|
107
|
-
"provider": "openai",
|
|
108
|
-
"model": "gpt-4o-mini",
|
|
109
|
-
"apiKey": "your-api-key",
|
|
110
|
-
"maxTokens": 100,
|
|
111
|
-
"temperature": 0.4,
|
|
112
|
-
"knowledgeBase": [{
|
|
113
|
-
"type": "s3",
|
|
114
|
-
"title": "Menu PDF",
|
|
115
|
-
"document": "sample.pdf"
|
|
116
|
-
}],
|
|
117
|
-
"tools": []
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
97
|
+
Coming soon...
|
|
121
98
|
|
|
122
99
|
## Adding Tools
|
|
123
100
|
|
|
@@ -131,9 +108,8 @@ You can configure a new tool by adding a new entry in the `tools` array in the c
|
|
|
131
108
|
"languageModel": {
|
|
132
109
|
"provider": "openai",
|
|
133
110
|
"model": "gpt-4o-mini",
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"temperature": 0.4,
|
|
111
|
+
"maxTokens": 250,
|
|
112
|
+
"temperature": 0.7,
|
|
137
113
|
"knowledgeBase": [],
|
|
138
114
|
"tools": [
|
|
139
115
|
{
|
|
@@ -43,11 +43,11 @@ class AbstractLanguageModel {
|
|
|
43
43
|
const { chain, chatHistory, toolsCatalog } = this;
|
|
44
44
|
const response = (await chain.invoke({ text }));
|
|
45
45
|
let firstInvocation = true;
|
|
46
|
-
if (response.
|
|
46
|
+
if (response.tool_calls && response.tool_calls.length > 0) {
|
|
47
47
|
// eslint-disable-next-line no-loops/no-loops
|
|
48
|
-
for (const toolCall of response.
|
|
49
|
-
const {
|
|
50
|
-
logger.verbose(`invoking tool: ${name} with args: ${args}`, {
|
|
48
|
+
for (const toolCall of response.tool_calls) {
|
|
49
|
+
const { args, name } = toolCall;
|
|
50
|
+
logger.verbose(`invoking tool: ${name} with args: ${JSON.stringify(args)}`, {
|
|
51
51
|
firstInvocation
|
|
52
52
|
});
|
|
53
53
|
switch (name) {
|
|
@@ -70,7 +70,7 @@ class AbstractLanguageModel {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
const finalResponse = (await chain.invoke({
|
|
73
|
-
text: "Please provide a final response based on the tool results."
|
|
73
|
+
text: "Please provide a final response based on the tool's results."
|
|
74
74
|
}));
|
|
75
75
|
response.content = finalResponse.content ?? "";
|
|
76
76
|
}
|
|
@@ -6,7 +6,7 @@ declare function toolInvocation(params: {
|
|
|
6
6
|
chatHistory: ReturnType<typeof createChatHistory>;
|
|
7
7
|
toolsCatalog: ToolsCatalog;
|
|
8
8
|
firstInvocation: boolean;
|
|
9
|
-
args: string
|
|
9
|
+
args: Record<string, unknown>;
|
|
10
10
|
voice: Voice;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
export { toolInvocation };
|
|
@@ -31,7 +31,7 @@ async function toolInvocation(params) {
|
|
|
31
31
|
await voice.say(message);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const toolResult = await toolsCatalog.invokeTool(toolName,
|
|
34
|
+
const toolResult = await toolsCatalog.invokeTool(toolName, args);
|
|
35
35
|
logger.verbose("tool result: ", toolResult);
|
|
36
36
|
await chatHistory.addAIMessage(`tool result: ${toolResult.result}`);
|
|
37
37
|
}
|
package/dist/voice/Voice.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VoiceResponse } from "@fonoster/voice";
|
|
2
2
|
import { Voice } from "./types";
|
|
3
3
|
declare class VoiceImpl implements Voice {
|
|
4
|
-
private voice;
|
|
5
|
-
private playbackRef;
|
|
4
|
+
private readonly voice;
|
|
5
|
+
private readonly playbackRef;
|
|
6
6
|
sessionRef: string;
|
|
7
7
|
sgatherStream: {
|
|
8
8
|
stop: () => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/autopilot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.4",
|
|
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",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@aws-sdk/client-s3": "^3.712.0",
|
|
39
|
-
"@fonoster/common": "^0.
|
|
40
|
-
"@fonoster/logger": "^0.
|
|
41
|
-
"@fonoster/types": "^0.
|
|
42
|
-
"@fonoster/voice": "^0.
|
|
39
|
+
"@fonoster/common": "^0.8.4",
|
|
40
|
+
"@fonoster/logger": "^0.8.4",
|
|
41
|
+
"@fonoster/types": "^0.8.4",
|
|
42
|
+
"@fonoster/voice": "^0.8.4",
|
|
43
43
|
"@langchain/community": "^0.3.19",
|
|
44
44
|
"@langchain/core": "^0.3.23",
|
|
45
45
|
"@langchain/groq": "^0.1.2",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"typescript": "^5.5.4"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "230bf0c9b793e5de49ffeb30ee1bd62226f55cba"
|
|
61
61
|
}
|