Skip to content

Commit 9b65944

Browse files
authored
Merge pull request #2950 from janhq/dev
Release/0.4.14 to main
2 parents ac33358 + 611a361 commit 9b65944

File tree

18 files changed

+369
-58
lines changed

18 files changed

+369
-58
lines changed

.github/workflows/jan-electron-build.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ jobs:
2525
GITHUB_REF: ${{ github.ref }}
2626
- name: Create Draft Release
2727
id: create_release
28-
uses: actions/create-release@v1
29-
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
uses: softprops/action-gh-release@v2
3129
with:
3230
tag_name: ${{ github.ref_name }}
33-
release_name: "${{ env.VERSION }}"
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
name: "${{ env.VERSION }}"
3433
draft: true
3534
prerelease: false
3635

.github/workflows/jan-openai-api-test.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Test - OpenAI API Pytest collection
22
on:
33
workflow_dispatch:
4+
inputs:
5+
endpoints:
6+
description: 'comma-separated list (see available at endpoints_mapping.json e.g. GET /users,POST /transform)'
7+
required: false
8+
default: all
9+
type: string
10+
411
push:
512
branches:
613
- main
@@ -38,11 +45,11 @@ jobs:
3845
rm -rf ~/jan
3946
make clean
4047
41-
- name: install dependencies
48+
- name: Install dependencies
4249
run: |
4350
npm install -g @stoplight/prism-cli
4451
45-
- name: create python virtual environment and run test
52+
- name: Create python virtual environment and run test
4653
run: |
4754
python3 -m venv /tmp/jan
4855
source /tmp/jan/bin/activate
@@ -65,10 +72,14 @@ jobs:
6572
6673
# Append to conftest.py
6774
cat ../docs/tests/conftest.py >> tests/conftest.py
68-
75+
cat ../docs/tests/endpoints_mapping.json >> tests/endpoints_mapping.json
76+
6977
# start mock server and run test then stop mock server
70-
prism mock ../docs/openapi/jan.yaml > prism.log & prism_pid=$! && pytest --reportportal --html=report.html && kill $prism_pid
78+
prism mock ../docs/openapi/jan.yaml > prism.log & prism_pid=$! &&
79+
pytest --endpoint "$ENDPOINTS" --reportportal --html=report.html && kill $prism_pid
7180
deactivate
81+
env:
82+
ENDPOINTS: ${{ github.event.inputs.endpoints }}
7283

7384
- name: Upload Artifact
7485
uses: actions/upload-artifact@v2
@@ -79,7 +90,7 @@ jobs:
7990
openai-python/assets
8091
openai-python/prism.log
8192
82-
- name: clean up
93+
- name: Clean up
8394
if: always()
8495
run: |
8596
rm -rf /tmp/jan

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Jan - Bring AI to your Desktop
1+
# Jan - Turn your computer into an AI computer
22

