promptrs
This crate provides a framework for building agentic workflows that integrate language models with tool calling capabilities. It handles conversation management, API interactions, tool invocation, and response parsing in a streamlined, composable manner. The core design philosophy is to enable fluent method chaining while maintaining minimal state management.
Features
- Streamed API communication with incremental message processing
- Multi-tool support with function call validation and error handling
- Configurable delimiters for custom message formatting
- Automated message pruning for context size management
- JSON schema generation for tool documentation
- Pythonic tool calling support
Usage Overview
- Configure API: Set up model parameters and credentials
- Define Tools: Create functions with
#[tool]attribute - Build Workflow: Chain configuration and tool registration
- Process Messages: Handle user input through fluent API
- Handle Responses: Manage tool calls and state updates
Example: Basic Workflow
use ;
use HashMap;
/// Tool implementation for note-taking
/// id: Unique ID for note
/// title: Note title