Skip to content

Class swarmauri_core.chains.IChainDependencyResolver.IChainDependencyResolver

swarmauri_core.chains.IChainDependencyResolver.IChainDependencyResolver

Bases: ABC

build_dependencies abstractmethod

build_dependencies()

Builds the dependencies for a particular sequence in the matrix.

PARAMETER DESCRIPTION
matrix

The prompt matrix.

TYPE: List[List[str]]

sequence_index

The index of the sequence to build dependencies for.

TYPE: int

RETURNS DESCRIPTION
List[ChainStep]

Tuple containing indegrees and graph dicts.

Source code in swarmauri_core/chains/IChainDependencyResolver.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
@abstractmethod
def build_dependencies(self) -> List[ChainStep]:
    """
    Builds the dependencies for a particular sequence in the matrix.

    Args:
        matrix (List[List[str]]): The prompt matrix.
        sequence_index (int): The index of the sequence to build dependencies for.

    Returns:
        Tuple containing indegrees and graph dicts.
    """
    pass

resolve_dependencies abstractmethod

resolve_dependencies(matrix, sequence_index)

Resolves the execution order based on the provided dependencies.

PARAMETER DESCRIPTION
indegrees

The indegrees of each node.

TYPE: Dict[int, int]

graph

The graph representing dependencies.

TYPE: Dict[int, List[int]]

RETURNS DESCRIPTION
List[int]

List[int]: The resolved execution order.

Source code in swarmauri_core/chains/IChainDependencyResolver.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@abstractmethod
def resolve_dependencies(
    self, matrix: List[List[Optional[str]]], sequence_index: int
) -> List[int]:
    """
    Resolves the execution order based on the provided dependencies.

    Args:
        indegrees (Dict[int, int]): The indegrees of each node.
        graph (Dict[int, List[int]]): The graph representing dependencies.

    Returns:
        List[int]: The resolved execution order.
    """
    pass