Skip to content
Closed
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
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/llm-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ tools = { path = "../tools" }

[dev-dependencies]
api-projection = { path = "../api-projection" }
minijinja = { version = "3.0.5", features = ["json", "loop_controls", "serde"] }
minijinja-contrib = { version = "3.0.5", features = ["pycompat"] }
test-support = { path = "../test-support" }
tokio = { version = "1", features = ["io-util", "macros", "net", "rt"] }
vfs = { path = "../vfs" }
16 changes: 3 additions & 13 deletions crates/llm-runtime/src/anthropic_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,23 +713,13 @@ async fn materialize_system(
entries: &[ContextEntry],
cache_control: &Value,
) -> LlmAdapterResult<Option<am::SystemContent>> {
let mut parts = Vec::new();
for entry in entries {
if matches!(entry.kind, ContextEntryKind::Instructions) {
let text = read_text(blobs, &entry.content.content_ref).await?;
let text = text.trim();
if !text.is_empty() {
parts.push(text.to_owned());
}
}
}
if parts.is_empty() {
let Some(text) = crate::system_prompt::collated_instructions(blobs, entries).await? else {
return Ok(None);
}
};
Ok(Some(am::SystemContent::Blocks(vec![
am::ContentBlockParam::Text(am::TextBlockParam {
r#type: "text".to_owned(),
text: parts.join("\n\n"),
text,
cache_control: Some(cache_control.clone()),
extra: Default::default(),
}),
Expand Down
1 change: 1 addition & 0 deletions crates/llm-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod prompt_cache;
pub mod provider_keys;
pub mod result;
pub mod secrets;
mod system_prompt;
pub mod testing;

pub use anthropic_messages::{
Expand Down
Loading
Loading