update the git file

This commit is contained in:
YuCheng Hu 2023-01-06 13:27:55 -05:00
parent 3bf8d33cd7
commit 633b877145
13 changed files with 767 additions and 32 deletions

264
.gitignore vendored
View File

@ -1,33 +1,235 @@
# Compiled class file ### Gradle ###
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
!gradle/wrapper/gradle-wrapper.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# IntelliJ Files #
.idea/
*.iml
# Ignore Gradle project-specific cache directory
.gradle .gradle
build/
# Ignore Gradle build output directory # Ignore Gradle GUI config
build gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
### Gradle Patch ###
**/build/
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint

10
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Zeppelin ignored files
/ZeppelinRemoteNotebooks/

14
.idea/compiler.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="openai-j-api" />
<module name="openai-j-client" />
</profile>
</annotationProcessing>
</component>
</project>

14
.idea/encodings.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/openai-j-api/src/filter/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/openai-j-api/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/openai-j-api/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/openai-j-client/src/filter/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/openai-j-client/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/openai-j-client/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/filter/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

35
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="ossez-repo-snapshots" />
<option name="name" value="OSSEZ Private Snapshots" />
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo-releases" />
<option name="name" value="OSSEZ Private Releases" />
<option name="url" value="https://repo.ossez.com/repository/maven-releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="ossez-repo" />
<option name="name" value="Ossez-Repo-Snapshot" />
<option name="url" value="https://repo.ossez.com/repository/maven-snapshots/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.ossez.com/repository/maven-public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

6
.idea/jpa-buddy.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>

12
.idea/php.xml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) [year] [fullname] Copyright (c) 2023 OSSEZ
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

259
README.md Normal file
View File

