Merged
Conversation
Contributor
ehayes2000
commented
Jan 13, 2026
- dog anthropic doesn't work
- backend working-ish
- tool renderer
7d36ce1 to
6fe2304
Compare
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Contributor
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
whutchinson98
requested changes
Jan 13, 2026
Comment on lines
+95
to
+184
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn test_deserialize_web_fetch_result() { | ||
| let json = r#"{ | ||
| "tool_use_id": "srvtoolu_01234567890abcdef", | ||
| "content": { | ||
| "type": "web_fetch_result", | ||
| "url": "https://example.com/article", | ||
| "content": { | ||
| "source": { | ||
| "type": "text", | ||
| "media_type": "text/plain", | ||
| "data": "Full text content of the article..." | ||
| }, | ||
| "title": "Article Title", | ||
| "citations": {"enabled": true} | ||
| }, | ||
| "retrieved_at": "2025-08-25T10:30:00Z" | ||
| } | ||
| }"#; | ||
|
|
||
| let result: WebFetchResponse = serde_json::from_str(json).expect("deserialize"); | ||
| assert_eq!(result.tool_use_id, "srvtoolu_01234567890abcdef"); | ||
| if let WebFetchContent::WebFetchResult(r) = result.content { | ||
| assert_eq!(r.url, "https://example.com/article"); | ||
| assert_eq!(r.content.title, Some("Article Title".to_string())); | ||
| } else { | ||
| panic!("Expected WebFetchResult"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_deserialize_web_fetch_pdf() { | ||
| let json = r#"{ | ||
| "tool_use_id": "srvtoolu_02", | ||
| "content": { | ||
| "type": "web_fetch_result", | ||
| "url": "https://example.com/paper.pdf", | ||
| "content": { | ||
| "source": { | ||
| "type": "base64", | ||
| "media_type": "application/pdf", | ||
| "data": "JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmo..." | ||
| }, | ||
| "citations": {"enabled": true} | ||
| }, | ||
| "retrieved_at": "2025-08-25T10:30:02Z" | ||
| } | ||
| }"#; | ||
|
|
||
| let result: WebFetchResponse = serde_json::from_str(json).expect("deserialize"); | ||
| if let WebFetchContent::WebFetchResult(r) = result.content { | ||
| if let WebFetchSource::Base64 { media_type, .. } = r.content.source { | ||
| assert_eq!(media_type, "application/pdf"); | ||
| } else { | ||
| panic!("Expected Base64 source"); | ||
| } | ||
| } else { | ||
| panic!("Expected WebFetchResult"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_deserialize_web_fetch_error() { | ||
| let json = r#"{ | ||
| "tool_use_id": "srvtoolu_a93jad", | ||
| "content": { | ||
| "type": "web_fetch_tool_result_error", | ||
| "error_code": "url_not_accessible" | ||
| } | ||
| }"#; | ||
|
|
||
| let result: WebFetchResponse = serde_json::from_str(json).expect("deserialize"); | ||
| if let WebFetchContent::WebFetchToolError(e) = result.content { | ||
| assert_eq!(e.error_code, WebFetchErrorCode::UrlNotAccessible); | ||
| } else { | ||
| panic!("Expected WebFetchToolError"); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_deserialize_tool_call() { | ||
| let json = r#"{"url": "https://example.com/article"}"#; | ||
| let call: WebFetchToolCall = serde_json::from_str(json).expect("deserialize"); | ||
| assert_eq!(call.url, "https://example.com/article"); | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
tests should live in their own file.
| async-openai = { workspace = true, optional = true} | ||
| chrono.workspace = true | ||
| lazy_static = {workspace = true} | ||
| regex.workspace = true |
Member
There was a problem hiding this comment.
nit: prefer regex = { workspace = true } syntax to match everything else
b22eebf to
e0f2e5b
Compare
whutchinson98
approved these changes
Jan 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.