Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

996 B
Raw Blame
import { readFileSync } from "node:fs";

import { modelBackendIdentityLabels, modelBackendNetworkIdentityLabels } from "../../../deploy/work-runner/docker-boundary.mjs";

const example = JSON.parse(readFileSync(new URL("../../../deploy/work-broker/policy.example.json", import.meta.url), "utf8"));

function prepared(overrides, bindings) {
  return { policy: { localModel: { ...example.localModel, ...overrides } }, ...(bindings === null ? {} : { bindings }) };
}

export function fixtureModelBackendLabelArguments(overrides = {}, bindings = null) {
  const value = prepared(overrides, bindings);
  return Object.entries(modelBackendIdentityLabels(value)).flatMap(([name, content]) => ["--label", `${name}=${content}`]);
}

export function fixtureModelBackendNetworkLabelArguments(overrides = {}, bindings = null) {
  const value = prepared(overrides, bindings);
  return Object.entries(modelBackendNetworkIdentityLabels(value)).flatMap(([name, content]) => ["--label", `${name}=${content}`]);
}