diff --git a/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md b/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md
index 0fe75dc84..47aaf8569 100644
--- a/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md
+++ b/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md
@@ -64,7 +64,7 @@ IAM user option will work on both cases above, as local and as OCI Function.
## Build and test
-During following the steps of the Hello function example adjust the line 131 to match your GenAI service model OCID.
+Following the steps of the Hello function example adjust the line 76 to match your compartment OCID and the line 77 to match your GenAI service model OCID.
@@ -75,13 +75,25 @@ Testing with curl (or copy-pasting the API Gateway deployment url to a browser):
curl https://n3yu.....ghhi.apigateway.eu-frankfurt-1.oci.customer-oci.com/ -What happened today 01/17/2025 100 years ago ? -On January 17th, 1925, 100 years ago, the following events took place: -- In the US, President Calvin Coolidge delivered his annual State of the Union address to Congress. He discussed the thriving state of the national economy, emphasizing the record-high production of American industries and the growth of the country's merchant marine fleet. Coolidge also urged Congress to pass legislation facilitating world trade and improving diplomatic relations. -- The first Winter Sports Week was held in Chamonix, France. This event eventually evolved into the prestigious Chamonix International Festival of Sports and Cinema. -- The play "The New York Idea" by Langdon Mitchell premiered at the Ambassador Theatre on Broadway. It ran for 144 performances and received critical acclaim. -- The silent film "The Gold Rush" directed by Charlie Chaplin was released in the United States. It's a classic comedy that tells the story of a prospector during the Klondike Gold Rush. Chaplin's unique brand of physical comedy and the film's innovative effects delighted audiences. -- In Germany, the Weimar Republic experienced a political scandal known as the "German-Russian Trade and Credit Agreement." The agreement, which granted Germany a loan of 300 million marks from Russia, was signed secretly, leading to accusations of mismanagement and lack of transparency in the government. This incident further destabilized the already fragile Weimar Republic. +What happened at 1925-02-07 ? + +On February 7, 1925, several significant events took place around the world: + +- In the United States, the Grand Ole Opry, a famous country music stage and radio show, made its debut on WSM radio in Nashville, Tennessee. It was initially called the "WSM Barn Dance" and has since become one of the longest-running radio programs in history. + +- The first issue of "The New Yorker" magazine was published in New York City. Founded by Harold Ross, the magazine quickly gained a reputation for its sophisticated and witty writing, featuring contributions from renowned writers and artists. + +- In the field of aviation, the first non-stop flight from England to India was completed by Squadron Leader John Henry "Jack" Moore-Brabazon, 1st Baron Brabazon of Tara. He flew a modified Airco DH.9A biplane, covering a distance of approximately 4,130 miles (6,646 kilometers) in about 50 hours and 37 minutes. + +- In sports, the 1925 Rose Bowl game was played in Pasadena, California. The game, which is an annual college football bowl game, saw the Dartmouth Indians defeat the California Golden Bears by a score of 14-0. + +- In the world of literature, the novel "The Great Gatsby" by F. Scott Fitzgerald was published in the United States. The book, set in the 1920s, explores themes of social class, wealth, and the American Dream, and has since become a classic of American literature. + +- In the realm of science, the American chemist Wallace Carothers filed a patent for the synthetic polymer nylon. Nylon, known for its strength and versatility, would go on to revolutionize the textile industry and find applications in various products. + +- In Europe, the Locarno Treaties were signed in Switzerland. These treaties aimed to promote peace and security in Europe after World War I. They included mutual guarantees of borders and commitments to resolve disputes peacefully. + +These are just a few notable events that occurred on February 7, 1925. The day witnessed advancements in entertainment, aviation, sports, literature, science, and international diplomacy.# Native image using GraalVM diff --git a/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java b/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java index 1d96d5e60..f08da15ff 100644 --- a/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java +++ b/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/src/main/java/com/example/HelloAIFunction.java @@ -63,6 +63,7 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on import com.oracle.bmc.generativeaiinference.model.TextContent; import com.oracle.bmc.retrier.RetryConfiguration; +import java.time.LocalDate; import java.io.*; import java.util.*; import java.text.*; @@ -72,9 +73,10 @@ public class HelloAIFunction { // FILL IN PROPER VALUES FOR OCI GENAI SERVICE private static final String ENDPOINT = "https://inference.generativeai.eu-frankfurt-1.oci.oraclecloud.com"; private static final Region REGION = Region.EU_FRANKFURT_1; + private static final String COMPARTMENT_ID = "ocid1.compartment.oc1.."; + private static final String GENAI_OCID = "ocid1.generativeaimodel.oc1.eu-frankfurt-1.amaaaaaa....wtig4q"; // FILL IN PROPER VALUES FOR IAM USER WHEN NOT USING INSTANCE_PRINCIPAL IN OCI FUNCTION - private static final String COMPARTMENT_ID = "ocid1.compartment.oc1.."; private static final String TENANCY_ID = "ocid1.tenancy.oc1.."; private static final String USER_ID = "ocid1.user.oc1.."; private static final String FINGERPRINT = "ef:4d:.."; @@ -85,10 +87,9 @@ public String handleRequest(String input) { GenerativeAiInferenceClient generativeAiInferenceClient; String answer = ""; try { - Date date = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); - String currentDate = dateFormat. format(date); - String questionToAI = (input == null || input.isEmpty()) ? "What happened today " + currentDate + " 100 years ago ?": input; + + LocalDate date = LocalDate.now().minusYears(100); + String questionToAI = (input == null || input.isEmpty()) ? "What happened at " + date + " ?": input; if(System.getenv("AUTH_INSTANCE_PRINCIPAL") != null) { System.out.println("AUTH_INSTANCE_PRINCIPAL"); @@ -128,7 +129,7 @@ public String handleRequest(String input) { .build(); ChatDetails chatDetails = ChatDetails.builder() - .servingMode(OnDemandServingMode.builder().modelId("ocid1.generativeaimodel.oc1.eu-frankfurt-1.amaaaaaa....wtig4q").build()) // Replace this with the actual OCID of the GenAI service + .servingMode(OnDemandServingMode.builder().modelId(GENAI_OCID).build()) .compartmentId(COMPARTMENT_ID) .chatRequest(chatRequest) .build();