53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
|
|
// This is an autogenerated file from Firebase Studio.
|
||
|
|
'use server';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @fileOverview This file defines a Genkit flow for classifying the complexity of project features.
|
||
|
|
*
|
||
|
|
* - classifyComplexity - An async function that takes a feature description and returns its complexity classification.
|
||
|
|
* - ClassifyComplexityInput - The input type for the classifyComplexity function.
|
||
|
|
* - ClassifyComplexityOutput - The output type for the classifyComplexity function.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import {ai} from '@/ai/genkit';
|
||
|
|
import {z} from 'genkit';
|
||
|
|
|
||
|
|
const ClassifyComplexityInputSchema = z.object({
|
||
|
|
featureDescription: z
|
||
|
|
.string()
|
||
|
|
.describe('A detailed description of the feature to be classified.'),
|
||
|
|
});
|
||
|
|
export type ClassifyComplexityInput = z.infer<typeof ClassifyComplexityInputSchema>;
|
||
|
|
|
||
|
|
const ClassifyComplexityOutputSchema = z.object({
|
||
|
|
complexity: z
|
||
|
|
.enum(['simple', 'medium', 'complex'])
|
||
|
|
.describe('The complexity classification of the feature.'),
|
||
|
|
});
|
||
|
|
export type ClassifyComplexityOutput = z.infer<typeof ClassifyComplexityOutputSchema>;
|
||
|
|
|
||
|
|
export async function classifyComplexity(
|
||
|
|
input: ClassifyComplexityInput
|
||
|
|
): Promise<ClassifyComplexityOutput> {
|
||
|
|
return classifyComplexityFlow(input);
|
||
|
|
}
|
||
|
|
|
||
|
|
const prompt = ai.definePrompt({
|
||
|
|
name: 'classifyComplexityPrompt',
|
||
|
|
input: {schema: ClassifyComplexityInputSchema},
|
||
|
|
output: {schema: ClassifyComplexityOutputSchema},
|
||
|
|
prompt: `You are an expert project manager classifying the complexity of software features. Classify the following feature description as either 'simple', 'medium', or 'complex'.\n\nFeature Description: {{{featureDescription}}}\n\nComplexity:`,
|
||
|
|
});
|
||
|
|
|
||
|
|
const classifyComplexityFlow = ai.defineFlow(
|
||
|
|
{
|
||
|
|
name: 'classifyComplexityFlow',
|
||
|
|
inputSchema: ClassifyComplexityInputSchema,
|
||
|
|
outputSchema: ClassifyComplexityOutputSchema,
|
||
|
|
},
|
||
|
|
async input => {
|
||
|
|
const {output} = await prompt(input);
|
||
|
|
return output!;
|
||
|
|
}
|
||
|
|
);
|