LLM Config • Rust AI Agent SDK
LlmConfig: LLM configuration
LlmConfig
Defined in the LLM module.
Rust AI Agent SDK
LLM configuration
Fields
| Name | Type | Description |
|---|---|---|
model | String | Model name (e.g., “gpt-4o-mini”, “claude-3-sonnet”) |
Option | :is_none")] | API key (optional, can use env var) |
api_key | Option<String> | API key (optional, can use env var) |
Option | :is_none")] | Base URL (optional, for custom endpoints) |
base_url | Option<String> | Base URL (optional, for custom endpoints) |
temperature | f32 | Temperature (0.0 – 2.0) |
Option | :is_none")] | Max tokens |
max_tokens | Option<u32> | Max tokens |
Methods
new
fn new(model: impl Into<String>) -> SelfCreate a new LLM config with the given model
Parameters:
| Name | Type |
|---|---|
model | impl Into<String> |
api_key
fn api_key(mut self, key: impl Into<String>) -> SelfSet the API key
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
base_url
fn base_url(mut self, url: impl Into<String>) -> SelfSet the base URL
Parameters:
| Name | Type |
|---|---|
url | impl Into<String> |
temperature
fn temperature(mut self, temp: f32) -> SelfSet the temperature
Parameters:
| Name | Type |
|---|---|
temp | f32 |
max_tokens
fn max_tokens(mut self, max: u32) -> SelfSet max tokens
Parameters:
| Name | Type |
|---|---|
max | u32 |
Source
View on GitHubpraisonai/src/llm/mod.rs at line 165