AISDK
An open-source Rust library for building AI-powered applications, inspired by the Vercel AI SDK. It provides a type-safe interface for interacting with Large Language Models (LLMs).
Installation
Usage
Enable Providers such as OpenAI, Anthropic, Google and more
Example with OpenAI provider
Basic Text Generation
use ;
async
Agents / Tools
Defining a Tool
Use the #[tool] macro to expose a Rust function as a callable tool.
use JsonSchema; // used to convert tool function to json schema
/// Get the weather information given a location
Using Tools in an Agent
Register tools with an agent so the model can call them during its reasoning loop.
use ;
async
Prompts
The AISDK prompt feature provides a powerful, file-based template system for managing AI prompts using the Tera template engine. It allows you to create reusable prompt templates with variable substitution, conditionals, loops, and template inclusion. See Examples for more template examples. Enable with cargo add aisdk --features prompt
Roadmap
- Agents
- Tool Execution
- Prompt Templating
- Stractured Output (JSON Schema)
- Language Model Request Support (Text Generation, Streaming)
- Embedding Model Request Support
- Image Model Request Support
- Voice Model Request Support
- Additional Providers
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
Licensed under the MIT License. See LICENSE for details.