swarmauri-core 0.5.0.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- swarmauri_core/ComponentBase.py +163 -0
- swarmauri_core/__init__.py +11 -0
- swarmauri_core/agent_apis/IAgentCommands.py +83 -0
- swarmauri_core/agent_apis/IAgentRouterCRUD.py +56 -0
- swarmauri_core/agent_apis/__init__.py +4 -0
- swarmauri_core/agent_factories/IAgentFactory.py +79 -0
- swarmauri_core/agent_factories/IExportConf.py +40 -0
- swarmauri_core/agent_factories/__init__.py +0 -0
- swarmauri_core/agents/IAgent.py +12 -0
- swarmauri_core/agents/IAgentConversation.py +5 -0
- swarmauri_core/agents/IAgentParser.py +14 -0
- swarmauri_core/agents/IAgentRetrieve.py +4 -0
- swarmauri_core/agents/IAgentSystemContext.py +4 -0
- swarmauri_core/agents/IAgentToolkit.py +4 -0
- swarmauri_core/agents/IAgentVectorStore.py +4 -0
- swarmauri_core/agents/__init__.py +0 -0
- swarmauri_core/chains/ICallableChain.py +15 -0
- swarmauri_core/chains/IChain.py +75 -0
- swarmauri_core/chains/IChainContext.py +11 -0
- swarmauri_core/chains/IChainContextLoader.py +8 -0
- swarmauri_core/chains/IChainDependencyResolver.py +32 -0
- swarmauri_core/chains/IChainFactory.py +61 -0
- swarmauri_core/chains/IChainStep.py +7 -0
- swarmauri_core/chains/__init__.py +1 -0
- swarmauri_core/chunkers/IChunker.py +15 -0
- swarmauri_core/chunkers/__init__.py +0 -0
- swarmauri_core/conversations/IConversation.py +45 -0
- swarmauri_core/conversations/IMaxSize.py +4 -0
- swarmauri_core/conversations/ISystemContext.py +4 -0
- swarmauri_core/conversations/__init__.py +0 -0
- swarmauri_core/distances/IDistanceSimilarity.py +49 -0
- swarmauri_core/distances/__init__.py +0 -0
- swarmauri_core/document_stores/IDocumentRetrieve.py +25 -0
- swarmauri_core/document_stores/IDocumentStore.py +79 -0
- swarmauri_core/document_stores/__init__.py +0 -0
- swarmauri_core/documents/IDocument.py +4 -0
- swarmauri_core/documents/IExperimentDocument.py +120 -0
- swarmauri_core/documents/__init__.py +0 -0
- swarmauri_core/embeddings/IFeature.py +9 -0
- swarmauri_core/embeddings/ISaveModel.py +30 -0
- swarmauri_core/embeddings/IVectorize.py +26 -0
- swarmauri_core/embeddings/__init__.py +1 -0
- swarmauri_core/experiment_stores/IExperimentStore.py +72 -0
- swarmauri_core/experiment_stores/__init__.py +99 -0
- swarmauri_core/llms/IFit.py +13 -0
- swarmauri_core/llms/IPredict.py +13 -0
- swarmauri_core/llms/__init__.py +0 -0
- swarmauri_core/messages/IMessage.py +10 -0
- swarmauri_core/messages/__init__.py +1 -0
- swarmauri_core/metrics/IMetric.py +19 -0
- swarmauri_core/metrics/IMetricAggregate.py +16 -0
- swarmauri_core/metrics/IMetricCalculate.py +30 -0
- swarmauri_core/metrics/IThreshold.py +4 -0
- swarmauri_core/metrics/__init__.py +0 -0
- swarmauri_core/parsers/IParser.py +19 -0
- swarmauri_core/parsers/__init__.py +0 -0
- swarmauri_core/prompts/IPrompt.py +18 -0
- swarmauri_core/prompts/IPromptMatrix.py +30 -0
- swarmauri_core/prompts/ITemplate.py +46 -0
- swarmauri_core/prompts/__init__.py +0 -0
- swarmauri_core/schema_converters/ISchemaConvert.py +9 -0
- swarmauri_core/schema_converters/__init__.py +0 -0
- swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +72 -0
- swarmauri_core/swarm_apis/ISwarmAPI.py +24 -0
- swarmauri_core/swarm_apis/__init__.py +0 -0
- swarmauri_core/swarms/ISwarm.py +67 -0
- swarmauri_core/swarms/ISwarmAgentRegistration.py +73 -0
- swarmauri_core/swarms/ISwarmChainCRUD.py +62 -0
- swarmauri_core/swarms/ISwarmComponent.py +13 -0
- swarmauri_core/swarms/ISwarmConfigurationExporter.py +33 -0
- swarmauri_core/swarms/ISwarmFactory.py +120 -0
- swarmauri_core/swarms/__init__.py +0 -0
- swarmauri_core/toolkits/IToolkit.py +44 -0
- swarmauri_core/toolkits/__init__.py +0 -0
- swarmauri_core/tools/IParameter.py +9 -0
- swarmauri_core/tools/ITool.py +12 -0
- swarmauri_core/tools/__init__.py +0 -0
- swarmauri_core/tracing/IChainTracer.py +25 -0
- swarmauri_core/tracing/ITraceContext.py +29 -0
- swarmauri_core/tracing/ITracer.py +45 -0
- swarmauri_core/tracing/__init__.py +0 -0
- swarmauri_core/typing.py +26 -0
- swarmauri_core/utils/ITransactional.py +24 -0
- swarmauri_core/utils/__init__.py +0 -0
- swarmauri_core/vector_stores/IAngleBetweenVectors.py +23 -0
- swarmauri_core/vector_stores/ICloudVectorStore.py +21 -0
- swarmauri_core/vector_stores/IDecompose.py +24 -0
- swarmauri_core/vector_stores/IDivergence.py +21 -0
- swarmauri_core/vector_stores/IGradient.py +22 -0
- swarmauri_core/vector_stores/IOrthogonalProject.py +21 -0
- swarmauri_core/vector_stores/IPersistentVectorStore.py +21 -0
- swarmauri_core/vector_stores/IProject.py +22 -0
- swarmauri_core/vector_stores/IReflect.py +21 -0
- swarmauri_core/vector_stores/ISimilarity.py +26 -0
- swarmauri_core/vector_stores/ISimiliarityQuery.py +19 -0
- swarmauri_core/vector_stores/IVectorArithmetic.py +31 -0
- swarmauri_core/vector_stores/IVectorBasisCheck.py +20 -0
- swarmauri_core/vector_stores/IVectorLinearCombination.py +21 -0
- swarmauri_core/vector_stores/IVectorNorm.py +49 -0
- swarmauri_core/vector_stores/IVectorRotate.py +24 -0
- swarmauri_core/vector_stores/IVectorSpan.py +21 -0
- swarmauri_core/vector_stores/IVectorStore.py +88 -0
- swarmauri_core/vector_stores/IVectorStoreRetrieve.py +26 -0
- swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +45 -0
- swarmauri_core/vector_stores/__init__.py +0 -0
- swarmauri_core/vectors/IVector.py +10 -0
- swarmauri_core/vectors/IVectorMeta.py +28 -0
- swarmauri_core/vectors/IVectorProduct.py +66 -0
- swarmauri_core/vectors/IVectorTransform.py +49 -0
- swarmauri_core/vectors/__init__.py +0 -0
- swarmauri_core-0.5.0.dev1.dist-info/METADATA +26 -0
- swarmauri_core-0.5.0.dev1.dist-info/RECORD +114 -0
- swarmauri_core-0.5.0.dev1.dist-info/WHEEL +5 -0
- swarmauri_core-0.5.0.dev1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Any, Dict
|
|
3
|
+
from swarmauri.core.chains.IChain import IChain
|
|
4
|
+
from swarmauri.core.chains.IChainStep import IChainStep
|
|
5
|
+
|
|
6
|
+
class IChainFactory(ABC):
|
|
7
|
+
"""
|
|
8
|
+
Interface for creating and managing execution chains within the system.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
@abstractmethod
|
|
12
|
+
def create_chain(self, steps: List[IChainStep] = None) -> IChain:
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def get_chain(self) -> IChain:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def set_chain(self, chain: IChain):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def reset_chain(self):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def get_chain_steps(self) -> List[IChainStep]:
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def set_chain_steps(self, steps: List[IChainStep]):
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def add_chain_step(self, step: IChainStep):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def remove_chain_step(self, key: str):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def get_configs(self) -> Dict[str, Any]:
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
@abstractmethod
|
|
49
|
+
def set_configs(self, **configs):
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
@abstractmethod
|
|
53
|
+
|
|
54
|
+
def get_config(self, key: str) -> Any:
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
@abstractmethod
|
|
58
|
+
def set_config(self, key: str, value: Any):
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from swarmauri.core.chains.ICallableChain import ICallableChain
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Union, Any
|
|
3
|
+
|
|
4
|
+
class IChunker(ABC):
|
|
5
|
+
"""
|
|
6
|
+
Interface for chunking text into smaller pieces.
|
|
7
|
+
|
|
8
|
+
This interface defines abstract methods for chunking texts. Implementing classes
|
|
9
|
+
should provide concrete implementations for these methods tailored to their specific
|
|
10
|
+
chunking algorithms.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def chunk_text(self, text: Union[str, Any], *args, **kwargs) -> List[Any]:
|
|
15
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from swarmauri.core.messages.IMessage import IMessage
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class IConversation(ABC):
|
|
7
|
+
"""
|
|
8
|
+
Interface for managing conversations, defining abstract methods for
|
|
9
|
+
adding messages, retrieving the latest message, getting all messages, and clearing history.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def history(self) -> List[IMessage]:
|
|
14
|
+
"""
|
|
15
|
+
Provides read-only access to the conversation history.
|
|
16
|
+
"""
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def add_message(self, message: IMessage):
|
|
21
|
+
"""
|
|
22
|
+
Adds a message to the conversation history.
|
|
23
|
+
"""
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
@abstractmethod
|
|
27
|
+
def add_messages(self, messages: List[IMessage]):
|
|
28
|
+
"""
|
|
29
|
+
Adds multiple messages to the conversation history.
|
|
30
|
+
"""
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def get_last(self) -> Optional[IMessage]:
|
|
35
|
+
"""
|
|
36
|
+
Retrieves the latest message from the conversation history.
|
|
37
|
+
"""
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
@abstractmethod
|
|
41
|
+
def clear_history(self) -> None:
|
|
42
|
+
"""
|
|
43
|
+
Clears the conversation history.
|
|
44
|
+
"""
|
|
45
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List
|
|
3
|
+
from swarmauri.core.vectors.IVector import IVector
|
|
4
|
+
|
|
5
|
+
class IDistanceSimilarity(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for computing distances and similarities between high-dimensional data vectors. This interface
|
|
8
|
+
abstracts the method for calculating the distance and similarity, allowing for the implementation of various
|
|
9
|
+
distance metrics such as Euclidean, Manhattan, Cosine similarity, etc.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def distance(self, vector_a: IVector, vector_b: IVector) -> float:
|
|
14
|
+
"""
|
|
15
|
+
Computes the distance between two vectors.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
vector_a (IVector): The first vector in the comparison.
|
|
19
|
+
vector_b (IVector): The second vector in the comparison.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
float: The computed distance between vector_a and vector_b.
|
|
23
|
+
"""
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@abstractmethod
|
|
28
|
+
def distances(self, vector_a: IVector, vectors_b: List[IVector]) -> float:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@abstractmethod
|
|
33
|
+
def similarity(self, vector_a: IVector, vector_b: IVector) -> float:
|
|
34
|
+
"""
|
|
35
|
+
Compute the similarity between two vectors. The definition of similarity (e.g., cosine similarity)
|
|
36
|
+
should be implemented in concrete classes.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
vector_a (IVector): The first vector.
|
|
40
|
+
vector_b (IVector): The second vector to compare with the first vector.
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
float: A similarity score between vector_a and vector_b.
|
|
44
|
+
"""
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
@abstractmethod
|
|
48
|
+
def similarities(self, vector_a: IVector, vectors_b: List[IVector]) -> float:
|
|
49
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List
|
|
3
|
+
from swarmauri.core.documents.IDocument import IDocument
|
|
4
|
+
|
|
5
|
+
class IDocumentRetrieve(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Abstract base class for document retrieval operations.
|
|
8
|
+
|
|
9
|
+
This class defines the interface for retrieving documents based on a query or other criteria.
|
|
10
|
+
Implementations may use various indexing or search technologies to fulfill these retrievals.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def retrieve(self, query: str, top_k: int = 5) -> List[IDocument]:
|
|
15
|
+
"""
|
|
16
|
+
Retrieve the most relevant documents based on the given query.
|
|
17
|
+
|
|
18
|
+
Parameters:
|
|
19
|
+
query (str): The query string used for document retrieval.
|
|
20
|
+
top_k (int): The number of top relevant documents to retrieve.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
List[Document]: A list of the top_k most relevant documents.
|
|
24
|
+
"""
|
|
25
|
+
pass
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Union
|
|
3
|
+
from swarmauri.core.documents.IDocument import IDocument
|
|
4
|
+
|
|
5
|
+
class IDocumentStore(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for a Document Store responsible for storing, indexing, and retrieving documents.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def add_document(self, document: IDocument) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Stores a single document in the document store.
|
|
14
|
+
|
|
15
|
+
Parameters:
|
|
16
|
+
- document (IDocument): The document to store.
|
|
17
|
+
"""
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def add_documents(self, documents: List[IDocument]) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Stores multiple documents in the document store.
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
- documents (List[IDocument]): The list of documents to store.
|
|
27
|
+
"""
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def get_document(self, doc_id: str) -> Union[IDocument, None]:
|
|
32
|
+
"""
|
|
33
|
+
Retrieves a document by its ID.
|
|
34
|
+
|
|
35
|
+
Parameters:
|
|
36
|
+
- doc_id (str): The unique identifier for the document.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
- Union[IDocument, None]: The requested document, or None if not found.
|
|
40
|
+
"""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def get_all_documents(self) -> List[IDocument]:
|
|
45
|
+
"""
|
|
46
|
+
Retrieves all documents stored in the document store.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
- List[IDocument]: A list of all documents.
|
|
50
|
+
"""
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
@abstractmethod
|
|
54
|
+
def delete_document(self, doc_id: str) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Deletes a document from the document store by its ID.
|
|
57
|
+
|
|
58
|
+
Parameters:
|
|
59
|
+
- doc_id (str): The unique identifier of the document to delete.
|
|
60
|
+
"""
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@abstractmethod
|
|
65
|
+
def update_document(self, doc_id: str, updated_document: IDocument) -> None:
|
|
66
|
+
"""
|
|
67
|
+
Updates a document in the document store.
|
|
68
|
+
|
|
69
|
+
Parameters:
|
|
70
|
+
- doc_id (str): The unique identifier for the document to update.
|
|
71
|
+
- updated_document (IDocument): The updated document object.
|
|
72
|
+
|
|
73
|
+
Note: It's assumed that the updated_document will retain the same doc_id but may have different content or metadata.
|
|
74
|
+
"""
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@abstractmethod
|
|
78
|
+
def document_count(self) -> int:
|
|
79
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Dict, Any, List, Optional
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from swarmauri.core.documents.IDocument import IDocument
|
|
5
|
+
|
|
6
|
+
class IExperimentDocument(IDocument, ABC):
|
|
7
|
+
"""
|
|
8
|
+
Interface for an Experiment Document, extending the general IDocument interface
|
|
9
|
+
with additional properties and methods specific to experimental data.
|
|
10
|
+
"""
|
|
11
|
+
@property
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def parameters(self) -> Dict[str, Any]:
|
|
14
|
+
"""
|
|
15
|
+
Get the parameters used in the experiment.
|
|
16
|
+
"""
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@parameters.setter
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def parameters(self, value: Dict[str, Any]) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Set the parameters used in the experiment.
|
|
24
|
+
"""
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def results(self) -> Dict[str, Any]:
|
|
30
|
+
"""
|
|
31
|
+
Get the results obtained from the experiment.
|
|
32
|
+
"""
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
@results.setter
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def results(self, value: Dict[str, Any]) -> None:
|
|
38
|
+
"""
|
|
39
|
+
Set the results obtained from the experiment.
|
|
40
|
+
"""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def instruction(self) -> str:
|
|
46
|
+
"""
|
|
47
|
+
An instructional or descriptive text about what the experiment aims to achieve or how.
|
|
48
|
+
"""
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
@instruction.setter
|
|
52
|
+
@abstractmethod
|
|
53
|
+
def instruction(self, value: str) -> None:
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
@abstractmethod
|
|
58
|
+
def feature_set(self) -> List[Any]:
|
|
59
|
+
"""
|
|
60
|
+
Description of the set of features or data used in the experiment.
|
|
61
|
+
"""
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
@feature_set.setter
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def feature_set(self, value: List[Any]) -> None:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
@abstractmethod
|
|
71
|
+
def version(self) -> str:
|
|
72
|
+
"""
|
|
73
|
+
The version of the experiment, useful for tracking iterations and changes over time.
|
|
74
|
+
"""
|
|
75
|
+
pass
|
|
76
|
+
|
|
77
|
+
@version.setter
|
|
78
|
+
@abstractmethod
|
|
79
|
+
def version(self, value: str) -> None:
|
|
80
|
+
pass
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
@abstractmethod
|
|
84
|
+
def artifacts(self) -> List[str]:
|
|
85
|
+
"""
|
|
86
|
+
A list of paths or identifiers for any artifacts generated by the experiment,
|
|
87
|
+
such as models, charts, or data dumps.
|
|
88
|
+
"""
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
@artifacts.setter
|
|
92
|
+
@abstractmethod
|
|
93
|
+
def artifacts(self, value: List[str]) -> None:
|
|
94
|
+
pass
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
@abstractmethod
|
|
98
|
+
def datetime_created(self) -> datetime:
|
|
99
|
+
"""
|
|
100
|
+
Timestamp marking when the experiment was initiated or created.
|
|
101
|
+
"""
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
@datetime_created.setter
|
|
105
|
+
@abstractmethod
|
|
106
|
+
def datetime_created(self, value: datetime) -> None:
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
@abstractmethod
|
|
111
|
+
def datetime_completed(self) -> Optional[datetime]:
|
|
112
|
+
"""
|
|
113
|
+
Timestamp of when the experiment was completed. None if the experiment is still running.
|
|
114
|
+
"""
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
@datetime_completed.setter
|
|
118
|
+
@abstractmethod
|
|
119
|
+
def datetime_completed(self, value: Optional[datetime]) -> None:
|
|
120
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
class ISaveModel(ABC):
|
|
5
|
+
"""
|
|
6
|
+
Interface to abstract the ability to save and load models.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def save_model(self, path: str) -> None:
|
|
11
|
+
"""
|
|
12
|
+
Saves the model to the specified directory.
|
|
13
|
+
|
|
14
|
+
Parameters:
|
|
15
|
+
- path (str): The directory path where the model will be saved.
|
|
16
|
+
"""
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def load_model(self, path: str) -> Any:
|
|
21
|
+
"""
|
|
22
|
+
Loads a model from the specified directory.
|
|
23
|
+
|
|
24
|
+
Parameters:
|
|
25
|
+
- path (str): The directory path from where the model will be loaded.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
- Returns an instance of the loaded model.
|
|
29
|
+
"""
|
|
30
|
+
pass
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Union, Any
|
|
3
|
+
from swarmauri.core.vectors.IVector import IVector
|
|
4
|
+
|
|
5
|
+
class IVectorize(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for converting text to vectors.
|
|
8
|
+
Implementations of this interface transform input text into numerical
|
|
9
|
+
vectors that can be used in machine learning models, similarity calculations,
|
|
10
|
+
and other vector-based operations.
|
|
11
|
+
"""
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def fit(self, data: Union[str, Any]) -> None:
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
@abstractmethod
|
|
17
|
+
def transform(self, data: Union[str, Any]) -> List[IVector]:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def fit_transform(self, data: Union[str, Any]) -> List[IVector]:
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def infer_vector(self, data: Union[str, Any], *args, **kwargs) -> IVector:
|
|
26
|
+
pass
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import List, Dict, Any, Union
|
|
3
|
+
from swarmauri.core.documents.IExperimentDocument import IExperimentDocument
|
|
4
|
+
|
|
5
|
+
class IExperimentStore(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for an Experiment Store that manages experimental documents and supports
|
|
8
|
+
operations related to experimenting, evaluating, testing, and benchmarking.
|
|
9
|
+
"""
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def add_experiment(self, experiment: IExperimentDocument) -> None:
|
|
12
|
+
"""
|
|
13
|
+
Stores a single experiment in the experiment store.
|
|
14
|
+
|
|
15
|
+
Parameters:
|
|
16
|
+
- experiment (IExperimentDocument): The experimental document to be stored.
|
|
17
|
+
"""
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def add_experiments(self, experiments: List[IExperimentDocument]) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Stores multiple experiments in the experiment store.
|
|
24
|
+
|
|
25
|
+
Parameters:
|
|
26
|
+
- experiments (List[IExperimentDocument]): The list of experimental documents to be stored.
|
|
27
|
+
"""
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
def get_experiment(self, experiment_id: str) -> Union[IExperimentDocument, None]:
|
|
32
|
+
"""
|
|
33
|
+
Retrieves an experimental document by its ID.
|
|
34
|
+
|
|
35
|
+
Parameters:
|
|
36
|
+
- experiment_id (str): The unique identifier of the experiment.
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
- Union[IExperimentDocument, None]: The requested experimental document, or None if not found.
|
|
40
|
+
"""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@abstractmethod
|
|
44
|
+
def get_all_experiments(self) -> List[IExperimentDocument]:
|
|
45
|
+
"""
|
|
46
|
+
Retrieves all experimental documents stored in the experiment store.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
- List[IExperimentDocument]: A list of all experimental documents.
|
|
50
|
+
"""
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
@abstractmethod
|
|
54
|
+
def update_experiment(self, experiment_id: str, updated_experiment: IExperimentDocument) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Updates an experimental document in the experiment store.
|
|
57
|
+
|
|
58
|
+
Parameters:
|
|
59
|
+
- experiment_id (str): The unique identifier of the experiment to update.
|
|
60
|
+
- updated_experiment (IExperimentDocument): The updated experimental document.
|
|
61
|
+
"""
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
@abstractmethod
|
|
65
|
+
def delete_experiment(self, experiment_id: str) -> None:
|
|
66
|
+
"""
|
|
67
|
+
Deletes an experimental document from the experiment store by its ID.
|
|
68
|
+
|
|
69
|
+
Parameters:
|
|
70
|
+
- experiment_id (str): The unique identifier of the experimental document to be deleted.
|
|
71
|
+
"""
|
|
72
|
+
pass
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# core/experiment_stores/IExperimentStore.py
|
|
2
|
+
from abc import ABC, abstractmethod
|
|
3
|
+
from typing import List, Dict, Any, Union
|
|
4
|
+
from swarmauri.core.documents.IExperimentDocument import IExperimentDocument
|
|
5
|
+
|
|
6
|
+
class IExperimentStore(ABC):
|
|
7
|
+
"""
|
|
8
|
+
Interface for an Experiment Store that manages experimental documents and supports
|
|
9
|
+
operations related to experimenting, evaluating, testing, and benchmarking.
|
|
10
|
+
"""
|
|
11
|
+
@abstractmethod
|
|
12
|
+
def add_experiment(self, experiment: IExperimentDocument) -> None:
|
|
13
|
+
"""
|
|
14
|
+
Stores a single experiment in the experiment store.
|
|
15
|
+
|
|
16
|
+
Parameters:
|
|
17
|
+
- experiment (IExperimentDocument): The experimental document to be stored.
|
|
18
|
+
"""
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def add_experiments(self, experiments: List[IExperimentDocument]) -> None:
|
|
23
|
+
"""
|
|
24
|
+
Stores multiple experiments in the experiment store.
|
|
25
|
+
|
|
26
|
+
Parameters:
|
|
27
|
+
- experiments (List[IExperimentDocument]): The list of experimental documents to be stored.
|
|
28
|
+
"""
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def get_experiment(self, experiment_id: str) -> Union[IExperimentDocument, None]:
|
|
33
|
+
"""
|
|
34
|
+
Retrieves an experimental document by its ID.
|
|
35
|
+
|
|
36
|
+
Parameters:
|
|
37
|
+
- id (str): The unique identifier of the experiment.
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
- Union[IExperimentDocument, None]: The requested experimental document, or None if not found.
|
|
41
|
+
"""
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
@abstractmethod
|
|
45
|
+
def get_all_experiments(self) -> List[IExperimentDocument]:
|
|
46
|
+
"""
|
|
47
|
+
Retrieves all experimental documents stored in the experiment store.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
- List[IExperimentDocument]: A list of all experimental documents.
|
|
51
|
+
"""
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
@abstractmethod
|
|
55
|
+
def update_experiment(self, experiment_id: str, updated_experiment: IExperimentDocument) -> None:
|
|
56
|
+
"""
|
|
57
|
+
Updates an experimental document in the experiment store.
|
|
58
|
+
|
|
59
|
+
Parameters:
|
|
60
|
+
- id (str): The unique identifier of the experiment to update.
|
|
61
|
+
- updated_experiment (IExperimentDocument): The updated experimental document.
|
|
62
|
+
"""
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
def delete_experiment(self, experiment_id: str) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Deletes an experimental document from the experiment store by its ID.
|
|
69
|
+
|
|
70
|
+
Parameters:
|
|
71
|
+
- id (str): The unique identifier of the experimental document to be deleted.
|
|
72
|
+
"""
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
@abstractmethod
|
|
76
|
+
def evaluate_experiments(self, evaluation_criteria: Dict[str, Any]) -> Any:
|
|
77
|
+
"""
|
|
78
|
+
Evaluates the experiments stored in the experiment store based on given criteria and metrics.
|
|
79
|
+
|
|
80
|
+
Parameters:
|
|
81
|
+
- evaluation_criteria (Dict[str, Any]): The criteria and metrics to evaluate the experiments.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
- Any: The evaluation results, which may vary depending on the evaluation criteria.
|
|
85
|
+
"""
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def benchmark_experiments(self, benchmarking_data: Dict[str, Any]) -> Any:
|
|
90
|
+
"""
|
|
91
|
+
Benchmarks the experiments against each other or predefined standards.
|
|
92
|
+
|
|
93
|
+
Parameters:
|
|
94
|
+
- benchmarking_data (Dict[str, Any]): Data and parameters for benchmarking the experiments.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
- Any: The benchmark results, which may vary depending on the benchmarking methodology.
|
|
98
|
+
"""
|
|
99
|
+
pass
|