Skip to content

Prompt Template API

api_delete_prompt_template(pt_id)

Deletes a prompt template by its identifier.

This function calls the delete method from the PromptTemplate class to delete a prompt template identified by its unique ID. It returns True if the deletion was successful, otherwise it raises an exception.

Parameters:

Name Type Description Default
pt_id str

The unique identifier of the prompt template to be deleted.

required

Returns:

Name Type Description
bool bool

True if the prompt template was successfully deleted.

Raises:

Type Description
Exception

If the deletion process encounters an error.

Source code in moonshot/src/api/api_prompt_template.py
@validate_call
def api_delete_prompt_template(pt_id: str) -> bool:
    """
    Deletes a prompt template by its identifier.

    This function calls the `delete` method from the `PromptTemplate` class to delete a prompt template
    identified by its unique ID. It returns True if the deletion was successful, otherwise it raises an exception.

    Args:
        pt_id (str): The unique identifier of the prompt template to be deleted.

    Returns:
        bool: True if the prompt template was successfully deleted.

    Raises:
        Exception: If the deletion process encounters an error.
    """
    return PromptTemplate.delete(pt_id)

api_get_all_prompt_template_detail()

Retrieves all available prompt template details and returns them as a list of dictionaries.

This function calls the get_all_prompt_template_details method from the PromptTemplate class to fetch the details of all prompt templates. It then returns these details as a list of dictionaries.

Returns:

Type Description
list[dict]

list[dict]: A list of dictionaries, each representing the details of a prompt template.

Source code in moonshot/src/api/api_prompt_template.py
def api_get_all_prompt_template_detail() -> list[dict]:
    """
    Retrieves all available prompt template details and returns them as a list of dictionaries.

    This function calls the `get_all_prompt_template_details` method from the `PromptTemplate` class
    to fetch the details of all prompt templates. It then returns these details as a list of dictionaries.

    Returns:
        list[dict]: A list of dictionaries, each representing the details of a prompt template.
    """
    return PromptTemplate.get_all_prompt_template_details()

api_get_all_prompt_template_name()

Retrieves all available prompt template names and returns them as a list.

This function calls the get_all_prompt_template_names method from the PromptTemplate class to fetch the names of all prompt templates. It then returns these names as a list of strings.

Returns:

Type Description
list[str]

list[str]: A list of prompt template names.

Source code in moonshot/src/api/api_prompt_template.py
def api_get_all_prompt_template_name() -> list[str]:
    """
    Retrieves all available prompt template names and returns them as a list.

    This function calls the `get_all_prompt_template_names` method from the `PromptTemplate` class
    to fetch the names of all prompt templates. It then returns these names as a list of strings.

    Returns:
        list[str]: A list of prompt template names.
    """
    return PromptTemplate.get_all_prompt_template_names()