Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
df105b5
codec: expand additive OpenAI request extraction and multimodal parts
afourniernv May 9, 2026
15ae186
codec: expand OpenAI Responses response-side extraction
afourniernv May 9, 2026
a8e9b66
codec: expand Anthropic request extraction for metadata and tool para…
afourniernv May 10, 2026
8330f0d
codec: expand Anthropic response api-specific extraction
afourniernv May 10, 2026
9512ccc
codec(openai-responses): adopt strict input fallback and add vLLM-sty…
afourniernv May 10, 2026
49ccb05
codec(anthropic): add vLLM tool_choice none parity and hybrid fixtures
afourniernv May 10, 2026
ea3203b
tests(codec): add LiteLLM hybrid fixtures for anthropic and responses
afourniernv May 11, 2026
e77584a
tests(codec): add SGLang responses extension fixture coverage
afourniernv May 11, 2026
096a6be
adaptive: handle expanded request IR and multimodal content parts
afourniernv May 11, 2026
2a4dc72
tests(codec): fix anthropic auto tool_choice round-trip expectation
afourniernv May 11, 2026
1225bf8
ffi/tests: update AnnotatedLlmRequest literals for expanded request IR
afourniernv May 11, 2026
812ffa2
wasm/tests: update AnnotatedLlmRequest literals for expanded request IR
afourniernv May 11, 2026
e06ecfc
python: update AnnotatedLlmRequest constructors for expanded request IR
afourniernv May 11, 2026
f6e79c8
style(codec): apply rustfmt after pre-commit
afourniernv May 11, 2026
c9ea854
fix(codec): preserve typed usage details and raw responses input
afourniernv May 12, 2026
2e927e1
fix(codec): address CodeRabbit review nits
afourniernv May 13, 2026
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
6 changes: 3 additions & 3 deletions crates/adaptive/src/acg/ir_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ fn extract_text(content: &MessageContent) -> String {
MessageContent::Text(text) => text.clone(),
MessageContent::Parts(parts) => parts
.iter()
.map(|part| {
let ContentPart::Text { text } = part;
text.as_str()
.filter_map(|part| match part {
ContentPart::Text { text } => Some(text.as_str()),
ContentPart::ImageUrl { .. } => None,
})
.collect::<Vec<_>>()
.join("\n"),
Expand Down
7 changes: 6 additions & 1 deletion crates/adaptive/src/acg_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ fn extract_text(content: &MessageContent) -> String {
MessageContent::Parts(parts) => parts
.iter()
.map(|part| match part {
ContentPart::Text { text } => text.as_str(),
ContentPart::Text { text } => text.clone(),
ContentPart::ImageUrl { image_url } => format!(
"[image:{}:{}]",
image_url.detail.as_deref().unwrap_or("none"),
sha256_hex(&image_url.url)
),
})
.collect::<Vec<_>>()
.join("\n"),
Expand Down
26 changes: 26 additions & 0 deletions crates/adaptive/tests/integration/acg_module_surface_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ fn acg_module_surface_policy_and_ir_builder_symbols_compile_from_canonical_names
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};

Expand Down Expand Up @@ -188,6 +201,19 @@ fn acg_module_surface_build_prompt_ir_inserts_tool_schema_before_first_non_syste
},
}]),
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};

Expand Down
13 changes: 13 additions & 0 deletions crates/adaptive/tests/integration/redis_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ fn sample_annotated_request(model: &str) -> AnnotatedLlmRequest {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
}
}
Expand Down
52 changes: 52 additions & 0 deletions crates/adaptive/tests/integration/runtime_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ fn sample_annotated_request(model: &str) -> AnnotatedLlmRequest {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: Map::new(),
}
}
Expand All @@ -100,6 +113,19 @@ fn sample_growing_chat_requests(model: &str) -> Vec<AnnotatedLlmRequest> {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: Map::new(),
},
AnnotatedLlmRequest {
Expand Down Expand Up @@ -128,6 +154,19 @@ fn sample_growing_chat_requests(model: &str) -> Vec<AnnotatedLlmRequest> {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: Map::new(),
},
AnnotatedLlmRequest {
Expand Down Expand Up @@ -167,6 +206,19 @@ fn sample_growing_chat_requests(model: &str) -> Vec<AnnotatedLlmRequest> {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: Map::new(),
},
]
Expand Down
39 changes: 39 additions & 0 deletions crates/adaptive/tests/unit/acg/ir_builder_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ fn build_prompt_ir_inserts_tools_before_first_non_system_message_and_preserves_a
params: None,
tools: Some(vec![sample_tool_definition("search")]),
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};

