Skip to content

Commit

Permalink
Merge pull request HamaWhiteGG#121 from HamaWhiteGG/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
HamaWhiteGG authored Oct 7, 2023
2 parents 2058cb6 + fdb5edd commit d664464
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven
name: Maven Build and Test

on:
push:
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/maven-javadoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Maven Generate Javadoc

on:
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Import GPG key
run: |
echo "${{ secrets.GPG_SECRET }}" | gpg --batch --yes --import
env:
GPG_TTY: $(tty)

- name: Install with Maven
run: mvn clean install -DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }}

- name: Build and generate Javadoc
run: mvn javadoc:javadoc

- name: Deploy to gh-pages
run: |
mkdir -p /tmp/javadoc
# create /tmp/javadoc/index.html
echo "<html><head><style>body {font-family: Arial, sans-serif;}h1 {color: #373E4D;}ul {list-style-type: none;}li {margin: 5px 0px;}a {color: #9C6ADE;text-decoration: none;}a:hover {text-decoration: underline;}</style></head><body><h1>API Documentation</h1><ul>" > /tmp/javadoc/index.html
echo "Listing all directories containing target/site/apidocs"
for dir in $(find . -type d -path '*target/site/apidocs'); do
echo "Processing $dir"
parent_dir=$(echo ${dir%/target/site/apidocs} | cut -c 3-)
echo "Processing $parent_dir"
# Create corresponding directory
mkdir -p "/tmp/javadoc/${parent_dir}"
# Copy Javadoc to corresponding directory
cp -R "$dir/"* "/tmp/javadoc/${parent_dir}"
echo "<li><a href='${parent_dir}/index.html'>${parent_dir}</a></li>" >> /tmp/javadoc/index.html
done
echo "</ul></body></html>" >> /tmp/javadoc/index.html
git config --global user.name "HamaWhiteGG"
git config --global user.email "baisongxx@gmail.com"
git checkout --orphan gh-pages
git reset --hard
git clean -df
cp -R /tmp/javadoc/* .
git add .
git commit -m "Update Javadoc" || true
cat << EOF > README.md
# Langchain-Java
Welcome to the Langchain-Java project!

## API Documentation

Our comprehensive API documentation is available at the following link:

[https://hamawhitegg.github.io/langchain-java](https://hamawhitegg.github.io/langchain-java)

This includes detailed information about the various modules, functionalities, and more within our project.

Enjoy exploring Langchain-Java!
EOF
git add README.md
git commit -m "Add README"

# Make sure "Read and write permissions" are enabled in Settings -> Actions -> General -> Workflow permissions
git push origin gh-pages --force
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ This library is aimed at assisting in the development of those types of applicat
The following example can view in the [langchain-example](langchain-examples/src/main/java/com/hw/langchain/examples)

## 2. User cases

- [SQL Chains](langchain-examples/src/main/java/com/hw/langchain/examples/chains/SqlChainExample.java)
- [API Chains](langchain-examples/src/main/java/com/hw/langchain/examples/chains/ApiChainExample.java)
- [QA-Milvus-Text](langchain-examples/src/main/java/com/hw/langchain/examples/chains/MilvusExample.java)
Expand All @@ -28,6 +27,7 @@ The following example can view in the [langchain-example](langchain-examples/src
- [Flink SQL AI](langchain-bigdata/langchain-flink/src/test/java/com/hw/langchain/agents/toolkits/flink/sql/toolkit/FlinkSqlToolkitTest.java)

## 3. Integrations

### 3.1 LLMs
- [OpenAI](langchain-examples/src/main/java/com/hw/langchain/examples/llms/OpenAIExample.java), (support [stream](langchain-examples/src/main/java/com/hw/langchain/examples/llms/StreamOpenAIExample.java))
- [Azure OpenAI](openai-client/src/test/java/com/hw/openai/AzureOpenAiClientTest.java)
Expand All @@ -41,19 +41,21 @@ The following example can view in the [langchain-example](langchain-examples/src
## 4. Quickstart Guide
This tutorial gives you a quick walkthrough about building an end-to-end language model application with LangChain.

View the [Quickstart Guide](https://python.langchain.com/docs/get_started) on the LangChain official website.
The API documentation is available at the following link:
[https://hamawhitegg.github.io/langchain-java](https://hamawhitegg.github.io/langchain-java)

### 4.1 Maven Repository
Prerequisites for building:
* Java 17 or later
* Unix-like environment (we use Linux, Mac OS X)
* Maven (we recommend version 3.8.6 and require at least 3.5.4)

[![Maven Central](https://img.shields.io/maven-central/v/io.github.hamawhitegg/langchain-core)](https://maven-badges.herokuapp.com/maven-central/io.github.hamawhitegg/langchain-core)
```xml
<dependency>
<groupId>io.github.hamawhitegg</groupId>
<artifactId>langchain-core</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions openai-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Java libraries for using OpenAI's GPT APIS.

## Usage

[![Maven Central](https://img.shields.io/maven-central/v/io.github.hamawhitegg/openai-client)](https://maven-badges.herokuapp.com/maven-central/io.github.hamawhitegg/openai-client)
```xml
<dependency>
<groupId>io.github.hamawhitegg</groupId>
<artifactId>openai-client</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
```
* Java 17 or later
Expand Down
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,16 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<locale>en</locale>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<doclint>none</doclint>
<additionalJOptions>
<additionalJOption>-J-Duser.language=en</additionalJOption>
<additionalJOption>-J-Duser.region=US</additionalJOption>
</additionalJOptions>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down

0 comments on commit d664464

Please sign in to comment.