reasonkit/thinktool/
thinktool_executor.rs

1use crate::error::{Error, Result};
2use crate::evaluation::Profile;
3
4/// Legacy `ThinkToolExecutor` API used by earlier examples.
5///
6/// This is a thin compatibility wrapper around the newer `ProtocolExecutor` APIs.
7#[derive(Debug, Default)]
8pub struct ThinkToolExecutor;
9
10impl ThinkToolExecutor {
11    pub fn new() -> Self {
12        Self
13    }
14
15    /// Executes a prompt using the given reasoning profile.
16    ///
17    /// Current implementation is a compile-first compatibility shim. It returns a
18    /// structured string that callers can validate and pass into other pipelines.
19    pub async fn run(&self, prompt: &str, profile: Profile) -> Result<String> {
20        if prompt.trim().is_empty() {
21            return Err(Error::Validation("Prompt is empty".to_string()));
22        }
23
24        let mut protocol = String::new();
25        protocol.push_str("Protocol: Generated Reasoning Protocol\n");
26        protocol.push_str(&format!("Profile: {:?}\n\n", profile));
27        protocol.push_str("Prompt:\n");
28        protocol.push_str(prompt);
29        protocol.push('\n');
30
31        Ok(protocol)
32    }
33}