-
Notifications
You must be signed in to change notification settings - Fork 361
feat(deps): upgrade rig-core to v0.33 #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1306,6 +1306,10 @@ pub fn convert_messages_to_anthropic(messages: &OneOrMany<Message>) -> Vec<serde | |||||||||||
| (!parts.is_empty()) | ||||||||||||
| .then(|| serde_json::json!({"role": "assistant", "content": parts})) | ||||||||||||
| } | ||||||||||||
| Message::System { content } => Some(serde_json::json!({ | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small guard: if
Suggested change
|
||||||||||||
| "role": "user", | ||||||||||||
| "content": content, | ||||||||||||
| })), | ||||||||||||
| }) | ||||||||||||
| .collect() | ||||||||||||
| } | ||||||||||||
|
|
@@ -1367,6 +1371,12 @@ fn convert_messages_to_openai(messages: &OneOrMany<Message>) -> Vec<serde_json:: | |||||||||||
|
|
||||||||||||
| result.extend(tool_results); | ||||||||||||
| } | ||||||||||||
| Message::System { content } => { | ||||||||||||
| result.push(serde_json::json!({ | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth double-checking the source of |
||||||||||||
| "role": "user", | ||||||||||||
| "content": content, | ||||||||||||
| })); | ||||||||||||
| } | ||||||||||||
| Message::Assistant { content, .. } => { | ||||||||||||
| let mut text_parts = Vec::new(); | ||||||||||||
| let mut reasoning_parts = Vec::new(); | ||||||||||||
|
|
@@ -1486,6 +1496,12 @@ fn convert_messages_to_openai_responses(messages: &OneOrMany<Message>) -> Vec<se | |||||||||||
| })); | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| Message::System { content } => { | ||||||||||||
| result.push(serde_json::json!({ | ||||||||||||
| "role": "user", | ||||||||||||
| "content": content, | ||||||||||||
| })); | ||||||||||||
| } | ||||||||||||
| Message::Assistant { content, .. } => { | ||||||||||||
| let mut text_parts = Vec::new(); | ||||||||||||
| let mut reasoning_parts = Vec::new(); | ||||||||||||
|
|
@@ -3068,6 +3084,39 @@ mod tests { | |||||||||||
| assert!(error.to_string().contains("stop_reason: max_tokens")); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #[test] | ||||||||||||
| fn convert_messages_to_anthropic_maps_system_to_user_role() { | ||||||||||||
| let messages = OneOrMany::one(Message::System { | ||||||||||||
| content: "You are a helpful assistant".to_string(), | ||||||||||||
| }); | ||||||||||||
| let converted = convert_messages_to_anthropic(&messages); | ||||||||||||
| assert_eq!(converted.len(), 1); | ||||||||||||
| assert_eq!(converted[0]["role"], "user"); | ||||||||||||
| assert_eq!(converted[0]["content"], "You are a helpful assistant"); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #[test] | ||||||||||||
| fn convert_messages_to_openai_maps_system_to_user_role() { | ||||||||||||
| let messages = OneOrMany::one(Message::System { | ||||||||||||
| content: "You are a helpful assistant".to_string(), | ||||||||||||
| }); | ||||||||||||
| let converted = convert_messages_to_openai(&messages); | ||||||||||||
| assert_eq!(converted.len(), 1); | ||||||||||||
| assert_eq!(converted[0]["role"], "user"); | ||||||||||||
| assert_eq!(converted[0]["content"], "You are a helpful assistant"); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #[test] | ||||||||||||
| fn convert_messages_to_openai_responses_maps_system_to_user_role() { | ||||||||||||
| let messages = OneOrMany::one(Message::System { | ||||||||||||
| content: "You are a helpful assistant".to_string(), | ||||||||||||
| }); | ||||||||||||
| let converted = convert_messages_to_openai_responses(&messages); | ||||||||||||
| assert_eq!(converted.len(), 1); | ||||||||||||
| assert_eq!(converted[0]["role"], "user"); | ||||||||||||
| assert_eq!(converted[0]["content"], "You are a helpful assistant"); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #[test] | ||||||||||||
| fn parse_openai_response_handles_content_array_parts() { | ||||||||||||
| let body = serde_json::json!({ | ||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message::Systemis getting persisted asTranscriptStep::UserText, whichtranscript_to_history()later reconstructs asMessage::Useron resume. If that’s intentional (e.g., providers without a system role), a quick comment here would help avoid someone “fixing” this later and changing behavior.