danoan.llm_assistant.prompt.core.api module
prompt-manager interface.
- danoan.llm_assistant.prompt.core.api.get_current_version(repository_folder: Path) str | None [source]
Get the most recent version prior to HEAD.
- Parameters:
repository_folder (Path)
- Return type:
str | None
- danoan.llm_assistant.prompt.core.api.get_most_recent_version_before_commit(repository_folder: Path, commit_hash: str) str | None [source]
Find the most recent version prior to a given commit hash.
- Parameters:
repository_folder (Path)
commit_hash (str)
- Return type:
str | None
- danoan.llm_assistant.prompt.core.api.get_prompt_configuration_filepath(prompt_name: str) Path [source]
Return path to prompt configuration file.
- Parameters:
prompt_name (str)
- Return type:
Path
- danoan.llm_assistant.prompt.core.api.get_prompt_test_regression_filepath(prompt_name: str) Path [source]
Get regression test file.
- Parameters:
prompt_name (str)
- Return type:
Path
- danoan.llm_assistant.prompt.core.api.get_prompt_versions(repository_path: Path) List[str] [source]
List all the versions available in a local prompt repository.
- Parameters:
repository_path (Path)
- Return type:
List[str]
- danoan.llm_assistant.prompt.core.api.get_prompts_folder() Path [source]
Return path to the folder where all tracked prompts are located.
- Return type:
Path
- danoan.llm_assistant.prompt.core.api.get_tracked_prompt(repository_name: str) TrackedPrompt [source]
Return a TrackedPrompt from the prompt repository.
- Raises:
FileNotFoundError – if prompt folder does not exist.
AttributeError – if head points to an invalid object or referece.
git.exc.InvalidGitRepositoryError – if prompt folder is not a valid git repository.
- Parameters:
repository_name (str)
- Return type:
- danoan.llm_assistant.prompt.core.api.get_tracked_prompts() Generator[TrackedPrompt, None, None] [source]
Return a list of all prompts tracked by the tool.
A prompt is considered tracked if it is a prompt repository located at get_prompts_folder.
A prompt repository is a folder with a config.toml file that can be loaded as a PromptConfiguration.
- Return type:
Generator[TrackedPrompt, None, None]
- danoan.llm_assistant.prompt.core.api.is_prompt_repository(path: Path) bool [source]
Check if a path points to a prompt repository.
A prompt repository must have a config.toml that must have the following keys.
user_prompt
system_prompt
- Parameters:
path (Path)
- Return type:
bool
- danoan.llm_assistant.prompt.core.api.suggest_next_version(repository_path: Path, current_version: str, cn: ChangeNature) str [source]
Suggest a new version based on the type of changes.
If PromptTweak, increment the fix unit. If InterfaceUpdate, increment the minor unit. If ScopeChange, increment the major unit.
- Parameters:
repository_path (Path)
current_version (str)
cn (ChangeNature)
- Return type:
str
- danoan.llm_assistant.prompt.core.api.sync(repo_config: PromptRepositoryConfiguration, progress_callback=None)[source]
Read prompt repository configuration file and sync local folder with the specified prompt version.
- Parameters:
repo_config (PromptRepositoryConfiguration)