use serde::{Deserialize, Serialize};
use super::super::{CustomToolGrammarSyntax, Extra, JsonSchema};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct FunctionDefinition {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub parameters: Option<JsonSchema>,
#[serde(skip_serializing_if = "Option::is_none")]
pub strict: Option<bool>,
#[serde(
default,
flatten,
skip_serializing_if = "std::collections::BTreeMap::is_empty"
)]
pub extra: Extra,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct FunctionCall {
pub arguments: String,
pub name: String,
#[serde(
default,
flatten,
skip_serializing_if = "std::collections::BTreeMap::is_empty"
)]
pub extra: Extra,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct CustomToolDefinition {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<CustomToolInputFormat>,
#[serde(
default,
flatten,
skip_serializing_if = "std::collections::BTreeMap::is_empty"
)]
pub extra: Extra,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum CustomToolInputFormat {
Text(CustomToolTextFormat),
Grammar(CustomToolGrammarFormat),
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
#[derive(gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct CustomToolTextFormat {
#[serde(rename = "type")]
pub type_: CustomToolTextFormatType,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CustomToolTextFormatType {
#[serde(rename = "text")]
Text,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
#[derive(gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct CustomToolGrammarFormat {
#[serde(rename = "type")]
pub type_: CustomToolGrammarFormatType,
pub grammar: CustomToolGrammar,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CustomToolGrammarFormatType {
#[serde(rename = "grammar")]
Grammar,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
#[derive(gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct CustomToolGrammar {
pub definition: String,
pub syntax: CustomToolGrammarSyntax,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, gproxy_protocol_macros::WireBuilder)]
#[non_exhaustive]
pub struct NamedTool {
pub name: String,
#[serde(
default,
flatten,
skip_serializing_if = "std::collections::BTreeMap::is_empty"
)]
pub extra: Extra,
}