@ -0,0 +1,259 @@
# Rets-Io
The Rets-Io RETS Client - Java is a library used to access data on RETS compliant servers.
## Links and related projects
| Project | URL | NOTE |
|------------------|----------------------------------------------------------------------------|------------------------|
| jrets | [https://github.com/jpfielding/jrets](https://github.com/jpfielding/jrets) | fork from this proejct |
| CART RETS client | [http://cart.sourceforge.net/](http://cart.sourceforge.net/) | Init submit form 2004 |
# 公众平台
我们建议您通过社区论坛来和我们进行沟通,请关注我们公众平台上的账号
## 微信公众号
![](https://cdn.ossez.com/img/cwikius/cwikius-qr-wechat-search-w400.png)
## 头条号
我们也在头条号上创建了我们的公众号,请扫描下面的 QR 关注我们的头条号。
![](https://cdn.ossez.com/img/cwikius/cwikus-qr-toutiao.png)
## 知乎
请关注我们的知乎https://www.zhihu.com/people/huyuchengus
# Examples
Simple example of a search:
```
public static void main(String[] args) throws MalformedURLException {
//Create a RetsHttpClient (other constructors provide configuration i.e. timeout, gzip capability)
RetsHttpClient httpClient = new CommonsHttpClient();
RetsVersion retsVersion = RetsVersion.RETS_1_7_2;
String loginUrl = "http://theurloftheretsserver.com";
//Create a RetesSession with RetsHttpClient
RetsSession session = new RetsSession(loginUrl, httpClient, retsVersion);
String username = "username";
String password = "password";
//Set method as GET or POST
session.setMethod("POST");
try {
//Login
session.login(username, password);
} catch (RetsException e) {
e.printStackTrace();
}
String sQuery = "(Member_num=.ANY.)";
String sResource = "Property";
String sClass = "Residential";
//Create a SearchRequest
SearchRequest request = new SearchRequest(sResource, sClass, sQuery);
//Select only available fields
String select ="field1,field2,field3,field4,field5";
request.setSelect(select);
//Set request to retrive count if desired
request.setCountFirst();
SearchResultImpl response;
try {
//Execute the search
response= (SearchResultImpl) session.search(request);
//Print out count and columns
int count = response.getCount();
System.out.println("COUNT: " + count);
System.out.println("COLUMNS: " + StringUtils.join(response.getColumns(), "\t"));
//Iterate over, print records
for (int row = 0; row < response.getRowCount(); row++){
System.out.println("ROW"+ row +": " + StringUtils.join(response.getRow(row), "\t"));
}
} catch (RetsException e) {
e.printStackTrace();
}
finally {
if(session != null) {
try {
session.logout();
}
catch(RetsException e) {
e.printStackTrace();
}
}
}
```
Simple example making a GetObjectRequest:
```
public static void main(String[] args) throws MalformedURLException {
//Create a RetsHttpClient (other constructors provide configuration i.e. timeout, gzip capability)
RetsHttpClient httpClient = new CommonsHttpClient();
RetsVersion retsVersion = RetsVersion.RETS_1_7_2;
String loginUrl = "http://theurloftheretsserver.com";
//Create a RetesSession with RetsHttpClient
RetsSession session = new RetsSession(loginUrl, httpClient, retsVersion);
String username = "username";
String password = "password";
try {
//Login
session.login(username, password);
} catch (RetsException e) {
e.printStackTrace();
}
String sResource = "Property";
String objType = "Photo";
String seqNum = "*"; // * denotes get all pictures associated with id (from Rets Spec)
List<String> idsList = Arrays.asList("331988","152305","243374");
try {
//Create a GetObjectRequeset
GetObjectRequest req = new GetObjectRequest(sResource, objType);
//Add the list of ids to request on (ids can be determined from records)
Iterator<String> idsIter = idsList.iterator();
while(idsIter.hasNext()) {
req.addObject(idsIter.next(), seqNum);
}
//Execute the retrieval of objects
Iterator<SingleObjectResponse> singleObjectResponseIter = session.getObject(req).iterator();
//Iterate over each Object
while (singleObjectResponseIter.hasNext()) {
SingleObjectResponse sor = (SingleObjectResponse)singleObjectResponseIter.next();
//Retrieve in info and print
String type = sor.getType();
String contentID = sor.getContentID();
String objectID = sor.getObjectID();
String description = sor.getDescription();
String location = sor.getLocation();
InputStream is = sor.getInputStream();
System.out.print("type:" + type);
System.out.print(" ,contentID:" + contentID);
System.out.print(" ,objectID:" + objectID);
System.out.println(" ,description:" + description);
System.out.println("location:" + location);
//Download object
try {
String dest = "/path/of/dowload/loaction";
int size = is.available();
String filename = dest + contentID +"-" + objectID + ".jpeg";
OutputStream out = new FileOutputStream(new File(filename));
int read = 0;
byte[] bytes = new byte[1024];
while ((read = is.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
is.close();
out.flush();
out.close();
System.out.println("New file with size " + size + " created: " + filename);
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
} catch (RetsException e) {
e.printStackTrace();
}
finally {
if(session != null) {
try {
session.logout();
}
catch (RetsException e) {
e.printStackTrace();
}
}
}
}
```
Example of Geting Metadata:
```
public static void main(String[] args) throws MalformedURLException {
//Create a RetsHttpClient (other constructors provide configuration i.e. timeout, gzip capability)
RetsHttpClient httpClient = new CommonsHttpClient();
RetsVersion retsVersion = RetsVersion.RETS_1_7_2;
String loginUrl = "http://theurloftheretsserver.com";
//Create a RetesSession with RetsHttpClient
RetsSession session = new RetsSession(loginUrl, httpClient, retsVersion);
String username = "username";
String password = "password";
//Set method as GET or POST
session.setMethod("POST");
try {
//Login
session.login(username, password);
} catch (RetsException e) {
e.printStackTrace();
}
try {
MSystem system = session.getMetadata().getSystem();
System.out.println(
"SYSTEM: " + system.getSystemID() +
" - " + system.getSystemDescription());
for(MResource resource: system.getMResources()) {
System.out.println(
" RESOURCE: " + resource.getResourceID());
for(MClass classification: resource.getMClasses()) {
System.out.println(
" CLASS: " + classification.getClassName() +
" - " + classification.getDescription());
}
}
}
catch (RetsException e) {
e.printStackTrace();
}
finally {
if(session != null) {
try {
session.logout();
}
catch(RetsException e) {
e.printStackTrace();
}
}
}
}
```
## License
[USRealEstate RETS Client is licensed under the MIT License](https://github.com/ossez-com/reoc-mls-client/blob/master/LICENSE)

View File

@ -0,0 +1,101 @@
package com.ossez.openai.completion;
import java.util.List;
import java.util.Map;
public class CompletionRequestBuilder {
private String model;
private String prompt;
private Integer maxTokens;
private Double temperature;
private Double topP;
private Integer n;
private Boolean stream;
private Integer logprobs;
private Boolean echo;
private List<String> stop;
private Double presencePenalty;
private Double frequencyPenalty;
private Integer bestOf;
private Map<String, Integer> logitBias;
private String user;
public CompletionRequestBuilder setModel(String model) {
this.model = model;
return this;
}
public CompletionRequestBuilder setPrompt(String prompt) {
this.prompt = prompt;
return this;
}
public CompletionRequestBuilder setMaxTokens(Integer maxTokens) {
this.maxTokens = maxTokens;
return this;
}
public CompletionRequestBuilder setTemperature(Double temperature) {
this.temperature = temperature;
return this;
}
public CompletionRequestBuilder setTopP(Double topP) {
this.topP = topP;
return this;
}
public CompletionRequestBuilder setN(Integer n) {
this.n = n;
return this;
}
public CompletionRequestBuilder setStream(Boolean stream) {
this.stream = stream;
return this;
}
public CompletionRequestBuilder setLogprobs(Integer logprobs) {
this.logprobs = logprobs;
return this;
}
public CompletionRequestBuilder setEcho(Boolean echo) {
this.echo = echo;
return this;
}
public CompletionRequestBuilder setStop(List<String> stop) {
this.stop = stop;
return this;
}
public CompletionRequestBuilder setPresencePenalty(Double presencePenalty) {
this.presencePenalty = presencePenalty;
return this;
}
public CompletionRequestBuilder setFrequencyPenalty(Double frequencyPenalty) {
this.frequencyPenalty = frequencyPenalty;
return this;
}
public CompletionRequestBuilder setBestOf(Integer bestOf) {
this.bestOf = bestOf;
return this;
}
public CompletionRequestBuilder setLogitBias(Map<String, Integer> logitBias) {
this.logitBias = logitBias;
return this;
}
public CompletionRequestBuilder setUser(String user) {
this.user = user;
return this;
}
public CompletionRequest createCompletionRequest() {
return new CompletionRequest(model, prompt, maxTokens, temperature, topP, n, stream, logprobs, echo, stop, presencePenalty, frequencyPenalty, bestOf, logitBias, user);
}
}

View File

@ -0,0 +1,46 @@
package com.ossez.openai.edit;
import org.checkerframework.checker.nullness.qual.NonNull;
public class EditRequestBuilder {
private String model;
private String input;
private @NonNull String instruction;
private Integer n;
private Double temperature;
private Double topP;
public EditRequestBuilder setModel(String model) {
this.model = model;
return this;
}
public EditRequestBuilder setInput(String input) {
this.input = input;
return this;
}
public EditRequestBuilder setInstruction(@NonNull String instruction) {
this.instruction = instruction;
return this;
}
public EditRequestBuilder setN(Integer n) {
this.n = n;
return this;
}
public EditRequestBuilder setTemperature(Double temperature) {
this.temperature = temperature;
return this;
}
public EditRequestBuilder setTopP(Double topP) {
this.topP = topP;
return this;
}
public EditRequest createEditRequest() {
return new EditRequest(model, input, instruction, n, temperature, topP);
}
}

View File

@ -0,0 +1,30 @@
package com.ossez.openai.embedding;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
public class EmbeddingRequestBuilder {
private String model;
private @NonNull List<String> input;
private String user;
public EmbeddingRequestBuilder setModel(String model) {
this.model = model;
return this;
}
public EmbeddingRequestBuilder setInput(@NonNull List<String> input) {
this.input = input;
return this;
}
public EmbeddingRequestBuilder setUser(String user) {
this.user = user;
return this;
}
public EmbeddingRequest createEmbeddingRequest() {
return new EmbeddingRequest(model, input, user);
}
}