langfuse Rust Client
A non official open-source Rust client for tracking simple interactions with Langfuse (https://langfuse.com) the open-source LLM observability platform.
Features
- Track user interactions with LangFuse
- Handle both successful and error cases
- Configure LangFuse API settings
- Support for custom trace names
- Track tokens used and model name
- Track processing time
- Flexible metadata and observation tracking
Installation
Type this inside your project directory
cargo add langfuse
Or if you prefer to use a Cargo.toml file:
Add this to your Cargo.toml:
[]
= "0.1.2"
Usage
Basic example:
use ;
async
API Documentation
LangFuseConfig
Configuration for LangFuse API credentials and endpoint.
send_interaction
Track an interaction with LangFuse.
pub async ;
// TokenUsage structure for detailed token tracking
LangFuseTrackerError
Error types for LangFuse tracking operations.
Project Structure
langfuse_tracker/
├── src/
│ ├── lib.rs
│ ├── client.rs
│ ├── error.rs
│ ├── types.rs
│ └── utils/
│ └── mod.rs
├── example/
│ └── usage.rs
├── tests/
│ └── integration.rs
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details. If you have any questions or suggestions, please contact open an issue or a pull request on https://github.com/adolfousier/langfuse-rust
License
This project is licensed under the MIT License - see the LICENSE file for details.