mirror of
https://github.com/AlexsJones/llmfit.git
synced 2026-08-29 21:21:40 +00:00
chore: move schema.json to llmfit-core/data and drop root data/ references
Follows up the #585 merge: the schema now lives next to the catalog it validates, and the workflow/test/docs no longer reference the removed root data/ copies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
cf64a5b415
commit
fe89b82366
4 changed files with 6 additions and 15 deletions
4
.github/workflows/weekly-model-update.yml
vendored
4
.github/workflows/weekly-model-update.yml
vendored
|
|
@ -31,9 +31,7 @@ jobs:
|
|||
run: python3 scripts/scrape_hf_models.py -n 5000
|
||||
|
||||
- name: Validate generated JSON
|
||||
run: |
|
||||
python3 -m json.tool data/hf_models.json > /dev/null
|
||||
python3 -m json.tool llmfit-core/data/hf_models.json > /dev/null
|
||||
run: python3 -m json.tool llmfit-core/data/hf_models.json > /dev/null
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ Keep PRs focused. One bug fix or feature per PR is easier to review than a combi
|
|||
3. Run `make update-models` to regenerate the database and rebuild.
|
||||
4. Verify with `./target/release/llmfit list`.
|
||||
5. Update [MODELS.md](MODELS.md) if needed.
|
||||
6. Update [data/schema.json](data/schema.json) if the model has new or unique metadata fields.
|
||||
6. Update [llmfit-core/data/schema.json](llmfit-core/data/schema.json) if the model has new or unique metadata fields.
|
||||
7. Open a PR.
|
||||
|
||||
## Code guidelines
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://llmfit.dev/schemas/hf_models.schema.json",
|
||||
"title": "llmfit HuggingFace model catalog",
|
||||
"description": "Schema for data/hf_models.json and llmfit-core/data/hf_models.json",
|
||||
"description": "Schema for llmfit-core/data/hf_models.json",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/model"
|
||||
|
|
@ -3,20 +3,14 @@ use serde_json::Value;
|
|||
use std::path::Path;
|
||||
|
||||
fn load_schema() -> Value {
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("data/schema.json");
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("data/schema.json");
|
||||
let text = std::fs::read_to_string(&path)
|
||||
.unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display()));
|
||||
serde_json::from_str(&text).unwrap_or_else(|e| panic!("cannot parse schema JSON: {e}"))
|
||||
}
|
||||
|
||||
fn validate_file(schema: &Validator, rel_path: &str) {
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join(rel_path);
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join(rel_path);
|
||||
|
||||
let text = std::fs::read_to_string(&path)
|
||||
.unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display()));
|
||||
|
|
@ -44,8 +38,7 @@ fn validate_file(schema: &Validator, rel_path: &str) {
|
|||
fn hf_models_match_schema() {
|
||||
let schema_value = load_schema();
|
||||
let schema = jsonschema::validator_for(&schema_value)
|
||||
.expect("schema itself is invalid — check data/schema.json");
|
||||
.expect("schema itself is invalid — check llmfit-core/data/schema.json");
|
||||
|
||||
validate_file(&schema, "data/hf_models.json");
|
||||
validate_file(&schema, "llmfit-core/data/hf_models.json");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue