@caretakerai/agent 0.0.25 → 0.0.27
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/activity.d.ts +14 -0
- package/dist/activity.js +13 -0
- package/dist/activity.js.map +1 -1
- package/dist/agent.d.ts +23 -2
- package/dist/agent.js +51 -14
- package/dist/agent.js.map +1 -1
- package/package.json +1 -1
package/dist/activity.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the kinds of activities that an agent can perform.
|
|
3
|
+
*/
|
|
1
4
|
export declare enum ActivityKind {
|
|
5
|
+
/** An observation made by the agent. */
|
|
2
6
|
Observation = "Observation",
|
|
7
|
+
/** A thought process of the agent. */
|
|
3
8
|
Thought = "Thought",
|
|
9
|
+
/** An action taken by the agent. */
|
|
4
10
|
Action = "Action"
|
|
5
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Parameters for creating a new Activity instance.
|
|
14
|
+
*/
|
|
6
15
|
export type ActivityParams = {
|
|
16
|
+
/** The kind of activity. */
|
|
7
17
|
kind: ActivityKind;
|
|
18
|
+
/** The input or content of the activity. */
|
|
8
19
|
input: string;
|
|
9
20
|
};
|
|
10
21
|
export declare class Activity implements ActivityParams {
|
|
@@ -15,6 +26,9 @@ export declare class Activity implements ActivityParams {
|
|
|
15
26
|
prompt(): string;
|
|
16
27
|
toObject(): this;
|
|
17
28
|
static fromObject({ kind, input }: Record<string, any>): Activity;
|
|
29
|
+
/**
|
|
30
|
+
* Parse XML-like text structure into array of activities
|
|
31
|
+
*/
|
|
18
32
|
static parse(text: string): Activity[];
|
|
19
33
|
static validateSequence(activities: Activity[]): void;
|
|
20
34
|
static filterSequence(activities: Activity[]): Activity[];
|
package/dist/activity.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Activity = exports.ActivityKind = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Enum representing the kinds of activities that an agent can perform.
|
|
6
|
+
*/
|
|
4
7
|
var ActivityKind;
|
|
5
8
|
(function (ActivityKind) {
|
|
9
|
+
/** An observation made by the agent. */
|
|
6
10
|
ActivityKind["Observation"] = "Observation";
|
|
11
|
+
/** A thought process of the agent. */
|
|
7
12
|
ActivityKind["Thought"] = "Thought";
|
|
13
|
+
/** An action taken by the agent. */
|
|
8
14
|
ActivityKind["Action"] = "Action";
|
|
9
15
|
})(ActivityKind || (exports.ActivityKind = ActivityKind = {}));
|
|
10
16
|
class Activity {
|
|
@@ -23,12 +29,18 @@ class Activity {
|
|
|
23
29
|
static fromObject({ kind, input }) {
|
|
24
30
|
return new Activity({ kind, input });
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Parse XML-like text structure into array of activities
|
|
34
|
+
*/
|
|
26
35
|
static parse(text) {
|
|
36
|
+
// Ignore all possible free text outside activities tags
|
|
27
37
|
const pattern = new RegExp(`<(${ActivityKind.Thought}|${ActivityKind.Action}|${ActivityKind.Observation})>(.*?)<\\/\\1>`);
|
|
28
38
|
const match = text.match(new RegExp(pattern, 'gs'));
|
|
39
|
+
// Validate text for any activities
|
|
29
40
|
if (!match) {
|
|
30
41
|
throw new Error(`Could not extract activities from "${text}"`);
|
|
31
42
|
}
|
|
43
|
+
// Extract activities from match
|
|
32
44
|
let activities = match.map(str => {
|
|
33
45
|
const [, kind, input] = str.match(new RegExp(pattern, 's'));
|
|
34
46
|
try {
|
|
@@ -42,6 +54,7 @@ class Activity {
|
|
|
42
54
|
throw new Error(`Could not extract activity from "${str}": ${err}`);
|
|
43
55
|
}
|
|
44
56
|
});
|
|
57
|
+
// Remove activities once sequence of Observation -> Thought -> Action is broken
|
|
45
58
|
Activity.filterSequence(activities);
|
|
46
59
|
return activities;
|
|
47
60
|
}
|
package/dist/activity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACH,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,wCAAwC;IACxC,2CAA2B,CAAA;IAC3B,sCAAsC;IACtC,mCAAmB,CAAA;IACnB,oCAAoC;IACpC,iCAAiB,CAAA;AACnB,CAAC,EAPW,YAAY,4BAAZ,YAAY,QAOvB;AAYD,MAAa,QAAQ;IACnB,IAAI,CAAgB;IACpB,UAAU,CAA0B;IACpC,KAAK,CAAU;IAEf,YAAY,MAAsB;QAChC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC;IAC1D,CAAC;IAED,QAAQ;QACN,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAuB;QACpD,OAAO,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,IAAY;QACvB,wDAAwD;QACxD,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,KAAK,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,WAAW,iBAAiB,CAAC,CAAC;QAC1H,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAEpD,mCAAmC;QACnC,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,GAAG,CAAC,CAAC;SAChE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,IAAI,KAAK,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,WAAW,EAAE;gBACnF,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,kCAAkC,CAAC,CAAC;aAC7E;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,UAAsB;QAC1C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,UAAU,CAAC;QAE/C,MAAM,MAAM,GAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC1C,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAEvC,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,OAAO,EAAE;gBACnF,MAAM;aACP;YAED,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,EAAE;gBAC9E,MAAM;aACP;YAED,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,WAAW,EAAE;gBAClF,MAAM;aACP;YAED,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACtB;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AApGD,4BAoGC"}
|
package/dist/agent.d.ts
CHANGED
|
@@ -6,24 +6,45 @@ import { ExecutionResult, GraphQLSchema } from 'graphql';
|
|
|
6
6
|
import { Activity } from './activity';
|
|
7
7
|
import { Optimizer } from './types';
|
|
8
8
|
type GraphQLExecutor = (query: string) => Promise<ExecutionResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for initializing an Agent.
|
|
11
|
+
*/
|
|
9
12
|
interface AgentPrams {
|
|
10
|
-
name
|
|
11
|
-
|
|
13
|
+
/** The name of the agent. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** A description of the agent. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** The language model the agent will use. */
|
|
12
18
|
llm: BaseLanguageModel;
|
|
19
|
+
/** Is chat model is used. Used to mitigate Langchain Human prefix in case of interacting with chat model. should be removed in favor of LLM selectors once fixed */
|
|
13
20
|
isChatModel?: boolean;
|
|
21
|
+
/** A GraphQL type definitions document. */
|
|
14
22
|
typeDefs: TypeSource;
|
|
23
|
+
/** A GraphQL resolvers. Will be ignored if custom executor is used. Optional. */
|
|
15
24
|
resolvers?: IResolvers;
|
|
25
|
+
/** The custom GraphQL executor to handle agent action. Optional. */
|
|
16
26
|
executor?: GraphQLExecutor;
|
|
27
|
+
/** The history of activities performed by the agent. Optional. */
|
|
17
28
|
history?: Activity[];
|
|
29
|
+
/** Examples of activities to guide the agent. Optional. */
|
|
18
30
|
examples?: Activity[];
|
|
31
|
+
/** The objective or goal the agent is trying to achieve. Optional. */
|
|
19
32
|
objective?: string;
|
|
33
|
+
/** Completion instruction for the LLM. Optional. */
|
|
20
34
|
instruction?: string;
|
|
35
|
+
/** The maximum number of iterations the agent can perform. Optional. */
|
|
21
36
|
maxIterations?: number;
|
|
37
|
+
/** The maximum number of retries for actions. Optional. */
|
|
22
38
|
maxRetries?: number;
|
|
39
|
+
/** The pipeline of history optimizers used to improve the agent's performance. */
|
|
23
40
|
optimizers: Optimizer[];
|
|
41
|
+
/** The template for generating prompts for the agent. Optional. */
|
|
24
42
|
signal?: AbortSignal;
|
|
43
|
+
/** The template for generating prompts for the agent. Optional. */
|
|
25
44
|
template?: PromptTemplate;
|
|
45
|
+
/** A list of strings that, if generated by the agent, should cause it to stop. Optional. */
|
|
26
46
|
stop?: string[];
|
|
47
|
+
/** The logger the agent will use for outputting information. Optional. */
|
|
27
48
|
logger?: Logger;
|
|
28
49
|
}
|
|
29
50
|
export declare class AgentRetryError extends Error {
|
package/dist/agent.js
CHANGED
|
@@ -42,23 +42,41 @@ class Agent {
|
|
|
42
42
|
schema;
|
|
43
43
|
static defaults = {
|
|
44
44
|
template: prompts_1.PromptTemplate.fromTemplate((0, dedent_1.default) `
|
|
45
|
-
|
|
45
|
+
<Objective>
|
|
46
46
|
{objective}
|
|
47
|
+
</Objective>
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
The only permissible actions you may take are listed below:
|
|
50
|
-
\`\`\`graphql
|
|
49
|
+
<GraphQLSchema>
|
|
51
50
|
{schema}
|
|
52
|
-
|
|
51
|
+
</GraphQLSchema>
|
|
53
52
|
|
|
53
|
+
<Instructions>
|
|
54
54
|
{instruction}
|
|
55
|
+
</Instructions>
|
|
55
56
|
`),
|
|
56
57
|
objective: 'You are helpful assistant.',
|
|
57
58
|
instruction: (0, dedent_1.default) `
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
**WARNING: FAILURE TO FOLLOW THE BELOW INSTRUCTIONS WILL RESULT IN INVALID RESPONSES**
|
|
60
|
+
|
|
61
|
+
1. Always plan your action step by step before executing them.
|
|
62
|
+
2. Generate reasoning as follows:
|
|
63
|
+
- Wrap your thoughts into XML tag to let the following software parse it properly as following: <Thought>your thoughts</Thought>
|
|
64
|
+
- First, reflect on the current state and previous <Observation>
|
|
65
|
+
- Then list the remaining steps to accomplish the <Objective>
|
|
66
|
+
- Finally, explain your next step.
|
|
67
|
+
3. Generate <Action> tag immediately after <Thought> as follows:
|
|
68
|
+
- Wrap your action into XML tag to let the following software parse it properly as following: <Action>your action</Action>
|
|
69
|
+
- Action content must be a single GraphQL operation
|
|
70
|
+
- Action content must not be wrapped in any tags
|
|
71
|
+
- Action content must valid against <GraphQLSchema>
|
|
72
|
+
4. Only use explicitly defined operations in the <GraphQLSchema>.
|
|
73
|
+
5. If a request:
|
|
74
|
+
- Falls outside your objective scope
|
|
75
|
+
- Cannot be fulfilled using the available operations
|
|
76
|
+
- Violates any constraints
|
|
77
|
+
Then explain why in your thoughts and politely decline the request.
|
|
78
|
+
|
|
79
|
+
**COMPLETE YOUR <Thought> AND <Action> IN A SINGLE MESSAGE**
|
|
62
80
|
`,
|
|
63
81
|
maxRetries: 7,
|
|
64
82
|
isChatModel: false,
|
|
@@ -75,13 +93,19 @@ class Agent {
|
|
|
75
93
|
}),
|
|
76
94
|
new activity_1.Activity({
|
|
77
95
|
kind: activity_1.ActivityKind.Thought,
|
|
78
|
-
input:
|
|
96
|
+
input: (0, dedent_1.default) `
|
|
97
|
+
Based on the observation, I have received information that 73 is the best number.
|
|
98
|
+
|
|
99
|
+
Remaining steps:
|
|
100
|
+
1. Share this information with the user
|
|
101
|
+
|
|
102
|
+
For my next step, I will use the say mutation to communicate this finding to the user in a clear and direct way.`,
|
|
79
103
|
}),
|
|
80
104
|
new activity_1.Activity({
|
|
81
105
|
kind: activity_1.ActivityKind.Action,
|
|
82
106
|
input: (0, dedent_1.default) `
|
|
83
|
-
|
|
84
|
-
say(
|
|
107
|
+
mutation {
|
|
108
|
+
say(message: "The best number is 73!") {
|
|
85
109
|
reply
|
|
86
110
|
}
|
|
87
111
|
}
|
|
@@ -92,6 +116,7 @@ class Agent {
|
|
|
92
116
|
constructor(params) {
|
|
93
117
|
Object.assign(this, Agent.defaults, params);
|
|
94
118
|
const { typeDefs, resolvers, executor } = params;
|
|
119
|
+
// Create schema and validate
|
|
95
120
|
if (!executor) {
|
|
96
121
|
this.schema = (0, schema_1.makeExecutableSchema)({ typeDefs, resolvers });
|
|
97
122
|
}
|
|
@@ -103,10 +128,12 @@ class Agent {
|
|
|
103
128
|
async prompt(params) {
|
|
104
129
|
let activities = [];
|
|
105
130
|
const retryErrors = [];
|
|
131
|
+
// Prepare chat messages
|
|
106
132
|
let history = [...this.history];
|
|
107
|
-
if (history.length
|
|
133
|
+
if (history.length <= this.examples.length) {
|
|
108
134
|
history = [...this.examples, ...history];
|
|
109
135
|
}
|
|
136
|
+
// Apply optimizers
|
|
110
137
|
for (const opt of this.optimizers) {
|
|
111
138
|
history = await opt.optimize(history);
|
|
112
139
|
}
|
|
@@ -115,17 +142,21 @@ class Agent {
|
|
|
115
142
|
let aiActivities = [];
|
|
116
143
|
[...history, ...activities].forEach(activity => {
|
|
117
144
|
if (activity.kind === activity_1.ActivityKind.Observation) {
|
|
145
|
+
// AI generates Thought and Action per messages
|
|
118
146
|
aiActivities.length && messages.push(new messages_1.AIMessage(aiActivities.map(a => a.prompt()).join(constants_1.ACTIVITY_SEP)));
|
|
119
147
|
aiActivities = [];
|
|
148
|
+
// Human generates single Observation per message
|
|
120
149
|
messages.push(new messages_1.HumanMessage(activity.prompt()));
|
|
121
150
|
}
|
|
122
151
|
else {
|
|
123
152
|
aiActivities.push(activity);
|
|
124
153
|
}
|
|
125
154
|
});
|
|
155
|
+
// Push remaining activities to chat messages
|
|
126
156
|
if (aiActivities.length) {
|
|
127
157
|
messages.push(new messages_1.AIMessage(aiActivities.map(a => a.prompt()).join(constants_1.ACTIVITY_SEP)));
|
|
128
158
|
}
|
|
159
|
+
// Render system prompt
|
|
129
160
|
const systemPrompt = await this.template.partial({
|
|
130
161
|
objective: this.objective,
|
|
131
162
|
schema: this.typeDefs.toString(),
|
|
@@ -134,7 +165,7 @@ class Agent {
|
|
|
134
165
|
});
|
|
135
166
|
const { value: systemPromptValue } = await systemPrompt.invoke(params ?? {});
|
|
136
167
|
const res = await this.llm
|
|
137
|
-
.bind({ stop: [`<${activity_1.ActivityKind.Observation}>`] })
|
|
168
|
+
.bind({ stop: [`<${activity_1.ActivityKind.Observation}>`] }) // Do not allow LLMs to generate observations
|
|
138
169
|
.invoke([
|
|
139
170
|
new messages_1.SystemMessage(systemPromptValue),
|
|
140
171
|
...messages
|
|
@@ -160,16 +191,20 @@ class Agent {
|
|
|
160
191
|
continue;
|
|
161
192
|
}
|
|
162
193
|
const activity = activities.at(-1);
|
|
194
|
+
// Prompt LLM to provide action if missing
|
|
163
195
|
if (activity.kind === activity_1.ActivityKind.Thought) {
|
|
164
196
|
this.logger.debug(`Retry ${i + 1} due to missing action`);
|
|
165
197
|
retryErrors.push(new Error('Missing action'));
|
|
166
198
|
continue;
|
|
167
199
|
}
|
|
200
|
+
// Execute actions
|
|
168
201
|
try {
|
|
169
202
|
let source = activity.input;
|
|
203
|
+
// Prefer custom executor is specified
|
|
170
204
|
const result = this.executor
|
|
171
205
|
? await this.executor(source)
|
|
172
206
|
: await (0, graphql_1.graphql)({ schema: this.schema, source });
|
|
207
|
+
// Add new observation to the iteration history
|
|
173
208
|
activities.push(new activity_1.Activity({
|
|
174
209
|
kind: activity_1.ActivityKind.Observation,
|
|
175
210
|
input: (0, yaml_1.stringify)(result),
|
|
@@ -178,6 +213,7 @@ class Agent {
|
|
|
178
213
|
retryErrors.push(...result.errors);
|
|
179
214
|
continue;
|
|
180
215
|
}
|
|
216
|
+
// Add iteration activities to the agent history and finish iteration
|
|
181
217
|
this.addActivities(...activities);
|
|
182
218
|
return;
|
|
183
219
|
}
|
|
@@ -199,6 +235,7 @@ class Agent {
|
|
|
199
235
|
if (!this.history.length) {
|
|
200
236
|
throw new Error('History must not be empty.');
|
|
201
237
|
}
|
|
238
|
+
// Validate history sequence
|
|
202
239
|
activity_1.Activity.validateSequence(this.history);
|
|
203
240
|
if (this.history.at(-1)?.kind !== activity_1.ActivityKind.Observation) {
|
|
204
241
|
throw new Error('Latest experience must be of Observation kind');
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,+BAAiC;AACjC,gDAAoC;AAEpC,qDAAwD;AAGxD,kDAA6D;AAE7D,qCAAkE;AAElE,2CAA2C;AAC3C,yCAAoD;AAE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