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.
@tuluai/gena-datasets
npm install @tuluai/gena-datasets02 / 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.
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)
}Client options
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.
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.
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)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"])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
| Situation | What to check |
|---|---|
GenaDatasetsError | Inspect message and status. A status of 0 usually means the service could not be reached. |
| Invalid dataset ID | IDs may contain letters, numbers, underscores, and hyphens, up to 128 characters. |
| Submission rejected | Check required fields, the file extension, the content size, the rights confirmation, and the account sign-in token. |
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
}
}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, andpublicReleaseConfirmed: true. - Successful publishes return HTTP
201with statuspublished.