@@ -7,11 +7,13 @@ You are Lit - a friendly assistant and an expert in data science.
7
7
8
8
Your task is to help user design a text document processing pipeline using low-code platform called LitLytics.
9
9
LitLytics allows creating custom text document processing pipelines using custom processing steps.
10
+ LitLytics supports text documents and .csv, .doc(x), .pdf, .txt text files.
10
11
11
12
You have access to following LitLytics functions:
12
- - Suggest a list of possible pipelines that can be applied to user's documents
13
- - Generate a new pipeline for processing documents for given task from user
14
- - Refine suggested pipeline for processing documents
13
+ - Suggest a list of possible pipelines that can be applied to user's documents or files
14
+ - Suggest a new pipeline for processing documents for given task from user
15
+ - Refine suggested pipeline using user request
16
+ - Assemble suggested pipeline
15
17
- Add a new step to pipeline
16
18
- Edit a step in the pipeline
17
19
- Test a step in the pipeline
@@ -57,7 +59,7 @@ export const askAgent = async ({
57
59
// generate tools
58
60
const tools : LLMArgs [ 'tools' ] = {
59
61
analyzeDocuments : tool ( {
60
- description : `Suggest a list of possible pipelines that can be applied to user's documents. ` ,
62
+ description : `Suggest a list of possible pipelines that can be applied to user's documents` ,
61
63
parameters : z . object ( {
62
64
suggest : z . boolean ( ) ,
63
65
} ) ,
@@ -87,8 +89,8 @@ Generate a text description for user.`,
87
89
) ;
88
90
} ,
89
91
} ) ,
90
- generatePipeline : tool ( {
91
- description : `Generate a new pipeline for processing documents for given task from user. ` ,
92
+ suggestPipeline : tool ( {
93
+ description : `Suggest a new pipeline for processing documents for given task from user` ,
92
94
parameters : z . object ( {
93
95
task : z . string ( ) ,
94
96
} ) ,
@@ -121,6 +123,77 @@ Ask a user if that look fine.`,
121
123
) ;
122
124
} ,
123
125
} ) ,
126
+ refinePipeline : tool ( {
127
+ description : `Refine suggested pipeline using user request` ,
128
+ parameters : z . object ( {
129
+ refineRequest : z . string ( ) ,
130
+ } ) ,
131
+ execute : async ( { refineRequest } ) => {
132
+ // run task
133
+ const newPipeline = await litlytics . refinePipeline ( {
134
+ refineRequest : refineRequest ,
135
+ } ) ;
136
+ setPipeline ( newPipeline ) ;
137
+ // generate a response
138
+ const agentMessagesWithResult = agentMessages . concat ( [
139
+ {
140
+ content : `Refined pipeline from function execution:
141
+ ${ newPipeline . pipelinePlan }
142
+
143
+ Ask a user if that look fine.` ,
144
+ role : 'system' ,
145
+ } ,
146
+ ] ) ;
147
+ const result = await litlytics . runPromptFromMessages ( {
148
+ messages : agentMessagesWithResult ,
149
+ } ) ;
150
+ resolve (
151
+ messages . concat ( {
152
+ id : String ( messages . length ) ,
153
+ from : 'assistant' ,
154
+ text : result . result ,
155
+ } )
156
+ ) ;
157
+ } ,
158
+ } ) ,
159
+ createSuggestedPipeline : tool ( {
160
+ description : `Assemble suggested pipeline` ,
161
+ parameters : z . object ( {
162
+ assemble : z . boolean ( ) ,
163
+ } ) ,
164
+ execute : async ( ) => {
165
+ // run task
166
+ // generate plan from LLM
167
+ const newPipeline = await litlytics . pipelineFromText (
168
+ ( { step, totalSteps } ) => {
169
+ if ( step > totalSteps ) {
170
+ // setProgress('');
171
+ return ;
172
+ }
173
+
174
+ // setProgress(`Generating steps: ${step} / ${totalSteps}`);
175
+ }
176
+ ) ;
177
+ setPipeline ( newPipeline ) ;
178
+ // generate a response
179
+ const agentMessagesWithResult = agentMessages . concat ( [
180
+ {
181
+ content : `Pipeline assembled. Notify user. Be brief.` ,
182
+ role : 'system' ,
183
+ } ,
184
+ ] ) ;
185
+ const result = await litlytics . runPromptFromMessages ( {
186
+ messages : agentMessagesWithResult ,
187
+ } ) ;
188
+ resolve (
189
+ messages . concat ( {
190
+ id : String ( messages . length ) ,
191
+ from : 'assistant' ,
192
+ text : result . result ,
193
+ } )
194
+ ) ;
195
+ } ,
196
+ } ) ,
124
197
} ;
125
198
126
199
// execute request
0 commit comments