Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# This is an example of env file.
github.token=<set your token here>
quarkus.langchain4j.gemini.api-key=<set your api key here>
45 changes: 23 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.12.1</quarkus.platform.version>
<surefire-plugin.version>3.2.5</surefire-plugin.version>
<quarkus.platform.version>3.21.2</quarkus.platform.version>
<surefire-plugin.version>3.5.0</surefire-plugin.version>
<quarkus.google-cloud-services.version>2.13.0</quarkus.google-cloud-services.version>
</properties>

Expand All @@ -34,6 +34,7 @@
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>${quarkus.platform.group-id}</groupId>
<artifactId>quarkus-google-cloud-services-bom</artifactId>
Expand All @@ -45,22 +46,6 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jackson</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-client-jackson</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
Expand All @@ -84,19 +69,35 @@
<groupId>io.quarkiverse.googlecloudservices</groupId>
<artifactId>quarkus-google-cloud-firestore</artifactId>
</dependency>

<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-mcp</artifactId>
<version>1.3.0</version>
</dependency>

<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-ai-gemini</artifactId>
<version>1.3.0</version>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-mockito</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-mockito</artifactId>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.5.6</version>
<scope>test</scope>
</dependency>

Expand Down
18 changes: 18 additions & 0 deletions src/main/java/zenika/oss/stats/mcp/GitHubAIService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package zenika.oss.stats.mcp;

import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import io.quarkiverse.langchain4j.RegisterAiService;
import io.quarkiverse.langchain4j.mcp.runtime.McpToolBox;

@RegisterAiService
public interface GitHubAIService {

@SystemMessage("You are an open source lovers")
@UserMessage("""
Get the GitHub profile url for this user {userHandle}
""")
@McpToolBox
String getGitHubProfile(String userHandle);

}
24 changes: 24 additions & 0 deletions src/main/java/zenika/oss/stats/ressources/AIRessources.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package zenika.oss.stats.ressources;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.core.Response;
import zenika.oss.stats.mcp.GitHubAIService;

@ApplicationScoped
@Path("/v1/ai/")
public class AIRessources {

@Inject
GitHubAIService gitHubAIService;

@GET
@Path("/profile/{userHandle}")
public Response getProfile(@PathParam("userHandle") String userHandle) {
return Response.ok(gitHubAIService.getGitHubProfile(userHandle)).build();
}

}
21 changes: 14 additions & 7 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql:///mydatabase
quarkus.datasource.username=quarkus
quarkus.datasource.password=quarkus
quarkus.datasource.jdbc.additional-jdbc-properties.cloudSqlInstance=project-id:gcp-region:instance
quarkus.datasource.jdbc.additional-jdbc-properties.socketFactory=com.google.cloud.sql.postgres.SocketFactory
#quarkus.datasource.db-kind=postgresql
#quarkus.datasource.jdbc.url=jdbc:postgresql:///mydatabase
#quarkus.datasource.username=quarkus
#quarkus.datasource.password=quarkus
#quarkus.datasource.jdbc.additional-jdbc-properties.cloudSqlInstance=project-id:gcp-region:instance
#quarkus.datasource.jdbc.additional-jdbc-properties.socketFactory=com.google.cloud.sql.postgres.SocketFactory

# Cron
members.cron=0 9 1 * * ?
Expand Down Expand Up @@ -35,4 +35,11 @@ quarkus.google.cloud.firestore.database-id=opensource-statistics
%dev.quarkus.google.cloud.firestore.devservice.enabled=false
%test.quarkus.google.cloud.firestore.devservice.enabled=true
quarkus.google.cloud.service-account-location = ./.gcloud-conf.json
%dev.quarkus.google.cloud.service-account-location = ./.gcloud-conf.json
%dev.quarkus.google.cloud.service-account-location = ./.gcloud-conf.json

# GitHub MCP
quarkus.langchain4j.mcp.github.transport-type=http
quarkus.langchain4j.mcp.github.url=https://api.githubcopilot.com/mcp/sse
quarkus.langchain4j.log-requests=true
quarkus.langchain4j.log-responses=true
# quarkus.langchain4j.gemini.api-key to defined in .env file
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import static io.restassured.RestAssured.given;


@QuarkusTest
class ContributionsRessourcesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import zenika.oss.stats.beans.github.GitHubMember;
import zenika.oss.stats.services.FirestoreServices;
import zenika.oss.stats.services.GitHubServices;

import java.util.Arrays;
import java.util.List;

import static io.restassured.RestAssured.given;
Expand Down