1use reqwest::Client;
2
3#[allow(dead_code)]
4pub struct HttpClient {
5 client: Client,
6 api_key: String,
7 base_url: String,
8}
9
10impl HttpClient {
11 pub fn new(api_key: String) -> Self {
12 Self {
13 client: Client::new(),
14 api_key,
15 base_url: "https://api.anthropic.com".to_string(),
16 }
17 }
18
19 pub fn create_message_request(
20 &self,
21 model: &str,
22 messages: Vec<serde_json::Value>,
23 ) -> Result<serde_json::Value, crate::error::AgentError> {
24 let body = serde_json::json!({
25 "model": model,
26 "max_tokens": 16384,
27 "messages": messages,
28 });
29 Ok(body)
30 }
31}
32
33#[cfg(test)]
34mod tests {
35 use super::*;
36
37 #[tokio::test]
38 async fn test_create_request() {
39 let client = HttpClient::new("test-key".to_string());
40 let messages = vec![serde_json::json!({"role": "user", "content": "Hello"})];
41 let req = client.create_message_request("claude-sonnet-4-6", messages);
42 assert!(req.is_ok());
43 }
44}