-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli serve): add a new reranker BCEReranking and github action to…
… build core-library-cli Signed-off-by: bjwswang <bjwswang@gmail.com>
- Loading branch information
Showing
9 changed files
with
221 additions
and
17 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,61 @@ | ||
name: Build KubeAGI Core Library CLI Image | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'libs/**' | ||
workflow_dispatch: | ||
env: | ||
PYTHON_INDEX_URL: https://pypi.org/simple | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set Variable | ||
id: set-env | ||
run: | | ||
TAG=$(git describe --tags --abbrev=0 --match 'v*' 2> /dev/null) || true | ||
if [ -z "$TAG" ]; then | ||
echo "No tag found, use v0.0.1 as default" | ||
TAG=v0.0.1 | ||
fi | ||
echo "TAG=${TAG}" >> $GITHUB_OUTPUT | ||
echo "DATE=$(TZ=Asia/Shanghai date +'%Y%m%d')" >> $GITHUB_OUTPUT | ||
- name: Show Variable | ||
run: echo "varibables ${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
buildkitd-flags: --debug | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 1 | ||
- name: Login to the dockerhub Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
- uses: benjlevesque/short-sha@v2.2 | ||
name: Get short commit sha | ||
id: short-sha | ||
- name: Build and push Evaluation Image | ||
id: push-eval | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
tags: | | ||
kubeagi/core-library-cli:latest | ||
kubeagi/core-library-cli:${{ steps.set-env.outputs.TAG }} | ||
kubeagi/core-library-cli:${{ steps.set-env.outputs.TAG }}-${{ steps.set-env.outputs.DATE }}-${{ steps.short-sha.outputs.sha }} | ||
push: true | ||
build-args: | | ||
PYTHON_INDEX_URL=${{ env.PYTHON_INDEX_URL }} |
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 @@ | ||
name: Test Build KubeAGI Core Library CLI Image | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- 'libs/**' | ||
workflow_dispatch: | ||
env: | ||
PYTHON_INDEX_URL: https://pypi.org/simple | ||
|
||
jobs: | ||
test_image_build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
buildkitd-flags: --debug | ||
config-inline: | | ||
[worker.oci] | ||
max-parallelism = 1 | ||
- name: Set up GCC | ||
uses: egor-tensin/setup-gcc@v1 | ||
with: | ||
version: latest | ||
platform: x64 | ||
- name: Build core library cli image | ||
id: push-worker | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: docker/Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: false | ||
build-args: | | ||
PYTHON_INDEX_URL=${{ env.PYTHON_INDEX_URL }} |
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,27 @@ | ||
ARG PY_VER=3.11 | ||
|
||
# python environment | ||
FROM python:${PY_VER}-slim AS runner | ||
ARG PACKAGE_REGISTRY="mirrors.tuna.tsinghua.edu.cn" | ||
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources | ||
|
||
ENV TZ=Asia/Shanghai | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y tzdata \ | ||
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
&& dpkg-reconfigure --frontend noninteractive tzdata | ||
|
||
# Official: https://pypi.org/simple | ||
ARG PYTHON_INDEX_URL=https://pypi.mirrors.ustc.edu.cn/simple/ | ||
COPY libs /libs | ||
RUN python -m pip install ragas langchain==0.0.1 -i ${PYTHON_INDEX_URL} | ||
WORKDIR /libs/core | ||
RUN pip install -e . -i ${PYTHON_INDEX_URL} | ||
|
||
WORKDIR /libs/cli | ||
RUN pip install -e . -i ${PYTHON_INDEX_URL} | ||
|
||
ENV RERANKING_MODEL_PATH=BAAI/bge-reranker-large | ||
|
||
CMD [ "python","kubeagi_cli/cli.py","serve" ] |
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
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,20 @@ | ||
# Copyright 2024 KubeAGI. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
# TODO | ||
class Whisper: | ||
""" | ||
The Whisper is used to run OpenAI's whisper model | ||
""" |
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