pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: &str, fine_tune_api_key: Option<&str>) -> Self
pub fn new(api_key: &str, fine_tune_api_key: Option<&str>) -> Self
Create a new Galadriel client with the given API key and optional fine-tune API key.
Sourcepub fn from_url(
api_key: &str,
base_url: &str,
fine_tune_api_key: Option<&str>,
) -> Self
pub fn from_url( api_key: &str, base_url: &str, fine_tune_api_key: Option<&str>, ) -> Self
Create a new Galadriel client with the given API key, base API URL, and optional fine-tune API key.
pub fn from_url_with_optional_key( api_key: &str, base_url: &str, fine_tune_api_key: Option<&str>, ) -> Self
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Create a new Galadriel client from the GALADRIEL_API_KEY environment variable,
and optionally from the GALADRIEL_FINE_TUNE_API_KEY environment variable.
Panics if the GALADRIEL_API_KEY environment variable is not set.
Sourcepub fn completion_model(&self, model: &str) -> CompletionModel
pub fn completion_model(&self, model: &str) -> CompletionModel
Create a completion model with the given name.
§Example
use rig::providers::galadriel::{Client, self};
// Initialize the Galadriel client
let galadriel = Client::new("your-galadriel-api-key", None);
let gpt4 = galadriel.completion_model(galadriel::GPT_4);Sourcepub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
pub fn agent(&self, model: &str) -> AgentBuilder<CompletionModel>
Create an agent builder with the given completion model.
§Example
use rig::providers::galadriel::{Client, self};
// Initialize the Galadriel client
let galadriel = Client::new("your-galadriel-api-key", None);
let agent = galadriel.agent(galadriel::GPT_4)
.preamble("You are comedian AI with a mission to make people laugh.")
.temperature(0.0)
.build();Sourcepub fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>(
&self,
model: &str,
) -> ExtractorBuilder<T, CompletionModel>
pub fn extractor<T: JsonSchema + for<'a> Deserialize<'a> + Serialize + Send + Sync>( &self, model: &str, ) -> ExtractorBuilder<T, CompletionModel>
Create an extractor builder with the given completion model.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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