forked from langchain4j/langchain4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jina AI Embedding model integration (langchain4j#997)
- Loading branch information
1 parent
0ad92d5
commit 050e93b
Showing
14 changed files
with
77 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/EmbeddingRequest.java
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/EmbeddingResponse.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/JinaEmbedding.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/Usage.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/internal/api/EmbeddingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.langchain4j.model.jina.internal.api; | ||
|
||
import lombok.Builder; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public class EmbeddingRequest { | ||
|
||
public String model; | ||
public List<String> input; | ||
} |
9 changes: 9 additions & 0 deletions
9
...chain4j-jina/src/main/java/dev/langchain4j/model/jina/internal/api/EmbeddingResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.langchain4j.model.jina.internal.api; | ||
|
||
import java.util.List; | ||
|
||
public class EmbeddingResponse { | ||
|
||
public List<JinaEmbedding> data; | ||
public Usage usage; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/internal/api/JinaEmbedding.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package dev.langchain4j.model.jina.internal.api; | ||
|
||
import dev.langchain4j.data.embedding.Embedding; | ||
|
||
public class JinaEmbedding { | ||
|
||
public long index; | ||
public float[] embedding; | ||
public String object; | ||
|
||
public Embedding toEmbedding() { | ||
return Embedding.from(embedding); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
langchain4j-jina/src/main/java/dev/langchain4j/model/jina/internal/api/Usage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package dev.langchain4j.model.jina.internal.api; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
public class Usage { | ||
|
||
@SerializedName("total_tokens") | ||
public Integer totalTokens; | ||
|
||
@SerializedName("prompt_tokens") | ||
public Integer promptTokens; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters