|
Methods defined here:
- __init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
- Initializes the PromptTemplateClient
Args:
proxy_client: optional proxy client to use for requests
- create_prompt_template(self, name: str, version: str, scenario: str, prompt_template_spec: gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSpec) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplatePostResponse
- Create or update a prompt template.
Args:
scenario: The scenario name of the prompt template.
name: The name of the prompt template.
version: The version of the prompt template.
prompt_template_spec: The specification of the prompt template.
Returns:
PromptTemplatePostResponse object
- delete_prompt_template_by_id(self, template_id: str) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateDeleteResponse
- Delete a specific version of the prompt template. Only for imperative prompt templates.
Args:
template_id: The ID of the prompt template to delete.
Returns:
PromptTemplateDeleteResponse object
- export_prompt_template(self, template_id: str) -> bytes
- Export a design time template in a declarative compatible yaml file. Supports only single file export.
Args:
template_id: The id of the prompt template to export.
Returns:
bytes: The content of the exported file
- fill_prompt_template(self, scenario: str, name: str, version: str, input_params: dict, metadata: bool = False) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSubstitutionResponse
- Replace the placeholders of the prompt template referenced via scenario-name-version with user provided values.
Args:
scenario: The scenario name of the prompt template.
name: The name of the prompt template.
version: The version of the prompt template.
input_params: User provided values to replace the placeholders of the prompt template.
metadata: False(default), True return resource object with all details.
Returns:
PromptTemplateSubstitutionResponse object
- fill_prompt_template_by_id(self, template_id: str, input_params: dict, metadata: bool = False) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSubstitutionResponse
- Replace the placeholders of the prompt template referenced via template_id with user provided values.
Args:
template_id: The ID of the prompt template.
input_params: User provided values to replace the placeholders of the prompt template.
metadata: False(default), True return resource object with all details.
Returns:
PromptTemplateSubstitutionResponse object
- get_prompt_template_by_id(self, template_id: str) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateGetResponse
- Retrieve a specific version of the prompt template by ID.
Args:
template_id: The ID of the prompt template to retrieve.
Returns:
PromptTemplateGetResponse object
- get_prompt_template_history(self, scenario: str, name: str, version: str) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateListResponse
- List history of edits to the prompt template. Only for imperative managed prompt templates.
Args:
scenario: The scenario name of the prompt template.
name: The name of the prompt template.
version: The version ID of the prompt template.
Returns:
PromptTemplateListResponse object
- get_prompt_templates(self, scenario: str, name: str, version: str, retrieve: str = None, include_spec: bool = None) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateListResponse
- Retrieve the latest version of every prompt template based on the filters.
Args:
scenario: scenario name
name: template name
version: template version
retrieve: both(default), imperative, declarative
include_spec: false(default), true
Returns:
PromptTemplateListResponse object
- import_prompt_template(self, file: bytes) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplatePostResponse
- Import a runtime/declarative prompt template into the design time environment.
Supports only single file import as of now.
Args:
file: binary file content
Returns:
PromptTemplatePostResponse object
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|