-
Notifications
You must be signed in to change notification settings - Fork 153
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
OCI Native Generative AI Example #264
Conversation
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.
Thanks for the demo. LGTM so far, left a couple of minor comments. I'll approve when there's a workflow that tests the demo 😉
|
||
Edit the contents of [_GenerateTextExample.java_](./src/main/java/com/oracle/labs/GenerateTextExample.java) as follows: | ||
|
||
1. Update the value of the static variable `CONFIG_PROFILE` with the name of your OCI profile name. |
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.
These could just be Java properties or environment variables, which can then be set at run-time (or frozen into the executable via build-time init if you insist)?
.prompt( | ||
"Generate a job description for a data visualization expert with the following three qualifications only:\n1) At least 5 years of data visualization expert\n2) A great eye for details\n3) Ability to create original visualizations") |
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.
Use a text block (and, unlike me, an IDE for formatting 😉)
.prompt( | |
"Generate a job description for a data visualization expert with the following three qualifications only:\n1) At least 5 years of data visualization expert\n2) A great eye for details\n3) Ability to create original visualizations") | |
.prompt(""" | |
Generate a job description for a data visualization expert with the following three qualifications only: | |
1) At least 5 years of data visualization expert | |
2) A great eye for details | |
3) Ability to create original visualizations") | |
""") |
.temperature((double) 0.5) | ||
.frequencyPenalty((double) 1) | ||
.topP((double) 0.75) |
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.
Use double literals?
.temperature((double) 0.5) | |
.frequencyPenalty((double) 1) | |
.topP((double) 0.75) | |
.temperature(0.5d) | |
.frequencyPenalty(1.0d) | |
.topP(0.75d) |
native-oci-generative-ai/src/main/java/com/oracle/labs/GenerateTextExample.java
Show resolved
Hide resolved
native-oci-generative-ai/src/main/java/com/oracle/labs/GenerateTextExample.java
Show resolved
Hide resolved
.generateTextDetails(generateTextDetails) | ||
.build(); | ||
GenerateTextResponse generateTextResponse = generativeAiInferenceClient.generateText(generateTextRequest); | ||
System.out.println(generateTextResponse.toString()); |
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.
This should just do the right thing, even if generateTextResponse
can ever be null
(not sure it can):
System.out.println(generateTextResponse.toString()); | |
System.out.println(generateTextResponse); |
@fniephaus -- I've created the workflow and it passes. |
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
- uses: actions/checkout@v4 | ||
- uses: graalvm/setup-graalvm@v1 | ||
with: | ||
java-version: '21.0.2' |
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.
Can we also test this against latest-ea
to ensure updates don't break the demo? Also, the latest JDK 21 release is 21.0.3
.
@bhoran great, thanks! and yes, that makes sense. |
Co-Authored-By: Fabio Niephaus <fabio.niephaus@oracle.com>
Co-authored-by: Fabio Niephaus <fabio.niephaus@oracle.com>
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
An example of using the OCI generative AI service, using the native image maven plugin