openprotein.prompt#
Create prompts to be used with PoET models, along with queries which opens up use-cases like inverse folding with PoET-2.
Interface#
- class openprotein.prompt.PromptAPI(session)[source]#
Prompt API providing the interface to create prompts for use with PoET models.
- 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:
- 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]
Classes#
- class openprotein.prompt.Prompt(session, job=None, metadata=None, num_replicates=None)[source]#
Prompt which contains a set of sequences and/or structures used to condition the PoET models.
- Parameters:
session (APISession)
job (PromptJob | None)
metadata (PromptMetadata)
num_replicates (int | None)
- get()[source]#
Return the results from this job.
- Parameters:
verbose (bool, optional) – Flag to enable verbose output, by default False.
**kwargs – Additional keyword arguments.
- Return type:
list[list[Protein]]
- property id#
The unique identifier of the job.
- property created_date#
The creation timestamp of the job.
- property status#
The current status of the job.
- cancelled()#
Check if the job has been cancelled.
- Returns:
True if the job is cancelled, False otherwise.
- Return type:
bool
- done()#
Check if the job has completed.
- Returns:
True if the job is done, False otherwise.
- Return type:
bool
- property end_date: datetime | None#
The end timestamp of the job.
- property job_id: str#
The unique identifier of the job.
- property job_type: str#
The type of the job.
- property progress_counter: int#
The progress counter of the job.
- refresh()#
Refresh the job status and internal job object.
- property start_date: datetime | None#
The start timestamp of the job.
- wait(interval=5, timeout=None, verbose=False)#
Wait for the job to complete, then fetch results.
- Parameters:
interval (int, optional) – Time in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeout (int | None, optional) – Maximum time in seconds to wait. Defaults to None.
verbose (bool, optional) – Verbosity flag. Defaults to False.
- Returns:
The results of the job.
- Return type:
Any
- wait_until_done(interval=5, timeout=None, verbose=False)#
Wait for the job to complete.
- Parameters:
interval (float, optional) – Time in seconds between polling. Defaults to config.POLLING_INTERVAL.
timeout (int, optional) – Maximum time in seconds to wait. Defaults to None.
verbose (bool, optional) – Verbosity flag. Defaults to False.
- Returns:
True if the job completed successfully.
- Return type:
bool
Notes
This method does not fetch the job results, unlike wait().
- class openprotein.prompt.Query(session, metadata)[source]#
Query containing a sequence/structure used to query the PoET-2 model which opens up new workflows.
- Parameters:
session (APISession)
metadata (QueryMetadata)
- class openprotein.prompt.PromptMetadata(*, id, name, description=None, created_date, num_replicates, job_id=None, status)[source]#
Metadata about a prompt.
- Parameters:
id (str)
name (str)
description (str | None)
created_date (datetime)
num_replicates (int)
job_id (str | None)
status (JobStatus)
- class openprotein.prompt.QueryMetadata(*, id, created_date)[source]#
Metadata about a query.
- Parameters:
id (str)
created_date (datetime)
- class openprotein.prompt.PromptJob(*, job_id, job_type, status, created_date, start_date=None, end_date=None, prerequisite_job_id=None, progress_message=None, progress_counter=None, sequence_length=None, **extra_data)[source]#
A representation of a prompt job.
- Parameters:
job_id (str)
job_type (Literal[JobType.align_prompt])
status (JobStatus)
created_date (datetime)
start_date (datetime | None)
end_date (datetime | None)
prerequisite_job_id (str | None)
progress_message (str | None)
progress_counter (int | None)
sequence_length (int | None)
extra_data (Any)
- property msa_id#
ID of the underlying MSA.
- property prompt_id#
Prompt ID.