synaptic_parsers/
str_parser.rs1use async_trait::async_trait;
2use synaptic_core::{Message, RunnableConfig, SynapticError};
3use synaptic_runnables::Runnable;
4
5use crate::FormatInstructions;
6
7pub struct StrOutputParser;
9
10impl FormatInstructions for StrOutputParser {
11 fn get_format_instructions(&self) -> String {
12 String::new()
13 }
14}
15
16#[async_trait]
17impl Runnable<Message, String> for StrOutputParser {
18 async fn invoke(
19 &self,
20 input: Message,
21 _config: &RunnableConfig,
22 ) -> Result<String, SynapticError> {
23 Ok(input.content().to_string())
24 }
25}