Skip to content

Commit c3c16f2

Browse files
committed
Skill form improvements
*.* remove redundant description text from individual seed example *.* add link to the seed examples documentation page for user help *.* Rename File path to Taxonomy Directory Path and update the description. *.* Taxonomy directory path will only show directories within compositional_skills directory in taxonomy repo. Taxonomy repo doesn't allow contribution to foundational_skills at this point of time. *.* Update Skill contribution page head text with related links. Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
1 parent 62551bc commit c3c16f2

File tree

13 files changed

+52
-65
lines changed

13 files changed

+52
-65
lines changed

pathservice/cmd/pathservice.go

+8-39
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"os"
1010
"os/signal"
1111
"path/filepath"
12-
"strings"
1312
"sync"
1413
"syscall"
1514
"time"
@@ -27,7 +26,7 @@ const (
2726
repoDir = "/tmp/taxonomy"
2827
checkInterval = 1 * time.Minute // Interval for checking updates
2928
serviceLogLevel = "IL_UI_DEPLOYMENT"
30-
SKILLS = "skills/"
29+
SKILLS = "compositional_skills/" // Currently, we are only supporting compositional skills
3130
KNOWLEDGE = "knowledge/"
3231
)
3332

@@ -148,47 +147,18 @@ func (ps *PathService) checkForUpdates(ctx context.Context, wg *sync.WaitGroup,
148147

149148
}
150149

