Pular para o conteúdo principal

Postagens

Mostrando postagens com o rótulo quarkus

LLM-Powered Java Development: Using Quarkus and Langchain4J to Run Python-Generated Code

Code on my github   You may have heard that Auto Regressive LLMs (Large Language Models) are not good with certain tasks, given wrong or inaccurate results. Classical examples is the prompt: count the number of r in word strawberry Asking local llama 3.2 to count the number of 'r' on word 'strawberry' and it wrongly says 2 Or which number is bigger: 9.11 or 9.9 Asking Llama 3.2 the prompt which number is bigger: 9.11 or 9.9 and it wrongly says that 9.11 is bigger Of course modern LLMs may be trained to target such cases and may get it right, but if you try similar prompts you may get inaccurate results or even make the LLM "think" that they should answer something else and change the answer to something wrong. But still, there are issues that LLMs simply can't solve due the tokenization process and the context lenght. This is discussed in depth in recent Andrej Karpathy video about LLMs: In this same video Karpathy suggests the use of code to solve such ...

Database Query Server using Quarkus

We are updating our application to Quarkus and I have this requirement of supporting datasouces that users of our application can create. This is already supported in Widlfly , but does not seem to be supported on Quarkus . Before implementing this in our system we created a PoC which we share in this post. The problem Agroal is the part of Quarkus responsible for DataSources and pool connections. It is easy to configure datasources in Quarkus, but some properties only works during development time, after the JAR for distribution is built then you can't change some properties. The solution is programatically create datasources  so the application is flexible in a way that we can add datasets using system properties. We also must make sure that all supported data base drivers are in the application so users just needs to setup properties and no other action is required. All drivers dependencies Datasource from property We can create datasources using a map of properties. The proper...

Microblog application using Quarkus and template (Qute)

Quarkus 1.1 was released and in the announcement  surprisingly a new template extension was mentioned: Qute . Qute was made for Quarkus: it works in dev mode and you can compile to native image using Graal. In this post I will share the application I created to test the template engine. How Qute works with Quarkus? Qute works like very other Quarkus extension: convention over configuration and simple setup. It has support for custom tags and the template language is very simple. You can place templates in resource/templates and then inject them in your code. So if you have: src/main/resources/templates/productTemplate.html You can inject it using: @Inject io.quarkus.qute.Template productTemplate; Later you can create instances from this template passing variables and return them in JAX-RS methods. Yes, you can use JAX-RS as controller:       @GET     @Produces(MediaType.TEXT_HTML)     public TemplateInstance getProductsHtm...

Quarkus Application with Form Authentication using Database

Let's create a simple Quarkus application that uses databases table for authorization and authentication. This tutorial uses MariaDB and Quarkus 1.1.0.Final. Database configuration Remember to NEVER store plain text in the database. Elytron has the tools to use bcrypt for password encryption as described in the Quarkus JDBC security guide . We need to configure the database tables where the user, password and roles will be stored. Let's create the tables in the database: * User table keeps the username and password; * Roles is where you can find all the system roles; * User_role is user mapping to their roles Which translated to the following SQL: create table user(id int primary key,                              username varchar(100) unique,                              password varchar(1000)); create table role(i...

What is the final solution to reuse code in JAX-RS resources?

Back in 2008 I was in college and had to finish my graduation thesis, which was about mashing Web applications. At that time that great news was REST and it was in WAR with SOAP! I came across Roy Fielding famous dissertation , read RESTful Web Services , the book that speed up truly REST APIs (we had data update with GET back then!) in the WEB and then I stated calling myself a RESTAFarian . "Stateless architectures will never work" - said some SOAP lover 10 years ago  And I was also a Java programmer! However, back then create REST services for Java was not easy. We had to use servlets and JAX-RS was still in its early days  and we already had Restlet! However, JAX-RS was the best solution: annotation based, truly REST language and more. I decided to use Jersey and Spring for my thesis. (the only time I used it, after I felt in love with RESTEasy and have been using it since then). I liked JAX-RS since 10 years ago I have to repeat code, like check nullable entitie...

Hello World, Kogito!

Kogito is what you need to bring business automation to the cloud! Kogito Quarkus extension allows you to build applications on top of quarkus, bringing native business applications, developer joy and multiple useful extensions that can be used along with Kogito. Here are some interesting links for you to get started with Kogito: Kogito Get Started Guide Kogito Quarkus Extension Guide Kogito Examples Kogito Tooling Installation Kogito + Quarkus on VS Code Tutorial If you are a video person there's also this: Wondering about where Kogito came from? Read this blog from Kris. Happy Coding!

Hello World, Quarkus!

Today JBoss community released Quarkus . I could not wait to test it. Projects can be generated using the following archetype: mvn io.quarkus:quarkus-maven-plugin:0.11.0:create      \     -DprojectGroupId=org.fxapps                        \     -DprojectArtifactId=quarkus-getting-started        \     -DclassName="org.fxapps.GreetingResource"          \     -Dpath="/hello"              With the project that was generated you can create native binaries and docker images from it. See the following video for a quick demo of a hello world application: