Enhance begin_analyze_binary to support in-memory byte input (file path + bytes support)#134
Open
deril2605 wants to merge 2 commits intoAzure-Samples:mainfrom
Open
Enhance begin_analyze_binary to support in-memory byte input (file path + bytes support)#134deril2605 wants to merge 2 commits intoAzure-Samples:mainfrom
deril2605 wants to merge 2 commits intoAzure-Samples:mainfrom
Conversation
Refactor begin_analyze_binary to accept in-memory data or file path. Improve error handling for input parameters.
Author
|
@microsoft-github-policy-service agree |
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.
Enhance
begin_analyze_binaryto support in-memory byte input (file path + bytes support)Purpose
bytes) inbegin_analyze_binary.The method now accepts either:
file_location(existing behavior), ordata(in-memory bytes)Exactly one must be provided.
Does this introduce a breaking change?
This change is backward compatible. Existing file path usage continues to work unchanged.
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Get the code
git clone [repo-address] cd [repo-name] git checkout [branch-name]Test existing behavior (file path)
Expected:
Test new behavior (in-memory bytes)
Expected:
Negative test cases
1. Provide both arguments (should fail)
→ Raises
ValueError2. Provide neither argument (should fail)
→ Raises
ValueError3. Invalid file path (should fail)
→ Raises
ValueErrorWhat to Check
Verify that the following are valid:
bytesinput works correctly.Other Information
This change supports common production workflows where documents are retrieved from:
It avoids the need for writing temporary files before analysis and aligns with modern server-side processing patterns.
This is a small, self-contained enhancement and does not modify API contracts beyond input flexibility.