# langhub
**Repository Path**: rust_cn/langhub
## Basic Information
- **Project Name**: langhub
- **Description**: 一个基于Rust开发的LLM应用开发框架.
- **Primary Language**: Rust
- **License**: Apache-2.0
- **Default Branch**: main
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-04-05
- **Last Updated**: 2026-04-05
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
langhub
An LLM application development framework based on Rust.
简体中文 | English
# Install
```bash
cargo add langhub
```
```
[dependencies]
langhub = "0.1.1"
```
# Basic Usage
## Generate a welcome message with OpenAI
```rust
use langhub_macros::chat;
#[chat(msg = "Write a welcome message for a developer tool", type = "openai")]
fn generate_welcome() -> Result> {
println!("Generated: {}", llm_response);
Ok(llm_response)
}
```
## Reply to user using DeepSeek
```rust
use langhub_macros::chat;
#[chat(msg = format!("Reply to the user in a friendly tone: {}", user_input), type = "deepseek")]
fn reply_to_user(user_input: String) -> Result> {
println!("AI reply: {}", llm_response);
Ok(llm_response)
}
```
## Analyze sentiment with Anthropic
```rust
use langhub_macros::chat;
#[chat(msg = format!("Analyze the sentiment (positive/negative/neutral) of this text:\n{}", text), type = "anthropic")]
fn analyze_sentiment(text: String) -> Result> {
match llm_response {
Ok(sentiment) => {
println!("Sentiment analysis result: {}", sentiment);
Ok(sentiment)
}
Err(e) => {
eprintln!("Analysis failed: {}", e);
Err(e.into())
}
}
}
```