<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Antonio Perrone on foojay.io - Friends of OpenJDK</title><link>https://foojayio.github.io/website/today/author/anto_perrone/</link><description>Articles written by Antonio Perrone on foojay.io - Friends of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 21 Aug 2023 07:38:07 +0000</lastBuildDate><atom:link href="https://foojayio.github.io/website/today/author/anto_perrone/index.xml" rel="self" type="application/rss+xml"/><item><title>AI-based Images generation with Quarkus and OpenAI DALL.E</title><link>https://foojayio.github.io/website/today/images-generation-with-quarkus-and-openai/</link><pubDate>Mon, 21 Aug 2023 07:38:07 +0000</pubDate><guid>https://foojayio.github.io/website/today/images-generation-with-quarkus-and-openai/</guid><description>&lt;p&gt;&lt;strong&gt;In this article, we explore how to integrate OpenAI API with Quarkus. We will create a Quarkus application using the new REST Client Reactive to invoke the OpenAI DALL.E API for images generation.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id="h2-0-openai-api-overview"&gt;OpenAI API Overview&lt;/h2&gt;
&lt;p&gt;Before jumping into the code, let&amp;rsquo;s explore the OpenAI &lt;a href="https://platform.openai.com/docs/api-reference/images/create" target="_blank" rel="noopener noreferrer"&gt;Create Image&lt;/a&gt;
 API and how it works.&lt;/p&gt;
&lt;h3 id="h3-1-create-image-request"&gt;Create Image Request&lt;/h3&gt;
&lt;p&gt;The body request is made of the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;prompt&lt;/strong&gt;: the only required parameter is the description of the desired image (max 1000 characters)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;n&lt;/strong&gt;: number of desired images (from 1 to 10)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;size&lt;/strong&gt; : the size of a generated image (default 1024x1024, also admitted 256x256, 512x512)&lt;br&gt;
other parameters are:&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;response_format&lt;/strong&gt;: to specify the response image format (default url, also admitted b64_json)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;user&lt;/strong&gt;: identifier to track user activities.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To authenticate with the API, we&amp;rsquo;ll generate an &lt;a href="https://platform.openai.com/account/api-keys" target="_blank" rel="noopener noreferrer"&gt;API key&lt;/a&gt;
. We&amp;rsquo;ll set this key in the Authorization header while calling the API.&lt;/p&gt;</description></item></channel></rss>