Skip to content

Commit 1d24e0b

Browse files
deafnvjiahueitjtanaa
authored
Release (#1)
Initial release --------- Co-authored-by: Jia Huei Tan <tanjiahuei@gmail.com> Co-authored-by: tjtanaa <tunjian.tan@embeddedllm.com>
1 parent 11f36b8 commit 1d24e0b

File tree

379 files changed

+48230
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+48230
-2
lines changed

.dockerignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.egg-info
6+
.pytest_cache
7+
.ipynb_checkpoints
8+
venv/
9+
*.png
10+
*.jpg
11+
*.npy
12+
*.geojson
13+
*.laz
14+
15+
# Internal references, dependencies, temporary folders & files
16+
# .env
17+
**/__ref__/
18+
/dependencies/
19+
logs/
20+
*.log
21+
/datasets/
22+
/milvus_data/
23+
/vespa*/
24+
25+
# pytest-cov
26+
**/.coverage*
27+
/junit
28+
/htmlcov
29+
/coverage.xml
30+
31+
# pip
32+
**/build/
33+
34+
# OS
35+
thumbs.db
36+
.DS_Store

.env

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# External API keys
2+
OPENAI_API_KEY=
3+
ANTHROPIC_API_KEY=
4+
COHERE_API_KEY=
5+
TOGETHER_API_KEY=
6+
7+
# Service URLs
8+
DOCIO_URL=http://docio:6979/api/docio
9+
UNSTRUCTUREDIO_URL=http://unstructuredio:6989
10+
11+
# Configuration
12+
SERVICE_KEY=
13+
OWL_PORT=6969
14+
OWL_WORKERS=1
15+
OWL_DB_DIR=db
16+
OWL_LOG_DIR=logs
17+
DOCIO_WORKERS=1
18+
DOCIO_DEVICE=cpu
19+
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
20+
RERANKER_MODEL=cross-encoder/ms-marco-TinyBERT-L-2
21+
OWL_CONCURRENT_ROWS_BATCH_SIZE=3
22+
OWL_CONCURRENT_COLS_BATCH_SIZE=5
23+
24+
# Frontend config
25+
FRONTEND_PORT=4000
26+
JAMAI_URL=http://owl:${OWL_PORT}
27+
PUBLIC_JAMAI_URL=

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
max-line-length = 99
3+
select = C,E,F,W,B,B950
4+
extend-ignore = E203,E402,E501,F541,W503,F401
5+
extend-exclude =
6+
.vscode/,
7+
archive/,
8+
build/,
9+
configs/,
10+
dependencies/,
11+
venv/

.gitattributes

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
### https://git-scm.com/docs/gitattributes
2+
3+
# When `text` is set to "auto", the path is marked for automatic end-of-line conversion.
4+
# If Git decides that the content is text, its line endings are converted to LF on checkin.
5+
# When the file has been committed with CRLF, no conversion is done.
6+
# https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Settostringvalueauto
7+
* text=auto eol=lf
8+
9+
# These files are text and should be normalized (Convert crlf => lf)
10+
# Setting the `text` attribute on a path enables end-of-line normalization and marks the path as a text file.
11+
# End-of-line conversion takes place without guessing the content type.
12+
# https://git-scm.com/docs/gitattributes#_text
13+
*.css text
14+
*.html text
15+
*.js text
16+
*.md text
17+
*.py text
18+
*.sh text
19+
20+
# These files are binary and should be left untouched
21+
# `binary` is a built-in macro for `-text` `-diff` (ie unset `text` and `diff`)
22+
# https://git-scm.com/docs/gitattributes#_using_macro_attributes
23+
*.7z binary
24+
*.bin binary
25+
*.cu.o binary
26+
*.db binary
27+
*.doc binary
28+
*.docx binary
29+
*.gz binary
30+
*.jar binary
31+
*.jpeg binary
32+
*.jpg binary
33+
*.npy binary
34+
*.npz binary
35+
*.pcd binary
36+
*.pdf binary
37+
*.pkl binary
38+
*.png binary
39+
*.ppt binary
40+
*.pptx binary
41+
*.pth binary
42+
*.so binary
43+
*.xls binary
44+
*.xlsx binary
45+
*.zip binary
46+
47+
# These files should not be processed by Linguist for language detection on GitHub.com
48+
*.p linguist-detectable=false
49+
*.gz linguist-detectable=false

.github/workflows/ci.yml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
push:
9+
branches:
10+
- main
11+
tags:
12+
- "v*"
13+
14+
jobs:
15+
python_tests:
16+
name: Python unit tests
17+
runs-on: ubuntu-latest-l
18+
strategy:
19+
matrix:
20+
python-version: ["3.10"]
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
#- name: Test API Key
32+
# run: |
33+
# response=$(curl --fail -s -H "Authorization: Bearer ${OPENAI_API_KEY}" https://api.openai.com/v1/engines)
34+
# echo "$response"
35+
# if [ $? -ne 0 ]; then
36+
# echo "API key test failed!"
37+
# exit 1
38+
# fi
39+
# env:
40+
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
41+
42+
- name: Setup
43+
run: |
44+
set -e
45+
cd clients/python
46+
python -m pip install .[all]
47+
48+
- name: Check Docker Version
49+
run: docker version
50+
51+
- name: Check Docker Compose Version
52+
run: docker compose version
53+
54+
- name: Launch services
55+
timeout-minutes: 15
56+
run: |
57+
set -e
58+
export API_DEVICE=cpu
59+
export EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
60+
export RERANKER_MODEL=cross-encoder/ms-marco-TinyBERT-L-2
61+
62+
# Edit .env file
63+
ORGS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 1)
64+
KEYS=$(printenv | grep API_KEY | xargs -I {} echo {} | cut -d '=' -f 2-)
65+
# Convert them into arrays
66+
ORG_ARRAY=($ORGS)
67+
KEY_ARRAY=($KEYS)
68+
# Loop through the ORG_ARRAY
69+
for i in "${!ORG_ARRAY[@]}"; do
70+
# Get the org and key
71+
org="${ORG_ARRAY[$i]}"
72+
key="${KEY_ARRAY[$i]}"
73+
# Replace the org with the key in the .env file
74+
sed -i "s/$org=.*/$org=$key/g" .env
75+
done
76+
77+
docker compose -f docker/compose.cpu.yml up --quiet-pull -d
78+
79+
# Wait for the service to finish starting up
80+
set +e
81+
while true; do
82+
docker ps
83+
response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:${OWL_PORT:-6969}/health)
84+
echo $response
85+
if [ $response -eq 200 ]; then
86+
break
87+
fi
88+
printf "> Waiting for API service ...\n"
89+
sleep 10
90+
done
91+
printf "> DONE\n"
92+
env:
93+
JAMAI_API_KEY: ${{ secrets.JAMAI_API_KEY }}
94+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
95+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
96+
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
97+
TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }}
98+
COMPOSE_DOCKER_CLI_BUILD: 1
99+
DOCKER_BUILDKIT: 1
100+
101+
#- name: Test list models
102+
# run: |
103+
# response=$(curl --fail -s http://localhost:6969/api/v1/models)
104+
# echo "$response"
105+
# if [ $? -ne 0 ]; then
106+
# echo "list models test failed!"
107+
# exit 1
108+
# fi
109+
110+
#- name: Get docker compose logs
111+
# if: always()
112+
# run: |
113+
# docker compose -f docker/compose.cpu.yml logs
114+
115+
- name: Pytest
116+
run: |
117+
set -e
118+
export JAMAI_API_BASE=http://localhost:6969/api
119+
python -m pytest -vv --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov-report=xml clients/python/tests
120+
121+
- name: Upload Pytest Test Results
122+
uses: actions/upload-artifact@v4
123+
with:
124+
name: pytest-results-${{ matrix.python-version }}
125+
path: junit/test-results-${{ matrix.python-version }}.xml
126+
# Use always() to always run this step to publish test results when there are test failures
127+
if: ${{ always() }}
128+
129+
#- name: Generate OpenAPI Json Schema
130+
# run: mkdir -p artifacts && curl http://127.0.0.1:7770/api/openapi.json >> ./artifacts/openapi.json
131+
132+
#- name: Upload OpenAPI Json Schema
133+
# uses: actions/upload-artifact@v4
134+
# with:
135+
# name: openapi-json
136+
# path: artifacts/openapi.json
137+
138+
# readmeio_update:
139+
# needs: python_tests
140+
# name: Push OpenAPI to ReadMe.io
141+
# runs-on: ubuntu-latest-l
142+
# strategy:
143+
# matrix:
144+
# python-version: ["3.10"]
145+
# steps:
146+
# - name: Checkout code
147+
# uses: actions/checkout@v4
148+
149+
# - name: Download OpenAPI Json Schema
150+
# uses: actions/download-artifact@v4
151+
# with:
152+
# name: openapi-json
153+
# path: artifacts
154+
155+
# # - name: Display structure of downloaded files
156+
# # run: ls -R artifacts
157+
158+
# # Run GitHub Action to sync OpenAPI file at ./path-to-file.json
159+
# - name: Update ReadMe API Reference Documentation
160+
# # We recommend specifying a fixed version, i.e. @v8
161+
# # Docs: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#example-using-versioned-actions
162+
# uses: readmeio/rdme@v8
163+
# with:
164+
# rdme: openapi artifacts/openapi.json --key=${{ secrets.README_API_KEY }} --id=${{ secrets.API_DEFINITION_ID }}
165+
166+
# # - name: Generate Stainless SDK
167+
# # uses: stainless-api/upload-openapi-spec-action@main
168+
# # with:
169+
# # stainless_api_key: ${{ secrets.STAINLESS_API_KEY }}
170+
# # input_path: "artifacts/openapi.json"
171+
# # config_path: "ellm.stainless.yaml"
172+
# # project_name: "jamai"

.github/workflows/lint.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Linting Workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
8+
jobs:
9+
python_lint:
10+
name: Python linting and formatting checks
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.10"]
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install linting libraries
26+
run: |
27+
set -e
28+
cd clients/python
29+
python3 -m pip install .[lint]
30+
31+
- name: Check Python files using Black
32+
run: |
33+
set -e
34+
black --check --verbose --diff --config clients/python/pyproject.toml .
35+
36+
- name: Run flake8 lint tests (errors)
37+
run: |
38+
set -e
39+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
41+
- name: Run flake8 lint tests (warnings)
42+
run: |
43+
set -e
44+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=99 --statistics
45+
46+
prettier_lint:
47+
name: Prettier Checks
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: "16" # Specify the Node.js version you want to use
58+
59+
- name: Check files using Prettier
60+
run: |
61+
npm install -g prettier@3.1
62+
prettier --check .

0 commit comments

Comments
 (0)