UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

24 lines (20 loc) 759 B
import { join } from 'path'; import * as t from 'io-ts'; import { rpcCreateModelVersionArg0Codec } from '@alwaysai/cloud-api'; import { ConfigFile } from '@alwaysai/config-nodejs'; import { CLI_TERSE_ERROR } from '@alwaysai/alwayscli'; import { MODEL_JSON_FILE_NAME } from './model-package-json-file'; const ENOENT = { message: `Please check that "${MODEL_JSON_FILE_NAME}" exists and contains the correct model and user information`, code: CLI_TERSE_ERROR }; export type ModelJson = t.TypeOf<typeof rpcCreateModelVersionArg0Codec>; export function ModelJsonFile(dir: string) { const path = join(dir, MODEL_JSON_FILE_NAME); const configFile = ConfigFile({ path, codec: rpcCreateModelVersionArg0Codec, ENOENT }); return configFile; }