Skip to content

Commit

Permalink
Implement speculative caching.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed Jun 10, 2024
1 parent 4cf05db commit 5df6f0a
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 77 deletions.
5 changes: 3 additions & 2 deletions crates/ai00-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ pub async fn model_route(receiver: Receiver<ThreadRequest>) -> Result<()> {

let context = GenerateContext {
prompt_tokens: tokens.to_vec(),
prompt_cached: false,
prompt_cached: Default::default(),
prefix: Default::default(),
suffix: tokens,
output: None,
Expand All @@ -720,8 +720,9 @@ pub async fn model_route(receiver: Receiver<ThreadRequest>) -> Result<()> {
let queue = queue.clone();
let sender = sender.clone();
tokio::spawn(async move {
let context = &mut env.read().await.enqueue(context).await;
let mut queue = queue.lock().await;
queue.append(&mut env.read().await.enqueue(context).await);
queue.append(context);
let _ = sender.send(());
});
}
Expand Down
Loading

0 comments on commit 5df6f0a

Please sign in to comment.