Skip to main content

Using the generation pipeline

Defining the attribute schema

First we create the attribute interface and how they are going to be generated, here is an example schema

SCHEMA
[
{
attribute_name: "gender",
generation_type: "random_with_rarity",
options: [
{
rarity: 50,
value: "male",
label: "Male",
},
{
rarity: 50,
value: "female",
label: "Female",
},
],
},
{
attribute_name: "life_period",
generation_type: "random_with_rarity",
options: [
{
rarity: 16,
value: "Infancy",
label: "Infancy",
},
{
rarity: 15,
value: "Childhood",
label: "Childhood",
},
{
rarity: 14,
value: "Adolescence",
label: "Adolescence",
},
{
rarity: 14,
value: "Young Adulthood",
label: "Young Adulthood",
},
{
rarity: 12,
value: "Adulthood",
label: "Adulthood",
},
{
rarity: 10,
value: "Seasoned",
label: "Seasoned",
},
{
rarity: 10,
value: "Old Age",
label: "Old Age",
},
],
},
{
attribute_name: "origin",
generation_type: "random_from_options",
brick_name_for_options: "Location",
},
{
attribute_name: "role",
generation_type: "random_from_options",
brick_name_for_options: "Occupation",
},
{
attribute_name: "species",
generation_type: "random_from_options",
brick_name_for_options: "Species",
},
{
attribute_name: "hobbies",
generation_type: "random_from_options",
brick_name_for_options: "Hobbies",
},
{
attribute_name: "name",
generation_type: "prompted_text_attribute",
prompt:
"Create a name for a pudgy penguin. Don't write anything else, just the name.",
},
{
attribute_name: "traits",
generation_type: "prompted_text_attribute",
prompt:
"Create five traits that characterize our chracter, these characteristics describe their personality. Don't describe the traits, just list them. No numbering needed, just sepparate with commas.",
},
{
attribute_name: "core_description",
generation_type: "prompted_text_attribute",
prompt:
"Write an elaborated character's core description. Be both factual, and psychological. Make that text is no longer than 500 characters.",
},
{
attribute_name: "backstory",
generation_type: "prompted_text_attribute",
prompt:
"Write a exciting and short backstory for our character. Make that text no longer than 200 characters.",
},
{
attribute_name: "motivation",
generation_type: "prompted_text_attribute",
prompt:
"Write an elaborated character's motivations. Be both factual, and psychological. Make that text is no longer than 200 characters.",
},
{
attribute_name: "flaws",
generation_type: "prompted_text_attribute",
prompt:
"Write an elaborated character's flaws. Be both factual, and psychological. Make that text is no longer than 200 characters.",
},
{
attribute_name: "speech_adjectives",
generation_type: "prompted_text_attribute",
prompt:
"Give three unique speech adjectives, these are characteristics of a way a character from the world of Miyanu speaks. Don't describe the adjectives, just list them. No numbering needed, just sepparate with commas.",
},
{
attribute_name: "appearance",
generation_type: "prompted_text_attribute",
prompt:
"Describe the appearance of this character, keep the description smaller than 200 characters.",
},
];

Generation types

  • fixed
  • random_from_options
  • random_with_rarity
  • random_with_inner_options
  • prompted_text_attribute

Fixed Generation

In a fixed generation type, the value for an attribute is predetermined and does not vary between characters. This is useful when you want to ensure that all generated characters share a specific trait. In the provided schema example, the attribute "type" uses fixed generation, where all characters will have the value "meridian" for their type.

  {
"attribute_name": "type",
"generation_type": "fixed",
"value": "meridian"
},

Every generated character will have "type": "meridian".

Random From Options

The random_from_options generation type allows you to select a value at random from a list of predefined options. This is ideal for attributes that can take on multiple values, but you want the assignment to be purely random.

  {
"attribute_name": "hobbies",
"generation_type": "random_from_options",
"options": [
"Fortune Telling",
"Miniature Airship building",
"Herbology",
"Ethereal Music Composition",
"Potion Brewing",
"Rune Engraving",
"Celestial Observation",
]
},

For each character, one hobby will be randomly chosen from the list of options.

Random With Rarity

In this generation type, options are not only selected randomly, but each option also has a specific rarity or probability. The rarity defines the likelihood of an option being selected, which is useful when some values should appear more or less frequently than others.

  {
"attribute_name": "gender",
"generation_type": "random_with_rarity",
"options": [
{
"rarity": 50,
"value": "male",
"label": "Male",
},
{
"rarity": 50,
"value": "female",
"label": "Female",
},
]
}

Here, both "male" and "female" have equal rarity (50), so they will be selected with the same probability.

Random With Inner Options

This generation type is an extension of random_with_rarity, allowing for nested options. Once a primary value is selected, additional sub-options (inner options) can be chosen based on that primary value. This is useful for creating hierarchical or multi-layered attributes.

  {
"attribute_name": "teachings",
"generation_type": "random_with_inner_options",
"options": [
{
"rarity": 50,
"value": "genevieve",
"label": "Genevieve",
"innerOptions": [
{
"rarity": 50,
"value": "Spiritual",
"label": "Spiritual",
},
{
"rarity": 50,
"value": "Volatile",
"label": "Volatile",
},
]
},
{
"rarity": 50,
"value": "gilderay",
"label": "Gilderay",
"innerOptions": [
{
"rarity": 50,
"value": "Ambitious",
"label": "Ambitious",
},
{
"rarity": 50,
"value": "Reckless",
"label": "Reckless",
},
]
}
]
},

In this case, the primary options "Genevieve" or "Gilderay" are first selected with equal probability, and then their respective inner options (like "Spiritual" or "Ambitious") are selected based on the primary choice.

Prompted Text Attribute

This type generates a value by providing a text prompt to a language model or AI to create a description. It is useful for generating complex or creative attributes, such as backstories or detailed character traits. The prompt should guide the model to generate the desired type of output.

  {
"attribute_name": "core_description",
"generation_type": "prompted_text_attribute",
"prompt": "Write an elaborated character's core description. Be both factual, and psychological. Make that text is no longer than 900 characters."
}

Here, a language model will generate a unique description for each character based on the provided prompt, ensuring the description aligns with the specified guidelines.

Using the schema

After defining the schema we just need to run a POST request on the endpoint /generate while authenticated. The body on the request should contain the amount of characters to generate and the character schema created. Like so:

{
"character_schema": "meridian",
"amount": 10
}