Documentation
¶
Index ¶
- Constants
- Variables
- type CreateTodoArgs
- type CreateTodoOutput
- type CreateTodosArgs
- type CreateTodosOutput
- type ListTodosOutput
- type MemoryTodoStorage
- func (s *MemoryTodoStorage) Add(_ context.Context, todo Todo)
- func (s *MemoryTodoStorage) All(_ context.Context) []Todo
- func (s *MemoryTodoStorage) Clear(_ context.Context)
- func (s *MemoryTodoStorage) FindByID(_ context.Context, id string) int
- func (s *MemoryTodoStorage) Len(_ context.Context) int
- func (s *MemoryTodoStorage) Update(_ context.Context, index int, fn func(Todo) Todo)
- type Option
- type Storage
- type Todo
- type Tool
- type Update
- type UpdateTodosArgs
- type UpdateTodosOutput
Constants ¶
View Source
const ( ToolNameCreateTodo = "create_todo" ToolNameCreateTodos = "create_todos" ToolNameUpdateTodos = "update_todos" ToolNameListTodos = "list_todos" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type CreateTodoArgs ¶
type CreateTodoArgs struct {
Description string `json:"description" jsonschema:"Description of the todo item"`
}
type CreateTodoOutput ¶
type CreateTodosArgs ¶
type CreateTodosArgs struct {
Descriptions []string `json:"descriptions" jsonschema:"Descriptions of the todo items"`
}
type CreateTodosOutput ¶
type CreateTodosOutput struct {
Created []Todo `json:"created" jsonschema:"List of created todo items"`
AllTodos []Todo `json:"all_todos" jsonschema:"Current state of all todo items"`
Reminder string `json:"reminder,omitempty" jsonschema:"Reminder about incomplete todos that still need to be completed"`
}
type ListTodosOutput ¶
type MemoryTodoStorage ¶
type MemoryTodoStorage struct {
// contains filtered or unexported fields
}
MemoryTodoStorage is an in-memory, concurrency-safe implementation of Storage.
func NewMemoryTodoStorage ¶
func NewMemoryTodoStorage() *MemoryTodoStorage
func (*MemoryTodoStorage) Clear ¶
func (s *MemoryTodoStorage) Clear(_ context.Context)
type Option ¶
type Option func(*Tool)
Option is a functional option for configuring a Tool.
func WithStorage ¶
WithStorage sets a custom storage implementation for the Tool. The provided storage must not be nil.
type Storage ¶
type Storage interface {
// Add appends a new todo item.
Add(ctx context.Context, todo Todo)
// All returns a copy of all todo items.
All(ctx context.Context) []Todo
// Len returns the number of todo items.
Len(ctx context.Context) int
// FindByID returns the index of the todo with the given ID, or -1 if not found.
FindByID(ctx context.Context, id string) int
// Update modifies the todo at the given index using the provided function.
Update(ctx context.Context, index int, fn func(Todo) Todo)
// Clear removes all todo items.
Clear(ctx context.Context)
}
Storage defines the storage layer for todo items.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
func NewTodoTool ¶
func (*Tool) Instructions ¶
type UpdateTodosArgs ¶
type UpdateTodosArgs struct {
Updates []Update `json:"updates" jsonschema:"List of todo updates"`
}
type UpdateTodosOutput ¶
type UpdateTodosOutput struct {
Updated []Update `json:"updated,omitempty" jsonschema:"List of successfully updated todos"`
NotFound []string `json:"not_found,omitempty" jsonschema:"IDs of todos that were not found"`
AllTodos []Todo `json:"all_todos" jsonschema:"Current state of all todo items"`
Reminder string `json:"reminder,omitempty" jsonschema:"Reminder about incomplete todos that still need to be completed"`
}
Click to show internal directories.
Click to hide internal directories.