mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
Every model page opens in the family pages' frame (the name, one line, two actions) over a links row: the model's GitHub and Hugging Face, from its catalogue record and kept only when the build reads a 200, and this site's leaderboard and benchmarks for its family. Facts are a grid of labelled cells; a Kai page sets what ships today beside the Kai-1.7 target, each its own column. The quick start is a segmented control over TypeScript, Python, cURL and Go, in the shape the model's endpoint takes: a decision model's are the /v1/decisions severity call, each run against production and answered (the list-shaped body the card printed was refused 422). The guest key, which api.hanzo.ai no longer accepts, gives way to Get an API key. /kai's first action reads Get decisions, as the card's does.
38 lines
1.7 KiB
TypeScript
38 lines
1.7 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
import { links, BOARDS } from '../../lib/models/links'
|
|
import { examples } from '../../lib/models/examples'
|
|
|
|
/**
|
|
* A MODEL PAGE'S LINKS AND ITS CALL.
|
|
*
|
|
* The links row draws what the model has and nothing else: a repository the
|
|
* build found dead is absent from the record (lib/models/served), so it is
|
|
* absent from the row. The quick start is the endpoint's shape: a decision
|
|
* model's four calls are POST /v1/decisions with typed questions, and no other
|
|
* model is shown one.
|
|
*/
|
|
|
|
test('the links row draws only what the model has, in order', () => {
|
|
expect(links({})).toEqual([])
|
|
expect(links({ family: 'zen' }).map((l) => l.kind)).toEqual(['benchmarks'])
|
|
expect(links({ family: 'kai', github: 'https://github.com/hanzoai/kai' }).map((l) => [l.kind, l.href])).toEqual([
|
|
['github', 'https://github.com/hanzoai/kai'],
|
|
['leaderboard', BOARDS.kai.leaderboard],
|
|
['benchmarks', BOARDS.kai.benchmarks],
|
|
])
|
|
expect(links({ family: 'other', huggingface: 'https://huggingface.co/zenlm/zen5' }).map((l) => l.kind)).toEqual(['huggingface'])
|
|
})
|
|
|
|
test("a decision model's calls are /v1/decisions with typed questions; every other model's are chat", () => {
|
|
const kai = examples({ id: 'kai', endpoint: '/v1/decisions' })
|
|
for (const code of Object.values(kai)) {
|
|
expect(code).not.toMatch(/chat\/completions|chat\.completions|CreateChatCompletion|messages/)
|
|
expect(code).toMatch(/decisions/i)
|
|
expect(code).toContain('severity')
|
|
expect(code).not.toMatch(/"?reasoning"?\s*:/)
|
|
}
|
|
expect(kai.curl).toContain('"model": "kai"')
|
|
const zen = examples({ id: 'zen5', endpoint: '/v1/chat/completions' })
|
|
for (const code of Object.values(zen)) expect(code).not.toContain('/v1/decisions')
|
|
})
|