Skip to content
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
12 changes: 6 additions & 6 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ aisimulate-core = { version = "=0.12.0-dev.2" }
dynamo-runtime = { path = "lib/runtime", version = "1.5.0" }
dynamo-llm = { path = "lib/llm", version = "1.5.0" }
dynamo-rl = { path = "lib/rl", version = "1.5.0" }
dynamo-tokenizers = { version = "=1.8.0" }
dynamo-renderer = { version = "=5.1.0" }
dynamo-tokenizers = { version = "=1.8.1" }
dynamo-renderer = { version = "=5.1.2" }
Comment thread
nv-anants marked this conversation as resolved.
Comment thread
nv-anants marked this conversation as resolved.
dynamo-tokens = { path = "lib/tokens", version = "1.5.0" }
dynamo-truthy = { path = "lib/truthy", version = "1.5.0" }
dynamo-data-gen = { path = "lib/data-gen", version = "1.5.0" }
dynamo-kv-hashing = { path = "lib/kv-hashing", version = "1.5.0" }
dynamo-memory = { path = "lib/memory", version = "1.5.0" }
dynamo-mocker = { path = "lib/mocker", version = "1.5.0" }
dynamo-kv-router = { path = "lib/kv-router", version = "1.5.0" }
dynamo-protocols = { version = "=5.4.0" }
dynamo-protocols = { version = "=5.4.1" }
Comment thread
nv-anants marked this conversation as resolved.
dynamo-parsers = { version = "8.1.0" }

# Published on crates.io. To see all available versions:
Expand Down
12 changes: 6 additions & 6 deletions lib/bindings/kvbm/Cargo.lock

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

12 changes: 6 additions & 6 deletions lib/bindings/python/Cargo.lock

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

45 changes: 45 additions & 0 deletions lib/llm/src/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9668,6 +9668,14 @@ mod tests {
{% if not ns.has_user %}{{ raise_exception('No user query found in messages.') }}{% endif %}\
{{ messages[0]['content'] }}";

const REQUIRES_LEADING_SYSTEM_TEMPLATE: &str = "\
{%- for message in messages -%}\
{%- if message['role'] == 'system' and not loop.first -%}\
{{- raise_exception('System message must be at the beginning.') -}}\
{%- endif -%}\
{{- message['role'] }}:{{ message['content'] }}\n\
{%- endfor -%}";

fn render_through_preprocessor(
formatter: &dyn OAIPromptFormatter,
request: &dyn OAIChatLikeRequest,
Expand Down Expand Up @@ -9723,6 +9731,43 @@ mod tests {
assert_eq!(rendered.as_str(), "hello");
}

#[test]
fn test_nonleading_system_message_normalized_for_strict_template() {
let formatter = test_prompt_formatter(REQUIRES_LEADING_SYSTEM_TEMPLATE);
let anthropic_request: crate::protocols::anthropic::AnthropicCreateMessageRequest =
serde_json::from_value(serde_json::json!({
"model": "test-model",
"max_tokens": 100,
"system": "You are Claude Code.",
"messages": [
{"role": "user", "content": "Run make test."},
{"role": "system", "content": "Available agent types and skills."}
],
"tools": [{
"name": "Bash",
"description": "Run a shell command",
"input_schema": {
"type": "object",
"properties": {
"command": {"type": "string"}
},
"required": ["command"]
}
}]
}))
.unwrap();
let request: NvCreateChatCompletionRequest = anthropic_request.try_into().unwrap();

let rendered = render_through_preprocessor(formatter.as_ref(), &request).unwrap();

assert_eq!(
rendered.as_str(),
"system:You are Claude Code.\
user:Run make test.\
user:Available agent types and skills."
);
}

#[test]
fn continue_final_message_leaves_last_assistant_open_on_llama_template() {
let mut mdc = ModelDeploymentCard::load_from_disk(
Expand Down
Loading