Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Fixes langfuse/langfuse#20462
Verification
tests/unit/test_media_manager.py::test_media_upload_retries_on_retryable_http_status PASSED [ 2%]
tests/unit/test_media_manager.py::test_media_upload_gives_up_on_non_retryable_http_status PASSED [ 5%]
tests/unit/test_media_manager.py::test_find_and_process_media_sse_done_passes_through PASSED [ 7%]
tests/unit/test_media_manager.py::test_find_and_process_media_sse_json_payload_passes_through PASSED [ 10%]
tests/unit/test_media_manager.py::test_find_and_process_media_valid_base64_uri_is_processed PASSED [ 12%]
tests/unit/test_media_manager.py::test_upload_media_sync_rejects_invalid_media
-------------------------------- live log call ---------------------------------
ERROR langfuse:media.py:166 base64_data_uri, or content_bytes and content_type, or file_path must be provided to LangfuseMedia
PASSED [ 15%]
tests/unit/test_media_manager.py::test_find_and_process_media_data_uri_without_comma_passes_through PASSED [ 17%]
tests/unit/test_media_manager.py::test_find_and_process_media_non_base64_data_uri_passes_through PASSED [ 20%]
tests/unit/test_media_manager.py::test_find_and_process_media_sse_in_nested_structure_passes_through PASSED [ 23%]
tests/unit/test_media_manager.py::test_find_and_process_media_in_tuple_queues_upload PASSED [ 25%]
tests/unit/test_media_manager.py::test_find_and_process_media_gemini_inline_data_is_processed PASSED [ 28%]
tests/unit/test_media_manager.py::test_find_and_process_media_gemini_inline_data_camel_case_is_processed PASSED [ 30%]
tests/unit/test_media_manager.py::test_find_and_process_media_gemini_inline_data_non_string_data_passes_through[image-bytes] PASSED [ 33%]
tests/unit/test_media_manager.py::test_find_and_process_media_gemini_inline_data_non_string_data_passes_through[123] PASSED [ 35%]
tests/unit/test_media_manager.py::test_find_and_process_media_gemini_inline_data_non_string_data_passes_through[inline_data_value2] PASSED [ 38%]
tests/unit/test_media_manager.py::test_media_api_calls_do_not_multiply_client_retries[429] PASSED [ 41%]
tests/unit/test_media_manager.py::test_media_api_calls_do_not_multiply_client_retries[503] PASSED [ 43%]
tests/unit/test_media_manager.py::test_media_api_calls_share_one_retry_budget_across_failure_kinds PASSED [ 46%]
tests/unit/test_media.py::test_init_with_base64_data_uri PASSED [ 48%]
tests/unit/test_media.py::test_init_with_content_bytes PASSED [ 51%]
tests/unit/test_media.py::test_init_with_invalid_input
-------------------------------- live log call ---------------------------------
ERROR langfuse:media.py:166 base64_data_uri, or content_bytes and content_type, or file_path must be provided to LangfuseMedia
ERROR langfuse:media.py:166 base64_data_uri, or content_bytes and content_type, or file_path must be provided to LangfuseMedia
ERROR langfuse:media.py:166 base64_data_uri, or content_bytes and content_type, or file_path must be provided to LangfuseMedia
PASSED [ 53%]
tests/unit/test_media.py::test_content_length PASSED [ 56%]
tests/unit/test_media.py::test_content_sha256_hash PASSED [ 58%]
tests/unit/test_media.py::test_reference_string PASSED [ 61%]
tests/unit/test_media.py::test_parse_reference_string PASSED [ 64%]
tests/unit/test_media.py::test_parse_invalid_reference_string PASSED [ 66%]
tests/unit/test_media.py::test_media_reference_is_url_expired[None-False] PASSED [ 69%]
tests/unit/test_media.py::test_media_reference_is_url_expired[not-a-date-False] PASSED [ 71%]
tests/unit/test_media.py::test_media_reference_is_url_expired[2000-01-01T00:00:00+00:00-True] PASSED [ 74%]
tests/unit/test_media.py::test_media_reference_is_url_expired[2999-01-01T00:00:00+00:00-False] PASSED [ 76%]
tests/unit/test_media.py::test_media_reference_is_url_expired[2000-01-01T00:00:00Z-True] PASSED [ 79%]
tests/unit/test_media.py::test_file_handling PASSED [ 82%]
tests/unit/test_media.py::test_nonexistent_file
-------------------------------- live log call ---------------------------------
ERROR langfuse:media.py:166 base64_data_uri, or content_bytes and content_type, or file_path must be provided to LangfuseMedia
PASSED [ 84%]
tests/unit/test_media.py::test_media_reference_fetch_uses_configured_httpx_client PASSED [ 87%]
tests/unit/test_media.py::test_media_reference_fetch_uses_explicit_client PASSED [ 89%]
tests/unit/test_media.py::test_media_reference_fetch_falls_back_to_default_with_multiple_clients
-------------------------------- live log call ---------------------------------
WARNING langfuse:resource_manager.py:102 Multiple Langfuse clients are instantiated; falling back to a default httpx client for LangfuseMediaReference fetches. Pass an explicit
clientto fetch_bytes/fetch_base64/fetch_data_uri to honor per-client transport settings.PASSED [ 92%]
tests/unit/test_media.py::test_resolve_media_references_uses_configured_httpx_client PASSED [ 94%]
tests/unit/test_media.py::test_resolve_media_references_in_tuple PASSED [ 97%]
tests/unit/test_media.py::test_init_with_urlsafe_base64_data_uri PASSED [100%]
============================== 39 passed in 0.37s ============================== — 39 passed
The PR appears safe to merge, with a non-blocking compatibility issue for callers that pass named tuples to reference resolution.
Summary
Adds tuple traversal to media discovery and reference resolution, with focused tests for both paths.
Reviews (1) · Last reviewed commit: "fix(media): traverse tuples for media pr..." · Reviewed by Greptile