Sign inSign up

yashdiq/yas:1.0.2-kit

API management
Machine learning & AI
Manifest digest

sha256:f491a07b5be786800d8a8f8c7778fe45eac536f503f691066960ebc5bae0ca32

Last pushed

3 days by yashdiq

Type

Sandbox Kit

Manifest digest

sha256:f491a07b5be786800d8a8f8c7778fe45eac536f503f691066960ebc5bae0ca32

yaml
schemaVersion: "2"
kind: sandbox
name: yas
version: 1.0.2-kit
displayName: Yas (self-hosted Jev-style decision maker)
description: 'Self-hosted decision sandbox: Kev, a Jev-like family of decision models, behind TypeSafe''s System One wire API. POST /v1/systemone answers typed choice, score and noul questions over any state, with calibrated probabilities, in one request. Weights are baked into the image, so the sandbox needs no API keys and can run with zero egress.'
sandbox:
    image: docker.io/yashdiq/yas:1.0.2
ports:
    - container: 8009
      name: yas
environment:
    variables:
        KEV_BASE_URL: http://127.0.0.1:8009
        KEV_HOST: 0.0.0.0
        KEV_MODEL: jaredpalmer/kev-0.8b
        KEV_PORT: "8009"
        YAS_REQUIRE_API_KEY: "1"
setup:
    install:
        - command: python /opt/yas/warmup.py --model jaredpalmer/kev-0.8b --offline --timeout 600
          description: Verify the baked kev weights load offline.
    startup:
        - command:
            - python
            - /opt/yas/serve_docs.py
            - --run
            - jaredpalmer/kev-0.8b
            - --host
            - 0.0.0.0
            - --port
            - "8009"
          user: "0"
          background: true
          description: Serve kev behind the System One API on port 8009 (Scalar docs at /docs).
        - command:
            - python
            - -c
            - |
              import os, time, urllib.error, urllib.request
              for _ in range(150):
                  try:
                      req = urllib.request.Request("http://127.0.0.1:" + os.environ.get("KEV_PORT", "8009") + "/v1/models")
                      api_key = (os.environ.get("YAS_API_KEY") or os.environ.get("KEV_API_KEY") or "")
                      if api_key:
                          req.add_header("authorization", "Bearer " + api_key)
                      urllib.request.urlopen(req, timeout=4)
                      print("yas ready on port", os.environ.get("KEV_PORT", "8009"))
                      break
                  except urllib.error.HTTPError as e:
                      if e.code == 401:
                          print("yas ready (auth-enforcing) on port", os.environ.get("KEV_PORT", "8009"))
                          break
                      time.sleep(2)
                  except Exception:
                      time.sleep(2)
              else:
                  raise SystemExit("yas server did not become ready; check the sandbox logs")
          user: "0"
          description: Wait until the kev server answers /v1/models.