Chapter 3. Adding skills to your taxonomy tree The starter model can learn custom skills by populating the qna.yaml file with your domain specific skill. Each qna.yaml file for skills contains a set of key-value entries with the following keys: Table 3.1. Red Hat Enterprise Linux AI Field Desciption Restraints version The version of the qna.yaml file, this is the format of the file used for SDG The currently supported value for this parameter is 2. created_by Your Git username or name of contributor. None task_description A description of your skill and its function. None seed_examples A collection of key and value entries. Each qna.yaml file needs at least five seed examples context Grounded skills require the user to provide additional context containing information that the model needs to know for executing the skill. This filed is required for grounded skills. Each qna.yaml needs five context blocks and has a maximum token count of 500 tokens. question Specify a question for the model. Each qna.yaml file needs at least five question and answer pairs with a maximum token count of 250 tokens. answer Specify an answer for the model. Each qna.yaml file needs at least five question and answer pairs with a maximum token count of 250 tokens. 3.1. Creating a skill YAML file You can customize your taxonomy tree so the model can learn new skills for your desired use cases. The following procedure displays how to create a taxonomy tree that contains your skill qna.yaml file. Prerequisites You installed RHEL AI with the bootable container image. You initialized InstructLab and can use the ilab CLI. You have root user access on your machine. Procedure Navigate to the compositional_skills folder the taxonomy directory. Important Creating foundational skills, skills involving creating code, is not currently supported on RHEL AI version 1.4. Based on the directories that exist in the tree, select where in the tree you want to add your skill qna.yaml file. Example file path in the taxonomy tree taxonomy/compositional_skills/grounded/<add_example>/qna.yaml Using your desired text editor, create the qna.yaml file. Note For SDG to run properly, you must include at least five question and answer pair examples in your qna.yaml file. Add the necessary keys to the qna.yaml file and save your changes. For more information on formatting your qna.yaml file, see "Sample skill YAML specifications". Verification To verify that your skill is in the proper format, you can run the following command: USD ilab taxonomy diff The CLI displays if your taxonomy tree and qna.yaml file is valid and properly formatted. The CLI also displays where to fix any errors you may encounter. Example output of valid taxonomy tree and qna.yaml file compositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :) Example output of invalid taxonomy tree and qna.yaml file with errors 6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting. 3.2. Sample skills YAML specifications Skills share a similar question and answer layout as knowledge YAML files. On RHEL AI, the synthetic data generation (SDG) process uses your qna.yaml seed examples to create a large set of artificial data for the model to learn, rather than relying exclusively on user generated data. The order of the question, answer, and context pairs does not influence the SDG or training process. There are multiple types of skills that are split into categories: freeform, grounded, and foundational skills. You can see samples of each category in the following examples: Example freeform compositional skill qna.yaml file version: 2 1 created_by: <user-name> 2 task_description: 'Teach the model how to rhyme.' 3 seed_examples: - question: What are 5 words that rhyme with horn? 4 answer: warn, torn, born, thorn, and corn. 5 - question: What are 5 words that rhyme with cat? answer: bat, gnat, rat, vat, and mat. - question: What are 5 words that rhyme with poor? answer: door, shore, core, bore, and tore. - question: What are 5 words that rhyme with bank? answer: tank, rank, prank, sank, and drank. - question: What are 5 words that rhyme with bake? answer: wake, lake, steak, make, and quake. Example grounded compositional skill qna.yaml file version: 2 1 created_by: <user-name> 2 task_description: This skill provides the ability to read a markdown-formatted table. 3 seed_examples: - context: | 4 | **Breed** | **Size** | **Barking** | **Energy** | |----------------|--------------|-------------|------------| | Afghan Hound | 25-27 in | 3/5 | 4/5 | | Labrador | 22.5-24.5 in | 3/5 | 5/5 | | Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 | | Poodle (Toy) | <= 10 in | 4/5 | 4/5 | question: | 5 Which breed has the most energy? answer: | 6 The breed with the most energy is the Labrador. - context: | | **Name** | **Date** | **Color** | **Letter** | **Number** | |----------|----------|-----------|------------|------------| | George | Mar 5 | Green | A | 1 | | Grainne | Dec 31 | Red | B | 2 | | Abigail | Jan 17 | Yellow | C | 3 | | Bhavna | Apr 29 | Purple | D | 4 | | Remy | Sep 9 | Blue | E | 5 | question: | What is Grainne's letter and what is her color? answer: | Grainne's letter is B and her color is red. - context: | | Banana | Apple | Blueberry | Strawberry | |--------|------------|-----------|------------| | Yellow | Red, Green | Blue | Red | | Large | Medium | Small | Small | | Peel | Peel | No peel | No peel | question: | Which fruit is blue, small, and has no peel? answer: | The blueberry is blue, small, and has no peel. 1 1 Specify the version of the skill qna.yaml format. 2 2 Specify your name or git username. 3 3 Specify a description of your skill and its function. 4 Specify additional context containing information that the model needs to know for executing the skill. Required for grounded skills. 4 5 Specify a question for the model. 5 6 Specify the desired response from the model.

Commands:
taxonomy/compositional_skills/grounded/<add_example>/qna.yaml
ilab taxonomy diff
compositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)
6:11 error syntax error: mapping values are not allowed here (syntax) Reading taxonomy failed with the following error: 1 taxonomy with errors! Exiting.
version: 2 1 created_by: <user-name> 2 task_description: 'Teach the model how to rhyme.' 3 seed_examples: - question: What are 5 words that rhyme with horn? 4 answer: warn, torn, born, thorn, and corn. 5 - question: What are 5 words that rhyme with cat? answer: bat, gnat, rat, vat, and mat. - question: What are 5 words that rhyme with poor? answer: door, shore, core, bore, and tore. - question: What are 5 words that rhyme with bank? answer: tank, rank, prank, sank, and drank. - question: What are 5 words that rhyme with bake? answer: wake, lake, steak, make, and quake.
version: 2 1 created_by: <user-name> 2 task_description: This skill provides the ability to read a markdown-formatted table. 3 seed_examples: - context: | 4 | **Breed** | **Size** | **Barking** | **Energy** | |----------------|--------------|-------------|------------| | Afghan Hound | 25-27 in | 3/5 | 4/5 | | Labrador | 22.5-24.5 in | 3/5 | 5/5 | | Cocker Spaniel | 14.5-15.5 in | 3/5 | 4/5 | | Poodle (Toy) | <= 10 in | 4/5 | 4/5 | question: | 5 Which breed has the most energy? answer: | 6 The breed with the most energy is the Labrador. - context: | | **Name** | **Date** | **Color** | **Letter** | **Number** | |----------|----------|-----------|------------|------------| | George | Mar 5 | Green | A | 1 | | Grainne | Dec 31 | Red | B | 2 | | Abigail | Jan 17 | Yellow | C | 3 | | Bhavna | Apr 29 | Purple | D | 4 | | Remy | Sep 9 | Blue | E | 5 | question: | What is Grainne's letter and what is her color? answer: | Grainne's letter is B and her color is red. - context: | | Banana | Apple | Blueberry | Strawberry | |--------|------------|-----------|------------| | Yellow | Red, Green | Blue | Red | | Large | Medium | Small | Small | | Peel | Peel | No peel | No peel | question: | Which fruit is blue, small, and has no peel? answer: | The blueberry is blue, small, and has no peel.