151-
func (ps *PathService) skillPathHandler(w http.ResponseWriter, r *http.Request) {
152-
dirName := r.URL.Query().Get("dir_name")
153-
154-
var subDirs []string
155-
var levelOne bool
156-
if dirName == "" {
157-
levelOne = true
158-
}
159-
160-
dirPath := filepath.Join(repoDir, dirName)
161-
entries, err := os.ReadDir(dirPath)
162-
if err != nil {
163-
http.Error(w, "Directory path doesn't exist", http.StatusInternalServerError)
164-
return
165-
}
166-
167-
for _, entry := range entries {
168-
if entry.IsDir() {
169-
// If we are at root level, then only return directories ending with skills
170-
if levelOne && !strings.HasSuffix(entry.Name(), "skills") {
171-
continue
172-
}
173-
subDirs = append(subDirs, entry.Name())
174-
}
175-
}
176-
response, err := json.Marshal(subDirs)
177-
if err != nil {
178-
http.Error(w, "Error creating response", http.StatusInternalServerError)
179-
return
180-
}
150+
func (ps *PathService) skillPathHandler(w http.ResponseWriter, r *http.Request){
151+
ps.pathHandler(w, r, SKILLS)
152+
}
181153

182-
w.Header().Set("Content-Type", "application/json")
183-
w.Header().Set("Access-Control-Allow-Origin", "*")
184-
w.Write(response)
154+
func (ps *PathService) knowledgePathHandler(w http.ResponseWriter, r *http.Request){
155+
ps.pathHandler(w, r, KNOWLEDGE)
185156
}
186157

187-
func (ps *PathService) knowledgePathHandler(w http.ResponseWriter, r *http.Request) {
158+
func (ps *PathService) pathHandler(w http.ResponseWriter, r *http.Request, rootDir string) {
188159
dirName := r.URL.Query().Get("dir_name")
189160

190-
// Knowledge taxonomy tree is present in the knowledge directory
191-
dirName = KNOWLEDGE + dirName
161+
dirName = rootDir + dirName
192162
var subDirs []string
193163
dirPath := filepath.Join(repoDir, dirName)
194164
entries, err := os.ReadDir(dirPath)
@@ -202,7 +172,6 @@ func (ps *PathService) knowledgePathHandler(w http.ResponseWriter, r *http.Reque
202172
subDirs = append(subDirs, entry.Name())
203173
}
204174
}
205-
206175
response, err := json.Marshal(subDirs)
207176
if err != nil {
208177
http.Error(w, "Error creating response", http.StatusInternalServerError)

src/app/api/pr/skill/route.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SkillYamlData, AttributionData } from '@/types';
77
import { dumpYaml } from '@/utils/yamlConfig';
88

99
const GITHUB_API_URL = 'https://api.github.com';
10+
const SKILLS_DIR = 'compositional_skills';
1011
const UPSTREAM_REPO_OWNER = process.env.NEXT_PUBLIC_TAXONOMY_REPO_OWNER!;
1112
const UPSTREAM_REPO_NAME = process.env.NEXT_PUBLIC_TAXONOMY_REPO!;
1213
const BASE_BRANCH = 'main';
@@ -42,8 +43,8 @@ export async function POST(req: NextRequest) {
4243
}
4344

4445
const branchName = `skill-contribution-${Date.now()}`;
45-
const newYamlFilePath = `${filePath}qna.yaml`;
46-
const newAttributionFilePath = `${filePath}attribution.txt`;
46+
const newYamlFilePath = `${SKILLS_DIR}/${filePath}qna.yaml`;
47+
const newAttributionFilePath = `${SKILLS_DIR}/${filePath}attribution.txt`;
4748

4849
const skillData = yaml.load(content) as SkillYamlData;
4950
const attributionData = attribution as AttributionData;

src/app/edit-submission/knowledge/[id]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const EditKnowledgePage: React.FunctionComponent<{ params: { id: string } }> = (
106106
});
107107
knowledgeExistingFormData.seedExamples = seedExamples;
108108

109-
// Set the file path from the current YAML file
109+
// Set the file path from the current YAML file (remove the root folder name from the path)
110110
const currentFilePath = foundYamlFile.filename.split('/').slice(1, -1).join('/');
111111
knowledgeEditFormData.knowledgeFormData.filePath = currentFilePath + '/';
112112

src/app/edit-submission/skill/[id]/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const EditSkillPage: React.FunctionComponent<{ params: { id: string } }> = ({ pa
8888
skillExistingFormData.seedExamples = seedExamples;
8989

9090
// Set the file path from the current YAML file (Note: skills root directory starts from the repo root)
91-
const currentFilePath = foundYamlFile.filename.split('/').slice(0, -1).join('/');
91+
const currentFilePath = foundYamlFile.filename.split('/').slice(1, -1).join('/');
9292
skillEditFormData.skillFormData.filePath = currentFilePath + '/';
9393

9494
// Fetch and parse attribution file if it exists

src/components/Contribute/Skill/AttributionInformation/AttributionInformation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const AttributionInformation: React.FC<Props> = ({
9292
titleText={{
9393
text: (
9494
<p>
95-
Attribution Info <span style={{ color: 'red' }}>*</span>
95+
Attribution Information <span style={{ color: 'red' }}>*</span>
9696
</p>
9797
),
9898
id: 'attribution-info-id'

src/components/Contribute/Skill/AuthorInformation/AuthorInformation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const AuthorInformation: React.FC<Props> = ({ reset, skillFormData, setDisableAc
5858
titleText={{
5959
text: (
6060
<p>
61-
Author Info <span style={{ color: 'red' }}>*</span>
61+
Author Information <span style={{ color: 'red' }}>*</span>
6262
</p>
6363
),
6464
id: 'author-info-id'

src/components/Contribute/Skill/FilePathInformation/FilePathInformation.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ const FilePathInformation: React.FC<Props> = ({ reset, path, setFilePath }) => {
1818
titleText={{
1919
text: (
2020
<p>
21-
File Path Info <span style={{ color: 'red' }}>*</span>
21+
Taxonomy Directory Path <span style={{ color: 'red' }}>*</span>
2222
</p>
2323
),
2424
id: 'file-path-info-id'
2525
}}
26-
titleDescription="Specify the file path for the QnA and Attribution files."
26+
titleDescription="Specify the directory location within taxonomy repository structure for the QnA Yaml and Attribution files."
2727
/>
2828
}
2929
>

src/components/Contribute/Skill/SkillsDescription/SkillsDescriptionContent.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ const SkillsDescriptionContent: React.FunctionComponent = () => {
77
<div>
88
<b>
99
<br />
10-
<p>Skills in InstructLab come in two main types:</p>
1110
<p>
12-
1) Compositional Skills - These are skills that are performative and you are teaching the model how to do tasks like &quot;write me a
13-
song&quot; or &quot;summarize an email&quot;. <br />
14-
2) Core Skills - Core skills are foundational like math, reasoning and coding.
15-
<a href="https://github.com/instructlab/taxonomy/blob/main/docs/SKILLS_GUIDE.md" target="_blank">
11+
Skills are performative. When you create a skill for the model, you are teaching it how to do something: &quot;write me a song,&quot;
12+
&quot;rearrange words in a sentence&quot; or &quot;summarize an email.&quot;
13+
<a href="https://docs.instructlab.ai/taxonomy/skills/skills_guide/#what-is-a-skill" target="_blank" rel="noopener noreferrer">
1614
<Button variant="link" aria-label="Learn more about what Skills are in InstructLab">
17-
Learn More
15+
Learn more about skills
16+
<ExternalLinkAltIcon style={{ padding: '3px' }}></ExternalLinkAltIcon>
17+
</Button>
18+
</a>
19+
<a href="https://docs.instructlab.ai/taxonomy/skills/" target="_blank" rel="noopener noreferrer">
20+
<Button variant="link" aria-label="Learn more about what Skills are in InstructLab">
21+
Getting started with skills contribution
1822
<ExternalLinkAltIcon style={{ padding: '3px' }}></ExternalLinkAltIcon>
1923
</Button>
2024
</a>

src/components/Contribute/Skill/SkillsInformation/SkillsInformation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const SkillsInformation: React.FC<Props> = ({
7676
titleText={{
7777
text: (
7878
<p>
79-
Skills Info <span style={{ color: 'red' }}>*</span>
79+
Skill Information <span style={{ color: 'red' }}>*</span>
8080
</p>
8181
),
8282
id: 'skills-info-id'

src/components/Contribute/Skill/SkillsSeedExample/SkillsSeedExample.tsx

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import { FormFieldGroupExpandable, FormFieldGroupHeader, FormGroup, FormHelperText } from '@patternfly/react-core/dist/dynamic/components/Form';
33
import { Button } from '@patternfly/react-core/dist/dynamic/components/Button';
4-
import { TrashIcon, PlusCircleIcon, ExclamationCircleIcon } from '@patternfly/react-icons/dist/dynamic/icons/';
4+
import { TrashIcon, PlusCircleIcon, ExclamationCircleIcon, ExternalLinkAltIcon } from '@patternfly/react-icons/dist/dynamic/icons/';
55
import { SeedExample } from '..';
66
import { TextArea } from '@patternfly/react-core/dist/esm/components/TextArea';
77
import { ValidatedOptions } from '@patternfly/react-core/dist/esm/helpers/constants';
@@ -32,6 +32,7 @@ const SkillsSeedExample: React.FC<Props> = ({
3232
}) => {
3333
return (
3434
<FormFieldGroupExpandable
35+
style={{ justifyContent: 'left' }}
3536
isExpanded
3637
toggleAriaLabel="Details"
3738
header={
@@ -44,7 +45,16 @@ const SkillsSeedExample: React.FC<Props> = ({
4445
),
4546
id: 'seed-examples-id'
4647
}}
47-
titleDescription="Add seed examples with Q&A pair and context (optional). Minimum 5 seed examples are required."
48+
titleDescription={
49+
<p>
50+
Add seed examples with question and answer pair and related context (optional). Minimum 5 seed examples are required.{' '}
51+
<a href="https://docs.instructlab.ai/taxonomy/skills/#skills-yaml-examples" target="_blank" rel="noopener noreferrer">
52+
{' '}
53+
Learn more about seed examples
54+
<ExternalLinkAltIcon style={{ padding: '3px' }}></ExternalLinkAltIcon>
55+
</a>
56+
</p>
57+
}
4858
/>
4959
}
5060
>
@@ -58,12 +68,11 @@ const SkillsSeedExample: React.FC<Props> = ({
5868
titleText={{
5969
text: (
6070
<p>
61-
Skill Seed Example {seedExampleIndex + 1} {seedExample.immutable && <span style={{ color: 'red' }}>*</span>}
71+
Seed Example {seedExampleIndex + 1} {seedExample.immutable && <span style={{ color: 'red' }}>*</span>}
6272
</p>
6373
),
6474
id: 'nested-field-group1-titleText-id'
6575
}}
66-
titleDescription="Please enter question and answer for the seed example. Context is recommended but not required."
6776
actions={
6877
!seedExample.immutable && (
6978
<Button variant="plain" aria-label="Remove" onClick={() => deleteSeedExample(seedExampleIndex)}>
@@ -130,9 +139,11 @@ const SkillsSeedExample: React.FC<Props> = ({
130139
</FormGroup>
131140
</FormFieldGroupExpandable>
132141
))}
133-
<Button variant="link" onClick={addSeedExample}>
134-
<PlusCircleIcon /> Add Seed Example
135-
</Button>
142+
<div style={{ display: 'flex', justifyContent: 'flex-start' }}>
143+
<Button variant="link" type="button" onClick={addSeedExample}>
144+
<PlusCircleIcon /> Add Seed Example
145+
</Button>
146+
</div>
136147
</FormFieldGroupExpandable>
137148
);
138149
};

src/components/Contribute/Skill/Submit/Submit.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const Submit: React.FC<Props> = ({ disableAction, skillFormData, setActionGroupA
8888
};
8989
return (
9090
<Button variant="primary" type="submit" isDisabled={disableAction} onClick={handleSubmit}>
91-
Submit Skill
91+
Submit
9292
</Button>
9393
);
9494
};

src/components/Contribute/Skill/Update/Update.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { amendCommit, getGitHubUsername, updatePullRequest } from '@/utils/githu
88
import { useSession } from 'next-auth/react';
99
import { useRouter } from 'next/navigation';
1010

11+
const SKILLS_DIR = 'compositional_skills/';
1112
interface Props {
1213
disableAction: boolean;
1314
skillFormData: SkillFormData;
@@ -75,8 +76,9 @@ Creator names: ${attributionData.creator_names}
7576
const commitMessage = `Amend commit with updated content\n\nSigned-off-by: ${skillFormData.name} <${skillFormData.email}>`;
7677

7778
// Ensure proper file paths for the edit
78-
const finalYamlPath = skillFormData.filePath.replace(/^\//, '').replace(/\/?$/, '/') + yamlFile.filename.split('/').pop();
79-
const finalAttributionPath = skillFormData.filePath.replace(/^\//, '').replace(/\/?$/, '/') + attributionFile.filename.split('/').pop();
79+
const finalYamlPath = SKILLS_DIR + skillFormData.filePath.replace(/^\//, '').replace(/\/?$/, '/') + yamlFile.filename.split('/').pop();
80+
const finalAttributionPath =
81+
SKILLS_DIR + skillFormData.filePath.replace(/^\//, '').replace(/\/?$/, '/') + attributionFile.filename.split('/').pop();
8082

8183
const origFilePath = yamlFile.filename.split('/').slice(0, -1).join('/');
8284
const oldFilePath = {

src/components/Contribute/Skill/validation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const validateFields = (
6161
const { duplicate, index } = hasDuplicateSeedExamples(skillFormData.seedExamples);
6262
if (duplicate) {
6363
skillFormData.seedExamples[index].isQuestionValid = ValidatedOptions.error;
64-
skillFormData.seedExamples[index].questionValidationError = 'This is duplicate question, please provide unique contexts.';
64+
skillFormData.seedExamples[index].questionValidationError = 'This is duplicate question, please provide unique questions.';
6565
const actionGroupAlertContent: ActionGroupAlertContent = {
6666
title: `Seed example issue!`,
6767
message: `Seed example ${index + 1} question is duplicate. Please provide unique questions.`,

0 commit comments

Comments
 (0)