async_openai/types/assistants/
impls.rs

1use crate::types::assistants::{
2    AssistantToolCodeInterpreterResources, AssistantToolFileSearchResources,
3    AssistantToolResources, AssistantTools, AssistantToolsFileSearch, AssistantToolsFunction,
4    CreateAssistantToolFileSearchResources, CreateAssistantToolResources,
5    CreateMessageRequestContent, FunctionObject,
6};
7
8impl From<AssistantToolsFileSearch> for AssistantTools {
9    fn from(value: AssistantToolsFileSearch) -> Self {
10        Self::FileSearch(value)
11    }
12}
13
14impl From<AssistantToolsFunction> for AssistantTools {
15    fn from(value: AssistantToolsFunction) -> Self {
16        Self::Function(value)
17    }
18}
19
20impl From<FunctionObject> for AssistantToolsFunction {
21    fn from(value: FunctionObject) -> Self {
22        Self { function: value }
23    }
24}
25
26impl From<FunctionObject> for AssistantTools {
27    fn from(value: FunctionObject) -> Self {
28        Self::Function(value.into())
29    }
30}
31
32impl From<CreateAssistantToolFileSearchResources> for CreateAssistantToolResources {
33    fn from(value: CreateAssistantToolFileSearchResources) -> Self {
34        Self {
35            code_interpreter: None,
36            file_search: Some(value),
37        }
38    }
39}
40
41impl From<AssistantToolCodeInterpreterResources> for CreateAssistantToolResources {
42    fn from(value: AssistantToolCodeInterpreterResources) -> Self {
43        Self {
44            code_interpreter: Some(value),
45            file_search: None,
46        }
47    }
48}
49
50impl From<AssistantToolCodeInterpreterResources> for AssistantToolResources {
51    fn from(value: AssistantToolCodeInterpreterResources) -> Self {
52        Self {
53            code_interpreter: Some(value),
54            file_search: None,
55        }
56    }
57}
58
59impl From<AssistantToolFileSearchResources> for AssistantToolResources {
60    fn from(value: AssistantToolFileSearchResources) -> Self {
61        Self {
62            code_interpreter: None,
63            file_search: Some(value),
64        }
65    }
66}
67
68impl From<String> for CreateMessageRequestContent {
69    fn from(value: String) -> Self {
70        Self::Content(value)
71    }
72}
73
74impl From<&str> for CreateMessageRequestContent {
75    fn from(value: &str) -> Self {
76        Self::Content(value.to_string())
77    }
78}
79
80impl Default for CreateMessageRequestContent {
81    fn default() -> Self {
82        Self::Content("".into())
83    }
84}