gen_ai_hub.prompt_registry.client
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/prompt_registry/client.py

 
Classes
       
builtins.object
PromptTemplateClient

 
class PromptTemplateClient(builtins.object)
    PromptTemplateClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
 
Client for interacting with the Prompt Registry API.
 
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
 
  Methods defined here:
__init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
Initializes the PromptTemplateClient.
 
:param proxy_client: Optional proxy client to use for requests.
:type proxy_client: Optional[GenAIHubProxyClient], optional
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.
 
:param name: the name of the prompt template.
:type name: str
:param version: the version of the prompt template.
:type version: str
:param scenario: the scenario name of the prompt template.
:type scenario: str
:param prompt_template_spec: the specification of the prompt template.
:type prompt_template_spec: PromptTemplateSpec
:return: A PromptTemplatePostResponse object.
:rtype: PromptTemplatePostResponse
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 by ID.
 
:param template_id: The ID of the prompt template to delete.
:type template_id: str
:return: A PromptTemplateDeleteResponse object.
:rtype: PromptTemplateDeleteResponse
export_prompt_template(self, template_id: str) -> bytes
Export a design time template in a declarative compatible yaml file. Supports only single file export.
 
:param template_id: The id of the prompt template to export.
:type template_id: str
:return: bytes: The content of the exported file
:rtype: bytes
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.
 
:param scenario: the scenario name of the prompt template.
:type scenario: str
:param name: the name of the prompt template.
:type name: str
:param version: the version of the prompt template.
:type version: str
:param input_params: User provided values to replace the placeholders of the prompt template.
:type input_params: dict
:param metadata: False(default), True return resource object with all details.
:type metadata: bool, optional
:return: A PromptTemplateSubstitutionResponse object.
:rtype: PromptTemplateSubstitutionResponse
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.
 
:param template_id: The ID of the prompt template.
:type template_id: str
:param input_params: User provided values to replace the placeholders of the prompt template.
:type input_params: dict
:param metadata: False(default), True return resource object with all details.
:type metadata: bool, optional
:return: A PromptTemplateSubstitutionResponse object.
:rtype: PromptTemplateSubstitutionResponse
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.
 
:param template_id: The ID of the prompt template to retrieve.
:type template_id: str
:return: A PromptTemplateGetResponse object.
:rtype: PromptTemplateGetResponse
get_prompt_template_history(self, scenario: str, name: str, version: str) -> gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateListResponse
Retrieve the history of edits to the prompt template. Only for imperative managed prompt templates.
 
:param scenario: The scenario name of the prompt template.
:type scenario: str
:param name: The name of the prompt template.
:type name: str
:param version: The version ID of the prompt template.
:type version: str
:return: A PromptTemplateListResponse object.
:rtype: PromptTemplateListResponse
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.
 
:param scenario: the scenario name of the prompt template.
:type scenario: str
:param name: the name of the prompt template.
:type name: str
:param version: the version of the prompt template.
:type version: str
:param retrieve: both(default), imperative, declarative
:type retrieve: str, optional
:param include_spec: false(default), true
:type include_spec: bool, optional
:return: A PromptTemplateListResponse object.
:rtype: PromptTemplateListResponse
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.
 
:param file: binary file content
:type file: bytes
:return: A PromptTemplatePostResponse object.
:rtype: PromptTemplatePostResponse

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        CONTENT_TYPE_JSON_ = 'application/json'
Optional = typing.Optional
PATH_PROMPT_TEMPLATES = '/lm/promptTemplates'
PATH_SCENARIOS = '/lm/scenarios'