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
       
abc.ABC(builtins.object)
PromptRegistryClient
OrchestrationConfigClient
PromptTemplateClient

 
class OrchestrationConfigClient(PromptRegistryClient)
    OrchestrationConfigClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
 
Client for interacting with the Prompt Registry Orchestration Config API.
 
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
 
 
Method resolution order:
OrchestrationConfigClient
PromptRegistryClient
abc.ABC
builtins.object

Methods defined here:
create_orchestration_config(self, name: str, version: str, scenario: str, spec: Union[dict, gen_ai_hub.orchestration_v2.models.config.OrchestrationConfig]) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigPostResponse
Create an orchestration config.
 
:param name: the name of the orchestration config.
:type name: str
:param version: the version of the orchestration config.
:type version: str
:param scenario: the scenario name of the orchestration config.
:type scenario: str
:param spec: the specification of the orchestration config.
:type spec: Union[dict, OrchestrationConfig]
 
:return: An OrchestrationConfigPostResponse object.
:rtype: OrchestrationConfigPostResponse
delete_orchestration_config_by_id(self, config_id: str) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigDeleteResponse
Delete a specific version of the orchestration config by ID.
 
:param config_id: The ID of the orchestration config.
:type config_id: str
 
:return: An OrchestrationConfigDeleteResponse object.
:rtype: OrchestrationConfigDeleteResponse
export_orchestration_config(self, config_id: str) -> bytes
Export a design orchestration config  in a declarative compatible yaml file.
Supports only single file export.
 
:param config_id: The id of the orchestration config to export.
:type config_id: str
:return: bytes: The content of the exported file
:rtype: bytes
get_orchestration_config_by_id(self, config_id: str, resolve_template_ref: bool = None) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigGetResponse
Retrieve a specific version of the orchestration config by ID.
 
:param config_id: The ID of the orchestration config to retrieve.
:type config_id: str
:param resolve_template_ref: false(default), true
:type resolve_template_ref: bool, optional
 
:return: An OrchestrationConfigGetResponse object.
:rtype: OrchestrationConfigGetResponse
get_orchestration_config_history(self, scenario: str, name: str, version: str, include_spec: bool = None, resolve_template_ref: bool = None) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigListResponse
Retrieve the history of edits to the orchestration config.
 
:param scenario: The scenario name of the orchestration config.
:type scenario: str
:param name: The name of the orchestration config.
:type name: str
:param version: The version ID of the orchestration config.
:type version: str
:param include_spec: false(default), true
:type include_spec: bool, optional
:param resolve_template_ref: false(default), true
:type resolve_template_ref: bool, optional
 
:return: An OrchestrationConfigListResponse object.
:rtype: OrchestrationConfigListResponse
get_orchestration_configs(self, scenario: str, name: str, version: str, retrieve: str = None, include_spec: bool = None, resolve_template_ref: bool = None) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigListResponse
Retrieve the latest version of every orchestration config based on the filters.
 
:param scenario: the scenario name of the orchestration config.
:type scenario: str
:param name: the name of the orchestration config.
:type name: str
:param version: the version of the orchestration config.
:type version: str
:param retrieve: both(default), imperative, declarative
:type retrieve: str, optional
:param include_spec: false(default), true
:type include_spec: bool, optional
:param resolve_template_ref: false(default), true
:type resolve_template_ref: bool, optional
 
:return: An OrchestrationConfigListResponse object.
:rtype: OrchestrationConfigListResponse
import_orchestration_config(self, file: bytes) -> gen_ai_hub.prompt_registry.models.orchestration_config.OrchestrationConfigPostResponse
Import a runtime/declarative orchestration config into the design time environment.
 
:param file: binary file content
:type file: bytes
:return: A OrchestrationConfigPostResponse object.
:rtype: OrchestrationConfigPostResponse

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Methods inherited from PromptRegistryClient:
__init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
Initializes the PromptRegistryClient.
 
:param proxy_client: Optional proxy client to use for requests.
:type proxy_client: Optional[GenAIHubProxyClient], optional

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

 
class PromptRegistryClient(abc.ABC)
    PromptRegistryClient(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
 
 
Method resolution order:
PromptRegistryClient
abc.ABC
builtins.object

Methods defined here:
__init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
Initializes the PromptRegistryClient.
 
:param proxy_client: Optional proxy client to use for requests.
:type proxy_client: Optional[GenAIHubProxyClient], optional

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

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

 
class PromptTemplateClient(PromptRegistryClient)
    PromptTemplateClient(proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
 
Client for interacting with the Prompt Registry Prompt Template API.
 
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
 
 
Method resolution order:
PromptTemplateClient
PromptRegistryClient
abc.ABC
builtins.object

Methods defined here:
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 and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Methods inherited from PromptRegistryClient:
__init__(self, proxy_client: Optional[gen_ai_hub.proxy.gen_ai_hub_proxy.client.GenAIHubProxyClient] = None)
Initializes the PromptRegistryClient.
 
:param proxy_client: Optional proxy client to use for requests.
:type proxy_client: Optional[GenAIHubProxyClient], optional

Data descriptors inherited from PromptRegistryClient:
__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_REGISTRY_CONFIG = '/registry/v2/orchestrationConfigs'
PATH_REGISTRY_SCENARIOS = '/registry/v2/scenarios'
PATH_SCENARIOS = '/lm/scenarios'
Union = typing.Union