Chapter 3. Adding skills to your taxonomy tree
The student 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:
-
version- The version of theqna.yamlfile, 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. -
task_description- A description of your skill and its function. seed_examples- A collection of key and value entries.-
context- Grounded skills require the user to provide additional context containing information that the model needs to know for executing the skill. The context key is not required for freeform skills. Eachqna.yamlneeds five context blocks and has a maximum token count of 500 tokens. -
question- Specify a question for the model. Eachqna.yamlfile needs at least five question and answer pairs with a maximum token count of 250 tokens. -
answer- Specify an answer for the model. Eachqna.yamlfile needs at least five question and answer pairs with a maximum token count of 250 tokens.
-
3.1. Creating a skill YAML file Copy linkLink copied to clipboard!
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
ilabCLI. - You have root user access on your machine.
Procedure
Navigate to the
compositional_skillsfolder the taxonomy directory.ImportantCreating foundational skills, skills involving creating code, is not currently supported on RHEL AI version 1.3.
Based on the directories that exist in the tree, select where in the tree you want to add your skill
qna.yamlfile.Example file path in the taxonomy tree
taxonomy/compositional_skills/grounded/<add_example>/qna.yamlUsing your desired text editor, create the
qna.yamlfile.NoteFor SDG to run properly, you must include at least five question and answer pair examples in your
qna.yamlfile.-
Add the necessary keys to the
qna.yamlfile and save your changes. For more information on formatting yourqna.yamlfile, see "Sample skill YAML specifications".
Verification
To verify that your skill is in the proper format, you can run the following command:
$ ilab taxonomy diffThe CLI displays if your taxonomy tree and
qna.yamlfile 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.yamlfilecompositional_skills/writing/freeform/<example>/qna.yaml Taxonomy in /taxonomy/ is valid :)Example output of invalid taxonomy tree and
qna.yamlfile with errors6: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 Copy linkLink copied to clipboard!
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
created_by: <user-name>
task_description: 'Teach the model how to rhyme.'
seed_examples:
- question: What are 5 words that rhyme with horn?
answer: warn, torn, born, thorn, and corn.
- 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
created_by: <user-name>
task_description: |
Given a context document and a user's question, determine whether you have
enough information to provide a yes-or-no answer to the user's question.
seed_examples:
- context: |
Document:
All regular employees except those on a leave of absence (LOA) must file Form XYZ.
If you are a regular employee on a LOA, you do not need to file the form. If you
are a supplemental employee (type B1, type B2, or type B3), your employee type
determines which form you must file, as follows:
* If you are a type B1 employee, you must follow the same rules that apply to the
regular employees.
* If you are a type B2 employee, the rules that apply to you are different from
those that apply to the regular employees. See Pub. 31416 to find out which forms
you should file.
* If you are a supplemental employee of neither type B1 nor type B2, you are a
type B3 employee. Different rules apply for each part of the year. For information
on type B3 employees, see Pub. 31416.
question: |
User asks the following question:
"I am a supplemental employee of type B1 on a LOA. Should I file Form XYZ?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "no". Indeed, the user is a
supplemental employee of type B1 and is on a LOA. According to the document,
supplemental employees of type B1 must follow the same rules that apply to the
regular employees, and a regular employee on a LOA does not need to file Form XYZ.
Hence, the user does not need to file Form XYZ. I reached this conclusion using
only the information available in the document and in the user's question.
- context: |
Document:
All regular employees except those on a leave of absence (LOA) must file Form XYZ.
If you are a regular employee on a LOA, you do not need to file the form. If you
are a supplemental employee (type B1, type B2, or type B3), your employee type
determines which form you must file, as follows:
* If you are a type B1 employee, you must follow the same rules that apply to the
regular employees.
* If you are a type B2 employee, the rules that apply to you are different from
those that apply to the regular employees. See Pub. 31416 to find out which forms
you should file.
* If you are a supplemental employee of neither type B1 nor type B2, you are a
type B3 employee. Different rules apply for each part of the year. For information
on type B3 employees, see Pub. 31416.
question: |
User asks the following question:
"I am a supplemental employee of type B1, not on a LOA. Should I file Form XYZ?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "yes". Indeed, the user is a
supplemental employee of type B1 and is not on a LOA. According to the document,
supplemental employees of type B1 must follow the same rules that apply to the
regular employees, and all regular employees except those on a LOA must file
Form XYZ. Hence, the user must file Form XYZ. I reached this conclusion using only
the information available in the document and in the user's question.
- context: |
Document:
The Helping Hands Program enables the employees of XYZ Technologies to support
nonprofit organizations within the communities where the employees live and work.
All active, regular employees of XYZ Technologies are eligible to participate in
the program. The following categories are ineligible to participate in the program:
* Retirees who no longer work at XYZ Technologies
* XYZ employees on a leave of absence
* Supplemental employees and contractors who are not regular XYZ employees
Please note that XYZ employees on a leave of absence can participate in the Helping
Hands Program once they return to an active status.
question: |
User asks the following question:
"I am an active, regular employee of XYZ Technologies. I am not on a leave of absence.
Can I participate in the Helping Hands Program?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "yes". Indeed, the user is an
active, regular employee of XYZ Technologies. According to the document, all active,
regular employees of XYZ Technologies are eligible to participate in the Helping
Hands Program. The document excludes retirees, XYZ employees on a leave of absence,
and those who are not regular XYZ employees; however, the user is an active and
regular employee who is not on a leave of absence, so the exclusions do not apply.
Therefore, the user can participate in the Helping Hands Program. I reached this
conclusion using only the information available in the document and in the user's
question.
- context: |
Document:
Applying for a driver's license is as easy as 1-2-3! You can apply for a driver's license
if you bring documents from each of the three sections below:
Section 1. Proof of Identity - one document is required from the list below:
* Unexpired passport
* Birth certificate
* Certificate of naturalization or citizenship
* Valid, unexpired Permanent Resident Card
Section 2. Proof of Social Security Number - one document is required from the list below:
* Social Security card
* W-2 form
* SSA-1099 form
* Paystub
Section 3. Proof of Residency - two different documents are required from the list below:
* Home utility bill
* Medical document
* Proof of car registration
* Proof of employment
* Proof of insurance
* Mortgage bill
* Lease agreement
* Tax return
question: |
User asks the following question:
"Can I apply for a driver's license if I bring my birth certificate, my W-2 form, and
my proof of car registration?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "no". Indeed, the user wants to
bring a birth certificate, a W-2 form, and a proof of car registration. According to
the context document, to apply for a driver's license, the user must bring one proof
of Identity, one proof of Social Security Number, and two different proof of Residency
documents. A birth certificate is one proof of Identity, a W-2 form is one proof of
Social Security Number, and a proof of car registration is one proof of Residency
document. The user cannot apply for a driver's license without bringing a second proof
of Residency document. I reached this conclusion using only the information available
in the context document and in the user's question.
- context: |
Document:
XYZ Corporation released three models of phones in 2024: Model MX, Model MY, and
Model MZ. Model MX is the budget-conscious choice, it has 6-inch screen, a single
rear camera, and 32 GB of storage. Model MY is the most portable choice, with a
5-inch screen, a dual rear camera, and 32 GB of storage. Model MZ is the luxury
choice, sporting a 7-inch screen, a dual rear camera, and 64 GB of storage.
These three models are the only ones available for sale in our store.
question: |
User asks the following question:
"Does your store sell a phone made by XYZ Corporation that has a 6-inch screen and
a dual rear camera?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "no". Indeed, the user is looking
for a phone made by XYZ Corporation that has a 6-inch screen and a dual rear camera.
According to the document, our store sells only three models of phones made by
XYZ Corporation: Model MX, Model MY, and Model MZ. Only Model MX has a 6-inch screen,
but it has a single rear camera; models MY and MZ do not have a 6-inch screen. Hence,
our store does not sell a phone the user is looking for. I reached this conclusion
using only the information available in the document and in the user's question.
- context: |
Document:
Solar System Overview
The solar system has one star, eight planets, five dwarf planets, at least 290 moons,
more than 1.3 million asteroids, and about 3,900 comets. It is located in an outer
spiral arm of the Milky Way galaxy called the Orion Arm, or Orion Spur. Our solar
system orbits the center of the galaxy at about 515,000 mph (828,000 kph). It takes
about 230 million years to complete one orbit around the galactic center.
We call it the solar system because it is made up of our star, the Sun, and everything
bound to it by gravity - the planets Mercury, Venus, Earth, Mars, Jupiter, Saturn,
Uranus, and Neptune; dwarf planets Pluto, Ceres, Makemake, Haumea, and Eris - along
with hundreds of moons; and millions of asteroids, comets, and meteoroids.
question: |
User asks the following question:
"Does the solar system have two stars?"
As the responding agent, do you have enough information to provide a yes-or-no answer
to the user's question? Answer Yes or No, then explain your answer.
answer: |
Yes, I have enough information to provide a yes-or-no answer to the user's question.
Specifically, the answer to the user's question is "no". According to the document,
the solar system has only one star - the Sun, not two stars. I reached this
conclusion using only the information available in the document and in the user's
question.
- 1 1
- Specify the version of the skill
qna.yamlformat. Currently, the valid value is2. - 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.