33
![Jan banner](https://github.com/janhq/jan/assets/89722390/35daac7d-b895-487c-a6ac-6663daaad78e)
44

@@ -19,13 +19,14 @@
1919
- <a href="https://discord.gg/AsJ8krTT3N">Discord</a>
2020
</p>
2121

22-
> ⚠️ **Jan is currently in Development**: Expect breaking changes and bugs!
22+
>[!Warning]
23+
>**Jan is currently in Development**: Expect breaking changes and bugs!
2324
2425
Jan is an open-source ChatGPT alternative that runs 100% offline on your computer.
2526

2627
**Jan runs on any hardware.** From PCs to multi-GPU clusters, Jan supports universal architectures:
2728

28-
- [x] Nvidia GPUs (fast)
29+
- [x] NVIDIA GPUs (fast)
2930
- [x] Apple M-series (fast)
3031
- [x] Apple Intel
3132
- [x] Linux Debian
@@ -57,7 +58,7 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
5758
<td style="text-align:center">
5859
<a href='https://app.jan.ai/download/latest/mac-arm64'>
5960
<img src='https://github.com/janhq/docs/blob/main/static/img/mac.png' style="height:15px; width: 15px" />
60-
<b>M1/M2</b>
61+
<b>M1/M2/M3/M4</b>
6162
</a>
6263
</td>
6364
<td style="text-align:center">
@@ -90,7 +91,7 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
9091
<td style="text-align:center">
9192
<a href='https://app.jan.ai/download/nightly/mac-arm64'>
9293
<img src='https://github.com/janhq/docs/blob/main/static/img/mac.png' style="height:15px; width: 15px" />
93-
<b>M1/M2</b>
94+
<b>M1/M2/M3/M4</b>
9495
</a>
9596
</td>
9697
<td style="text-align:center">

docs/tests/conftest.py

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
1+
import json
2+
3+
4+
def pytest_addoption(parser):
5+
parser.addoption(
6+
"--endpoint", action="store", default="all", help="my option: endpoints"
7+
)
8+
9+
10+
def pytest_configure(config):
11+
config.addinivalue_line(
12+
"markers", "endpoint(endpoint): this mark select the test based on endpoint"
13+
)
14+
15+
16+
def pytest_runtest_setup(item):
17+
getoption = item.config.getoption("--endpoint").split(",")
18+
if getoption not in (["all"], [''], [""]):
19+
endpoint_names = [mark.args[0] for mark in item.iter_markers(name="endpoint")]
20+
if not endpoint_names or not set(getoption).intersection(set(endpoint_names)):
21+
pytest.skip("Test skipped because endpoint is {!r}".format(endpoint_names))
22+
23+
124
def pytest_collection_modifyitems(items):
25+
# load the JSON file
26+
with open("tests/endpoints_mapping.json", "r") as json_file:
27+
endpoints_file_mapping = json.load(json_file)
28+
29+
# create a dictionary to map filenames to endpoints
30+
filename_to_endpoint = {}
31+
for endpoint, files in endpoints_file_mapping.items():
32+
for filename in files:
33+
filename_to_endpoint[filename] = endpoint
34+
35+
# add the markers based on the JSON file
236
for item in items:
3-
# add the name of the file (without extension) as a marker
4-
filename = item.nodeid.split("::")[0].split("/")[-1].replace(".py", "")
5-
marker = pytest.mark.file(filename)
6-
item.add_marker(marker)
37+
# map the name of the file to endpoint, else use default value
38+
filename = item.fspath.basename
39+
marker = filename_to_endpoint.get(filename, filename)
40+
item.add_marker(pytest.mark.endpoint(marker, filename=filename))

docs/tests/endpoints_mapping.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"/embeddings": [
3+
"test_embedding.py"
4+
],
5+
"/audio/translations": [
6+
"test_translations.py"
7+
],
8+
"/audio/transcriptions": [
9+
"test_transcriptions.py"
10+
],
11+
"/moderations": [
12+
"test_moderations.py"
13+
],
14+
"/images/generations": [
15+
"test_images.py"
16+
],
17+
"/batches": [
18+
"test_batches.py"
19+
],
20+
"/vector_stores": [
21+
"test_vector_stores.py"
22+
],
23+
"/fine_tuning/jobs": [
24+
"test_jobs.py",
25+
"test_checkpoints.py"
26+
],
27+
"/assistants": [
28+
"test_assistants.py"
29+
],
30+
"/threads/{thread_id}/runs": [
31+
"test_runs.py"
32+
],
33+
"/threads/{thread_id}/runs/{run_id}/steps": [
34+
"test_steps.py"
35+
],
36+
"/vector_stores/{vector_store_id}/file_batches": [
37+
"test_file_batches.py"
38+
],
39+
"/messages": [
40+
"test_messages.py"
41+
],
42+
"/vector_stores/{vector_store_id}/files": [
43+
"test_files.py"
44+
],
45+
"/chat/completions": [
46+
"test_completions.py"
47+
],
48+
"/threads": [
49+
"test_threads.py"
50+
],
51+
"/audio/speech": [
52+
"test_speech.py"
53+
],
54+
"/models": [
55+
"test_models.py"
56+
],
57+
"native_client_sdk_only": [
58+
"test_streaming.py"
59+
],
60+
"utils": [
61+
"test_response.py",
62+
"test_client.py",
63+
"test_extract_files.py",
64+
"test_typing.py",
65+
"test_legacy_response.py",
66+
"test_module_client.py",
67+
"test_old_api.py",
68+
"test_proxy.py",
69+
"test_qs.py",
70+
"test_required_args.py",
71+
"test_transform.py",
72+
"test_azure.py",
73+
"test_deepcopy.py"
74+
]
75+
}

electron/sign.js

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
const { exec } = require('child_process')
22

