Before you start
The below imports are needed to use the code examples in this section.API key and client
Please provide a valid API key below to connect to the Labelbox client properly. For more information, please review the Create API key guide.Create a prompt and response ontology
You can create ontologies for prompt and response projects in the same way as other project ontologies using two methods:client.create_ontology
and client.create_ontology_from_feature_schemas
. For response creation projects the only difference between other projects is the media_type for the project needs to be set to lb.MediaType.Text
. For prompt and prompt response creation projects you need to include their respective media type: lb.MediaType.LLMPromptCreation
and lb.MediaType.LLMPromptResponseCreation
. Additional you also need to provide an additional parameter of ontology_kind
, which needs to be set to lb.OntologyKind.ResponseCreation
this is only applicable for prompt and prompt response creation projects.
Option A: create_ontology
Typically, you create ontologies and generate the associated features simultaneously. Below is an example of creating an ontology for your prompt and response projects using supported classifications; for information on supported annotation types, visit our prompt and response generation guide.
Depending on whether you are creating a prompt, a response, or both, certain classifications in your ontologies might not be necessary. See supported annotation types for more information.
Option B: create_ontology_from_feature_schemas
You can also create ontologies using feature schema IDs. This makes your ontologies come with existing features instead of generating new features. You can get these features by going to the Schema tab inside Labelbox.
Create response creation projects
You can create response creation projects usingclient.create_response_creation_project
, which uses the same parameters as client.create_project
but provides better validation to ensure the project is set up correctly. Additionally, you need to import text data rows to be used as prompts.
Create prompt response and prompt creation projects
When creating a prompt response or prompt creation project usingclient.create_prompt_response_generation_project
, you do not need to create data rows because they are generated automatically. This method takes the same parameters as the traditional client.create_project
but with a few specific additional parameters.
Parameters
Theclient.create_prompt_response_generation_project
method requires the following parameters:
-
create_prompt_response_generation_project
parameters:-
name
(required): The name of your new project. -
description
: An optional description of your project. -
media_type
(required): The type of assets this project accepts. Can be eitherlb.MediaType.LLMPromptCreation
orMediaType.LLMPromptResponseCreation
, depending on the project type you are setting up. -
dataset_name
: The name of the dataset where the generated data rows will be located. Include this parameter only if you want to create a new dataset. -
dataset_id
: An optional dataset ID of an existing Labelbox dataset. Include this parameter if you want to append it to an existing dataset. -
data_row_count
: The number of data row assets that will be generated and used with your project.
-