@agvel/sdk 0.0.0-stage → 1.0.0
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.
- package/README.md +59 -2
- package/bin/agvel.js +43 -0
- package/index.js +33 -0
- package/package.json +44 -4
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @agvel/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://agvel.org/developers/sdk/">
|
|
5
|
+
<picture>
|
|
6
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/agvel-ai/agvel/main/assets/package-agvel-dark.png">
|
|
7
|
+
<img src="https://raw.githubusercontent.com/agvel-ai/agvel/main/assets/package-agvel-light.png" alt="@agvel/sdk: the official SDK and CLI for Agvel." width="100%">
|
|
8
|
+
</picture>
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
The official SDK and CLI for [Agvel](https://agvel.org): open benchmarks, datasets and papers on how AI systems behave, starting with money. Read-only, no keys, no dependencies. Node 18 or newer, or any modern browser.
|
|
13
|
+
|
|
14
|
+
## CLI
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx @agvel/sdk search "rounding modes"
|
|
18
|
+
npx @agvel/sdk cite /benchmarks/kuralbench/ --apa
|
|
19
|
+
npx @agvel/sdk results claude-opus-5-5
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Command | Prints |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| `agvel search <words>` | Pages that match, best first |
|
|
25
|
+
| `agvel list [kind]` | Every page, or one kind: `benchmark`, `dataset`, `research` |
|
|
26
|
+
| `agvel page <path>` | One page's full text |
|
|
27
|
+
| `agvel releases` | Releases, newest first |
|
|
28
|
+
| `agvel cite <path> [--apa]` | The page's citation, BibTeX by default |
|
|
29
|
+
| `agvel results [model]` | NotStated scores, for one model or all |
|
|
30
|
+
| `agvel badge <model>` | A model's badge as Markdown |
|
|
31
|
+
|
|
32
|
+
Add `--json` to any command for the raw result.
|
|
33
|
+
|
|
34
|
+
## SDK
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { Agvel } from '@agvel/sdk';
|
|
38
|
+
|
|
39
|
+
const agvel = new Agvel();
|
|
40
|
+
const { results } = await agvel.search('ISO 8583');
|
|
41
|
+
const { citation } = await agvel.getCitation('/datasets/iso8583/');
|
|
42
|
+
const { rows } = await agvel.listResults({ model: 'claude-opus-5-5', split: 'invented' });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
| Method | Returns |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `search(query, { limit })` | Pages that match, best first |
|
|
48
|
+
| `listResearch({ kind, limit, cursor })` | Pages, a page at a time |
|
|
49
|
+
| `getPage(path)` | One page's full text and licence |
|
|
50
|
+
| `listReleases({ limit, cursor })` | Releases, newest first |
|
|
51
|
+
| `getCitation(path, { format })` | The page's citation, `bibtex` or `apa` |
|
|
52
|
+
| `listCitable({ limit, cursor })` | Every page that publishes a citation |
|
|
53
|
+
| `listResults({ benchmark, model, prompt, split, limit, cursor })` | NotStated score rows |
|
|
54
|
+
| `getItem(split, id)` | One case with every model answer |
|
|
55
|
+
| `getModelAnswers(model, { split, prompt, verdict, limit, cursor })` | One model's answers |
|
|
56
|
+
| `getBadge(model, { prompt, style })` | A model's badge, ready to paste |
|
|
57
|
+
|
|
58
|
+
Paged methods return `nextCursor` until the last page; pass it back as `cursor`. Failures throw `AgvelError` with a `code`.
|
|
59
|
+
|
|
60
|
+
Docs: [agvel.org/developers/sdk](https://agvel.org/developers/sdk/) · Licence: Apache 2.0
|
package/bin/agvel.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// agvel: the Agvel CLI. Read-only; prints JSON with --json, readable text otherwise.
|
|
3
|
+
import { Agvel } from '../index.js';
|
|
4
|
+
|
|
5
|
+
const [cmd, ...rest] = process.argv.slice(2);
|
|
6
|
+
const json = rest.includes('--json'); const args = rest.filter((a) => !a.startsWith('--'));
|
|
7
|
+
const flag = (n) => rest.find((a) => a.startsWith(`--${n}=`))?.split('=')[1];
|
|
8
|
+
const a = new Agvel();
|
|
9
|
+
const HELP = `agvel: read Agvel's benchmarks, datasets, papers and results (agvel.org)
|
|
10
|
+
|
|
11
|
+
agvel search <words> pages matching the words
|
|
12
|
+
agvel list [kind] pages (kind: benchmark, dataset, research, ...)
|
|
13
|
+
agvel page <path> one page's full text
|
|
14
|
+
agvel releases releases, newest first
|
|
15
|
+
agvel cite <path> [--apa] the page's citation (BibTeX by default)
|
|
16
|
+
agvel results [model] NotStated scores, for one model or all
|
|
17
|
+
agvel badge <model> a model's badge as Markdown
|
|
18
|
+
|
|
19
|
+
--json print raw JSON`;
|
|
20
|
+
|
|
21
|
+
const out = (v, text) => console.log(json ? JSON.stringify(v, null, 2) : text(v));
|
|
22
|
+
const rows = (xs) => xs.map((p) => `${p.title}\n ${p.url}\n ${p.description ?? p.line ?? ''}`).join('\n\n');
|
|
23
|
+
try {
|
|
24
|
+
switch (cmd) {
|
|
25
|
+
case 'search': out(await a.search(args.join(' ')), (v) => rows(v.results)); break;
|
|
26
|
+
case 'list': {
|
|
27
|
+
const all = []; let cursor;
|
|
28
|
+
do { const v = await a.listResearch({ kind: args[0], cursor, limit: 50 }); all.push(...v.pages); cursor = v.nextCursor; } while (cursor);
|
|
29
|
+
out({ pages: all }, (v) => rows(v.pages)); break;
|
|
30
|
+
}
|
|
31
|
+
case 'page': out(await a.getPage(args[0]), (v) => `${v.title}\n${v.url}\n\n${v.text}`); break;
|
|
32
|
+
case 'releases': out(await a.listReleases({ limit: Number(flag('limit')) || 20 }), (v) => v.releases.map((r) => `${r.date} ${r.kind}: ${r.title}\n ${r.url}`).join('\n')); break;
|
|
33
|
+
case 'results': {
|
|
34
|
+
const all = []; let cursor;
|
|
35
|
+
do { const v = await a.listResults({ benchmark: 'notstated', model: args[0], cursor, limit: 50 }); all.push(...v.rows); cursor = v.nextCursor; } while (cursor);
|
|
36
|
+
const pct = (x) => (x == null ? ' -' : String(Math.round(x)).padStart(3) + '%');
|
|
37
|
+
out({ rows: all }, (v) => v.rows.map((r) => `${(r.slug ?? r.model).padEnd(22)} ${r.prompt.padEnd(11)} ${r.split.padEnd(24)} named ${pct(r.named_pct)} [${r.wilson95_pct.map((x) => Math.round(x)).join('-')}]`).join('\n')); break;
|
|
38
|
+
}
|
|
39
|
+
case 'badge': out(await a.getBadge(args[0]), (v) => v.markdown); break;
|
|
40
|
+
case 'cite': out(await a.getCitation(args[0], { format: rest.includes('--apa') ? 'apa' : 'bibtex' }), (v) => v.citation); break;
|
|
41
|
+
default: console.log(HELP); process.exitCode = cmd && cmd !== 'help' && cmd !== '--help' ? 1 : 0;
|
|
42
|
+
}
|
|
43
|
+
} catch (e) { console.error(`agvel: ${e.message}`); process.exitCode = 1; }
|
package/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Agvel SDK: read-only access to agvel.org (benchmarks, datasets, papers) over its MCP servers: /mcp (releases, citations, results) and /mcp/docs (search, pages). No dependencies; Node 18+ or any browser.
|
|
2
|
+
const BASE = 'https://agvel.org';
|
|
3
|
+
|
|
4
|
+
export class Agvel {
|
|
5
|
+
constructor({ baseUrl = BASE, fetch: f = globalThis.fetch } = {}) { this.base = baseUrl.replace(/\/$/, ''); this.fetch = f; this.n = 0; }
|
|
6
|
+
|
|
7
|
+
async #call(path, name, args = {}) {
|
|
8
|
+
const res = await this.fetch(`${this.base}${path}`, {
|
|
9
|
+
method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
10
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: ++this.n, method: 'tools/call', params: { name, arguments: args } }),
|
|
11
|
+
});
|
|
12
|
+
if (!res.ok) throw new AgvelError(`HTTP ${res.status}`, res.status);
|
|
13
|
+
const out = await res.json();
|
|
14
|
+
if (out.error) throw new AgvelError(out.error.message, out.error.code);
|
|
15
|
+
if (out.result.isError) throw new AgvelError(out.result.content?.[0]?.text ?? 'Tool error', 'tool');
|
|
16
|
+
return out.result.structuredContent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Pages matching words, best first. */ search(query, { limit } = {}) { return this.#call('/mcp/docs', 'search', { query, ...(limit ? { limit } : {}) }); }
|
|
20
|
+
/** Pages, optionally of one kind, a page at a time (pass nextCursor back as cursor). */ listResearch({ kind, limit, cursor } = {}) { return this.#call('/mcp/docs', 'list_research', strip({ kind, limit, cursor })); }
|
|
21
|
+
/** The full text of one page. */ getPage(path) { return this.#call('/mcp/docs', 'get_page', { path }); }
|
|
22
|
+
/** Releases, newest first, a page at a time. */ listReleases({ limit, cursor } = {}) { return this.#call('/mcp', 'list_releases', strip({ limit, cursor })); }
|
|
23
|
+
/** The citation a page publishes, BibTeX or APA. */ getCitation(path, { format = 'bibtex' } = {}) { return this.#call('/mcp', 'get_citation', { path, format }); }
|
|
24
|
+
/** Every page that publishes a citation. */ listCitable({ limit, cursor } = {}) { return this.#call('/mcp', 'list_citable', strip({ limit, cursor })); }
|
|
25
|
+
/** NotStated score rows, filtered, a page at a time. */ listResults({ benchmark, model, prompt, split, limit, cursor } = {}) { return this.#call('/mcp', 'list_results', strip({ benchmark, model, prompt, split, limit, cursor })); }
|
|
26
|
+
/** One NotStated case with every model answer and its verdict. */ getItem(split, id) { return this.#call('/mcp', 'get_item', { split, id }); }
|
|
27
|
+
/** One model's NotStated answers, a page at a time. */ getModelAnswers(model, { split, prompt, verdict, limit, cursor } = {}) { return this.#call('/mcp', 'get_model_answers', strip({ model, split, prompt, verdict, limit, cursor })); }
|
|
28
|
+
/** A model's NotStated badge: SVG URL and ready-to-paste Markdown and HTML. */ getBadge(model, { prompt, style } = {}) { return this.#call('/mcp', 'get_badge', strip({ model, prompt, style })); }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class AgvelError extends Error { constructor(message, code) { super(message); this.name = 'AgvelError'; this.code = code; } }
|
|
32
|
+
const strip = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
|
|
33
|
+
export default Agvel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agvel/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The official Agvel SDK and CLI: search, read and cite Agvel's open AI benchmarks, datasets, papers and results.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"agvel": "bin/agvel.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"bin",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"agvel",
|
|
23
|
+
"ai",
|
|
24
|
+
"benchmarks",
|
|
25
|
+
"evals",
|
|
26
|
+
"datasets",
|
|
27
|
+
"mcp",
|
|
28
|
+
"sdk",
|
|
29
|
+
"cli"
|
|
30
|
+
],
|
|
31
|
+
"homepage": "https://agvel.org/developers/sdk/",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/agvel-ai/agvel.git",
|
|
35
|
+
"directory": "packages/agvel"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/agvel-ai/agvel/issues",
|
|
39
|
+
"email": "hello@agvel.org"
|
|
40
|
+
},
|
|
41
|
+
"author": "Agvel <hello@agvel.org> (https://agvel.org)",
|
|
42
|
+
"license": "Apache-2.0",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|