GENA CLIENT LIBRARIES

Build with TuluAI

Install an official client to browse public datasets, download their contents, or publish a dataset directly. Public reads are open; publishing requires a signed-in account and explicit rights confirmations.

API base URLhttps://tuluai.app

01 / INSTALL

Choose your language

The clients need no extra runtime dependencies. JavaScript requires Node.js 18 or newer; Python supports versions 3.9 and newer.

JAVASCRIPT / TYPESCRIPTv0.1.0 · MIT

@tuluai/gena-datasets

npm
npm install @tuluai/gena-datasets
Package details on npm
PYTHONv0.1.0 · MIT

gena-datasets

pip
python -m pip install gena-datasets
Package details on PyPI

02 / JAVASCRIPT AND TYPESCRIPT

Browse and download

Create a client, list public catalog entries, and use an entry’s ID to retrieve its metadata or the original file content. The optional search and language filters are applied to the returned catalog.

JavaScript
import { GenaDatasetsClient } from '@tuluai/gena-datasets'

const gena = new GenaDatasetsClient()
const datasets = await gena.listDatasets({
  language: 'Tulu',
  search: 'translation',
})

if (datasets.length > 0) {
  const dataset = await gena.getDataset(datasets[0].id)
  console.log(dataset.title, dataset.license)

  const originalFileText = await gena.downloadDataset(dataset.id)
  console.log(originalFileText)
}
Public readsListing, retrieving, and downloading public datasets do not require an API key or a signed-in account.

Client options

Optional configuration
const gena = new GenaDatasetsClient({
  baseUrl: 'https://tuluai.app',
  // Optional custom fetch implementation, useful for tests or runtimes
  fetchImpl: fetch,
})

The default base URL is https://tuluai.app. TypeScript declarations for dataset metadata and submissions are included in the package.

03 / PYTHON

Use datasets in Python

The Python client returns dictionaries using the API’s field names. Filter the list in your application, then fetch a dataset or its source file.

Python
from gena_datasets import GenaDatasetsClient

gena = GenaDatasetsClient(timeout=30)
datasets = gena.list_datasets()
tulu_datasets = [
    item for item in datasets
    if "tulu" in item.get("language", "").lower()
]

if tulu_datasets:
    dataset = gena.get_dataset(tulu_datasets[0]["id"])
    print(dataset["title"], dataset["license"])

    original_file_text = gena.download_dataset(dataset["id"])
    print(original_file_text)

Use GenaDatasetsClient(base_url=..., timeout=...) to point the client at a compatible Gena deployment or adjust its request timeout.

04 / DATASET SUBMISSIONS

Publish a dataset

Both clients can publish a dataset using the current sign-in token from the contributor’s account. Get that token from the active signed-in session when publishing; do not hardcode it. Developer API keys can read public datasets but cannot publish data.

JavaScript submission
const idToken = await currentUser.getIdToken()

const result = await gena.submitDataset({
  title: 'Example collection',
  description: 'A short description of the data and how it was collected.',
  language: 'Tulu',
  license: 'CC BY 4.0',
  fileName: 'examples.jsonl',
  content: '{"text":"Example"}\n',
  sourceUrl: 'https://example.org/source',
  rightsConfirmed: true,
  publicReleaseConfirmed: true,
}, { idToken })

console.log(result.datasetId, result.status)
Python submission
id_token = current_user.get_id_token()

result = gena.submit_dataset(
    {
        "title": "Example collection",
        "description": "A short description of the data and how it was collected.",
        "language": "Tulu",
        "license": "CC BY 4.0",
        "fileName": "examples.jsonl",
        "content": '{"text":"Example"}\n',
        "sourceUrl": "https://example.org/source",
        "rightsConfirmed": True,
        "publicReleaseConfirmed": True,
    },
    id_token=id_token,
)

print(result["datasetId"], result["status"])
Publishing is immediateA successful request returns HTTP 201 and status published. Contributors must have the right to share the data, choose an appropriate license, and confirm public release. Uploaded datasets are not used for model training by default.

05 / ERRORS AND LIMITS

Handle failures and submission rules

SituationWhat to check
GenaDatasetsErrorInspect message and status. A status of 0 usually means the service could not be reached.
Invalid dataset IDIDs may contain letters, numbers, underscores, and hyphens, up to 128 characters.
Submission rejectedCheck required fields, the file extension, the content size, the rights confirmation, and the account sign-in token.
JavaScript error handling
import {
  GenaDatasetsClient,
  GenaDatasetsError,
} from '@tuluai/gena-datasets'

try {
  const datasets = await new GenaDatasetsClient().listDatasets()
  console.log(datasets)
} catch (error) {
  if (error instanceof GenaDatasetsError) {
    console.error(error.status, error.message)
  } else {
    throw error
  }
}
Python error handling
from gena_datasets import GenaDatasetsClient, GenaDatasetsError

try:
    datasets = GenaDatasetsClient().list_datasets()
except GenaDatasetsError as error:
    print(error.status, str(error))
  • Accepted submission file extensions: .csv, .json, .jsonl, and .txt.
  • Dataset content must be text and no larger than 900,000 bytes.
  • The request must include a title, description, language, license, filename, content, rightsConfirmed: true, and publicReleaseConfirmed: true.
  • Successful publishes return HTTP 201 with status published.