API Docs
Open-Creator API Documentation
Function: create
Generates a CodeSkill instance using different input sources.
Parameters:
request: String detailing the skill functionality.messagesormessages_json_path: Messages as a list of dictionaries or a path to a JSON file containing messages.file_contentorfile_path: String of file content or path to a code/API doc file.skill_pathorskill_json_path: Directory path with skill name as stem or file path withskill.jsonas stem.huggingface_repo_id: Identifier for a Huggingface repository.huggingface_skill_path: Path to the skill within the Huggingface repository.
Returns:
CodeSkill: The created skill.
Usage:
- Creating Skill using a Request String:
- Creating Skill using Messages:
- Directly:
-
Via JSON Path:
-
Creating Skill using File Content or File Path:
- Direct Content:
-
File Path:
-
Creating Skill using Skill Path or Skill JSON Path:
- JSON Path:
-
Skill Path:
-
Creating Skill using Huggingface Repository ID and Skill Path: If a skill is hosted in a Huggingface repository, you can create it by specifying the repository ID and the skill path within the repository.
Notes:
- Ensure to provide accurate and accessible file paths.
- At least one parameter must be specified to generate a skill.
- Parameters’ functionality does not overlap; specify the most relevant one for clarity.
- Use absolute paths where possible to avoid relative path issues.
- Ensure the repository ID and skill path are accurate and that you have the necessary access permissions to retrieve the skill from the repository.
Function: save
Stores a CodeSkill instance either to a local path or a Huggingface repository. In default just use save(skill) and it will store the skill into the default path. Only save the skill when the user asks to do so.
Parameters:
skill(CodeSkill): The skill instance to be saved.huggingface_repo_id(Optional[str]): Identifier for a Huggingface repository.skill_path(Optional[str]): Local path where the skill should be saved.
Returns:
- None
Usage:
The save function allows for the persistent storage of a CodeSkill instance by saving it either locally or to a specified Huggingface repository.
-
Save to Huggingface Repository:
-
Save Locally:
Notes:
- At least one of
huggingface_repo_idorskill_pathmust be provided to execute the function, otherwise aValueErrorwill be raised. - Ensure provided paths and repository identifiers are accurate and accessible.
Function: search
Retrieve skills related to a specified query from the available pool of skills.
Parameters:
query(str): Search query string.top_k(Optional[int]): Maximum number of skills to return. Default is 1.threshold(Optional[float]): Minimum similarity score to return a skill. Default is 0.8.
Returns:
- List[CodeSkill]: A list of retrieved
CodeSkillobjects that match the query.
Usage:
The search function allows users to locate skills related to a particular query string. This is particularly useful for identifying pre-existing skills within a skill library that may fulfill a requirement or for exploring available functionalities.
-
Basic Search:
-
Refined Search:
Notes:
- The
queryshould be descriptive to enhance the accuracy of retrieved results. - Adjust
top_kandthresholdto balance between specificity and breadth of results. - Ensure to check the length of the returned list to validate the presence of results before usage.
Skill Object Methods and Operator Overloading
Explore the functionalities and modifications of a skill object through methods and overloaded operators.
Method: run
Execute a skill with provided arguments or request.
- Example Usage:
Method: test
Validate a skill using a tester agent.
- Example Usage:
Overloaded Operators:
Modify and refine skills using operator overloading.
- Combining Skills: Utilize the
+operator to chain or execute skills in parallel, detailing the coordination with the>operator.
-
Refactoring Skills: Employ the
>operator to enhance or modify existing skills. -
Decomposing Skills: Use the
<operator to break down a skill into simpler components.
Notes:
- Ensure accurate descriptions when using overloaded operators to ensure skill modifications are clear and understandable.
- Validate skills with
testmethod to ensure functionality post-modification.
Created: October 6, 2023