-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
3,503 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?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>0.37.0-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>langchain4j-community-vearch</artifactId> | ||
<name>LangChain4j :: Community :: Integration :: Vearch</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 CONFLICT RESOLUTION FOR OKHTTP (START) --> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib-jdk8</artifactId> | ||
</dependency> | ||
<!-- DEPENDENCY CONFLICT RESOLUTION FOR OKHTTP (END) --> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- junit-jupiter-params should be declared explicitly | ||
to run parameterized tests inherited from EmbeddingStore*IT--> | ||
<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>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-embeddings-all-minilm-l6-v2-q</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-core</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>testcontainers</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.tinylog</groupId> | ||
<artifactId>tinylog-impl</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.tinylog</groupId> | ||
<artifactId>slf4j-tinylog</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.awaitility</groupId> | ||
<artifactId>awaitility</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
</project> |
41 changes: 41 additions & 0 deletions
41
...rc/main/java/dev/langchain4j/community/store/embedding/vearch/CreateDatabaseResponse.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,41 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
class CreateDatabaseResponse { | ||
|
||
private Long id; | ||
private String name; | ||
|
||
CreateDatabaseResponse() { | ||
} | ||
|
||
CreateDatabaseResponse(Long id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
...ch/src/main/java/dev/langchain4j/community/store/embedding/vearch/CreateSpaceRequest.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,84 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import dev.langchain4j.community.store.embedding.vearch.field.Field; | ||
|
||
import java.util.List; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
class CreateSpaceRequest { | ||
|
||
private String name; | ||
private Integer partitionNum; | ||
private Integer replicaNum; | ||
private List<Field> fields; | ||
|
||
CreateSpaceRequest() { | ||
} | ||
|
||
CreateSpaceRequest(String name, Integer partitionNum, Integer replicaNum, List<Field> fields) { | ||
this.name = name; | ||
this.partitionNum = partitionNum; | ||
this.replicaNum = replicaNum; | ||
this.fields = fields; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Integer getPartitionNum() { | ||
return partitionNum; | ||
} | ||
|
||
public Integer getReplicaNum() { | ||
return replicaNum; | ||
} | ||
|
||
public List<Field> getFields() { | ||
return fields; | ||
} | ||
|
||
static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
static class Builder { | ||
|
||
private String name; | ||
private Integer partitionNum; | ||
private Integer replicaNum; | ||
private List<Field> fields; | ||
|
||
Builder name(String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
|
||
Builder partitionNum(Integer partitionNum) { | ||
this.partitionNum = partitionNum; | ||
return this; | ||
} | ||
|
||
Builder replicaNum(Integer replicaNum) { | ||
this.replicaNum = replicaNum; | ||
return this; | ||
} | ||
|
||
Builder fields(List<Field> fields) { | ||
this.fields = fields; | ||
return this; | ||
} | ||
|
||
CreateSpaceRequest build() { | ||
return new CreateSpaceRequest(name, partitionNum, replicaNum, fields); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...h/src/main/java/dev/langchain4j/community/store/embedding/vearch/CreateSpaceResponse.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,41 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
class CreateSpaceResponse { | ||
|
||
private Integer id; | ||
private String name; | ||
|
||
CreateSpaceResponse() { | ||
} | ||
|
||
CreateSpaceResponse(Integer id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../src/main/java/dev/langchain4j/community/store/embedding/vearch/ListDatabaseResponse.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,41 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
class ListDatabaseResponse { | ||
|
||
private Integer id; | ||
private String name; | ||
|
||
ListDatabaseResponse() { | ||
} | ||
|
||
ListDatabaseResponse(Integer id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...rch/src/main/java/dev/langchain4j/community/store/embedding/vearch/ListSpaceResponse.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,42 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(NON_NULL) | ||
@JsonNaming(SnakeCaseStrategy.class) | ||
public class ListSpaceResponse { | ||
|
||
private Integer id; | ||
private String name; | ||
|
||
ListSpaceResponse() { | ||
|
||
} | ||
|
||
ListSpaceResponse(Integer id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...ity-vearch/src/main/java/dev/langchain4j/community/store/embedding/vearch/MetricType.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,17 @@ | ||
package dev.langchain4j.community.store.embedding.vearch; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* if metric type is not set when searching, it will use the parameter specified when building the space | ||
* | ||
* <p>LangChain4j currently only support {@link MetricType#INNER_PRODUCT}</p> | ||
*/ | ||
public enum MetricType { | ||
|
||
/** | ||
* Inner Product | ||
*/ | ||
@JsonProperty("InnerProduct") | ||
INNER_PRODUCT | ||
} |
Oops, something went wrong.