gen_ai_hub.prompt_registry package
Subpackages
Submodules
gen_ai_hub.prompt_registry.client module
- class OrchestrationConfigClient
Bases:
PromptRegistryClientClient for interacting with the Prompt Registry Orchestration Config API.
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
- create_orchestration_config(name, version, scenario, spec)
Create an orchestration config.
- Parameters:
name (str) -- the name of the orchestration config.
version (str) -- the version of the orchestration config.
scenario (str) -- the scenario name of the orchestration config.
spec (Union[dict, OrchestrationConfig]) -- the specification of the orchestration config.
- Returns:
An OrchestrationConfigPostResponse object.
- Return type:
- delete_orchestration_config_by_id(config_id)
Delete a specific version of the orchestration config by ID.
- Parameters:
config_id (str) -- The ID of the orchestration config.
- Returns:
An OrchestrationConfigDeleteResponse object.
- Return type:
- export_orchestration_config(config_id)
Export a design orchestration config in a declarative compatible yaml file. Supports only single file export.
- Parameters:
config_id (str) -- The id of the orchestration config to export.
- Returns:
bytes: The content of the exported file
- Return type:
bytes
- get_orchestration_config_by_id(config_id, resolve_template_ref=None)
Retrieve a specific version of the orchestration config by ID.
- Parameters:
config_id (str) -- The ID of the orchestration config to retrieve.
resolve_template_ref (bool, optional) -- false(default), true
- Returns:
An OrchestrationConfigGetResponse object.
- Return type:
- get_orchestration_config_history(scenario, name, version, include_spec=None, resolve_template_ref=None)
Retrieve the history of edits to the orchestration config.
- Parameters:
scenario (str) -- The scenario name of the orchestration config.
name (str) -- The name of the orchestration config.
version (str) -- The version ID of the orchestration config.
include_spec (bool, optional) -- false(default), true
resolve_template_ref (bool, optional) -- false(default), true
- Returns:
An OrchestrationConfigListResponse object.
- Return type:
- get_orchestration_configs(scenario, name, version, retrieve=None, include_spec=None, resolve_template_ref=None)
Retrieve the latest version of every orchestration config based on the filters.
- Parameters:
scenario (str) -- the scenario name of the orchestration config.
name (str) -- the name of the orchestration config.
version (str) -- the version of the orchestration config.
retrieve (str, optional) -- both(default), imperative, declarative
include_spec (bool, optional) -- false(default), true
resolve_template_ref (bool, optional) -- false(default), true
- Returns:
An OrchestrationConfigListResponse object.
- Return type:
- import_orchestration_config(file)
Import a runtime/declarative orchestration config into the design time environment.
- Parameters:
file (bytes) -- binary file content
- Returns:
A OrchestrationConfigPostResponse object.
- Return type:
- class PromptRegistryClient
Bases:
ABCClient for interacting with the Prompt Registry API.
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
- __init__(proxy_client=None)
Initializes the PromptRegistryClient.
- Parameters:
proxy_client (Optional[GenAIHubProxyClient], optional) -- Optional proxy client to use for requests.
- class PromptTemplateClient
Bases:
PromptRegistryClientClient for interacting with the Prompt Registry Prompt Template API.
https://api.sap.com/api/PROMPT_REGISTRY_API/overview
- create_prompt_template(name, version, scenario, prompt_template_spec)
Create or update a prompt template.
- Parameters:
name (str) -- the name of the prompt template.
version (str) -- the version of the prompt template.
scenario (str) -- the scenario name of the prompt template.
prompt_template_spec (PromptTemplateSpec) -- the specification of the prompt template.
- Returns:
A PromptTemplatePostResponse object.
- Return type:
- delete_prompt_template_by_id(template_id)
Delete a specific version of the prompt template by ID.
- Parameters:
template_id (str) -- The ID of the prompt template to delete.
- Returns:
A PromptTemplateDeleteResponse object.
- Return type:
- export_prompt_template(template_id)
Export a design time template in a declarative compatible yaml file. Supports only single file export.
- Parameters:
template_id (str) -- The id of the prompt template to export.
- Returns:
bytes: The content of the exported file
- Return type:
bytes
- fill_prompt_template(scenario, name, version, input_params, metadata=False)
Replace the placeholders of the prompt template referenced via scenario-name-version with user provided values.
- Parameters:
scenario (str) -- the scenario name of the prompt template.
name (str) -- the name of the prompt template.
version (str) -- the version of the prompt template.
input_params (dict) -- User provided values to replace the placeholders of the prompt template.
metadata (bool, optional) -- False(default), True return resource object with all details.
- Returns:
A PromptTemplateSubstitutionResponse object.
- Return type:
- fill_prompt_template_by_id(template_id, input_params, metadata=False)
Replace the placeholders of the prompt template referenced via template_id with user provided values.
- Parameters:
template_id (str) -- The ID of the prompt template.
input_params (dict) -- User provided values to replace the placeholders of the prompt template.
metadata (bool, optional) -- False(default), True return resource object with all details.
- Returns:
A PromptTemplateSubstitutionResponse object.
- Return type:
- get_prompt_template_by_id(template_id)
Retrieve a specific version of the prompt template by ID.
- Parameters:
template_id (str) -- The ID of the prompt template to retrieve.
- Returns:
A PromptTemplateGetResponse object.
- Return type:
- get_prompt_template_history(scenario, name, version)
Retrieve the history of edits to the prompt template. Only for imperative managed prompt templates.
- Parameters:
scenario (str) -- The scenario name of the prompt template.
name (str) -- The name of the prompt template.
version (str) -- The version ID of the prompt template.
- Returns:
A PromptTemplateListResponse object.
- Return type:
- get_prompt_templates(scenario, name, version, retrieve=None, include_spec=None)
Retrieve the latest version of every prompt template based on the filters.
- Parameters:
scenario (str) -- the scenario name of the prompt template.
name (str) -- the name of the prompt template.
version (str) -- the version of the prompt template.
retrieve (str, optional) -- both(default), imperative, declarative
include_spec (bool, optional) -- false(default), true
- Returns:
A PromptTemplateListResponse object.
- Return type:
- import_prompt_template(file)
Import a runtime/declarative prompt template into the design time environment.
- Parameters:
file (bytes) -- binary file content
- Returns:
A PromptTemplatePostResponse object.
- Return type: