{"id":50564219,"url":"https://github.com/quarkiverse/quarkus-rage4j","last_synced_at":"2026-06-04T13:01:51.312Z","repository":{"id":313811062,"uuid":"1012549485","full_name":"quarkiverse/quarkus-rage4j","owner":"quarkiverse","description":"Rage4j is a java library thats helps evaluate LLM's based on scientifically grounded metrics","archived":false,"fork":false,"pushed_at":"2026-04-10T14:18:11.000Z","size":66,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-10T16:16:11.421Z","etag":null,"topics":["ai","continuous-integration","langchain4j","large-language-models","llm-testing","llms","openai","quarkus-extension","semantic-evaluation","testing-library"],"latest_commit_sha":null,"homepage":"https://explore-de.github.io/rage4j/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quarkiverse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-02T13:56:48.000Z","updated_at":"2026-04-10T14:18:35.000Z","dependencies_parsed_at":"2025-09-08T17:14:17.075Z","dependency_job_id":"0c83a235-c6a2-42a8-ad38-d20b8bf47c69","html_url":"https://github.com/quarkiverse/quarkus-rage4j","commit_stats":null,"previous_names":["quarkiverse/quarkus-rage4j"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quarkiverse/quarkus-rage4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quarkiverse%2Fquarkus-rage4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quarkiverse%2Fquarkus-rage4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quarkiverse%2Fquarkus-rage4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quarkiverse%2Fquarkus-rage4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quarkiverse","download_url":"https://codeload.github.com/quarkiverse/quarkus-rage4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quarkiverse%2Fquarkus-rage4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33905359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","continuous-integration","langchain4j","large-language-models","llm-testing","llms","openai","quarkus-extension","semantic-evaluation","testing-library"],"created_at":"2026-06-04T13:01:51.211Z","updated_at":"2026-06-04T13:01:51.306Z","avatar_url":"https://github.com/quarkiverse.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quarkus Rage4j\n\n[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.rage4j/quarkus-rage4j?logo=apache-maven\u0026style=flat-square)](https://central.sonatype.com/artifact/io.quarkiverse.rage4j/quarkus-rage4j)\n\nA Quarkus extension that integrates [Rage4j](https://github.com/rage4j/rage4j) for testing AI services with RAG (Retrieval-Augmented Generation) evaluation metrics. This extension enables you to validate the quality of your LangChain4j-based AI services in Quarkus applications.\n\n## Features\n\n- 🎯 **Answer Correctness**: Evaluate how accurate your AI service responses are\n- 🔗 **Faithfulness**: Measure if the answer is faithful to the provided context\n- 📊 **Answer Relevance**: Check if responses are relevant to the question\n- 🔍 **Semantic Similarity**: Compare semantic similarity between answers and ground truth\n- 🔌 **Seamless Integration**: Works with Quarkus and LangChain4j AI services\n- ✅ **JUnit 5 Support**: Easy integration with your existing test suite\n\n## Installation\n\nAdd the extension to your Quarkus project:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.quarkiverse.rage4j\u003c/groupId\u003e\n    \u003cartifactId\u003equarkus-rage4j\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nYou'll also need a LangChain4j provider (e.g., OpenAI):\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.quarkiverse.langchain4j\u003c/groupId\u003e\n    \u003cartifactId\u003equarkus-langchain4j-openai\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Configuration\n\nConfigure your API keys in `application.properties`:\n\n```properties\n# Rage4j API key for evaluation LLM\nquarkus.rage4j.api-key=your-openai-api-key\n\n# LangChain4j API key for your AI service\nquarkus.langchain4j.openai.api-key=your-openai-api-key\n```\n\n## Usage\n\n### 1. Create Your AI Service\n\nFirst, define a LangChain4j AI service using `@RegisterAiService`:\n\n```java\nimport dev.langchain4j.service.SystemMessage;\nimport io.quarkiverse.langchain4j.RegisterAiService;\nimport jakarta.enterprise.context.ApplicationScoped;\n\n@RegisterAiService\n@ApplicationScoped\n@SystemMessage(\"\"\"\n    You are a helpful assistant. Your task is to answer questions clearly, \n    precisely, and in a friendly manner. You support the user in understanding \n    concepts, solving problems, and creating content.\n    \"\"\")\npublic interface MyAiService {\n    String chat(String question);\n}\n```\n\n### 2. Set Up Your Test Class\n\nCreate a test class with the Rage4j extension and inject required components:\n\n```java\nimport io.quarkiverse.rage4j.runtime.annotations.TestAIService;\nimport io.quarkiverse.rage4j.runtime.junitextension.Rage4jTestExtension;\nimport io.quarkiverse.rage4j.runtime.wrapper.RageAssert;\nimport io.quarkus.test.junit.QuarkusTest;\nimport jakarta.inject.Inject;\nimport org.junit.jupiter.api.Test;\nimport org.junit.jupiter.api.extension.ExtendWith;\n\n@QuarkusTest\n@ExtendWith(Rage4jTestExtension.class)\nclass MyAiServiceTest {\n\n    @Inject\n    RageAssert rageAssert;\n\n    @Inject\n    MyAiService aiService;\n\n    @TestAIService\n    public String answer(String question) {\n        return aiService.chat(question);\n    }\n\n    // Your tests go here\n}\n```\n\n### 3. Write Your Tests\n\n#### Test Answer Correctness\n\nVerify that your AI service provides correct answers:\n\n```java\n@Test\nvoid testAnswerCorrectness() {\n    String groundTruth = \"\"\"\n        The answer to \"life, the universe, and everything\" is famously \n        known to be **42**. This concept originates from Douglas Adams' \n        science fiction series \"The Hitchhiker's Guide to the Galaxy.\"\n        \"\"\";\n    \n    rageAssert\n        .question(\"What is the answer to life, the universe and everything?\")\n        .groundTruth(groundTruth)\n        .threshold(0.50)\n        .assertAnswerCorrectness();\n}\n```\n\n#### Test with Expected Failure\n\nYou can also test scenarios where the answer should be incorrect:\n\n```java\n@Test\nvoid shouldFailWithIncorrectGroundTruth() {\n    assertThrows(Rage4JCorrectnessException.class, () -\u003e \n        rageAssert\n            .question(\"What is the answer to life, the universe and everything?\")\n            .groundTruth(\"Nothing.\")\n            .threshold(0.50)\n            .assertAnswerCorrectness()\n    );\n}\n```\n\n### 4. Available Assertions\n\nThe `RageAssert` API provides several assertion methods:\n\n```java\nrageAssert\n    .question(\"Your question\")\n    .groundTruth(\"Expected answer\")\n    .threshold(0.7)\n    .assertAnswerCorrectness();  // Evaluates overall correctness\n```\n\nAvailable assertion methods:\n- `assertAnswerCorrectness()` - Evaluates the overall correctness of the answer\n- `assertFaithfulness()` - Checks if the answer is faithful to the provided context\n- `assertAnswerRelevance()` - Verifies that the answer is relevant to the question\n- `assertSemanticSimilarity()` - Compares semantic similarity between the answer and ground truth\n\n#### Chaining Multiple Assertions\n\nYou can chain multiple assertions to evaluate different aspects of the response:\n\n```java\n@Test\nvoid testMultipleMetrics() {\n    rageAssert\n        .question(\"What is the answer to life, the universe and everything?\")\n        .groundTruth(\"The answer is 42, from The Hitchhiker's Guide to the Galaxy.\")\n        .threshold(0.7)\n        .assertAnswerCorrectness()\n        .assertAnswerRelevance()\n        .assertSemanticSimilarity()\n        .assertFaithfulness();\n}\n```\n\n## How It Works\n\n1. **`@TestAIService` Annotation**: Mark a method with this annotation to define how your AI service should be called\n2. **`RageAssert` API**: Use the fluent API to configure your test with question, ground truth, and threshold\n3. **Evaluation**: Rage4j uses an LLM (configured via `quarkus.rage4j.api-key`) to evaluate the quality of responses\n4. **Threshold**: Scores range from 0.0 to 1.0; assertions pass if the score meets or exceeds the threshold\n\n## Example Project Structure\n\n```\nsrc/\n├── main/\n│   └── java/\n│       └── com/example/\n│           └── MyAiService.java\n└── test/\n    ├── java/\n    │   └── com/example/\n    │       └── MyAiServiceTest.java\n    └── resources/\n        └── application.properties\n```\n\n## Configuration Properties\n\n| Property | Description | Required |\n|----------|-------------|----------|\n| `quarkus.rage4j.api-key` | OpenAI API key for Rage4j evaluation | Yes |\n| `quarkus.langchain4j.openai.api-key` | OpenAI API key for your AI service | Yes (if using OpenAI) |\n\n## Requirements\n\n- Java 17 or higher\n- Quarkus 3.x\n- An OpenAI API key (or compatible LLM provider)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Links\n\n- [Rage4j GitHub](https://github.com/explore-de/rage4j)\n- [Quarkus LangChain4j](https://docs.langchain4j.dev/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquarkiverse%2Fquarkus-rage4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquarkiverse%2Fquarkus-rage4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquarkiverse%2Fquarkus-rage4j/lists"}