langchain_rust/schemas/
agent.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4use tokio::sync::mpsc;
5
6pub enum ToolInput {
7    //Will implement this in the future
8    StrInput(String),
9    DictInput(HashMap<String, String>),
10}
11
12#[derive(Clone, Debug, Deserialize, Serialize)]
13pub struct AgentAction {
14    pub tool: String,
15    pub tool_input: String, //this should be ToolInput in the future
16    pub log: String,
17}
18
19///Log tools is a struct used by the openai-like agents
20#[derive(Clone, Debug, Deserialize, Serialize)]
21pub struct LogTools {
22    pub tool_id: String,
23    pub tools: String,
24}
25
26#[derive(Clone, Debug, Deserialize, Serialize)]
27pub struct AgentFinish {
28    pub output: String,
29}
30
31#[derive(Debug)]
32pub enum AgentEvent {
33    Action(Vec<AgentAction>),
34    Finish(AgentFinish),
35}
36
37pub enum AgentPlan {
38    Text(AgentEvent),
39    Stream(mpsc::Receiver<Result<String, reqwest_eventsource::Error>>),
40}