pub struct Tool {
pub tool_type: ToolType,
pub function: Option<FunctionTool>,
pub max_keyword: Option<u32>,
pub force_search: Option<bool>,
pub limit: Option<u32>,
pub user_location: Option<UserLocation>,
}Expand description
A tool that can be called by the model.
Fields§
§tool_type: ToolTypeTool type
function: Option<FunctionTool>Function tool (if type is function)
max_keyword: Option<u32>Maximum number of keywords for web search (web_search only)
force_search: Option<bool>Force search even if model thinks it’s unnecessary (web_search only)
limit: Option<u32>Limit the number of search results (web_search only)
user_location: Option<UserLocation>User location for localized search (web_search only)
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn function(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn function(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new function tool.
Sourcepub fn function_with_params(
name: impl Into<String>,
description: impl Into<String>,
parameters: HashMap<String, Value>,
) -> Self
pub fn function_with_params( name: impl Into<String>, description: impl Into<String>, parameters: HashMap<String, Value>, ) -> Self
Create a new function tool with parameters.
Sourcepub fn web_search() -> Self
pub fn web_search() -> Self
Create a web search tool.
Note: You must first enable the “联网服务插件” (Web Search Plugin)
in the MiMo console and set web_search_enabled(true) in your
ChatRequest before using this feature.
Sourcepub fn max_keyword(self, max: u32) -> Self
pub fn max_keyword(self, max: u32) -> Self
Set maximum number of keywords for web search.
Sourcepub fn force_search(self, force: bool) -> Self
pub fn force_search(self, force: bool) -> Self
Set whether to force search.
Sourcepub fn user_location(self, location: UserLocation) -> Self
pub fn user_location(self, location: UserLocation) -> Self
Set the user location for localized search.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tool
impl<'de> Deserialize<'de> for Tool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl UnwindSafe for Tool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more