Skip to main content

ds_api/raw/request/
tool_choice.rs

1use serde::{Deserialize, Serialize};
2
3use super::message::ToolType;
4
5#[derive(Debug, Serialize, Deserialize)]
6#[serde(untagged)]
7pub enum ToolChoice {
8    String(ToolChoiceType),
9
10    /// type string REQUIRED
11    ///     Possible values: `function`
12    ///     The tool type. Currently only `function` is supported.
13    /// function object REQUIRED
14    ///     name string REQUIRED
15    ///     The name of the function to invoke.
16    Object(ToolChoiceObject),
17}
18
19#[derive(Debug, Serialize, Deserialize)]
20#[serde(rename_all = "lowercase")]
21pub enum ToolChoiceType {
22    None,
23    Auto,
24    Required,
25}
26
27#[derive(Debug, Serialize, Deserialize)]
28pub struct ToolChoiceObject {
29    pub r#type: ToolType,
30    pub function: FunctionName,
31}
32
33#[derive(Debug, Serialize, Deserialize)]
34pub struct FunctionName {
35    pub name: String,
36}