Skip to content

Design Candidate Sets (🧪Beta)

albert.collections.design_candidate_sets.DesignCandidateSetCollection

DesignCandidateSetCollection(*, session: AlbertSession)

Bases: BaseCollection

Access design candidate sets in the Albert platform (🧪 Beta).

A candidate set holds the candidates a design run produced. Its ID is the result_set_id of the completed run. Sets are read-only. List a set's candidates with client.design_candidates.get_all(candidate_set_id=...).

This collection is accessed as client.design_candidate_sets.

Beta Feature!

Please do not use in production or without explicit guidance from Albert. You might otherwise have a bad experience. This feature currently falls outside of the Albert support contract, but we'd love your feedback!

Example

from albert import Albert

client = Albert()
run = client.design_runs_v4.get_by_id(id="DSR123")
candidate_set = client.design_candidate_sets.get_by_id(id=run.result_set_id)

Parameters:

Name Type Description Default
session AlbertSession

The authenticated Albert session used for API calls.

required

Attributes:

Name Type Description
base_path str

The base API route for candidate-set requests.

Methods:

Name Description
get_by_id

Get a candidate set by its ID.

Source code in src/albert/collections/design_candidate_sets.py
def __init__(self, *, session: AlbertSession):
    super().__init__(session=session)
    self.base_path = f"/api/{DesignCandidateSetCollection._api_version}/design/candidate-sets"

base_path

base_path = f"/api/{DesignCandidateSetCollection._api_version}/design/candidate-sets"

get_by_id

Get a candidate set by its ID.

Example

candidate_set = client.design_candidate_sets.get_by_id(id="DCS123")
candidate_set.source.source_id
# 'DSR123'

Parameters:

Name Type Description Default
id DesignCandidateSetId

The candidate set ID (format DCS...).

required

Returns:

Type Description
DesignCandidateSet

The fully populated DesignCandidateSet.

Source code in src/albert/collections/design_candidate_sets.py
@validate_call
def get_by_id(self, *, id: DesignCandidateSetId) -> DesignCandidateSet:
    """Get a candidate set by its ID.

    !!! example
        ```python
        candidate_set = client.design_candidate_sets.get_by_id(id="DCS123")
        candidate_set.source.source_id
        # 'DSR123'
        ```

    Parameters
    ----------
    id : DesignCandidateSetId
        The candidate set ID (format ``DCS...``).

    Returns
    -------
    DesignCandidateSet
        The fully populated DesignCandidateSet.
    """
    response = self.session.get(f"{self.base_path}/{id}")
    return DesignCandidateSet(**response.json())