Skip to content

Commit

Permalink
squash! feat: add MaxBatchSize option
Browse files Browse the repository at this point in the history
Thi commit removed the options as they are no longer needed.

Signed-off-by: Daniel Bevenius <[email protected]>
  • Loading branch information
danbev committed Nov 29, 2023
1 parent dfce4c9 commit f0c9fdd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
8 changes: 1 addition & 7 deletions crates/llm-chain-llama/examples/alpaca.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
use llm_chain::executor;
use llm_chain::options;
use llm_chain::{parameters, prompt};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let opts = options!(
NThreads: 4_usize,
MaxTokens: 2048_usize,
StopSequence: vec!["\n".to_string()]
);
let exec = executor!(llama, opts.clone())?;
let exec = executor!(llama)?;
let res = prompt!("Write a hypothetical weather report for {season} in {location}.")
.run(
&parameters!("season" => "summer", "location" => "the moon"),
Expand Down
10 changes: 2 additions & 8 deletions crates/llm-chain-llama/examples/few_shot.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use llm_chain::options;
use llm_chain::prompt::Conversation;
use llm_chain::{chains::conversation::Chain, executor, parameters, prompt, step::Step};
/// This example demonstrates how to use the llm-chain for few-shot prompting
Expand All @@ -10,12 +9,7 @@ use llm_chain::{chains::conversation::Chain, executor, parameters, prompt, step:
/// Make sure to have the env var 'LLM_CHAIN_MODEL' set
#[tokio::main(flavor = "multi_thread", worker_threads = 1)]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let opts = options!(
NThreads: 4_usize,
StopSequence: vec!["\n".to_string()]
);

let exec_1 = executor!(llama, opts.clone())?;
let exec_1 = executor!(llama)?;

let user_prompt =
"Take the last letters of the words in '{{ full_name }}' and concatenate them";
Expand Down Expand Up @@ -47,7 +41,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Define the step
let step = Step::for_prompt_template(prompt!(user: user_prompt));
// Execute the chain.
let exec_2 = executor!(llama, opts)?;
let exec_2 = executor!(llama)?;
let res = chain
.send_message(step, &parameters!().with("full_name", "Elon Musk"), &exec_2)
.await?;
Expand Down

0 comments on commit f0c9fdd

Please sign in to comment.