fixxxeeess
This commit is contained in:
parent
643203b8a5
commit
c4d9ca19ce
8 changed files with 142 additions and 54 deletions
14
src/agent.rs
14
src/agent.rs
|
|
@ -19,13 +19,13 @@ impl Agent {
|
|||
zen_api_key: Option<String>,
|
||||
tavily_api_key: Option<String>,
|
||||
initial_message: String,
|
||||
) -> Self {
|
||||
) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
let intro = format!(
|
||||
"You are an autonomous agent. You have access to tools that can help
|
||||
you achieve your goals. Use them wisely. The user is unable to respond to you
|
||||
so do not ask for clarification and use the
|
||||
answer tool once you to give your final answer. current date is {}",
|
||||
Utc::now().to_rfc3339()
|
||||
Utc::now().format("%B %d, %Y %H:%M:%S UTC").to_string()
|
||||
);
|
||||
println!("initial_message: {}", intro);
|
||||
let messages = vec![
|
||||
|
|
@ -45,8 +45,12 @@ impl Agent {
|
|||
|
||||
let tools = Some(tools::get_tools());
|
||||
|
||||
Self {
|
||||
client: reqwest::Client::new(),
|
||||
let client = reqwest::Client::builder()
|
||||
.timeout(std::time::Duration::from_secs(60))
|
||||
.build()?;
|
||||
|
||||
Ok(Self {
|
||||
client,
|
||||
url: "https://opencode.ai/zen/v1/chat/completions".to_string(),
|
||||
zen_api_key,
|
||||
tavily_api_key,
|
||||
|
|
@ -54,7 +58,7 @@ impl Agent {
|
|||
tools,
|
||||
logs: String::new(),
|
||||
answer: None,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn log(&mut self, message: &str) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue