Commit ab5f609 1 parent aab1c36 commit ab5f609 Copy full SHA for ab5f609
File tree 3 files changed +20
-5
lines changed
3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ const researchTripWorkflow = workflow({
57
57
- highly-rated restaurants and dining experiences.
58
58
- landmarks with historic context.
59
59
- picturesque and entertaining locations.
60
-
60
+ ` ,
61
+ knowledge : `
61
62
Traveler's information:
62
63
- Origin: New York, USA
63
64
- Destination: Wrocław, Poland
@@ -70,7 +71,6 @@ const researchTripWorkflow = workflow({
70
71
Comprehensive day-by-day itinerary for the trip to Wrocław, Poland.
71
72
Ensure the itinerary integrates flights, hotel information, and all planned activities and dining experiences.
72
73
` ,
73
- snapshot : logger ,
74
74
} )
75
75
76
76
const result = await teamwork ( researchTripWorkflow )
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export const agent = (options: AgentOptions = {}): Agent => {
28
28
provider,
29
29
run :
30
30
options . run ??
31
- ( async ( state , context ) => {
31
+ ( async ( state , context , workflow ) => {
32
32
const mappedTools = tools
33
33
? Object . entries ( tools ) . map ( ( [ name , tool ] ) =>
34
34
zodFunction ( {
@@ -39,6 +39,8 @@ export const agent = (options: AgentOptions = {}): Agent => {
39
39
)
40
40
: [ ]
41
41
42
+ const [ , ...messages ] = context
43
+
42
44
const response = await provider . completions ( {
43
45
messages : [
44
46
{
@@ -62,7 +64,17 @@ export const agent = (options: AgentOptions = {}): Agent => {
62
64
} ,
63
65
{
64
66
role : 'user' ,
65
- content : `Here is all the work done so far by other agents: ${ JSON . stringify ( context ) } ` ,
67
+ content : `Here is all the work done so far by other agents: ${ JSON . stringify ( messages ) } ` ,
68
+ } ,
69
+ {
70
+ role : 'assistant' ,
71
+ content : 'Is there anything else I need to know?' ,
72
+ } ,
73
+ {
74
+ role : 'user' ,
75
+ content : workflow . knowledge
76
+ ? `Here is all the knowledge available: ${ workflow . knowledge } `
77
+ : 'No, I do not have any additional information.' ,
66
78
} ,
67
79
{
68
80
role : 'assistant' ,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ type WorkflowOptions = {
11
11
12
12
team : Team
13
13
14
+ knowledge ?: string
14
15
provider ?: Provider
15
16
maxIterations ?: number
16
17
snapshot ?: Telemetry
@@ -37,4 +38,6 @@ export const workflow = (options: WorkflowOptions): Workflow => {
37
38
}
38
39
}
39
40
40
- export type Workflow = Required < WorkflowOptions >
41
+ export type Workflow = Required < Omit < WorkflowOptions , 'knowledge' > > & {
42
+ knowledge ?: string
43
+ }
You can’t perform that action at this time.
0 commit comments