Repository: langchain4j/langchain4j-community
Pull request #59: LlamaParse parser integration
Author: login: dloiacono
Labels: name: P3
description: Medium priority
name: theme: document parser
description: Issues/PRs related to document parser
Created: 2025-01-27T10:36:50Z | Merged: 2025-03-31T14:07:26Z

## Issue
Provides the LlamaParse parser integration

## Change
LlamaParse is a component of LlamaCloud that allows you to parse PDFs into structured data. https://docs.cloud.llamaindex.ai/
LlamaParse, parses complex documents with embedded objects like tables and figures.


## General checklist
<!-- Please double-check the following points and mark them like this: [X] -->
- [X] There are no breaking changes
- [X] I have added unit and integration tests for my change
- [X] I have manually run all the unit tests in _all_ modules, and they are all green
- [X] I have manually run all integration tests in the module I have added/changed, and they are all green
<!-- Before adding documentation and example(s) (below), please wait until the PR is reviewed and approved. -->
- [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs)
- [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features)
- [ ] I have added/updated [Spring Boot starter(s)](https://github.com/langchain4j/langchain4j-spring) (if applicable)


## Checklist for adding new maven module
<!-- Please double-check the following points and mark them like this: [X] -->
- [X] I have added my new module in the root `pom.xml` and `langchain4j-community-bom/pom.xml`


## Checklist for adding new embedding store integration
<!-- Please double-check the following points and mark them like this: [X] -->
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreIT` that extends from either `EmbeddingStoreIT` or `EmbeddingStoreWithFilteringIT`
- [ ] I have added a `{NameOfIntegration}EmbeddingStoreRemovalIT` that extends from `EmbeddingStoreWithRemovalIT`

## Checklist for changing existing embedding store integration
<!-- Please double-check the following points and mark them like this: [X] -->
- [ ] I have manually verified that the `{NameOfIntegration}EmbeddingStore` works correctly with the data persisted using the latest released version of LangChain4j



Diff:
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/pom.xml b/document-parsers/langchain4j-community-document-parser-llamaparse/pom.xml
new file mode 100644
index 000000000..ddd449d87
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/pom.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>dev.langchain4j</groupId>
+        <artifactId>langchain4j-community</artifactId>
+        <version>1.0.0-beta3-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>langchain4j-community-document-parser-llamaparse</artifactId>
+    <packaging>jar</packaging>
+    <name>LangChain4j :: Community :: Document parser :: LlamaParse</name>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>retrofit</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>converter-jackson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jspecify</groupId>
+            <artifactId>jspecify</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.assertj</groupId>
+            <artifactId>assertj-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+</project>
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/ApiKeyInsertingInterceptor.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/ApiKeyInsertingInterceptor.java
new file mode 100644
index 000000000..8570b91d6
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/ApiKeyInsertingInterceptor.java
@@ -0,0 +1,28 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static dev.langchain4j.internal.ValidationUtils.ensureNotBlank;
+
+import java.io.IOException;
+import okhttp3.Interceptor;
+import okhttp3.Request;
+import okhttp3.Response;
+
+class ApiKeyInsertingInterceptor implements Interceptor {
+
+    private final String apiKey;
+
+    ApiKeyInsertingInterceptor(String apiKey) {
+        this.apiKey = ensureNotBlank(apiKey, "apiKey");
+    }
+
+    @Override
+    public Response intercept(Chain chain) throws IOException {
+
+        Request request = chain.request()
+                .newBuilder()
+                .addHeader("Authorization", "Bearer " + apiKey)
+                .build();
+
+        return chain.proceed(request);
+    }
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseApi.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseApi.java
new file mode 100644
index 000000000..3096e363b
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseApi.java
@@ -0,0 +1,39 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlamaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{jobId}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("jobId") String jobId);
+
+    @GET("job/{jobId}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("jobId") String jobId);
+
+    @GET("job/{jobId}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("jobId") String jobId);
+
+    @GET("job/{jobId}/result/image/{image_name}")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> imageResult(@Path("jobId") String jobId, @Path("image_name") String image_name);
+
+    @GET("job/{jobId}")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> jobStatus(@Path("jobId") String jobId);
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClient.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClient.java
new file mode 100644
index 000000000..2e7473067
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClient.java
@@ -0,0 +1,158 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import org.jspecify.annotations.NonNull;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import retrofit2.Retrofit;
+import retrofit2.converter.jackson.JacksonConverterFactory;
+
+public class LlamaParseClient {
+    private static final Logger log = LoggerFactory.getLogger(LlamaParseClient.class);
+
+    private final LlamaParseApi llamaParseApi;
+
+    public LlamaParseClient(String apiKey) {
+        llamaParseApi = createLlamaParseClient(null, null, apiKey);
+    }
+
+    public LlamaParseClient(String baseUrl, Duration timeout, String apiKey) {
+        llamaParseApi = createLlamaParseClient(baseUrl, timeout, apiKey);
+    }
+
+    @NonNull
+    private LlamaParseApi createLlamaParseClient(String baseUrl, Duration timeout, String apiKey) {
+        final LlamaParseApi llamaParseApi;
+        OkHttpClient.Builder okHttpClientBuilder = new OkHttpClient.Builder()
+                .addInterceptor(new ApiKeyInsertingInterceptor(apiKey))
+                .callTimeout(getOrDefault(timeout, ofSeconds(30)))
+                .connectTimeout(getOrDefault(timeout, ofSeconds(30)))
+                .readTimeout(getOrDefault(timeout, ofSeconds(30)))
+                .writeTimeout(getOrDefault(timeout, ofSeconds(30)));
+
+        OkHttpClient okHttpClient = okHttpClientBuilder.build();
+
+        Retrofit retrofit = new Retrofit.Builder()
+                .baseUrl(getOrDefault(baseUrl, "https://api.cloud.llamaindex.ai/api/parsing/"))
+                .client(okHttpClient)
+                .addConverterFactory(JacksonConverterFactory.create())
+                .build();
+
+        llamaParseApi = retrofit.create(LlamaParseApi.class);
+        return llamaParseApi;
+    }
+
+    public LlamaParseResponse upload(Path path, String parsingInstructions) {
+        try {
+            RequestBody requestFile = RequestBody.create(MediaType.parse("application/pdf"), path.toFile());
+
+            MultipartBody.Part filePart =
+                    MultipartBody.Part.createFormData("file", path.toFile().getName(), requestFile);
+
+            MultipartBody.Part parsingInstructionsPart =
+                    MultipartBody.Part.createFormData("parsingInstructions", parsingInstructions);
+
+            retrofit2.Response<LlamaParseResponse> retrofitResponse =
+                    llamaParseApi.upload(filePart, parsingInstructionsPart).execute();
+
+            if (retrofitResponse.isSuccessful()) {
+                return retrofitResponse.body();
+            } else {
+                throw toException(retrofitResponse);
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    public ResponseBody jsonResult(String jobId) {
+        try {
+            retrofit2.Response<ResponseBody> response =
+                    llamaParseApi.jsonResult(jobId).execute();
+            if (response.isSuccessful()) {
+                return response.body();
+            } else {
+                throw toException(response);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public LlamaParseMarkdownResponse markdownResult(String jobId) {
+        try {
+            retrofit2.Response<LlamaParseMarkdownResponse> response =
+                    llamaParseApi.markdownResult(jobId).execute();
+            if (response != null && response.isSuccessful()) {
+                return response.body();
+            } else {
+                throw toException(response);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public LlamaParseTextResponse textResult(String jobId) {
+        try {
+            retrofit2.Response<LlamaParseTextResponse> response =
+                    llamaParseApi.textResult(jobId).execute();
+            if (response.isSuccessful()) {
+                return response.body();
+            } else {
+                throw toException(response);
+            }
+        } catch (Exception e) {
+            log.error("Error getting text result from the job {}", jobId);
+            throw new RuntimeException(e);
+        }
+    }
+
+    public ResponseBody imageResult(String jobId, String imageName) {
+        try {
+            retrofit2.Response<ResponseBody> response =
+                    llamaParseApi.imageResult(jobId, imageName).execute();
+            if (response.isSuccessful()) {
+                return response.body();
+            } else {
+                throw toException(response);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public LlamaParseResponse jobStatus(String jobId) {
+        try {
+            retrofit2.Response<LlamaParseResponse> retrofitResponse =
+                    llamaParseApi.jobStatus(jobId).execute();
+
+            if (retrofitResponse.isSuccessful()) {
+                return retrofitResponse.body();
+            } else {
+                throw toException(retrofitResponse);
+            }
+
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private RuntimeException toException(retrofit2.Response<?> response) throws IOException {
+        int code = response.code();
+        String body = response.errorBody().string();
+
+        String errorMessage = String.format("status code: %s; body: %s", code, body);
+        return new RuntimeException(errorMessage);
+    }
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseMarkdownResponse.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseMarkdownResponse.java
new file mode 100644
index 000000000..564303445
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseMarkdownResponse.java
@@ -0,0 +1,13 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LlamaParseMarkdownResponse {
+
+    public String markdown;
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseResponse.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseResponse.java
new file mode 100644
index 000000000..a1c952d73
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseResponse.java
@@ -0,0 +1,14 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LlamaParseResponse {
+
+    public String id;
+    public String status;
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseTextResponse.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseTextResponse.java
new file mode 100644
index 000000000..39965f1e4
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/main/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseTextResponse.java
@@ -0,0 +1,13 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class LlamaParseTextResponse {
+
+    public String text;
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClientIT.java b/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClientIT.java
new file mode 100644
index 000000000..7e0beb126
--- /dev/null
+++ b/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/java/dev/langchain4j/community/data/document/parser/llamaparse/LlamaParseClientIT.java
@@ -0,0 +1,63 @@
+package dev.langchain4j.community.data.document.parser.llamaparse;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.with;
+
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
+@EnabledIfEnvironmentVariable(named = "LLAMA_PARSE_API_KEY", matches = ".+")
+class LlamaParseClientIT {
+
+    private static final Logger log = LoggerFactory.getLogger(LlamaParseClientIT.class);
+
+    @Test
+    void shouldParseUploadAndGetMarkdown() {
+        String API_KEY = System.getenv("LLAMA_PARSE_API_KEY");
+
+        assertThat(API_KEY).isNotNull().isNotBlank();
+
+        LlamaParseClient client = new LlamaParseClient(API_KEY);
+
+        Path path = toPath("files/sample.pdf");
+        String parsingInstructions = "The provided document is a PDF sample containing Lorem Ipsum text.";
+
+        log.info("Uploading the file...");
+        LlamaParseResponse responseBody = client.upload(path, parsingInstructions);
+        String jobId = responseBody.id;
+        String status = responseBody.status;
+
+        assertThat(jobId).isNotBlank();
+        // assertThat(status).isEqualTo("SUCCESS");
+
+        log.info("Waiting for parsing...");
+        with().pollInterval(Duration.ofSeconds(3))
+                .await("check success status")
+                .atMost(Duration.ofSeconds(60))
+                .untilAsserted(() -> assertThat(client.jobStatus(jobId).status).isEqualTo("SUCCESS"));
+
+        log.info("Getting markdown result...");
+        LlamaParseMarkdownResponse response = client.markdownResult(jobId);
+        String markdown = response.markdown;
+        assertThat(markdown.length()).isGreaterThan(0);
+
+        log.info("Test completed...");
+    }
+
+    private Path toPath(String fileName) {
+        try {
+            return Paths.get(getClass().getClassLoader().getResource(fileName).toURI());
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/resources/files/sample.pdf b/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/resources/files/sample.pdf
new file mode 100644
index 000000000..c01805e89
Binary files /dev/null and b/document-parsers/langchain4j-community-document-parser-llamaparse/src/test/resources/files/sample.pdf differ
diff --git a/langchain4j-community-bom/pom.xml b/langchain4j-community-bom/pom.xml
index 563ffefe8..cfd5d33d0 100644
--- a/langchain4j-community-bom/pom.xml
+++ b/langchain4j-community-bom/pom.xml
@@ -91,12 +91,20 @@
                 <artifactId>langchain4j-community-lucene</artifactId>
                 <version>${project.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>dev.langchain4j</groupId>
                 <artifactId>langchain4j-community-neo4j-retriever</artifactId>
                 <version>${project.version}</version>
             </dependency>
 
+            <!-- document parsers -->
+            <dependency>
+                <groupId>dev.langchain4j</groupId>
+                <artifactId>langchain4j-community-document-parser-llamaparse</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
             <!-- web search engines -->
             <dependency>
                 <groupId>dev.langchain4j</groupId>
diff --git a/pom.xml b/pom.xml
index fb7838553..f6a3824c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,6 +70,9 @@
         <!-- Integration of web search engine -->
         <module>web-search-engines/langchain4j-community-web-search-engine-searxng</module>
 
+        <!-- Integration of document parsers -->
+        <module>document-parsers/langchain4j-community-document-parser-llamaparse</module>
+
         <!-- Spring Boot Starters -->
         <module>spring-boot-starters</module>
 


Reviews:
user: login: Martin7-1
body: @dloiacono Thank you for your patience! I'm travelling for Chinese New Year now and do not have much time to review it. Will review it next week.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-01-29T16:30:30Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:23:45Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:23:51Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:02Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:11Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:18Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:24Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:30Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:35Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:41Z
user: login: dloiacono
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-31T13:24:46Z
user: login: Martin7-1
body: @dloiacono Thank you! Right now `langchain4j` suggest to migrate from `retrofit` to `langchain4j-http-client` to avoid coupling. You can check `langchain4j-community-vearch` and `langchain4j-ollama` for reference.

You can raise a new PR and implement it if you have time. :)
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-31T13:36:11Z

Review comments:
diff_hunk: @@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>dev.langchain4j</groupId>
+        <artifactId>langchain4j-community</artifactId>
+        <version>1.0.0-alpha2-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>langchain4j-document-parser-llamaparse</artifactId>
+    <packaging>jar</packaging>
+    <name>LangChain4j :: Community :: Document parser :: LlamaParse</name>
+
+    <properties>
+        <awaitility.version>4.2.1</awaitility.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.awaitility</groupId>
+                <artifactId>awaitility</artifactId>
+                <version>${awaitility.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>retrofit</artifactId>
+        </dependency>
+
+        <dependency>
path: document-parsers/langchain4j-document-parser-llamaparse/pom.xml
user: login: Martin7-1
body: Would be great if use `jackson` instead as other modules do.
created_at: 2025-01-29T16:23:51Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: Martin7-1
body: Could you please standardise the naming? (`job_id` to `jobId`)
created_at: 2025-01-29T16:25:03Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: Martin7-1
body: Could you please standardise the naming? (`job_id` to `jobId`)
created_at: 2025-01-29T16:25:07Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/image/{image_name}")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> imageResult(@Path("job_id") String job_id, @Path("image_name") String image_name);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: Martin7-1
body: Could you please standardise the naming? (`job_id` to `jobId`, `image_name` to `imageName`)
created_at: 2025-01-29T16:25:18Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/image/{image_name}")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> imageResult(@Path("job_id") String job_id, @Path("image_name") String image_name);
+
+    @GET("job/{job_id}")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> jobStatus(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: Martin7-1
body: Could you please standardise the naming? (`job_id` to `jobId`)
created_at: 2025-01-29T16:25:20Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>dev.langchain4j</groupId>
+        <artifactId>langchain4j-community</artifactId>
+        <version>1.0.0-alpha2-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>langchain4j-document-parser-llamaparse</artifactId>
+    <packaging>jar</packaging>
+    <name>LangChain4j :: Community :: Document parser :: LlamaParse</name>
+
+    <properties>
+        <awaitility.version>4.2.1</awaitility.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.awaitility</groupId>
+                <artifactId>awaitility</artifactId>
+                <version>${awaitility.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>retrofit</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>converter-gson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+
+        <dependency>
path: document-parsers/langchain4j-document-parser-llamaparse/pom.xml
user: login: Martin7-1
body: Could you please not introduce `lombok` as we are getting rid of it?
created_at: 2025-01-29T16:27:32Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
+public class LlamaParseClient {
+    private static final Gson GSON =
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: Martin7-1
body: Using `jackson` will be better
created_at: 2025-01-29T16:27:46Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
+public class LlamaParseClient {
+    private static final Gson GSON =
+            new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
+
+    private final LlmaParseApi llmaParseApi;
+
+    @Builder
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: Martin7-1
body: Could you please not introduce lombok as we are getting rid of it?
created_at: 2025-01-29T16:27:57Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: Martin7-1
body: Could you please not introduce lombok as we are getting rid of it?
created_at: 2025-01-29T16:28:00Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,14 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(NON_NULL)
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseResponse.java
user: login: Martin7-1
body: `jackson` annotations are used, but `gson-convertor` is introduced in `pom.xml`
created_at: 2025-01-29T16:28:49Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
+public class LlamaParseClient {
+    private static final Gson GSON =
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:23:45Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
+public class LlamaParseClient {
+    private static final Gson GSON =
+            new GsonBuilder().setFieldNamingPolicy(LOWER_CASE_WITH_UNDERSCORES).create();
+
+    private final LlmaParseApi llmaParseApi;
+
+    @Builder
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:23:51Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,14 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(NON_NULL)
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseResponse.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>dev.langchain4j</groupId>
+        <artifactId>langchain4j-community</artifactId>
+        <version>1.0.0-alpha2-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>langchain4j-document-parser-llamaparse</artifactId>
+    <packaging>jar</packaging>
+    <name>LangChain4j :: Community :: Document parser :: LlamaParse</name>
+
+    <properties>
+        <awaitility.version>4.2.1</awaitility.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.awaitility</groupId>
+                <artifactId>awaitility</artifactId>
+                <version>${awaitility.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>retrofit</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>converter-gson</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+        </dependency>
+
+        <dependency>
path: document-parsers/langchain4j-document-parser-llamaparse/pom.xml
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:11Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,152 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import static com.google.gson.FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES;
+import static dev.langchain4j.internal.Utils.getOrDefault;
+import static java.time.Duration.ofSeconds;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.time.Duration;
+import lombok.Builder;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.MediaType;
+import okhttp3.MultipartBody;
+import okhttp3.OkHttpClient;
+import okhttp3.RequestBody;
+import okhttp3.ResponseBody;
+import retrofit2.Retrofit;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+@Slf4j
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlamaParseClient.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/image/{image_name}")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> imageResult(@Path("job_id") String job_id, @Path("image_name") String image_name);
+
+    @GET("job/{job_id}")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> jobStatus(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/image/{image_name}")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> imageResult(@Path("job_id") String job_id, @Path("image_name") String image_name);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
+
+    @GET("job/{job_id}/result/text")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseTextResponse> textResult(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:35Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,39 @@
+package dev.langchain4j.data.document.parser.llamaparse;
+
+import okhttp3.MultipartBody;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.http.GET;
+import retrofit2.http.Headers;
+import retrofit2.http.Multipart;
+import retrofit2.http.POST;
+import retrofit2.http.Part;
+import retrofit2.http.Path;
+
+interface LlmaParseApi {
+
+    @POST("upload")
+    @Multipart
+    @Headers({"accept: application/json"})
+    Call<LlamaParseResponse> upload(@Part MultipartBody.Part file, @Part MultipartBody.Part parsingInstructions);
+
+    @GET("job/{job_id}/result/json")
+    @Headers({"accept: application/json"})
+    Call<ResponseBody> jsonResult(@Path("job_id") String jobId);
+
+    @GET("job/{job_id}/result/markdown")
+    @Headers({"accept: application/json"})
+    Call<LlamaParseMarkdownResponse> markdownResult(@Path("job_id") String job_id);
path: document-parsers/langchain4j-document-parser-llamaparse/src/main/java/dev/langchain4j/data/document/parser/llamaparse/LlmaParseApi.java
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>dev.langchain4j</groupId>
+        <artifactId>langchain4j-community</artifactId>
+        <version>1.0.0-alpha2-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>langchain4j-document-parser-llamaparse</artifactId>
+    <packaging>jar</packaging>
+    <name>LangChain4j :: Community :: Document parser :: LlamaParse</name>
+
+    <properties>
+        <awaitility.version>4.2.1</awaitility.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.awaitility</groupId>
+                <artifactId>awaitility</artifactId>
+                <version>${awaitility.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>dev.langchain4j</groupId>
+            <artifactId>langchain4j-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.retrofit2</groupId>
+            <artifactId>retrofit</artifactId>
+        </dependency>
+
+        <dependency>
path: document-parsers/langchain4j-document-parser-llamaparse/pom.xml
user: login: dloiacono
body: done
created_at: 2025-03-31T13:24:46Z
author_association: CONTRIBUTOR

PR comments:
user: login: Martin7-1
created_at: 2025-03-21T12:50:30Z
body: Hi! Any update?
author_association: COLLABORATOR
user: login: dloiacono
created_at: 2025-03-27T20:12:49Z
body: I will review tomorrow morning.

Best
Domenico

On Fri, 21 Mar 2025 at 13:50, Martin7-1 ***@***.***> wrote:

> Hi! Any update?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/langchain4j/langchain4j-community/pull/59#issuecomment-2743276284>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAC5MXY5RJTFXFO27B3O7232VQDK3AVCNFSM6AAAAABV5XXYSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBTGI3TMMRYGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
> [image: Martin7-1]*Martin7-1* left a comment
> (langchain4j/langchain4j-community#59)
> <https://github.com/langchain4j/langchain4j-community/pull/59#issuecomment-2743276284>
>
> Hi! Any update?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/langchain4j/langchain4j-community/pull/59#issuecomment-2743276284>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAC5MXY5RJTFXFO27B3O7232VQDK3AVCNFSM6AAAAABV5XXYSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONBTGI3TMMRYGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>

author_association: CONTRIBUTOR