Detached Prompts
Note
Additional details and the list of valid values for task_id
can be found in the Task
class.
Sample formats for model_parameters can be downloaded from here txt
- create_detached_prompt(self, name: str, model_id: str, task_id: str, detached_information: DetachedPromptTemplate, description: str = None, prompt_details: PromptTemplate = None, container_type: str = None, container_id: str = None) AIGovAssetUtilities
Create a Detached/External Prompt Template Asset.
- Parameters:
name (str) – The name of the detached prompt being created.
model_id (str) – The identifier of the model associated with the extrnal prompt
task_id (str) – Describes possible Task for the prompt template creation
detached_information (DetachedPromptTemplate) – Holds information about an external prompt, including its ID, associated model ID, provider, model name and URL, prompt URL, and additional information
description (str) – (Optional) description of the external prompt to be created
prompt_details (PromptTemplate) – (Optional) Holds information about task IDs, model version details, prompt variables, instructions, input/output prefixes, and example data
container_id (str) – (Optional) used to save the detached prompt
- Returns:
AIGovAssetUtilities
Example-1 (Creating a Detached prompt with minimal information),:
detached_info = DetachedPromptTemplate(prompt_id="n/a", model_id="arn:aws:bedrock:us-east1:123456789012:provisioned-model/anthropic.claude-v2", model_provider="AWS Bedrock", model_name="Anthropic Claude 2.0", model_url="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html", prompt_url="n/a", prompt_additional_info={"AWS Region": "us-east1"} ) external_prompt = facts.client.asests.create_detached_prompt(name="External prompt sample (model AWS Bedrock Anthropic)", task_id="summarization", model_id="anthropic.claude-v2", description="My First External Prompt", detached_information=ivar_detached_info)
Example-2 (Creating a Detached prompt with additional details),:
detached_info = DetachedPromptTemplate(prompt_id="n/a", model_id="arn:aws:bedrock:us-east1:123456789012:provisioned-model/anthropic.claude-v2", model_provider="AWS Bedrock", model_name="Anthropic Claude 2.0", model_url="https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html", prompt_url="n/a", prompt_additional_info={"AWS Region": "us-east1"} ) prompt_template = PromptTemplate( prompt_variables= {"text": "value" } input="Input text to be given", model_parameters={"decoding_method":"greedy" "max_new_tokens":2034, "min_new_tokens":0, "random_seed":0, "top_k":0, "top_p":0 } external_prompt = facts.client.asests.create_detached_prompt(name="External prompt sample (model AWS Bedrock Anthropic)", model_id="anthropic.claude-v2", task_id="summarization", detached_information=ivar_detached_info, description="My First External Prompt", prompt_details=prompt_template, )