Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(llm): changing with_option of llm trait to add_options #78

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/chain/llm_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl LLMChainBuilder {
let mut llm = self.llm.ok_or("LLM must be set")?;
if let Some(options) = self.options {
let llm_options = ChainCallOptions::to_llm_options(options);
llm.with_options(llm_options);
llm.add_options(llm_options);
}

let chain = LLMChain {
Expand Down
5 changes: 4 additions & 1 deletion src/language_models/llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ pub trait LLM: Sync + Send {
log::warn!("stream not implemented for this model");
unimplemented!()
}
fn with_options(&mut self, _options: CallOptions) {

/// This is usefull when you want to create a chain and override
/// LLM options
fn add_options(&mut self, _options: CallOptions) {
// No action taken
}
//This is usefull when using non chat models
Expand Down
2 changes: 1 addition & 1 deletion src/llm/openai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl<C: Config + Send + Sync> LLM for OpenAI<C> {
Ok(Box::pin(new_stream))
}

fn with_options(&mut self, options: CallOptions) {
fn add_options(&mut self, options: CallOptions) {
self.options = options;
}
}
Expand Down
Loading