Skip to main content

Client for the public Ginkgo AI API

Project description

Ginkgo's AI model API client

Work in progress: this repo was just made public and we are still working on integration

A python client for Ginkgo's AI model API, to run inference on public and Ginkgo-proprietary models. Learn more in the Model API announcement.

Prerequisites

Register at https://models.ginkgobioworks.ai/ to get credits and an API KEY (of the form xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx). Store the API KEY in the GINKGOAI_API_KEY environment variable.

Installation

Install the python client with pip:

pip install ginkgo-ai-client

Usage:

Note: This is an alpha version of the client and its interface may vary in the future.

Example : masked inference with Ginkgo's AA0 model

The client requires an API key (and defaults to os.environ.get("GINKGOAI_API_KEY") if none is explicitly provided)

from ginkgo_ai_client import GinkgoAIClient, MaskedInferenceQuery

client = GinkgoAIClient()
model = "ginkgo-aa0-650M"

# SINGLE QUERY

query = MaskedInferenceQuery(sequence="MPK<mask><mask>RRL", model=model)
prediction = client.send_request(query)
# prediction.sequence == "MPKRRRRL"

# BATCH QUERY

sequences = ["MPK<mask><mask>RRL", "M<mask>RL", "MLLM<mask><mask>R"]
queries = [MaskedInferenceQuery(sequence=seq, model=model) for seq in sequences]
predictions = client.send_batch_request(queries)
# predictions[0].sequence == "MPKRRRRL"

Changing the model parameter to esm2-650M or esm2-3b in this example will perform masked inference with the ESM2 model.

Example : embedding computation with Ginkgo's 3'UTR language model

from ginkgo_ai_client import GinkgoAIClient, MeanEmbeddingQuery

client = GinkgoAIClient()
model = "ginkgo-maskedlm-3utr-v1"

# SINGLE QUERY

query = MeanEmbeddingQuery(sequence="ATTGCG", model=model)
prediction = client.send_request(query)
# prediction.embedding == [1.05, -2.34, ...]

# BATCH QUERY

sequences = ["ATTGCG", "CAATGC", "GCGCACATGT"]
queries = [MeanEmbeddingQuery(sequence=seq, model=model) for seq in sequences]
predictions = client.send_batch_request(queries)
# predictions[0].embedding == [1.05, -2.34, ...]

Available models

See the example folder and reference docs for more details on usage and parameters.

Model Description Reference Supported queries Versions
ESM2 Large Protein language model from Meta Github Embeddings, masked inference 3B, 650M
AA0 Ginkgo's proprietary protein language model Announcement Embeddings, masked inference 650M
3UTR Ginkgo's proprietary 3'UTR language model Preprint Embeddings, masked inference v1

License

This project is licensed under the MIT License. See the LICENSE file for details.

Releases

Make sure the changelog is up to date and the top section reads Unreleased. Increment the version with the bumpversion workflow in Actions - it will update the version everywhere in the repo, create a tag, and trigger a Github release. If all looks good, publish to PyPI via the publish workflow in Actions.

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

ginkgo_ai_client-0.4.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

ginkgo_ai_client-0.4.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file ginkgo_ai_client-0.4.0.tar.gz.

File metadata

  • Download URL: ginkgo_ai_client-0.4.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ginkgo_ai_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d1e264983c96f62d23332a0bd88555a926d7b1bf8d25acf06d8dfde82936c30b
MD5 be4d6facc3cb6f73c3dec98157e9313d
BLAKE2b-256 100a62773a9a8f07e42c76c7839b5290d92033ed606ef8b7a7fbd0184913719e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ginkgo_ai_client-0.4.0.tar.gz:

Publisher: publish.yml on ginkgobioworks/ginkgo-ai-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ginkgo_ai_client-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ginkgo_ai_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9d36cb9361f1ceec8f217d61b9dfa6c8bdc67c7b70bf75c0121c2a3883fdd3
MD5 73f1a4899f2aa6bf8e2e9ffba74fca0c
BLAKE2b-256 0f4fb4d04ee07ffdbfe7d4f7026ac7122003324516fd352c1de0f4290d876aa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ginkgo_ai_client-0.4.0-py3-none-any.whl:

Publisher: publish.yml on ginkgobioworks/ginkgo-ai-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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