-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Java Sample Code modified to modernized code and easy to understand #1175
Merged
markwallace-microsoft
merged 7 commits into
microsoft:experimental-java
from
yoshioterada:java-api-test-modify
May 24, 2023
Merged
Java Sample Code modified to modernized code and easy to understand #1175
markwallace-microsoft
merged 7 commits into
microsoft:experimental-java
from
yoshioterada:java-api-test-modify
May 24, 2023
Conversation
This file contains 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
1 Modified getConfigValue() 1.1: local variable name from apiKey to propertyValue 1.2: Use NIO.2 libraries instead of old FileInputStream 1.3: modified Exception throw code 2. Defined TEXT_TO_SUMMARIZE Instead of local variable definition, I defined static final field 3. As a sample, I wrote non blocking code for Async operation Previously it was wrote as summarize.invokeAsync(TEXT_TO_SUMMARIZE).block() to subscribe() 4. In order to show the result, I added following code to receive the result. try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { LOGGER.warn("Interrupted : {}", e.getMessage()); Thread.currentThread().interrupt(); } 5. Code Structure modified: I modified the code structure of both 'InlineFunctionExample.java' and 'InlineFunctionWithPreBuiltSkillExample.java' to be as similar as possible, making them easier to compare.
Removed Invalid character
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.
LGTM
johnoliver
reviewed
May 23, 2023
java/api-test/api-usage-example/src/main/java/InlineFunctionExample.java
Outdated
Show resolved
Hide resolved
johnoliver
reviewed
May 23, 2023
java/api-test/api-usage-example/src/main/java/InlineFunctionExample.java
Show resolved
Hide resolved
johnoliver
reviewed
May 23, 2023
java/api-test/api-usage-example/src/main/java/InlineFunctionWithPreBuiltSkillExample.java
Outdated
Show resolved
Hide resolved
Modified from sleep to CountDownLatch
Added countDown() to Error Status too
johnoliver
approved these changes
May 23, 2023
johnoliver
previously approved these changes
May 23, 2023
Added import for CountDownLatch and added try-catch statement
markwallace-microsoft
approved these changes
May 24, 2023
This was referenced Aug 1, 2023
johnoliver
pushed a commit
to johnoliver/semantic-kernel
that referenced
this pull request
Jun 5, 2024
…icrosoft#1175) This is the update pull request of microsoft#1128 I closed the previous Pull Request microsoft#1128. 1 Modified getConfigValue() 1.1: local variable name from apiKey to propertyValue 1.2: Use NIO.2 libraries instead of old FileInputStream 1.3: modified Exception throw code 2. Defined TEXT_TO_SUMMARIZE Instead of local variable definition, I defined static final field 3. As a sample, I wrote non blocking code for Async operation Previously it was wrote as summarize.invokeAsync(TEXT_TO_SUMMARIZE).block() to subscribe() 4. In order to show the result, I added following code to receive the result. try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { LOGGER.warn("Interrupted : {}", e.getMessage()); Thread.currentThread().interrupt(); } 5. Code Structure modified: I modified the code structure of both 'InlineFunctionExample.java' and 'InlineFunctionWithPreBuiltSkillExample.java' to be as similar as possible, making them easier to compare. --------- Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
johnoliver
pushed a commit
to johnoliver/semantic-kernel
that referenced
this pull request
Jun 5, 2024
…icrosoft#1175) This is the update pull request of microsoft#1128 I closed the previous Pull Request microsoft#1128. 1 Modified getConfigValue() 1.1: local variable name from apiKey to propertyValue 1.2: Use NIO.2 libraries instead of old FileInputStream 1.3: modified Exception throw code 2. Defined TEXT_TO_SUMMARIZE Instead of local variable definition, I defined static final field 3. As a sample, I wrote non blocking code for Async operation Previously it was wrote as summarize.invokeAsync(TEXT_TO_SUMMARIZE).block() to subscribe() 4. In order to show the result, I added following code to receive the result. try { TimeUnit.SECONDS.sleep(10); } catch (InterruptedException e) { LOGGER.warn("Interrupted : {}", e.getMessage()); Thread.currentThread().interrupt(); } 5. Code Structure modified: I modified the code structure of both 'InlineFunctionExample.java' and 'InlineFunctionWithPreBuiltSkillExample.java' to be as similar as possible, making them easier to compare. --------- Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This is the update pull request of
#1128
I closed the previous Pull Request #1128.
1 Modified getConfigValue()
1.1: local variable name from apiKey to propertyValue 1.2: Use NIO.2 libraries instead of old FileInputStream 1.3: modified Exception throw code
Defined TEXT_TO_SUMMARIZE Instead of local variable definition, I defined static final field
As a sample, I wrote non blocking code for Async operation Previously it was wrote as
summarize.invokeAsync(TEXT_TO_SUMMARIZE).block() to subscribe()
In order to show the result, I added following code to receive the result. try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
LOGGER.warn("Interrupted : {}", e.getMessage());
Thread.currentThread().interrupt();
}
Code Structure modified: I modified the code structure of both 'InlineFunctionExample.java' and 'InlineFunctionWithPreBuiltSkillExample.java' to be as similar as possible, making them easier to compare.