Class ClassPathSkillLoader
java.lang.Object
dev.langchain4j.skills.ClassPathSkillLoader
Loads skills from the classpath (including cases when they are packaged inside
a JAR file that is on 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 SkillLoads a single skill from the given classpath directory.static SkillloadSkill(String skillDirectoryOnClasspath, ClassLoader classLoader) Loads a single skill from the given classpath directory.loadSkills(String directoryOnClasspath) Loads all skills found in immediate subdirectories of the given classpath directory.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
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
-
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
-