persianeval 0.1.2__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {persianeval-0.1.2 → persianeval-0.2.0}/.gitignore +4 -1
- {persianeval-0.1.2 → persianeval-0.2.0}/CHANGELOG.md +25 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/PKG-INFO +24 -19
- {persianeval-0.1.2 → persianeval-0.2.0}/README.md +23 -18
- persianeval-0.2.0/docs/assets/social_preview.png +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/pyproject.toml +1 -1
- persianeval-0.2.0/results/README.md +13 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/cli.py +3 -1
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/harness/providers.py +42 -3
- {persianeval-0.1.2 → persianeval-0.2.0}/tests/test_runner.py +38 -0
- persianeval-0.1.2/results/README.md +0 -1
- {persianeval-0.1.2 → persianeval-0.2.0}/LICENSE +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/adding_a_task.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/adr/0001-task-design.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/adr/0002-scoring-policy.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/adr/0003-leaderboard-freshness.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/assets/banner.svg +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/docs/methodology.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/common.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_bias.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_code.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_cultural.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_rag.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_reading.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_reasoning.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_spelling.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/gen_translation.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/scripts/generate_data/run_all.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/README.md +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/SHA256SUMS +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/bias_detection.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/code_with_persian_comments.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/cultural_knowledge.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/rag_faithfulness.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/reading_comprehension.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/reasoning.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/spelling.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/translation_fa_en.jsonl +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/harness/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/harness/results.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/harness/runner.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/harness/scorers.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/leaderboard/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/leaderboard/generate.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/leaderboard/templates/index.html.j2 +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/py.typed +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/__init__.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/base.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/bias_detection.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/code_with_persian_comments.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/cultural_knowledge.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/rag_faithfulness.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/reading_comprehension.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/reasoning.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/spelling.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/tasks/translation_fa_en.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/tests/test_data_integrity.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/tests/test_scorers.py +0 -0
- {persianeval-0.1.2 → persianeval-0.2.0}/tests/test_tasks.py +0 -0
|
@@ -15,10 +15,13 @@ venv/
|
|
|
15
15
|
coverage.xml
|
|
16
16
|
htmlcov/
|
|
17
17
|
|
|
18
|
-
# PersianEval runtime artifacts
|
|
18
|
+
# PersianEval runtime artifacts: caches and parquet files are run-local, but
|
|
19
|
+
# committed result JSONs are deliberate — they are the audit trail behind the
|
|
20
|
+
# leaderboard and the fallback the site_only workflow deploy publishes from.
|
|
19
21
|
.persianeval_cache/
|
|
20
22
|
results/*
|
|
21
23
|
!results/README.md
|
|
24
|
+
!results/*.json
|
|
22
25
|
|
|
23
26
|
# OS / editor
|
|
24
27
|
.DS_Store
|
|
@@ -4,6 +4,30 @@ All notable changes to PersianEval are documented here.
|
|
|
4
4
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
5
5
|
and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.2.0] - 2026-11-25
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `zai` provider: evaluate GLM models through Z.ai's OpenAI-compatible Chat
|
|
12
|
+
Completions endpoint (`ZAI_API_KEY` / `ZAI_BASE_URL`, plus the usual
|
|
13
|
+
`--base-url` override). It inherits the OpenAI request/response handling
|
|
14
|
+
and the shared rate-limiter/retry plumbing, and is tested offline like the
|
|
15
|
+
other providers.
|
|
16
|
+
- First published leaderboard run: GLM-4-Plus (Z.ai hosted API) over the
|
|
17
|
+
weekly seeded subsample (20 items per task, seed 202648, ISO week 48).
|
|
18
|
+
Seven of the eight tasks completed; `code_with_persian_comments` was cut
|
|
19
|
+
short by the API's rate limit and stays pending, so its table cell shows
|
|
20
|
+
a dash until a re-run lands.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Result JSONs from published runs are now committed under `results/` as the
|
|
25
|
+
audit trail behind `leaderboard/data.json` (parquet files and caches stay
|
|
26
|
+
git-ignored). The `site_only=true` dispatch of the leaderboard workflow
|
|
27
|
+
builds the published page from these committed files.
|
|
28
|
+
- README leaderboard status section now describes the actual run instead of
|
|
29
|
+
the empty-pipeline state.
|
|
30
|
+
|
|
7
31
|
## [0.1.2] - 2026-11-23
|
|
8
32
|
|
|
9
33
|
### Fixed
|
|
@@ -58,6 +82,7 @@ Initial public release.
|
|
|
58
82
|
- **Docs**: bilingual README/methodology/CONTRIBUTING, task-authoring guide,
|
|
59
83
|
three ADRs, CITATION.cff, Code of Conduct.
|
|
60
84
|
|
|
85
|
+
[0.2.0]: https://github.com/Abolfazlrwm/persianeval/releases/tag/v0.2.0
|
|
61
86
|
[0.1.2]: https://github.com/Abolfazlrwm/persianeval/releases/tag/v0.1.2
|
|
62
87
|
[0.1.1]: https://github.com/Abolfazlrwm/persianeval/releases/tag/v0.1.1
|
|
63
88
|
[0.1.0]: https://github.com/Abolfazlrwm/persianeval/releases/tag/v0.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: persianeval
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: PersianEval: the first serious open-source benchmark for evaluating LLMs on Persian (Farsi) — 8 tasks, reproducible async harness, weekly leaderboard.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Abolfazlrwm/persianeval
|
|
6
6
|
Project-URL: Repository, https://github.com/Abolfazlrwm/persianeval
|
|
@@ -90,7 +90,7 @@ prompts, judge prompts, scores) is Apache-2.0 and open.
|
|
|
90
90
|
|
|
91
91
|
```bash
|
|
92
92
|
pip install persianeval
|
|
93
|
-
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY / local Ollama
|
|
93
|
+
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY / ZAI_API_KEY / local Ollama
|
|
94
94
|
persianeval tasks # list the 8 tasks
|
|
95
95
|
persianeval run --task reasoning --provider openai --model gpt-4o-mini --rpm 60
|
|
96
96
|
persianeval leaderboard --results-dir results --out leaderboard # static site
|
|
@@ -123,15 +123,17 @@ regenerate weekly by evaluating a rotating seeded sample of open-source models
|
|
|
123
123
|
(Qwen 2.5, Llama 3.1, Gemma 2, Aya Expanse) through local Ollama runners on GitHub-hosted
|
|
124
124
|
CPU runners.
|
|
125
125
|
|
|
126
|
-
**Status:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
**Status: first real run published (2026-11-25).** GLM-4-Plus (Z.ai hosted API) was
|
|
127
|
+
scored by the same harness on the weekly seeded subsample (20 items per task, seed
|
|
128
|
+
202648 = ISO week 48): overall **82.9**, with spelling, RAG faithfulness and bias at
|
|
129
|
+
100, reading comprehension 90, cultural knowledge 80, reasoning and translation 55.
|
|
130
|
+
Judge-scored tasks are self-judged by the model under evaluation (ADR 0002), so read
|
|
131
|
+
those numbers as directional. The `code_with_persian_comments` run is pending — the
|
|
132
|
+
API's rate limit cut the run short; it will be appended on a re-run and its table cell
|
|
133
|
+
shows a dash until then. Every published score is auditable: the per-item result files
|
|
134
|
+
are committed under [`results/`](results/). The open-source Ollama models (Qwen 2.5,
|
|
135
|
+
Llama 3.1, Gemma 2, Aya Expanse) join the table once a weekly CPU run fits the runner
|
|
136
|
+
budget again.
|
|
135
137
|
|
|
136
138
|
### Adding a task in 15 minutes
|
|
137
139
|
|
|
@@ -156,7 +158,7 @@ PersianEval, please cite (see [`CITATION.cff`](CITATION.cff)):
|
|
|
156
158
|
author = {PersianEval Contributors},
|
|
157
159
|
year = {2026},
|
|
158
160
|
url = {https://github.com/Abolfazlrwm/persianeval},
|
|
159
|
-
version= {v0.
|
|
161
|
+
version= {v0.2.0}
|
|
160
162
|
}
|
|
161
163
|
```
|
|
162
164
|
|
|
@@ -197,7 +199,7 @@ PersianEval, please cite (see [`CITATION.cff`](CITATION.cff)):
|
|
|
197
199
|
|
|
198
200
|
```bash
|
|
199
201
|
pip install persianeval
|
|
200
|
-
export OPENAI_API_KEY=sk-... # یا ANTHROPIC_API_KEY / مدل محلی با Ollama
|
|
202
|
+
export OPENAI_API_KEY=sk-... # یا ANTHROPIC_API_KEY / ZAI_API_KEY / مدل محلی با Ollama
|
|
201
203
|
persianeval tasks # فهرست ۸ تسک
|
|
202
204
|
persianeval run --task reasoning --provider openai --model gpt-4o-mini --rpm 60
|
|
203
205
|
persianeval leaderboard --results-dir results --out leaderboard # صفحهٔ استاتیک
|
|
@@ -229,12 +231,15 @@ results : results/reasoning__demo.parquet
|
|
|
229
231
|
مدلهای اپنسورس (Qwen 2.5، Llama 3.1، Gemma 2 و Aya Expanse) روی رانرهای CPU گیتهاب
|
|
230
232
|
بازتولید کند.
|
|
231
233
|
|
|
232
|
-
**وضعیت:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
234
|
+
**وضعیت: نخستین اجرای واقعی منتشر شد (۲۰۲۶-۱۱-۲۵).** GLM-4-Plus (API میزبانیشدهٔ Z.ai)
|
|
235
|
+
با همان هارنس روی زیرنمونهٔ هفتگی seedدار (۲۰ نمونه در هر تسک، seed ۲۰۲۶۴۸ = هفتهٔ ۴۸ ISO)
|
|
236
|
+
امتیازدهی شد: کلی **۸۲٫۹**؛ املا، وفاداری RAG و تشخیص تعصب ۱۰۰، درک مطلب ۹۰، دانش فرهنگی
|
|
237
|
+
۸۰، استدلال و ترجمه ۵۵. در تسکهای داوری، همان مدلِ تحت ارزیابی داوری کرده است (ADR 0002)؛
|
|
238
|
+
پس این اعداد را جهتنما بدانید. اجرای `code_with_persian_comments` بهخاطر محدودیت نرخ API
|
|
239
|
+
ناقص مانده و در اجرای بعدی اضافه میشود؛ تا آن موقع سلول جدول خط تیره نشان میدهد. هر
|
|
240
|
+
امتیاز منتشرشده قابل ممیزی است: فایلهای نتیجهٔ تکتک آیتمها در [`results/`](results/)
|
|
241
|
+
کامیت شدهاند. مدلهای اپنسورس Ollama (Qwen 2.5، Llama 3.1، Gemma 2، Aya Expanse) وقتی
|
|
242
|
+
بودجهٔ رانر CPU اجازهٔ اجرای هفتگی بدهد به جدول اضافه میشوند.
|
|
238
243
|
|
|
239
244
|
### اضافهکردن تسک جدید در ۱۵ دقیقه
|
|
240
245
|
|
|
@@ -53,7 +53,7 @@ prompts, judge prompts, scores) is Apache-2.0 and open.
|
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
pip install persianeval
|
|
56
|
-
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY / local Ollama
|
|
56
|
+
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY / ZAI_API_KEY / local Ollama
|
|
57
57
|
persianeval tasks # list the 8 tasks
|
|
58
58
|
persianeval run --task reasoning --provider openai --model gpt-4o-mini --rpm 60
|
|
59
59
|
persianeval leaderboard --results-dir results --out leaderboard # static site
|
|
@@ -86,15 +86,17 @@ regenerate weekly by evaluating a rotating seeded sample of open-source models
|
|
|
86
86
|
(Qwen 2.5, Llama 3.1, Gemma 2, Aya Expanse) through local Ollama runners on GitHub-hosted
|
|
87
87
|
CPU runners.
|
|
88
88
|
|
|
89
|
-
**Status:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
**Status: first real run published (2026-11-25).** GLM-4-Plus (Z.ai hosted API) was
|
|
90
|
+
scored by the same harness on the weekly seeded subsample (20 items per task, seed
|
|
91
|
+
202648 = ISO week 48): overall **82.9**, with spelling, RAG faithfulness and bias at
|
|
92
|
+
100, reading comprehension 90, cultural knowledge 80, reasoning and translation 55.
|
|
93
|
+
Judge-scored tasks are self-judged by the model under evaluation (ADR 0002), so read
|
|
94
|
+
those numbers as directional. The `code_with_persian_comments` run is pending — the
|
|
95
|
+
API's rate limit cut the run short; it will be appended on a re-run and its table cell
|
|
96
|
+
shows a dash until then. Every published score is auditable: the per-item result files
|
|
97
|
+
are committed under [`results/`](results/). The open-source Ollama models (Qwen 2.5,
|
|
98
|
+
Llama 3.1, Gemma 2, Aya Expanse) join the table once a weekly CPU run fits the runner
|
|
99
|
+
budget again.
|
|
98
100
|
|
|
99
101
|
### Adding a task in 15 minutes
|
|
100
102
|
|
|
@@ -119,7 +121,7 @@ PersianEval, please cite (see [`CITATION.cff`](CITATION.cff)):
|
|
|
119
121
|
author = {PersianEval Contributors},
|
|
120
122
|
year = {2026},
|
|
121
123
|
url = {https://github.com/Abolfazlrwm/persianeval},
|
|
122
|
-
version= {v0.
|
|
124
|
+
version= {v0.2.0}
|
|
123
125
|
}
|
|
124
126
|
```
|
|
125
127
|
|
|
@@ -160,7 +162,7 @@ PersianEval, please cite (see [`CITATION.cff`](CITATION.cff)):
|
|
|
160
162
|
|
|
161
163
|
```bash
|
|
162
164
|
pip install persianeval
|
|
163
|
-
export OPENAI_API_KEY=sk-... # یا ANTHROPIC_API_KEY / مدل محلی با Ollama
|
|
165
|
+
export OPENAI_API_KEY=sk-... # یا ANTHROPIC_API_KEY / ZAI_API_KEY / مدل محلی با Ollama
|
|
164
166
|
persianeval tasks # فهرست ۸ تسک
|
|
165
167
|
persianeval run --task reasoning --provider openai --model gpt-4o-mini --rpm 60
|
|
166
168
|
persianeval leaderboard --results-dir results --out leaderboard # صفحهٔ استاتیک
|
|
@@ -192,12 +194,15 @@ results : results/reasoning__demo.parquet
|
|
|
192
194
|
مدلهای اپنسورس (Qwen 2.5، Llama 3.1، Gemma 2 و Aya Expanse) روی رانرهای CPU گیتهاب
|
|
193
195
|
بازتولید کند.
|
|
194
196
|
|
|
195
|
-
**وضعیت:
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
**وضعیت: نخستین اجرای واقعی منتشر شد (۲۰۲۶-۱۱-۲۵).** GLM-4-Plus (API میزبانیشدهٔ Z.ai)
|
|
198
|
+
با همان هارنس روی زیرنمونهٔ هفتگی seedدار (۲۰ نمونه در هر تسک، seed ۲۰۲۶۴۸ = هفتهٔ ۴۸ ISO)
|
|
199
|
+
امتیازدهی شد: کلی **۸۲٫۹**؛ املا، وفاداری RAG و تشخیص تعصب ۱۰۰، درک مطلب ۹۰، دانش فرهنگی
|
|
200
|
+
۸۰، استدلال و ترجمه ۵۵. در تسکهای داوری، همان مدلِ تحت ارزیابی داوری کرده است (ADR 0002)؛
|
|
201
|
+
پس این اعداد را جهتنما بدانید. اجرای `code_with_persian_comments` بهخاطر محدودیت نرخ API
|
|
202
|
+
ناقص مانده و در اجرای بعدی اضافه میشود؛ تا آن موقع سلول جدول خط تیره نشان میدهد. هر
|
|
203
|
+
امتیاز منتشرشده قابل ممیزی است: فایلهای نتیجهٔ تکتک آیتمها در [`results/`](results/)
|
|
204
|
+
کامیت شدهاند. مدلهای اپنسورس Ollama (Qwen 2.5، Llama 3.1، Gemma 2، Aya Expanse) وقتی
|
|
205
|
+
بودجهٔ رانر CPU اجازهٔ اجرای هفتگی بدهد به جدول اضافه میشوند.
|
|
201
206
|
|
|
202
207
|
### اضافهکردن تسک جدید در ۱۵ دقیقه
|
|
203
208
|
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "persianeval"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "PersianEval: the first serious open-source benchmark for evaluating LLMs on Persian (Farsi) — 8 tasks, reproducible async harness, weekly leaderboard."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Run results (JSON/Parquet) are produced by `persianeval run`.
|
|
2
|
+
|
|
3
|
+
- `*.json` files from published leaderboard runs are **committed on purpose**:
|
|
4
|
+
they are the audit trail behind `leaderboard/data.json` (every row there can
|
|
5
|
+
be traced back to a per-item score) and the fallback that the
|
|
6
|
+
`site_only=true` dispatch of `.github/workflows/leaderboard.yml` publishes
|
|
7
|
+
to GitHub Pages when the weekly evaluation is skipped.
|
|
8
|
+
- `*.parquet` files and the response cache stay local; CI and local runs write
|
|
9
|
+
them here and they are git-ignored.
|
|
10
|
+
|
|
11
|
+
Each JSON records the full run context (provider, model, seed, temperature,
|
|
12
|
+
limit, per-item scores), so a committed file is exactly reproducible with the
|
|
13
|
+
same seed.
|
|
@@ -57,7 +57,9 @@ def tasks() -> None:
|
|
|
57
57
|
def run(
|
|
58
58
|
task: Annotated[str, typer.Option(help="Task name (see `persianeval tasks`).")],
|
|
59
59
|
model: Annotated[str, typer.Option(help="Model identifier, e.g. gpt-4o or qwen2.5:7b-instruct.")],
|
|
60
|
-
provider: Annotated[
|
|
60
|
+
provider: Annotated[
|
|
61
|
+
str, typer.Option(help="openai | anthropic | ollama | vllm | zai | dummy")
|
|
62
|
+
] = "openai",
|
|
61
63
|
base_url: Annotated[str | None, typer.Option(help="Endpoint override (vLLM/self-hosted).")] = None,
|
|
62
64
|
org: Annotated[str, typer.Option(help="Organization metadata for the leaderboard.")] = "",
|
|
63
65
|
license_id: Annotated[str, typer.Option("--license", help="Model license metadata.")] = "",
|
|
@@ -262,6 +262,42 @@ class OpenAIProvider(BaseProvider):
|
|
|
262
262
|
return data
|
|
263
263
|
|
|
264
264
|
|
|
265
|
+
class ZaiProvider(OpenAIProvider):
|
|
266
|
+
"""Z.ai (Zhipu) Chat Completions provider for GLM models.
|
|
267
|
+
|
|
268
|
+
Z.ai exposes an OpenAI-compatible ``/chat/completions`` endpoint, so the
|
|
269
|
+
request/response handling is inherited from :class:`OpenAIProvider`; only
|
|
270
|
+
the defaults for the endpoint and the credential differ.
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
model: e.g. ``"glm-4-plus"``.
|
|
274
|
+
base_url: API root; defaults to ``ZAI_BASE_URL`` or
|
|
275
|
+
``https://api.z.ai/api/paas/v4``.
|
|
276
|
+
api_key: Bearer token; defaults to ``ZAI_API_KEY``.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
provider_name: ClassVar[str] = "zai"
|
|
280
|
+
|
|
281
|
+
def __init__(
|
|
282
|
+
self,
|
|
283
|
+
model: str,
|
|
284
|
+
*,
|
|
285
|
+
base_url: str | None = None,
|
|
286
|
+
api_key: str | None = None,
|
|
287
|
+
**kwargs: Any,
|
|
288
|
+
) -> None:
|
|
289
|
+
resolved_key = api_key or os.environ.get("ZAI_API_KEY")
|
|
290
|
+
if not resolved_key:
|
|
291
|
+
msg = "Z.ai API key missing: set ZAI_API_KEY or pass api_key explicitly"
|
|
292
|
+
raise ProviderError(msg)
|
|
293
|
+
super().__init__(
|
|
294
|
+
model,
|
|
295
|
+
base_url=base_url or os.environ.get("ZAI_BASE_URL", "https://api.z.ai/api/paas/v4"),
|
|
296
|
+
api_key=resolved_key,
|
|
297
|
+
**kwargs,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
|
|
265
301
|
class AnthropicProvider(BaseProvider):
|
|
266
302
|
"""Anthropic Messages API provider.
|
|
267
303
|
|
|
@@ -455,10 +491,11 @@ def create_provider(
|
|
|
455
491
|
|
|
456
492
|
Args:
|
|
457
493
|
provider: One of ``openai``, ``anthropic``, ``ollama``, ``vllm``,
|
|
458
|
-
``dummy``.
|
|
494
|
+
``zai``, ``dummy``.
|
|
459
495
|
model: Model identifier.
|
|
460
496
|
base_url: Optional endpoint override (``vllm`` requires it or the
|
|
461
|
-
``VLLM_BASE_URL`` environment variable
|
|
497
|
+
``VLLM_BASE_URL`` environment variable; ``zai`` accepts it or
|
|
498
|
+
``ZAI_BASE_URL``).
|
|
462
499
|
rpm: Requests-per-minute cap for this provider instance.
|
|
463
500
|
timeout_s: HTTP timeout in seconds.
|
|
464
501
|
max_retries: Retry budget per request.
|
|
@@ -487,7 +524,9 @@ def create_provider(
|
|
|
487
524
|
api_key=os.environ.get("VLLM_API_KEY", "EMPTY"),
|
|
488
525
|
**common,
|
|
489
526
|
)
|
|
527
|
+
if provider == "zai":
|
|
528
|
+
return ZaiProvider(model, base_url=base_url, **common)
|
|
490
529
|
if provider == "dummy":
|
|
491
530
|
return DummyProvider(model=model, **common)
|
|
492
|
-
msg = f"unknown provider '{provider}'; expected one of: openai, anthropic, ollama, vllm, dummy"
|
|
531
|
+
msg = f"unknown provider '{provider}'; expected one of: openai, anthropic, ollama, vllm, zai, dummy"
|
|
493
532
|
raise ProviderError(msg)
|
|
@@ -20,6 +20,7 @@ from persianeval.harness.providers import (
|
|
|
20
20
|
ProviderError,
|
|
21
21
|
RateLimiter,
|
|
22
22
|
ScriptedProvider,
|
|
23
|
+
ZaiProvider,
|
|
23
24
|
create_provider,
|
|
24
25
|
)
|
|
25
26
|
from persianeval.harness.results import load_json, save_json, save_parquet
|
|
@@ -144,6 +145,43 @@ def test_openai_provider_gives_up_after_retries(monkeypatch: pytest.MonkeyPatch)
|
|
|
144
145
|
asyncio.run(provider.aclose())
|
|
145
146
|
|
|
146
147
|
|
|
148
|
+
def test_zai_provider_parses_response(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
149
|
+
def handler(request: httpx.Request) -> httpx.Response:
|
|
150
|
+
payload = json.loads(request.content)
|
|
151
|
+
assert payload["model"] == "glm-4-plus"
|
|
152
|
+
assert request.headers["Authorization"] == "Bearer zai-key"
|
|
153
|
+
assert request.url.path.endswith("/chat/completions")
|
|
154
|
+
return httpx.Response(
|
|
155
|
+
200,
|
|
156
|
+
json={
|
|
157
|
+
"choices": [{"message": {"content": "پاسخ"}}],
|
|
158
|
+
"usage": {"prompt_tokens": 9, "completion_tokens": 4},
|
|
159
|
+
},
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
monkeypatch.setenv("ZAI_API_KEY", "zai-key")
|
|
163
|
+
provider = ZaiProvider("glm-4-plus", base_url="https://api.example.test/v4")
|
|
164
|
+
provider._client = httpx.AsyncClient(transport=httpx.MockTransport(handler))
|
|
165
|
+
response = asyncio.run(provider.complete("سلام", system="سیستم"))
|
|
166
|
+
assert response.text == "پاسخ"
|
|
167
|
+
assert response.input_tokens == 9 and response.output_tokens == 4
|
|
168
|
+
asyncio.run(provider.aclose())
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def test_create_provider_zai_missing_key(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
172
|
+
monkeypatch.delenv("ZAI_API_KEY", raising=False)
|
|
173
|
+
with pytest.raises(ProviderError, match=r"Z\.ai API key missing"):
|
|
174
|
+
create_provider("zai", "glm-4-plus")
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def test_zai_provider_defaults_to_public_endpoint(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
178
|
+
monkeypatch.setenv("ZAI_API_KEY", "zai-key")
|
|
179
|
+
provider = ZaiProvider("glm-4-plus")
|
|
180
|
+
assert provider.provider_name == "zai"
|
|
181
|
+
assert provider._base_url == "https://api.z.ai/api/paas/v4"
|
|
182
|
+
asyncio.run(provider.aclose())
|
|
183
|
+
|
|
184
|
+
|
|
147
185
|
def test_openai_provider_non_retryable_4xx(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
148
186
|
def handler(request: httpx.Request) -> httpx.Response:
|
|
149
187
|
return httpx.Response(401, text="unauthorized")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Run results (JSON/Parquet) are produced by `persianeval run`. This directory is git-ignored; CI and local runs write here.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{persianeval-0.1.2 → persianeval-0.2.0}/src/persianeval/data/v1/code_with_persian_comments.jsonl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|