-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add spring boot starter of xinference (#38)
* add spring boot starter of xinference * add spring boot starter of xinference * switch testcontainers * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * Update spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/src/main/java/dev/langchain4j/community/xinference/spring/AutoConfig.java Co-authored-by: Martin7-1 <[email protected]> * add spring boot starter of xinference --------- Co-authored-by: lixw <> Co-authored-by: Martin7-1 <[email protected]>
- Loading branch information
1 parent
3155af0
commit da54df5
Showing
16 changed files
with
1,808 additions
and
1 deletion.
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
99 changes: 99 additions & 0 deletions
99
spring-boot-starters/langchain4j-community-xinference-spring-boot-starter/pom.xml
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,99 @@ | ||
<?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-spring-boot-starters</artifactId> | ||
<version>1.0.0-alpha1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>langchain4j-community-xinference-spring-boot-starter</artifactId> | ||
<name>LangChain4j :: Community :: Spring Boot starter :: Xinference</name> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>dev.langchain4j</groupId> | ||
<artifactId>langchain4j-community-xinference</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-autoconfigure-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- needed to generate automatic metadata about available config properties --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<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> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.honton.chas</groupId> | ||
<artifactId>license-maven-plugin</artifactId> | ||
<configuration> | ||
<acceptableLicenses combine.children="append"> | ||
<!-- due to excludes/includes above --> | ||
<license> | ||
<name>Eclipse Public License</name> | ||
<url>http://www.eclipse.org/legal/epl-v10.html</url> | ||
</license> | ||
<license> | ||
<name>GNU Lesser General Public License</name> | ||
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</url> | ||
</license> | ||
</acceptableLicenses> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
186 changes: 186 additions & 0 deletions
186
...tarter/src/main/java/dev/langchain4j/community/xinference/spring/ChatModelProperties.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,186 @@ | ||
package dev.langchain4j.community.xinference.spring; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.NestedConfigurationProperty; | ||
|
||
@ConfigurationProperties(prefix = ChatModelProperties.PREFIX) | ||
public class ChatModelProperties { | ||
static final String PREFIX = "langchain4j.community.xinference.chat-model"; | ||
private String baseUrl; | ||
private String apiKey; | ||
private String modelName; | ||
private Double temperature; | ||
private Double topP; | ||
private List<String> stop; | ||
private Integer maxTokens; | ||
private Double presencePenalty; | ||
private Double frequencyPenalty; | ||
private Integer seed; | ||
private String user; | ||
private Object toolChoice; | ||
private Boolean parallelToolCalls; | ||
private Integer maxRetries; | ||
private Duration timeout; | ||
|
||
@NestedConfigurationProperty | ||
private ProxyProperties proxy; | ||
|
||
private Boolean logRequests; | ||
private Boolean logResponses; | ||
private Map<String, String> customHeaders; | ||
|
||
public String getBaseUrl() { | ||
return baseUrl; | ||
} | ||
|
||
public void setBaseUrl(final String baseUrl) { | ||
this.baseUrl = baseUrl; | ||
} | ||
|
||
public String getApiKey() { | ||
return apiKey; | ||
} | ||
|
||
public void setApiKey(final String apiKey) { | ||
this.apiKey = apiKey; | ||
} | ||
|
||
public String getModelName() { | ||
return modelName; | ||
} | ||
|
||
public void setModelName(final String modelName) { | ||
this.modelName = modelName; | ||
} | ||
|
||
public Double getTemperature() { | ||
return temperature; | ||
} | ||
|
||
public void setTemperature(final Double temperature) { | ||
this.temperature = temperature; | ||
} | ||
|
||
public Double getTopP() { | ||
return topP; | ||
} | ||
|
||
public void setTopP(final Double topP) { | ||
this.topP = topP; | ||
} | ||
|
||
public List<String> getStop() { | ||
return stop; | ||
} | ||
|
||
public void setStop(final List<String> stop) { | ||
this.stop = stop; | ||
} | ||
|
||
public Integer getMaxTokens() { | ||
return maxTokens; | ||
} | ||
|
||
public void setMaxTokens(final Integer maxTokens) { | ||
this.maxTokens = maxTokens; | ||
} | ||
|
||
public Double getPresencePenalty() { | ||
return presencePenalty; | ||
} | ||
|
||
public void setPresencePenalty(final Double presencePenalty) { | ||
this.presencePenalty = presencePenalty; | ||
} | ||
|
||
public Double getFrequencyPenalty() { | ||
return frequencyPenalty; | ||
} | ||
|
||
public void setFrequencyPenalty(final Double frequencyPenalty) { | ||
this.frequencyPenalty = frequencyPenalty; | ||
} | ||
|
||
public Integer getSeed() { | ||
return seed; | ||
} | ||
|
||
public void setSeed(final Integer seed) { | ||
this.seed = seed; | ||
} | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(final String user) { | ||
this.user = user; | ||
} | ||
|
||
public Object getToolChoice() { | ||
return toolChoice; | ||
} | ||
|
||
public void setToolChoice(final Object toolChoice) { | ||
this.toolChoice = toolChoice; | ||
} | ||
|
||
public Boolean getParallelToolCalls() { | ||
return parallelToolCalls; | ||
} | ||
|
||
public void setParallelToolCalls(final Boolean parallelToolCalls) { | ||
this.parallelToolCalls = parallelToolCalls; | ||
} | ||
|
||
public Integer getMaxRetries() { | ||
return maxRetries; | ||
} | ||
|
||
public void setMaxRetries(final Integer maxRetries) { | ||
this.maxRetries = maxRetries; | ||
} | ||
|
||
public Duration getTimeout() { | ||
return timeout; | ||
} | ||
|
||
public void setTimeout(final Duration timeout) { | ||
this.timeout = timeout; | ||
} | ||
|
||
public ProxyProperties getProxy() { | ||
return proxy; | ||
} | ||
|
||
public void setProxy(final ProxyProperties proxy) { | ||
this.proxy = proxy; | ||
} | ||
|
||
public Boolean getLogRequests() { | ||
return logRequests; | ||
} | ||
|
||
public void setLogRequests(final Boolean logRequests) { | ||
this.logRequests = logRequests; | ||
} | ||
|
||
public Boolean getLogResponses() { | ||
return logResponses; | ||
} | ||
|
||
public void setLogResponses(final Boolean logResponses) { | ||
this.logResponses = logResponses; | ||
} | ||
|
||
public Map<String, String> getCustomHeaders() { | ||
return customHeaders; | ||
} | ||
|
||
public void setCustomHeaders(final Map<String, String> customHeaders) { | ||
this.customHeaders = customHeaders; | ||
} | ||
} |
Oops, something went wrong.