Expand Down Expand Up @@ -110,6 +123,19 @@ fn build_prompt_ir_appends_tool_blocks_when_request_contains_only_system_message
sample_tool_definition("lookup"),
]),
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};

Expand Down Expand Up @@ -139,6 +165,19 @@ fn build_prompt_ir_omits_tool_schema_hashes_when_no_tools_are_present() {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};

Expand Down
13 changes: 13 additions & 0 deletions crates/adaptive/tests/unit/acg_component_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ fn sample_annotated_request(model: &str) -> AnnotatedLlmRequest {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
}
}
Expand Down
13 changes: 13 additions & 0 deletions crates/adaptive/tests/unit/acg_learner_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ fn sample_request(model: &str, system: &str, user: &str) -> AnnotatedLlmRequest
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
}
}
Expand Down
49 changes: 48 additions & 1 deletion crates/adaptive/tests/unit/acg_profile_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
//! Unit tests for acg profile in the NeMo Flow adaptive crate.

use nemo_flow::codec::request::{
AnnotatedLlmRequest, ContentPart, FunctionDefinition, Message, MessageContent, ToolDefinition,
AnnotatedLlmRequest, ContentPart, FunctionDefinition, Message, MessageContent,
OpenAiImageUrl, ToolDefinition,
};
use serde_json::json;

Expand All @@ -17,6 +18,19 @@ fn request(messages: Vec<Message>, tools: Option<Vec<ToolDefinition>>) -> Annota
params: None,
tools,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
}
}
Expand Down Expand Up @@ -110,3 +124,36 @@ fn acg_profile_helpers_cover_none_paths_and_short_hash() {
assert_eq!(short_hash("short"), "short");
assert_eq!(message_role_tag(&too_short.messages[0]), "user");
}

#[test]
fn acg_profile_image_parts_contribute_stable_fingerprint_signal() {
let with_image_a = request(
vec![Message::User {
content: MessageContent::Parts(vec![ContentPart::ImageUrl {
image_url: OpenAiImageUrl {
url: "https://example.com/a.png".to_string(),
detail: Some("high".to_string()),
},
}]),
name: None,
}],
None,
);
let with_image_b = request(
vec![Message::User {
content: MessageContent::Parts(vec![ContentPart::ImageUrl {
image_url: OpenAiImageUrl {
url: "https://example.com/b.png".to_string(),
detail: Some("high".to_string()),
},
}]),
name: None,
}],
None,
);

assert_ne!(
learning_seed_fingerprint(&with_image_a),
learning_seed_fingerprint(&with_image_b)
);
}
13 changes: 13 additions & 0 deletions crates/adaptive/tests/unit/adaptive_hints_intercept_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ fn test_adaptive_hints_intercept_injects_prediction_hints_and_manual_override()
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: serde_json::Map::new(),
};
let (request, returned_annotated) = req_fn(
Expand Down
13 changes: 13 additions & 0 deletions crates/adaptive/tests/unit/cache_diagnostics_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ fn sample_request(model: Option<&str>) -> AnnotatedLlmRequest {
params: None,
tools: None,
tool_choice: None,
store: None,
previous_response_id: None,
truncation: None,
reasoning: None,
include: None,
user: None,
metadata: None,
service_tier: None,
parallel_tool_calls: None,
max_output_tokens: None,
max_tool_calls: None,
top_logprobs: None,
stream: None,
extra: Map::new(),
}
}
Expand Down
Loading
Loading