Skip to content

Commit

Permalink
Update todo example
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkpiano committed Jun 13, 2024
1 parent 651f23f commit 2afc080
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions examples/todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const agent = createAgent({
model: openai('gpt-4o'),
events: {
addTodo: z.object({
message: z.string().min(1).max(100).describe('The message of the todo'),
title: z.string().min(1).max(100).describe('The title of the todo'),
content: z.string().min(1).max(100).describe('The content of the todo'),
}),
deleteTodo: z.object({
index: z.number().describe('The index of the todo to delete'),
Expand All @@ -24,7 +25,8 @@ const agent = createAgent({
});

interface Todo {
message: string;
title: string;
content: string;
done: boolean;
}

Expand All @@ -48,7 +50,8 @@ const machine = setup({
todos: ({ context, event }) => [
...context.todos,
{
message: event.message,
title: event.title,
content: event.content,
done: false,
},
],
Expand Down

0 comments on commit 2afc080

Please sign in to comment.