Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Conversation

@Dohbedoh
Copy link
Contributor

@Dohbedoh Dohbedoh commented Aug 16, 2024

Fixes langchain4j/langchain4j#1596

This fixes the dependency convergence issues introduced in https://github.com/langchain4j/langchain4j-embeddings/pull/29/files. Since embedding manages a direct dependency on ai.djl:api to exclude commons-compress, I propose to add an exclusion of ai.djl:api from ai.djl.huggingface to avoid transitive dependencies issues.

Also added the enforcer to avoid this in the future.

@Dohbedoh Dohbedoh changed the title Fix Dependency convergence issue + enable Maven Enforcer #1596 Fix Dependency convergence issue + enable Maven Enforcer Aug 16, 2024
Copy link
Collaborator

@langchain4j langchain4j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dohbedoh thank you!

<exclusions>
<exclusion>
<groupId>ai.djl</groupId>
<artifactId>api</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we exclude slf4j-api on ai.djl:api instead?

        <dependency>
            <groupId>ai.djl</groupId>
            <artifactId>api</artifactId>
            <version>0.28.0</version>
            <exclusions>
                <!-- due to CVE-2024-26308 and CVE-2024-25710-->
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-compress</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not following. I am not touching the exclusions for ai.djl:api https://github.com/langchain4j/langchain4j-embeddings/blob/0.33.0/langchain4j-embeddings/pom.xml#L37-L41.

The problem is that embedding has 2 dependencies on ai.djl:api, one direct dependency and a transitive dependency through ai.djl.huggingface:tokenizers. To avoid future problems, we should exclude ai.djl:api from ai.djl.huggingface:tokenizers.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU, tokenizers always uses the same version of ai.djl:api, so there is no need in exclusions, we just need to make sure we use the same version of api and tokenizers.

But if we remove exclusion of api, there is a problem with slf4j-api...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we just need to make sure we use the same version of api and tokenizers.

That's why I propose the exclusion here. ai.djl:api. The same thing we did for common-compress in 6c358b8.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excluding ai.djl:api is not necessary, it works fine without it. And maven-enforcer-plugin will always make sure there is no conflict.

Copy link
Collaborator

@langchain4j langchain4j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dohbedoh thank you!

<exclusions>
<exclusion>
<groupId>ai.djl</groupId>
<artifactId>api</artifactId>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excluding ai.djl:api is not necessary, it works fine without it. And maven-enforcer-plugin will always make sure there is no conflict.

@langchain4j langchain4j merged commit f24558f into langchain4j:main Aug 21, 2024
langchain4j pushed a commit that referenced this pull request Aug 21, 2024
Process in the same thread when embedding single segment, otherwise use executor and cache threads for 1 second (#34)

## Issue
This PR partially fixes
langchain4j/langchain4j#1454
@Dohbedoh Dohbedoh deleted the bugfix/deps branch August 21, 2024 23:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ai.djl:api Dependency convergence issue

2 participants