WIP - ai process builder codex attempt
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { compileProcessGraph } from '../ai-processes.compiler';
|
||||
import { demoRegisterNewPetProcess } from '../demo-process';
|
||||
import { runCompiledGraph } from '../ai-processes.runner';
|
||||
import { ToolRegistry } from '../tools/tool-registry';
|
||||
|
||||
describe('ai-processes runner', () => {
|
||||
it('runs the demo process until human input is required', async () => {
|
||||
const compiled = compileProcessGraph(demoRegisterNewPetProcess, {
|
||||
tenantId: 'default',
|
||||
version: 1,
|
||||
});
|
||||
|
||||
const result = await runCompiledGraph({
|
||||
compiledGraph: compiled,
|
||||
input: {
|
||||
accountName: 'Acme Inc',
|
||||
firstName: 'Jamie',
|
||||
lastName: 'Doe',
|
||||
},
|
||||
toolRegistry: new ToolRegistry(),
|
||||
toolContext: { tenantId: 'default', userId: 'user-1' },
|
||||
llmDecision: async (node, state) => {
|
||||
if (node.id === 'decide_account') {
|
||||
return { accountAction: 'find', accountName: state.accountName };
|
||||
}
|
||||
if (node.id === 'decide_contact') {
|
||||
return {
|
||||
contactAction: 'find',
|
||||
firstName: state.firstName,
|
||||
lastName: state.lastName,
|
||||
};
|
||||
}
|
||||
return {};
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.status).toBe('waiting');
|
||||
expect(result.currentNodeId).toBe('need_pet');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user