New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jina AI Embedding model integration #997
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucifer-Hell thank you a lot! I have left some comments, please check.
<artifactId>langchain4j-jina-ai</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>22</maven.compiler.source> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep it compatible with Java 8. More info: https://github.com/langchain4j/langchain4j/blob/main/CONTRIBUTING.md
<version>0.30.0</version> | ||
</parent> | ||
|
||
<artifactId>langchain4j-jina-ai</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick:
<artifactId>langchain4j-jina-ai</artifactId> | |
<artifactId>langchain4j-jina</artifactId> |
Please rename it everywhere, including package name jinaAi
-> jina
<dependency> | ||
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-core</artifactId> | ||
<version>0.30.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to specify version explicitly, it will be resolved from parent
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-core</artifactId> | ||
<version>0.30.0</version> | ||
<scope>compile</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: no need to specify default scope (same for all deps below)
<dependency> | ||
<groupId>com.squareup.retrofit2</groupId> | ||
<artifactId>retrofit</artifactId> | ||
<version>2.9.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
<dependency> | ||
<groupId>com.squareup.retrofit2</groupId> | ||
<artifactId>converter-gson</artifactId> | ||
<version>2.9.0</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>testcontainers</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this dep required?
import dev.langchain4j.model.embedding.EmbeddingModel; | ||
import dev.langchain4j.model.output.Response; | ||
import dev.langchain4j.store.embedding.CosineSimilarity; | ||
import org.junit.Test; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use junit5
import static dev.langchain4j.internal.ValidationUtils.ensureNotBlank; | ||
|
||
public class JinaAiClient { | ||
private static final Gson GSON = new GsonBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: it would be great to use Jackson instead, as we are starting to get rid of Gson. More details: #1043
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional: it would be great to follow the same package structure as in #1043
thanks for reviewing @langchain4j i will do the changes and re-request for review . |
Context
This pr is for integration of jina ai embedding model which is mentioned in the issue 973
Change
Checklist
Before submitting this PR, please check the following points:
Checklist for adding new embedding store integration