Spaces:
Running
Running
| 'use server'; | |
| /** | |
| * @fileOverview This file defines a Genkit flow for extracting data science skills from project descriptions. | |
| * | |
| * It includes: | |
| * - `extractSkills`: An async function to initiate the skill extraction process. | |
| * - `SkillsExtractionInput`: The input type for the `extractSkills` function, containing an array of project descriptions. | |
| * - `SkillsExtractionOutput`: The output type for the `extractSkills` function, listing the extracted skills. | |
| */ | |
| import {ai} from '@/ai/genkit'; | |
| import {z} from 'genkit'; | |
| const SkillsExtractionInputSchema = z.object({ | |
| projectDescriptions: z | |
| .array(z.string()) | |
| .describe('An array of project descriptions.'), | |
| }); | |
| export type SkillsExtractionInput = z.infer<typeof SkillsExtractionInputSchema>; | |
| const SkillsExtractionOutputSchema = z.object({ | |
| skills: z | |
| .array(z.string()) | |
| .describe('A list of the unique data science skills extracted from the project descriptions.'), | |
| }); | |
| export type SkillsExtractionOutput = z.infer<typeof SkillsExtractionOutputSchema>; | |
| export async function extractSkills(input: SkillsExtractionInput): Promise<SkillsExtractionOutput> { | |
| return skillsExtractionFlow(input); | |
| } | |
| const skillsExtractionPrompt = ai.definePrompt({ | |
| name: 'skillsExtractionPrompt', | |
| input: {schema: SkillsExtractionInputSchema}, | |
| output: {schema: SkillsExtractionOutputSchema}, | |
| prompt: `You are an expert data science skill identifier. | |
| Given the following project descriptions, identify the key data science skills that are demonstrated. Provide the skills as a list of strings. | |
| Project Descriptions: | |
| {{#each projectDescriptions}}- {{{this}}} | |
| {{/each}}`, | |
| }); | |
| const skillsExtractionFlow = ai.defineFlow( | |
| { | |
| name: 'skillsExtractionFlow', | |
| inputSchema: SkillsExtractionInputSchema, | |
| outputSchema: SkillsExtractionOutputSchema, | |
| }, | |
| async input => { | |
| const {output} = await skillsExtractionPrompt(input); | |
| return output!; | |
| } | |
| ); | |