openprotein.prompt#
Create prompts to be used with PoET models, along with queries which opens up use-cases like inverse folding with PoET-2.
- class openprotein.prompt.PromptAPI[source]#
Prompt API providing the interface to create prompts for use with PoET models.
- __init__(session)[source]#
- Parameters:
session (APISession)
- create_prompt(context, name=None, description=None)[source]#
Create a prompt.
- Parameters:
context (Context | Sequence[Context]) – context or list of contexts, where each context is a Sequence of str, bytes, and/or Protein
query (Optional[bytes | str | Protein]) – Optional query provided as sequence/structure
name (str) – Name of the prompt.
description (Optional[str]) – Description of the prompt.
- Returns:
Metadata of the created prompt.
- Return type:
PromptMetadata
- get_prompt(prompt_id)[source]#
Get the prompt for a given prompt ID.
- Parameters:
prompt_id (str) – The prompt ID.
- Returns:
The prompt data in binary format.
- Return type:
BinaryIO
- list_prompts()[source]#
List all prompts.
- Returns:
List of prompt metadata.
- Return type:
List[PromptMetadata]
- class openprotein.prompt.Prompt[source]#
Prompt which contains a set of sequences and/or structures used to condition the PoET models.
- __init__(session, job=None, metadata=None, num_replicates=None)[source]#
Initialize a new Prompt instance.
- Parameters:
session (APISession) – An APISession object used for interacting with the API.
job (PromptJob | None) – A PromptJob containing information about the optional prompt job.
metadata (PromptMetadata) – A PromptMetadata object containing metadata for the prompt.
num_replicates (int | None)
- cancelled()#
check if job is cancelled
- Return type:
bool
- done()#
Check if job is complete
- Return type:
bool
- refresh()#
Refresh job status.
- wait(interval=5, timeout=None, verbose=False)#
Wait for job to complete, then fetch results.
- Parameters:
interval (int, optional) – time between polling. Defaults to config.POLLING_INTERVAL.
timeout (int, optional) – max time to wait. Defaults to None.
verbose (bool, optional) – verbosity flag. Defaults to False.
- Returns:
results of job
- Return type:
results
- wait_until_done(interval=5, timeout=None, verbose=False)#
Wait for job to complete. Do not fetch results (unlike wait())
- Parameters:
interval (int, optional) – time between polling. Defaults to config.POLLING_INTERVAL.
timeout (int, optional) – max time to wait. Defaults to None.
verbose (bool, optional) – verbosity flag. Defaults to False.
- Returns:
results of job
- Return type:
results
- class openprotein.prompt.Query[source]#
Query containing a sequence/structure used to query the PoET-2 model which opens up new workflows.
- __init__(session, metadata)[source]#
Initialize a new Query instance.
- Parameters:
session (APISession) – An APISession object used for interacting with the API.
metadata (QueryMetadata) – A QueryMetadata object containing metadata for the query.