From the course: Foundations of AI and Machine Learning for Java Developers
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Approaches and Java REST libraries - Java Tutorial
From the course: Foundations of AI and Machine Learning for Java Developers
Approaches and Java REST libraries
- [Speaker] Now that we know there are rest APIs for writing gen AI applications with Java, let's see how we can proceed. There are a couple of possible approaches. One way is to write our own Java code. Modern Java has excellent libraries for handling Http and Https to connect to a server using REST and get back a result. This is pretty straightforward. You can ask a language model for some code to get started connected to your language model provider of choice. Building simple code to access a REST endpoint is very straightforward, by the way, since you're typically getting results from the model in JSON format, you'll also need JSON parsing code to retrieve the relevant data. Also, your language model provider may release a version incompatible with the code you wrote, so you may have to change that. I personally encountered this unfortunate issue when writing code for an early version of ChatGPT three. You may also have to add production quality connection code for timeouts…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.