Skip to main content

LlmConfigBuilder

Struct LlmConfigBuilder 

Source
pub struct LlmConfigBuilder { /* private fields */ }
Expand description

Builder for LlmConfig.

Implementations§

Source§

impl LlmConfigBuilder

Source

pub fn provider(self, provider: Provider) -> Self

Set the LLM provider. Required.

Source

pub fn base_url(self, base_url: impl Into<String>) -> Self

Set the base URL of the LLM endpoint. Required.

Source

pub fn model(self, model: impl Into<String>) -> Self

Set the model name. Required.

Source

pub fn api_key(self, api_key: impl Into<String>) -> Self

Set the API key. Optional for local providers.

Source

pub fn num_ctx(self, num_ctx: u32) -> Self

Set the context window size sent in the options.num_ctx field of Ollama requests. Defaults to 4096. Ignored by OpenAI-compatible and Anthropic providers; use max_tokens for those.

Source

pub fn max_tokens(self, max_tokens: u32) -> Self

Set the maximum number of generated tokens sent in the max_tokens field of OpenAI-compatible and Anthropic requests. Defaults to 4096. Ignored by Ollama; use num_ctx for that.

Source

pub fn build(self) -> Result<LlmConfig, LlmConfigError>

Build the LlmConfig.

Trait Implementations§

Source§

impl Default for LlmConfigBuilder

Source§

fn default() -> LlmConfigBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.