pub struct SessionBuilder<'m, M: LanguageModel + ?Sized> { /* private fields */ }Expand description
Builder combining instructions, custom tools, and built-in system tools.
use fm_rs::{Session, SystemLanguageModel, SystemTool};
let model = SystemLanguageModel::new()?;
let session = Session::builder(&model)
.instructions("Describe attached images and read any text in them.")
.system_tool(SystemTool::Ocr)
.build()?;Implementations§
Source§impl<M: LanguageModel + ?Sized> SessionBuilder<'_, M>
impl<M: LanguageModel + ?Sized> SessionBuilder<'_, M>
Sourcepub fn instructions(self, instructions: impl Into<String>) -> Self
pub fn instructions(self, instructions: impl Into<String>) -> Self
Sets the session instructions.
Sourcepub fn system_tool(self, tool: SystemTool) -> Self
pub fn system_tool(self, tool: SystemTool) -> Self
Adds a built-in system tool (Foundation Models 27).
Session creation fails with crate::Error::UnsupportedPlatform on
pre-27 build SDKs or runtimes.
Auto Trait Implementations§
impl<'m, M> !RefUnwindSafe for SessionBuilder<'m, M>
impl<'m, M> !UnwindSafe for SessionBuilder<'m, M>
impl<'m, M> Freeze for SessionBuilder<'m, M>
impl<'m, M> Send for SessionBuilder<'m, M>
impl<'m, M> Sync for SessionBuilder<'m, M>
impl<'m, M> Unpin for SessionBuilder<'m, M>
impl<'m, M> UnsafeUnpin for SessionBuilder<'m, M>
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