Scale API Key can be retrieved by logging into the Scale dashboard. In the customer dashboard, click your profile and visit the “API Key” section to get your “Live API Key”, which should start with live_.
2
Decide Which Tasks You Want to Download
You can browse your projects and batches in the Scale Dashboard.
API supports searching tasks by name or ID of the associated projects, batches or deliveries.
Scale API offers multiple ways to search tasks that you want to download:
You can download from a project or a batch
You can download tasks directly from a specific delivery
You can recently completed tasks from a project
3
Downloading Tasks
Below you can find an example of how to download completed tasks from a project: Downloading Tasks
You can also explore other ways to download tasks from Scale API:
# Downloads all completed tasks from a project and saves them to a jsonl fileimport jsonPROJECT_NAME = "My Test Project"def get_tasks_by_project_name(project_name: str): tasks_generator = client.v2_get_tasks( project_name=project_name, status="completed", limit=100, ) tasks = list(tasks_generator) return tasksif __name__ == "__main__": tasks = get_tasks_by_project_name(PROJECT_NAME) with open(f"{PROJECT_NAME}.jsonl", "w+") as f: for task in tasks: json.dump(task.model_dump(mode='json'), f) f.write("\n")
Once a batch is created, then the tasks can be created within that batch. Each task is expected to have certain information sent in the request payload that corresponds to the project.
# Those variables are specific to each project and need to be aligned with Scale before sending themtemplate_variables = { "id": "0", "prompt": "Hello world!", "base_model_response": "..." "test_modeL_response": "..." "languageCode": "en_US",}# Task Payloadpayload = { "project": project.name, "batch": batch.name, "template_variables": template_variables, "unique_id":"unique_id_12345"}def create_task_request(client: scaleapi.ScaleClient, payload): try: task = client.create_task(TaskType.Chat, **payload) return task.id except ScaleDuplicateResource as dup_err: # Existing Task print(f"Task already exists: {dup_err.message}") except ScaleException as err: print(f"❌ ERROR Task Creation: {err.message}") return Nonetask_id = create_task_request(client, payload)