FlashLearn skills are at the heart of the library’s design. A “skill” in FlashLearn is essentially a compact JSON-like object that defines how an LLM should process and transform data. Skills can be either “learned” via sample data or pre-built to address common tasks such as classification, sentiment analysis, or data transformation.
Definition of a Skill #
At its core, a FlashLearn skill is defined by:
- Skill Class: Indicates the type of skill (e.g., “GeneralSkill”, “ClassificationSkill”, etc.), which in turn determines how the task will be processed.
- System Prompt: A natural language instruction that tells the LLM what to do. This prompt sets the context and guides the transformation.
- Function Definitions: These are structured definitions that specify the expected JSON format of the LLM output. They enforce a strict schema ensuring that every response complies with predetermined parameters.
Skill Structure #
A typical skill is represented as a JSON file with the following structure:
{
"skill_class": "GeneralSkill",
"system_prompt": "Evaluate how likely the user is to buy our product, returning an integer 1-100 and a short reason.",
"function_definition": {
"type": "function",
"function": {
"name": "EvaluateToBuySkill",
"description": "Assess user text regarding the likelihood of a purchase.",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"likely_to_buy": {
"type": "integer",
"description": "A number from 1 to 100 indicating the purchasing likelihood."
},
"reason": {
"type": "string",
"description": "A brief explanation detailing the score."
}
},
"required": ["likely_to_buy", "reason"],
"additionalProperties": false
}
}
}
}
Key Points #
- JSON Definition: Skills are represented as JSON, making them both human-readable and machine-verifiable. This ensures that outputs always conform to the specified schema.
- System Prompt and Instructions: The system prompt provides a clear and concise instruction to the LLM, ensuring that the context is preserved and the task is executed as intended.
- Strict Output Validation: By using function definitions, FlashLearn validates that every transformation or classification adheres to the expected structure, reducing errors and unexpected outputs in your data pipelines.
This JSON-centric approach simplifies the process of training, reusing, and sharing skills. Whether you generate skills from sample data with LearnSkill
or use pre-built skills for common tasks, the uniform structure means you can easily manage and chain multiple skills in your workflows.