AI Assist
A Rust library for interacting with multiple AI providers including Google's Gemini API, OpenAI's GPT, and Anthropic's Claude. This library provides a simple and unified way to integrate AI capabilities into your Rust applications.
Features
- Support for multiple AI providers:
- Google Gemini
- OpenAI GPT
- Anthropic Claude
- Simple and unified API
- Async support
- Error handling with anyhow
- Type-safe request and response handling
- Configurable timeouts
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
First, you'll need to get API keys from the providers you want to use. Then you can use the library like this:
use ;
async
Environment Variables
GEMINI_API_KEY: Your Google Gemini API keyOPENAI_API_KEY: Your OpenAI API keyANTHROPIC_API_KEY: Your Anthropic API key
Provider-Specific Details
Google Gemini
- Uses the Gemini Pro model
- Requires a Google AI Studio API key
OpenAI
- Uses the GPT-3.5-turbo model by default
- Requires an OpenAI API key
- Supports chat completion format
Claude
- Uses Claude-2 model
- Requires an Anthropic API key
- Supports completion format
Error Handling
The library uses anyhow for error handling. All errors are wrapped in anyhow::Result, making it easy to handle different types of errors that might occur during API calls.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.