Class AsyncPrompts (1.122.0)

  AsyncPrompts 
 ( 
 api_client_ 
 : 
 google 
 . 
 genai 
 . 
 _api_client 
 . 
 BaseApiClient 
 ) 
 

API documentation for AsyncPrompts class.

Methods

create

  create 
 ( 
 * 
 , 
 prompt 
 : 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 PromptDict 
 ], 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 CreatePromptConfig 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 CreatePromptConfigDict 
 , 
 ] 
 ] 
 = 
 None 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 

Creates a new prompt in a Vertex Dataset resource.

This method waits for prompt creation to be complete before returning.

create_version

  create_version 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 prompt 
 : 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 PromptDict 
 ], 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 CreatePromptVersionConfig 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 CreatePromptVersionConfigDict 
 , 
 ] 
 ] 
 = 
 None 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 

Creates a new version of a prompt in the prompt resource associated with the provided prompt_id.

When creating new prompt version resources, this waits for the create operation to complete before returning.

delete

  delete 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 DeletePromptConfig 
 ] 
 = 
 None 
 ) 
 - 
> None 
 

Deletes a prompt resource.

Exceptions
Type
Description
TimeoutError
If the delete operation does not complete within the timeout.
ValueError
If the delete operation fails.

delete_version

  delete_version 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 version_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 DeletePromptConfig 
 ] 
 = 
 None 
 ) 
 - 
> None 
 

Deletes a prompt version resource.

Exceptions
Type
Description
TimeoutError
If the delete operation does not complete within the timeout.
ValueError
If the delete operation fails.

get

  get 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 GetPromptConfig 
 ] 
 = 
 None 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 

Gets a prompt resource from a Vertex Dataset.

get_version

  get_version 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 version_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 GetPromptConfig 
 ] 
 = 
 None 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 

Gets a prompt resource from a Vertex Dataset.

list

  list 
 ( 
 * 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 ListPromptsConfig 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 ListPromptsConfigDict 
 , 
 ] 
 ] 
 = 
 None 
 ) 
 - 
> typing 
 . 
 AsyncIterator 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 PromptRef 
 ] 
 

Lists prompt resources in a project.

This method retrieves all the prompts from the project provided in the vertexai.Client constructor and returns a list of prompt references containing the prompt_id and model for the prompt.

To get the full types.Prompt resource for a PromptRef after calling this method, use the get() method with the prompt_id as the prompt_id argument. Example usage:

 prompt_refs = client.aio.prompt_management.list_prompts()
async for prompt_ref in prompt_refs:
  await client.prompt_management.get(prompt_id=prompt_ref.prompt_id) 

list_versions

  list_versions 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Union 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 ListPromptsConfig 
 , 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 ListPromptsConfigDict 
 , 
 ] 
 ] 
 = 
 None 
 ) 
 - 
> typing 
 . 
 AsyncIterator 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 PromptVersionRef 
 ] 
 

Lists prompt version resources for a provided prompt_id.

This method retrieves all the prompt versions for a provided prompt_id.

To get the full types.Prompt resource for a PromptVersionRef after calling this method, use the get() method with the returned prompt_id and version_id. Example usage:

 prompt_version_refs = await client.prompt_management.list_versions(prompt_id="123")
async for version_ref in prompt_version_refs:
  await client.aio.prompt_management.get(prompt_id=version_ref.prompt_id, version_id=version_ref.version_id) 

restore_version

  restore_version 
 ( 
 * 
 , 
 prompt_id 
 : 
 str 
 , 
 version_id 
 : 
 str 
 , 
 config 
 : 
 typing 
 . 
 Optional 
 [ 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 RestoreVersionConfig 
 ] 
 = 
 None 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 Prompt 
 

Restores the provided prompt version to the latest version.

Create a Mobile Website
View Site in Mobile | Classic
Share by: