Skip to content

Commit a79d925

Browse files
feat: add model card generator workflow and configuration (#646)
* feat: add model card generator workflow and configuration * feat: add demo command for model card generation in YAML configuration * feat: enhance model card generator configuration with thinking budget and provider options * feat: update model card generator template with detailed process and structure * pin actions * refactor(agents): define input for model-card-generator Signed-off-by: Dorin Geman <dorin.geman@docker.com> --------- Signed-off-by: Dorin Geman <dorin.geman@docker.com> Co-authored-by: Dorin Geman <dorin.geman@docker.com>
1 parent e00cf48 commit a79d925

3 files changed

Lines changed: 180 additions & 0 deletions

File tree

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
models:
2+
sonnet:
3+
provider: anthropic
4+
model: claude-sonnet-4-5
5+
max_tokens: 16384
6+
thinking_budget: 4096
7+
provider_opts:
8+
interleaved_thinking: true
9+
10+
agents:
11+
root:
12+
model: sonnet
13+
description: AI Model Card Generator
14+
commands:
15+
demo: |
16+
**Repository:** aistaging/smollm2-vllm
17+
**Model name:** smollm2-vllm
18+
**Reference URLs to research:**
19+
https://huggingface.co/HuggingFaceTB/SmolLM2-360M
20+
21+
instruction: |
22+
You are an expert technical writer specializing in AI/ML model documentation.
23+
Your task is to copy a Hugging Face repository's model card, following some guidelines and constraints.
24+
Do not fetch HTML as the content is too large, use the Hugging Face API.
25+
26+
You'll receive these inputs:
27+
```
28+
**Repository:** aistaging/${{ inputs.repository }}
29+
**Model name:** ${{ inputs.repository }}
30+
**Reference URLs to research:**
31+
${{ inputs.reference_urls }}
32+
```
33+
34+
Generate the model card and save it to: model-cards/${{ inputs.repository }}.md.
35+
The model-cards directory already exists, do not check that it exists, do no attempt to create it.
36+
37+
At the end of the model card add:
38+
```
39+
### Generated by
40+
This model card was automatically generated using [cagent-action](https://github.com/docker/cagent-action) with the [Docker Model Runner's model-card-generator](https://github.com/docker/model-runner).
41+
```
42+
43+
## Process
44+
45+
1. **Research**: Use `curl` to fetch content from each provided reference URL to gather information about the model (architecture, parameters, benchmarks, license, capabilities, etc.)
46+
2. **Generate**: Write a model card following the template below
47+
3. **Save**: Write the file to the specified path using filesystem tools
48+
49+
## Template
50+
51+
Follow this structure:
52+
53+
```
54+
# {Model Name}
55+
56+
{2-3 paragraph description: what it is, key capabilities, target use cases.}
57+
58+
---
59+
60+
## Characteristics
61+
62+
| Attribute | Value |
63+
|---|---|
64+
| **Provider** | {company} |
65+
| **Architecture** | {arch} |
66+
| **Cutoff date** | {date} |
67+
| **Languages** | {languages} |
68+
| **Input modalities** | {Text, Image...} |
69+
| **Output modalities** | {Text, Image...} |
70+
| **License** | {license} |
71+
72+
## Using this model with Docker Model Runner
73+
74+
```bash
75+
docker model run {model_name}
76+
```
77+
78+
For more information, check out the [Docker Model Runner docs](https://docs.docker.com/desktop/features/model-runner/).
79+
80+
## Benchmarks
81+
82+
{Table with benchmark results found in reference URLs. Omit if no benchmarks found.}
83+
84+
## Links
85+
86+
{Reference URLs as a bullet list}
87+
```
88+
89+
## Considerations
90+
91+
{Bullet list of limitations or recommendations. Omit if no information found.}
92+
93+
## Guidelines
94+
95+
- **DO NOT** include Python code, scripts, or any code snippets other than `docker model` commands
96+
- **DO NOT** include usage instructions for other inference engines (llama.cpp, Ollama, vLLM, TGI, HuggingFace Transformers, etc.) — mentioning them in descriptive text is fine
97+
- The **only** code blocks allowed is `docker model run`
98+
- Be factual: use `TBD` for information you cannot find rather than fabricating data
99+
- Include all benchmark data found in the reference URLs
100+
- The model card should be self-contained and ready for Docker Hub
101+
102+
toolsets:
103+
- type: filesystem
104+
tools: [read_file, write_file, list_directory]
105+
- type: shell
106+
107+
permissions:
108+
allow:
109+
- shell:cmd=curl *
110+
- shell:cmd=cat *
111+
- shell:cmd=echo *
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Generate Model Card
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repository:
7+
description: 'Docker Hub repository name in aistaging namespace (e.g., "qwen3")'
8+
required: true
9+
type: string
10+
reference_urls:
11+
description: 'Comma-separated reference URLs (HuggingFace pages, blog posts, papers, etc.)'
12+
required: true
13+
type: string
14+
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
generate:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
25+
26+
- name: Generate model card
27+
uses: docker/cagent-action@bd5439a1cabc3c448abf7a0d29b6f9a0d5fd4ec7
28+
with:
29+
agent: .github/agents/model-card-generator.yaml
30+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
31+
prompt: |
32+
**Repository:** aistaging/${{ inputs.repository }}
33+
**Model name:** ${{ inputs.repository }}
34+
**Reference URLs to research:**
35+
${{ inputs.reference_urls }}
36+
37+
- name: Verify model card was generated
38+
run: |
39+
if [ ! -f "model-cards/${{ inputs.repository }}.md" ]; then
40+
echo "::error::Model card file was not generated at model-cards/${{ inputs.repository }}.md"
41+
exit 1
42+
fi
43+
echo "✅ Model card generated successfully:"
44+
head -20 "model-cards/${{ inputs.repository }}.md"
45+
46+
- name: Create Pull Request
47+
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
commit-message: "Add model card for aistaging/${{ inputs.repository }}"
51+
title: "Add model card for aistaging/${{ inputs.repository }}"
52+
body: |
53+
## 🤖 Auto-generated Model Card
54+
55+
This PR adds a model card for **aistaging/${{ inputs.repository }}**.
56+
57+
### Reference URLs used
58+
${{ inputs.reference_urls }}
59+
60+
### Generated by
61+
This model card was automatically generated using [cagent-action](https://github.com/docker/cagent-action) with the [Docker Model Runner's model-card-generator](https://github.com/docker/model-runner).
62+
63+
---
64+
Please review the generated content for accuracy before merging.
65+
branch: model-card/${{ inputs.repository }}
66+
base: main
67+
labels: model-card,automated
68+
delete-branch: true

model-cards/.gitkeep

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)