Skip to main content

A Python package containing jinko_helpers, jinko_stats, and crabbit modules aimed to be used with Jinko.ai API

Project description

Jinkō Python SDK

Installation

pip install jinko-sdk

Development tests

See tests/README.md.

Configuration

export JINKO_API_KEY="..."
export JINKO_PROJECT_ID="..."
export JINKO_BASE_URL="https://api.jinko.ai" # Already uses this adress by default

These variables can also be set through JinkoClient's init.

Quickstart

from jinko import JinkoClient

client = JinkoClient()  # Can receive api key and project id

model = client.models.get("cm-...")
print(model.name)

content = model.content()

trial = client.trials.get("tr-...")
trial.run()
trial.wait_until_completed()

summary = trial.results.summary()
scalars = trial.results.scalars(["AUC", "Cmax"]).to_dataframe()

Model Components API

Model.components is the default ergonomic entrypoint for component edits.

model = client.models.get("cm-...")

# typed read
p = model.components.get_parameter("k_clearance")

# immediate typed update in one API call
p.update(formula="CL / V", unit="L/h")

# staged multi-component edit in one commit
with model.components.batch(version_name="retune") as b:
    b.edit_parameter("k_clearance").set_formula("CL2 / V")
    b.create_parameter(id="k_new", formula=1.2, unit="1/h")

Low-level escape hatch is still available for advanced/raw payload workflows:

from jinko.openapi_types import Parameter

model = model.edit_components(
    add=Parameter(id="k_raw", specifics={"formula": 2.0}),
    version_name="raw edit",
)

Versioned resources

By default, the SDK works with the latest version of a resource.

model = client.models.get("cm-...")

To access older versions:

versions = model.versions.list()
old = model.versions.get(revision=3)

To restore an older version as the new latest version:

model.versions.restore(revision=3, version_name="restore baseline")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jinko_sdk-1.0.0.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jinko_sdk-1.0.0-py3-none-any.whl (105.6 kB view details)

Uploaded Python 3

File details

Details for the file jinko_sdk-1.0.0.tar.gz.

File metadata

  • Download URL: jinko_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for jinko_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7ffa9dd50c4ae500d348b684a95ce0df83e4e7bf64718b49b1633989c302fbc6
MD5 36c959d40b6a5986ec8c7fa929cbb8fe
BLAKE2b-256 40972585b25439a2be856d82409c0d4c9f400b6a864d9f06fcb4d8249d96f5be

See more details on using hashes here.

File details

Details for the file jinko_sdk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: jinko_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 105.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for jinko_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac9d127b40628f82744568b7a37da4a45c14cb2cc387ae40da1516c184b208ca
MD5 4fcb6dc3b5f38798081045f3f8945fe1
BLAKE2b-256 7cda5c7d3b7550cb4729e0bb17c2140b01426d7b22478a4b544e83714d4e1c0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page