Model revisions
Use the model ID returned by get or create. See Model versions to run a decision at a tag or commit.
Update against a known revision, tag, and roll back
Pass the current head on configuration updates to guard against concurrent changes. Rollback creates a new commit with the target revision's files.
model = modaic.models.get(workspace="acme", model="support-priority")
updated = modaic.models.update(
model.id,
questions={
"priority": {
"type": "choice",
"instructions": "Choose the support priority for this ticket.",
"criteria": {
"normal": "Routine customer issue.",
"high": "Financial impact or an urgent blocker.",
},
}
},
expected_head_sha=model.commit.commit_sha,
)
modaic.models.create_tag(model.id, name="v1", commit_sha=updated.commit.commit_sha)
commits = modaic.models.list_commits(model.id, branch="main").commits
modaic.models.rollback(
model.id,
branch="main",
target_commit_sha=commits[1].sha,
expected_head_sha=commits[0].sha,
message="Restore checkpoint 1",
)
Manage branches
Create a branch from a source revision, list branches, or delete a branch.
modaic.models.create_branch(model.id, name="experiment", source_ref="main")
branches = modaic.models.list_branches(model.id)
modaic.models.delete_branch(model.id, "experiment")
List and delete tags
tags = modaic.models.list_tags(model.id)
modaic.models.delete_tag(model.id, "v1")
Read commits and files
Pass a revision to inspect a specific version.
history = modaic.models.list_commits(model.id, branch="main")
commit = modaic.models.get_commit(model.id, history.commits[0].sha)
files = modaic.models.list_files(model.id, revision="v1")
config = modaic.models.get_file(model.id, "model.json", revision="v1")
Commit file changes
Submit file changes together and pass the expected branch head.
commit = modaic.models.commit(
model.id,
branch="main",
message="Document the decision task",
expected_head_sha=model.commit.commit_sha,
changes=[{"operation": "upsert", "path": "README.md", "contents": "# Support triage"}],
)