3+
function execCommandWithRetry(command, retries = 3) {
4+
return new Promise((resolve, reject) => {
5+
const execute = (attempt) => {
6+
exec(command, (error, stdout, stderr) => {
7+
if (error) {
8+
console.error(`Error: ${error}`)
9+
if (attempt < retries) {
10+
console.log(`Retrying... Attempt ${attempt + 1}`)
11+
execute(attempt + 1)
12+
} else {
13+
return reject(error)
14+
}
15+
} else {
16+
console.log(`stdout: ${stdout}`)
17+
console.error(`stderr: ${stderr}`)
18+
resolve()
19+
}
20+
})
21+
}
22+
execute(0)
23+
})
24+
}
25+
326
function sign({
427
path,
528
name,
@@ -13,16 +36,9 @@ function sign({
1336
}) {
1437
return new Promise((resolve, reject) => {
1538
const command = `azuresigntool.exe sign -kvu "${certUrl}" -kvi "${clientId}" -kvt "${tenantId}" -kvs "${clientSecret}" -kvc "${certName}" -tr "${timestampServer}" -v "${path}"`
16-
17-
exec(command, (error, stdout, stderr) => {
18-
if (error) {
19-
console.error(`Error: ${error}`)
20-
return reject(error)
21-
}
22-
console.log(`stdout: ${stdout}`)
23-
console.error(`stderr: ${stderr}`)
24-
resolve()
25-
})
39+
execCommandWithRetry(command)
40+
.then(resolve)
41+
.catch(reject)
2642
})
2743
}
2844

@@ -34,15 +50,20 @@ exports.default = async function (options) {
3450
const certName = process.env.AZURE_CERT_NAME
3551
const timestampServer = 'http://timestamp.globalsign.com/tsa/r6advanced1'
3652

37-
await sign({
38-
path: options.path,
39-
name: 'jan-win-x64',
40-
certUrl,
41-
clientId,
42-
tenantId,
43-
clientSecret,
44-
certName,
45-
timestampServer,
46-
version: options.version,
47-
})
53+
try {
54+
await sign({
55+
path: options.path,
56+
name: 'jan-win-x64',
57+
certUrl,
58+
clientId,
59+
tenantId,
60+
clientSecret,
61+
certName,
62+
timestampServer,
63+
version: options.version,
64+
})
65+
} catch (error) {
66+
console.error('Failed to sign after 3 attempts:', error)
67+
process.exit(1)
68+
}
4869
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.7
1+
0.4.9

extensions/inference-nitro-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@janhq/inference-cortex-extension",
33
"productName": "Cortex Inference Engine",
4-
"version": "1.0.7",
4+
"version": "1.0.10",
55
"description": "This extension embeds cortex.cpp, a lightweight inference engine written in C++. See https://nitro.jan.ai.\nAdditional dependencies could be installed to run without Cuda Toolkit installation.",
66
"main": "dist/index.js",
77
"node": "dist/node/index.cjs.js",
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"sources": [
3+
{
4+
"filename": "aya-23-35B-Q4_K_M.gguf",
5+
"url": "https://huggingface.co/bartowski/aya-23-35B-GGUF/resolve/main/aya-23-35B-Q4_K_M.gguf"
6+
}
7+
],
8+
"id": "aya-23-35b",
9+
"object": "model",
10+
"name": "Aya 23 35B Q4",
11+
"version": "1.0",
12+
"description": "Aya 23 can talk upto 23 languages fluently.",
13+
"format": "gguf",
14+
"settings": {
15+
"ctx_len": 8192,
16+
"prompt_template": "<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{system_prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",
17+
"llama_model_path": "aya-23-35B-Q4_K_M.gguf",
18+
"ngl": 40
19+
},
20+
"parameters": {
21+
"temperature": 0.7,
22+
"top_p": 0.95,
23+
"stream": true,
24+
"max_tokens": 8192,
25+
"frequency_penalty": 0,
26+
"presence_penalty": 0,
27+
"stop": ["<|END_OF_TURN_TOKEN|>"]
28+
},
29+
"metadata": {
30+
"author": "CohereForAI",
31+
"tags": ["34B", "Finetuned"],
32+
"size": 21556982144
33+
},
34+
"engine": "nitro"
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"sources": [
3+
{
4+
"filename": "aya-23-8B-Q4_K_M.gguf",
5+
"url": "https://huggingface.co/bartowski/aya-23-8B-GGUF/resolve/main/aya-23-8B-Q4_K_M.gguf"
6+
}
7+
],
8+
"id": "aya-23-8b",
9+
"object": "model",
10+
"name": "Aya 23 8B Q4",
11+
"version": "1.0",
12+
"description": "Aya 23 can talk upto 23 languages fluently.",
13+
"format": "gguf",
14+
"settings": {
15+
"ctx_len": 8192,
16+
"prompt_template": "<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>{system_prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|USER_TOKEN|>{prompt}<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>",
17+
"llama_model_path": "aya-23-8B-Q4_K_M.gguf",
18+
"ngl": 32
19+
},
20+
"parameters": {
21+
"temperature": 0.7,
22+
"top_p": 0.95,
23+
"stream": true,
24+
"max_tokens": 8192,
25+
"frequency_penalty": 0,
26+
"presence_penalty": 0,
27+
"stop": ["<|END_OF_TURN_TOKEN|>"]
28+
},
29+
"metadata": {
30+
"author": "CohereForAI",
31+
"tags": ["7B", "Finetuned","Featured"],
32+
"size": 5056982144
33+
},
34+
"engine": "nitro"
35+
}

0 commit comments

Comments
 (0)