Class ClassPathSkillLoader
java.lang.Object
dev.langchain4j.skills.ClassPathSkillLoader
Loads skills from the classpath.
Each skill must reside in its own directory containing a SKILL.md file.
The file must have a YAML front matter block that declares the skill's name
and description. The body of the file (below the front matter) becomes the
skill's content.
Any additional files in the skill directory are loaded as SkillResources,
except SKILL.md itself and any files under a scripts/ subdirectory.
Empty files are silently skipped.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FileSystemSkillLoads a single skill from the given classpath directory.static FileSystemSkillloadSkill(String skillDirectoryOnClasspath, ClassLoader classLoader) Loads a single skill from the given classpath directory.static List<FileSystemSkill> loadSkills(String directoryOnClasspath) Loads all skills found in immediate subdirectories of the given classpath directory.static List<FileSystemSkill> loadSkills(String directoryOnClasspath, ClassLoader classLoader) Loads all skills found in immediate subdirectories of the given classpath directory.
-
Method Details
-
loadSkills
Loads all skills found in immediate subdirectories of the given classpath directory. Uses the thread's context class loader.- Parameters:
directoryOnClasspath- the classpath directory whose immediate subdirectories are scanned for skills- Returns:
- the list of loaded skills
-
loadSkills
public static List<FileSystemSkill> loadSkills(String directoryOnClasspath, ClassLoader classLoader) Loads all skills found in immediate subdirectories of the given classpath directory.- Parameters:
directoryOnClasspath- the classpath directory whose immediate subdirectories are scanned for skillsclassLoader- the class loader to use- Returns:
- the list of loaded skills
-
loadSkill
Loads a single skill from the given classpath directory. Uses the thread's context class loader.- Parameters:
skillDirectoryOnClasspath- the classpath path to the skill directory- Returns:
- the loaded skill
-
loadSkill
Loads a single skill from the given classpath directory.- Parameters:
skillDirectoryOnClasspath- the classpath path to the skill directoryclassLoader- the class loader to use- Returns:
- the loaded skill
-