swarmauri_core 0.9.2.dev9__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/__init__.py +14 -0
- swarmauri_core/agent_apis/IAgentCommands.py +83 -0
- swarmauri_core/agent_apis/IAgentRouterCRUD.py +61 -0
- swarmauri_core/agent_apis/__init__.py +4 -0
- swarmauri_core/agent_factories/IExportConf.py +41 -0
- swarmauri_core/agent_factories/__init__.py +0 -0
- swarmauri_core/agents/IAgent.py +47 -0
- swarmauri_core/agents/IAgentConversation.py +5 -0
- swarmauri_core/agents/IAgentParser.py +14 -0
- swarmauri_core/agents/IAgentRetrieve.py +5 -0
- swarmauri_core/agents/IAgentSystemContext.py +5 -0
- swarmauri_core/agents/IAgentToolkit.py +5 -0
- swarmauri_core/agents/IAgentVectorStore.py +5 -0
- swarmauri_core/agents/__init__.py +0 -0
- swarmauri_core/auth_idp/IOAuth20AppClient.py +13 -0
- swarmauri_core/auth_idp/IOAuth20Login.py +18 -0
- swarmauri_core/auth_idp/IOAuth21AppClient.py +13 -0
- swarmauri_core/auth_idp/IOAuth21Login.py +18 -0
- swarmauri_core/auth_idp/IOIDC10AppClient.py +13 -0
- swarmauri_core/auth_idp/IOIDC10Login.py +18 -0
- swarmauri_core/auth_idp/__init__.py +15 -0
- swarmauri_core/billing/IBalanceTransfers.py +22 -0
- swarmauri_core/billing/IBillingProvider.py +22 -0
- swarmauri_core/billing/ICustomers.py +28 -0
- swarmauri_core/billing/IHostedCheckout.py +17 -0
- swarmauri_core/billing/IInvoicing.py +30 -0
- swarmauri_core/billing/IMarketplace.py +29 -0
- swarmauri_core/billing/IOnlinePayments.py +32 -0
- swarmauri_core/billing/IPaymentMethods.py +32 -0
- swarmauri_core/billing/IPayouts.py +18 -0
- swarmauri_core/billing/IProductsPrices.py +27 -0
- swarmauri_core/billing/IPromotions.py +24 -0
- swarmauri_core/billing/IRefunds.py +22 -0
- swarmauri_core/billing/IReports.py +18 -0
- swarmauri_core/billing/IRisk.py +20 -0
- swarmauri_core/billing/ISubscriptions.py +24 -0
- swarmauri_core/billing/IWebhooks.py +18 -0
- swarmauri_core/billing/__init__.py +121 -0
- swarmauri_core/billing/enums.py +97 -0
- swarmauri_core/billing/protos.py +131 -0
- swarmauri_core/certs/ICertService.py +193 -0
- swarmauri_core/certs/__init__.py +5 -0
- swarmauri_core/chains/ICallableChain.py +18 -0
- swarmauri_core/chains/IChain.py +77 -0
- swarmauri_core/chains/IChainContext.py +11 -0
- swarmauri_core/chains/IChainContextLoader.py +9 -0
- swarmauri_core/chains/IChainDependencyResolver.py +35 -0
- swarmauri_core/chains/IChainFactory.py +59 -0
- swarmauri_core/chains/IChainStep.py +6 -0
- swarmauri_core/chains/__init__.py +1 -0
- swarmauri_core/chunkers/IChunker.py +16 -0
- swarmauri_core/chunkers/__init__.py +0 -0
- swarmauri_core/cipher_suites/ICipherSuite.py +67 -0
- swarmauri_core/cipher_suites/__init__.py +23 -0
- swarmauri_core/cipher_suites/types.py +76 -0
- swarmauri_core/conversations/IConversation.py +45 -0
- swarmauri_core/conversations/IMaxSize.py +5 -0
- swarmauri_core/conversations/ISystemContext.py +5 -0
- swarmauri_core/conversations/__init__.py +0 -0
- swarmauri_core/crypto/ICrypto.py +257 -0
- swarmauri_core/crypto/__init__.py +0 -0
- swarmauri_core/crypto/types.py +310 -0
- swarmauri_core/dataconnectors/IDataConnector.py +70 -0
- swarmauri_core/dataconnectors/__init__.py +0 -0
- swarmauri_core/distances/IDistanceSimilarity.py +48 -0
- swarmauri_core/distances/__init__.py +0 -0
- swarmauri_core/document_stores/IDocumentRetrieve.py +26 -0
- swarmauri_core/document_stores/IDocumentStore.py +79 -0
- swarmauri_core/document_stores/__init__.py +0 -0
- swarmauri_core/documents/IDocument.py +5 -0
- swarmauri_core/documents/IExperimentDocument.py +122 -0
- swarmauri_core/documents/__init__.py +0 -0
- swarmauri_core/embeddings/IFeature.py +8 -0
- swarmauri_core/embeddings/ISaveModel.py +31 -0
- swarmauri_core/embeddings/IVectorize.py +28 -0
- swarmauri_core/embeddings/__init__.py +1 -0
- swarmauri_core/ensembles/IEnsemble.py +55 -0
- swarmauri_core/ensembles/__init__.py +0 -0
- swarmauri_core/evaluator_pools/IEvaluatorPool.py +181 -0
- swarmauri_core/evaluator_pools/__init__.py +0 -0
- swarmauri_core/evaluator_results/IEvalResult.py +52 -0
- swarmauri_core/evaluator_results/__init__.py +0 -0
- swarmauri_core/evaluators/IEvaluate.py +59 -0
- swarmauri_core/evaluators/__init__.py +0 -0
- swarmauri_core/factories/IFactory.py +18 -0
- swarmauri_core/factories/__init__.py +0 -0
- swarmauri_core/git_filters/IGitFilter.py +29 -0
- swarmauri_core/git_filters/__init__.py +5 -0
- swarmauri_core/image_gens/IGenImage.py +35 -0
- swarmauri_core/image_gens/__init__.py +0 -0
- swarmauri_core/inner_products/IInnerProduct.py +119 -0
- swarmauri_core/inner_products/__init__.py +0 -0
- swarmauri_core/key_providers/IKeyProvider.py +88 -0
- swarmauri_core/key_providers/__init__.py +17 -0
- swarmauri_core/key_providers/types.py +55 -0
- swarmauri_core/keys.py +23 -0
- swarmauri_core/llms/IFit.py +14 -0
- swarmauri_core/llms/IPredict.py +49 -0
- swarmauri_core/llms/__init__.py +0 -0
- swarmauri_core/logger_formatters/IFormatter.py +11 -0
- swarmauri_core/logger_formatters/__init__.py +0 -0
- swarmauri_core/logger_handlers/IHandler.py +11 -0
- swarmauri_core/logger_handlers/__init__.py +0 -0
- swarmauri_core/loggers/ILogger.py +11 -0
- swarmauri_core/loggers/__init__.py +0 -0
- swarmauri_core/matrices/IMatrix.py +361 -0
- swarmauri_core/matrices/__init__.py +0 -0
- swarmauri_core/measurements/IMeasurement.py +20 -0
- swarmauri_core/measurements/IMeasurementAggregate.py +16 -0
- swarmauri_core/measurements/IMeasurementCalculate.py +29 -0
- swarmauri_core/measurements/IThreshold.py +5 -0
- swarmauri_core/measurements/__init__.py +0 -0
- swarmauri_core/messages/IMessage.py +11 -0
- swarmauri_core/messages/__init__.py +1 -0
- swarmauri_core/metrics/IMetric.py +178 -0
- swarmauri_core/metrics/__init__.py +0 -0
- swarmauri_core/middlewares/IMiddleware.py +61 -0
- swarmauri_core/middlewares/__init__.py +0 -0
- swarmauri_core/mre_crypto/IMreCrypto.py +191 -0
- swarmauri_core/mre_crypto/__init__.py +19 -0
- swarmauri_core/mre_crypto/types.py +50 -0
- swarmauri_core/norms/INorm.py +158 -0
- swarmauri_core/norms/IUseInnerProduct.py +122 -0
- swarmauri_core/norms/__init__.py +0 -0
- swarmauri_core/ocrs/IPredict.py +50 -0
- swarmauri_core/ocrs/__init__.py +0 -0
- swarmauri_core/parsers/IParser.py +24 -0
- swarmauri_core/parsers/__init__.py +0 -0
- swarmauri_core/pipelines/IPipeline.py +57 -0
- swarmauri_core/pipelines/__init__.py +0 -0
- swarmauri_core/pop/__init__.py +31 -0
- swarmauri_core/pop/ipop.py +76 -0
- swarmauri_core/pop/isigner.py +29 -0
- swarmauri_core/pop/types.py +48 -0
- swarmauri_core/programs/IProgram.py +68 -0
- swarmauri_core/programs/__init__.py +0 -0
- swarmauri_core/prompt_templates/IPromptTemplate.py +55 -0
- swarmauri_core/prompt_templates/__init__.py +0 -0
- swarmauri_core/prompts/IPrompt.py +19 -0
- swarmauri_core/prompts/IPromptMatrix.py +30 -0
- swarmauri_core/prompts/ITemplate.py +47 -0
- swarmauri_core/prompts/__init__.py +0 -0
- swarmauri_core/pseudometrics/IPseudometric.py +194 -0
- swarmauri_core/pseudometrics/__init__.py +0 -0
- swarmauri_core/publishers/IPublish.py +11 -0
- swarmauri_core/publishers/__init__.py +0 -0
- swarmauri_core/rate_limits/IRateLimit.py +17 -0
- swarmauri_core/rate_limits/__init__.py +0 -0
- swarmauri_core/schema_converters/ISchemaConvert.py +9 -0
- swarmauri_core/schema_converters/__init__.py +0 -0
- swarmauri_core/seminorms/ISeminorm.py +111 -0
- swarmauri_core/seminorms/__init__.py +0 -0
- swarmauri_core/service_registries/IServiceRegistry.py +43 -0
- swarmauri_core/service_registries/__init__.py +0 -0
- swarmauri_core/signing/ISigning.py +238 -0
- swarmauri_core/signing/__init__.py +6 -0
- swarmauri_core/signing/intent.py +40 -0
- swarmauri_core/signing/types.py +68 -0
- swarmauri_core/similarities/ISimilarity.py +228 -0
- swarmauri_core/similarities/__init__.py +0 -0
- swarmauri_core/sst/IPredict.py +49 -0
- swarmauri_core/sst/__init__.py +0 -0
- swarmauri_core/state/IState.py +28 -0
- swarmauri_core/state/__init__.py +0 -0
- swarmauri_core/storage/IStorageAdapter.py +106 -0
- swarmauri_core/storage/__init__.py +3 -0
- swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +73 -0
- swarmauri_core/swarm_apis/ISwarmAPI.py +25 -0
- swarmauri_core/swarm_apis/__init__.py +0 -0
- swarmauri_core/swarms/ISwarm.py +32 -0
- swarmauri_core/swarms/__init__.py +0 -0
- swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +43 -0
- swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
- swarmauri_core/tensors/ITensor.py +400 -0
- swarmauri_core/tensors/__init__.py +0 -0
- swarmauri_core/tokens/ITokenService.py +49 -0
- swarmauri_core/tokens/__init__.py +5 -0
- swarmauri_core/tool_llms/IToolPredict.py +71 -0
- swarmauri_core/tool_llms/__init__.py +0 -0
- swarmauri_core/toolkits/IToolkit.py +46 -0
- swarmauri_core/toolkits/__init__.py +0 -0
- swarmauri_core/tools/IParameter.py +9 -0
- swarmauri_core/tools/ITool.py +16 -0
- swarmauri_core/tools/__init__.py +0 -0
- swarmauri_core/tracing/IChainTracer.py +28 -0
- swarmauri_core/tracing/ITraceContext.py +30 -0
- swarmauri_core/tracing/ITracer.py +47 -0
- swarmauri_core/tracing/__init__.py +0 -0
- swarmauri_core/transports/ITransport.py +43 -0
- swarmauri_core/transports/__init__.py +38 -0
- swarmauri_core/transports/capabilities.py +20 -0
- swarmauri_core/transports/enums.py +74 -0
- swarmauri_core/transports/i_anycast.py +16 -0
- swarmauri_core/transports/i_appserver.py +27 -0
- swarmauri_core/transports/i_broadcast.py +14 -0
- swarmauri_core/transports/i_http_client.py +21 -0
- swarmauri_core/transports/i_multicast.py +16 -0
- swarmauri_core/transports/i_multiplex.py +33 -0
- swarmauri_core/transports/i_peer.py +14 -0
- swarmauri_core/transports/i_runnable.py +38 -0
- swarmauri_core/transports/i_unicast.py +20 -0
- swarmauri_core/tts/IPredict.py +49 -0
- swarmauri_core/tts/__init__.py +0 -0
- swarmauri_core/utils/ITransactional.py +24 -0
- swarmauri_core/utils/__init__.py +0 -0
- swarmauri_core/vector_stores/ICloudVectorStore.py +21 -0
- swarmauri_core/vector_stores/IPersistentVectorStore.py +21 -0
- swarmauri_core/vector_stores/ISimilarity.py +25 -0
- swarmauri_core/vector_stores/IVectorNorm.py +50 -0
- swarmauri_core/vector_stores/IVectorStore.py +87 -0
- swarmauri_core/vector_stores/IVectorStoreRetrieve.py +26 -0
- swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +46 -0
- swarmauri_core/vector_stores/__init__.py +0 -0
- swarmauri_core/vectors/IVector.py +11 -0
- swarmauri_core/vectors/IVectorMeta.py +28 -0
- swarmauri_core/vectors/IVectorProduct.py +73 -0
- swarmauri_core/vectors/IVectorTransform.py +50 -0
- swarmauri_core/vectors/__init__.py +0 -0
- swarmauri_core/vlms/IPredictVision.py +35 -0
- swarmauri_core/vlms/__init__.py +0 -0
- swarmauri_core/xmp/IEmbedXMP.py +26 -0
- swarmauri_core/xmp/__init__.py +5 -0
- swarmauri_core-0.9.2.dev9.dist-info/METADATA +195 -0
- swarmauri_core-0.9.2.dev9.dist-info/RECORD +226 -0
- swarmauri_core-0.9.2.dev9.dist-info/WHEEL +4 -0
- swarmauri_core-0.9.2.dev9.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
__version__ = "0.5.1.dev8"
|
|
2
|
+
__long_desc__ = """
|
|
3
|
+
# Swarmauri Core
|
|
4
|
+
|
|
5
|
+
## Core
|
|
6
|
+
- **Core Interfaces**: Define the fundamental communication and data-sharing protocols between components in a Swarmauri-based system.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Visit us at: https://swarmauri.com
|
|
10
|
+
Follow us at: https://github.com/swarmauri
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
"""
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any, List
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IAgentCommands(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for the API object that enables a SwarmAgent to host various API routes.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def invoke(self, request: Any) -> Any:
|
|
12
|
+
"""
|
|
13
|
+
Handles invocation requests synchronously.
|
|
14
|
+
|
|
15
|
+
Parameters:
|
|
16
|
+
request (Any): The incoming request payload.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
Any: The response payload.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
@abstractmethod
|
|
24
|
+
async def ainvoke(self, request: Any) -> Any:
|
|
25
|
+
"""
|
|
26
|
+
Handles invocation requests asynchronously.
|
|
27
|
+
|
|
28
|
+
Parameters:
|
|
29
|
+
request (Any): The incoming request payload.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
Any: The response payload.
|
|
33
|
+
"""
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
@abstractmethod
|
|
37
|
+
def batch(self, requests: List[Any]) -> List[Any]:
|
|
38
|
+
"""
|
|
39
|
+
Handles batched invocation requests synchronously.
|
|
40
|
+
|
|
41
|
+
Parameters:
|
|
42
|
+
requests (List[Any]): A list of incoming request payloads.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
List[Any]: A list of responses.
|
|
46
|
+
"""
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
@abstractmethod
|
|
50
|
+
async def abatch(self, requests: List[Any]) -> List[Any]:
|
|
51
|
+
"""
|
|
52
|
+
Handles batched invocation requests asynchronously.
|
|
53
|
+
|
|
54
|
+
Parameters:
|
|
55
|
+
requests (List[Any]): A list of incoming request payloads.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
List[Any]: A list of responses.
|
|
59
|
+
"""
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
@abstractmethod
|
|
63
|
+
def stream(self, request: Any) -> Any:
|
|
64
|
+
"""
|
|
65
|
+
Handles streaming requests.
|
|
66
|
+
|
|
67
|
+
Parameters:
|
|
68
|
+
request (Any): The incoming request payload.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Any: A streaming response.
|
|
72
|
+
"""
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
@abstractmethod
|
|
76
|
+
def get_schema_config(self) -> dict:
|
|
77
|
+
"""
|
|
78
|
+
Retrieves the schema configuration for the API.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
dict: The schema configuration.
|
|
82
|
+
"""
|
|
83
|
+
pass
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Callable, Any, Dict
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IAgentRouterCRUD(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for managing API routes within a SwarmAgent.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
def create_route(
|
|
12
|
+
self, path: str, method: str, handler: Callable[[Any], Any]
|
|
13
|
+
) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Create a new route for the API.
|
|
16
|
+
|
|
17
|
+
Parameters:
|
|
18
|
+
- path (str): The URL path for the route.
|
|
19
|
+
- method (str): The HTTP method (e.g., 'GET', 'POST').
|
|
20
|
+
- handler (Callable[[Any], Any]): The function that handles requests to this route.
|
|
21
|
+
"""
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def read_route(self, path: str, method: str) -> Dict:
|
|
26
|
+
"""
|
|
27
|
+
Retrieve information about a specific route.
|
|
28
|
+
|
|
29
|
+
Parameters:
|
|
30
|
+
- path (str): The URL path for the route.
|
|
31
|
+
- method (str): The HTTP method.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
- Dict: Information about the route, including path, method, and handler.
|
|
35
|
+
"""
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
@abstractmethod
|
|
39
|
+
def update_route(
|
|
40
|
+
self, path: str, method: str, new_handler: Callable[[Any], Any]
|
|
41
|
+
) -> None:
|
|
42
|
+
"""
|
|
43
|
+
Update the handler function for an existing route.
|
|
44
|
+
|
|
45
|
+
Parameters:
|
|
46
|
+
- path (str): The URL path for the route.
|
|
47
|
+
- method (str): The HTTP method.
|
|
48
|
+
- new_handler (Callable[[Any], Any]): The new function that handles requests to this route.
|
|
49
|
+
"""
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
@abstractmethod
|
|
53
|
+
def delete_route(self, path: str, method: str) -> None:
|
|
54
|
+
"""
|
|
55
|
+
Delete a specific route from the API.
|
|
56
|
+
|
|
57
|
+
Parameters:
|
|
58
|
+
- path (str): The URL path for the route.
|
|
59
|
+
- method (str): The HTTP method.
|
|
60
|
+
"""
|
|
61
|
+
pass
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any, Dict
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IExportConf(ABC):
|
|
6
|
+
"""
|
|
7
|
+
Interface for exporting configurations related to agent factories.
|
|
8
|
+
|
|
9
|
+
Implementing classes are expected to provide functionality for representing
|
|
10
|
+
the factory's configuration as a dictionary, JSON string, or exporting to a file.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
15
|
+
"""
|
|
16
|
+
Serializes the agent factory's configuration to a dictionary.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
Dict[str, Any]: A dictionary representation of the factory's configuration.
|
|
20
|
+
"""
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
@abstractmethod
|
|
24
|
+
def to_json(self) -> str:
|
|
25
|
+
"""
|
|
26
|
+
Serializes the agent factory's configuration to a JSON string.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
str: A JSON string representation of the factory's configuration.
|
|
30
|
+
"""
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
@abstractmethod
|
|
34
|
+
def to_file(self, file_path: str) -> None:
|
|
35
|
+
"""
|
|
36
|
+
Exports the agent factory's configuration to a file in a suitable format.
|
|
37
|
+
|
|
38
|
+
Parameters:
|
|
39
|
+
file_path (str): The path to the file where the configuration should be saved.
|
|
40
|
+
"""
|
|
41
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from typing import Any, Optional, Dict, List, Union
|
|
3
|
+
from swarmauri_core.messages.IMessage import IMessage
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class IAgent(ABC):
|
|
7
|
+
@abstractmethod
|
|
8
|
+
def exec(self, input_data: Optional[Any], llm_kwargs: Optional[Dict]) -> Any:
|
|
9
|
+
"""
|
|
10
|
+
Executive method that triggers the agent's action based on the input data.
|
|
11
|
+
"""
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
async def aexec(
|
|
16
|
+
self,
|
|
17
|
+
input_str: Optional[Union[str, IMessage]] = "",
|
|
18
|
+
llm_kwargs: Optional[Dict] = None,
|
|
19
|
+
) -> Any:
|
|
20
|
+
"""
|
|
21
|
+
Async executive method that triggers the agent's action based on the input data.
|
|
22
|
+
"""
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def batch(
|
|
27
|
+
self,
|
|
28
|
+
inputs: List[Union[str, IMessage]],
|
|
29
|
+
llm_kwargs: Optional[Dict] = None,
|
|
30
|
+
) -> List[Any]:
|
|
31
|
+
"""
|
|
32
|
+
Default batch implementation: calls `exec` on each input in `inputs`.
|
|
33
|
+
Subclasses can override for optimized bulk behavior.
|
|
34
|
+
"""
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
@abstractmethod
|
|
38
|
+
async def abatch(
|
|
39
|
+
self,
|
|
40
|
+
inputs: List[Union[str, IMessage]],
|
|
41
|
+
llm_kwargs: Optional[Dict] = None,
|
|
42
|
+
) -> List[Any]:
|
|
43
|
+
"""
|
|
44
|
+
Default async batch implementation: concurrently calls `aexec` on all inputs.
|
|
45
|
+
Subclasses can override for more efficient implementations.
|
|
46
|
+
"""
|
|
47
|
+
pass
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from swarmauri_core.parsers.IParser import IParser
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IAgentParser(ABC):
|
|
6
|
+
@property
|
|
7
|
+
@abstractmethod
|
|
8
|
+
def parser(self) -> IParser:
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
@parser.setter
|
|
12
|
+
@abstractmethod
|
|
13
|
+
def parser(self) -> IParser:
|
|
14
|
+
pass
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOAuth20AppClient(ABC):
|
|
8
|
+
"""Contract for OAuth 2.0 machine-to-machine token flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def access_token(self, scope: Optional[str] = None) -> str:
|
|
12
|
+
"""Return a bearer token constrained to the optional scope."""
|
|
13
|
+
...
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Any, Mapping
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOAuth20Login(ABC):
|
|
8
|
+
"""Contract for OAuth 2.0 user login flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def auth_url(self) -> Mapping[str, str]:
|
|
12
|
+
"""Return the authorization URL payload for initiating login."""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
async def exchange_and_identity(self, code: str, state: str) -> Mapping[str, Any]:
|
|
17
|
+
"""Exchange the authorization code and return normalized identity claims."""
|
|
18
|
+
...
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOAuth21AppClient(ABC):
|
|
8
|
+
"""Contract for OAuth 2.1 machine-to-machine token flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def access_token(self, scope: Optional[str] = None) -> str:
|
|
12
|
+
"""Return a bearer token constrained to the optional scope."""
|
|
13
|
+
...
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Any, Mapping
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOAuth21Login(ABC):
|
|
8
|
+
"""Contract for OAuth 2.1 user login flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def auth_url(self) -> Mapping[str, str]:
|
|
12
|
+
"""Return the authorization URL payload for initiating login."""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
async def exchange_and_identity(self, code: str, state: str) -> Mapping[str, Any]:
|
|
17
|
+
"""Exchange the authorization code and return normalized identity claims."""
|
|
18
|
+
...
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOIDC10AppClient(ABC):
|
|
8
|
+
"""Contract for OIDC 1.0 machine-to-machine token flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def access_token(self, scope: Optional[str] = None) -> str:
|
|
12
|
+
"""Return a bearer token constrained to the optional scope."""
|
|
13
|
+
...
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Any, Mapping
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IOIDC10Login(ABC):
|
|
8
|
+
"""Contract for OpenID Connect 1.0 user login flows."""
|
|
9
|
+
|
|
10
|
+
@abstractmethod
|
|
11
|
+
async def auth_url(self) -> Mapping[str, str]:
|
|
12
|
+
"""Return the authorization URL payload for initiating login."""
|
|
13
|
+
...
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
async def exchange(self, code: str, state: str) -> Mapping[str, Any]:
|
|
17
|
+
"""Exchange the authorization code and return normalized identity claims."""
|
|
18
|
+
...
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .IOAuth20AppClient import IOAuth20AppClient
|
|
2
|
+
from .IOAuth20Login import IOAuth20Login
|
|
3
|
+
from .IOAuth21AppClient import IOAuth21AppClient
|
|
4
|
+
from .IOAuth21Login import IOAuth21Login
|
|
5
|
+
from .IOIDC10AppClient import IOIDC10AppClient
|
|
6
|
+
from .IOIDC10Login import IOIDC10Login
|
|
7
|
+
|
|
8
|
+
__all__ = (
|
|
9
|
+
"IOAuth20AppClient",
|
|
10
|
+
"IOAuth20Login",
|
|
11
|
+
"IOAuth21AppClient",
|
|
12
|
+
"IOAuth21Login",
|
|
13
|
+
"IOIDC10AppClient",
|
|
14
|
+
"IOIDC10Login",
|
|
15
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Balance transfer interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
from .protos import BalanceRefProto, TransferReqProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IBalanceTransfers(ABC):
|
|
12
|
+
"""Operations for balance retrieval and transfers."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def get_balance(self) -> BalanceRefProto:
|
|
16
|
+
"""Retrieve the provider balance."""
|
|
17
|
+
|
|
18
|
+
@abstractmethod
|
|
19
|
+
def create_transfer(
|
|
20
|
+
self, req: TransferReqProto, *, idempotency_key: str
|
|
21
|
+
) -> Mapping[str, Any]:
|
|
22
|
+
"""Create a balance transfer."""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Billing provider metadata interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Sequence, Tuple, Type
|
|
7
|
+
|
|
8
|
+
from .enums import Capability
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IBillingProvider(ABC):
|
|
12
|
+
"""Shared interface for all billing providers."""
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def capabilities(self) -> Sequence[Capability]:
|
|
17
|
+
"""Return provider capabilities as capability identifiers."""
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def api_strategies(self) -> Tuple[Type[Any], ...]:
|
|
22
|
+
"""Return strategy interfaces supported by the provider."""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Customer management interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
from .protos import CustomerRefProto, CustomerSpecProto, PaymentMethodRefProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ICustomers(ABC):
|
|
12
|
+
"""Operations for managing customers."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_customer(
|
|
16
|
+
self, spec: CustomerSpecProto, *, idempotency_key: str
|
|
17
|
+
) -> CustomerRefProto:
|
|
18
|
+
"""Create a customer profile."""
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def get_customer(self, customer_id: str) -> CustomerRefProto:
|
|
22
|
+
"""Retrieve a customer profile."""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def attach_payment_method_to_customer(
|
|
26
|
+
self, customer: CustomerRefProto, pm: PaymentMethodRefProto
|
|
27
|
+
) -> Mapping[str, Any]:
|
|
28
|
+
"""Attach a payment method to a customer."""
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Hosted checkout interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
|
|
7
|
+
from .protos import CheckoutIntentProto, CheckoutReqProto, PriceRefProto
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class IHostedCheckout(ABC):
|
|
11
|
+
"""Operations for hosted checkout flows."""
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def create_checkout(
|
|
15
|
+
self, price: PriceRefProto, request: CheckoutReqProto
|
|
16
|
+
) -> CheckoutIntentProto:
|
|
17
|
+
"""Create a hosted checkout intent for the supplied price."""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Invoicing interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
from .protos import InvoiceSpecProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IInvoicing(ABC):
|
|
12
|
+
"""Operations for managing invoices."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_invoice(
|
|
16
|
+
self, spec: InvoiceSpecProto, *, idempotency_key: str
|
|
17
|
+
) -> Mapping[str, Any]:
|
|
18
|
+
"""Create an invoice."""
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def finalize_invoice(self, invoice_id: str) -> Mapping[str, Any]:
|
|
22
|
+
"""Finalize an invoice for payment."""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def void_invoice(self, invoice_id: str) -> Mapping[str, Any]:
|
|
26
|
+
"""Void an invoice."""
|
|
27
|
+
|
|
28
|
+
@abstractmethod
|
|
29
|
+
def mark_uncollectible(self, invoice_id: str) -> Mapping[str, Any]:
|
|
30
|
+
"""Mark an invoice as uncollectible."""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Marketplace and split interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
from .protos import SplitSpecProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IMarketplace(ABC):
|
|
12
|
+
"""Operations for marketplace splits and charges."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_split(
|
|
16
|
+
self, spec: SplitSpecProto, *, idempotency_key: str
|
|
17
|
+
) -> Mapping[str, Any]:
|
|
18
|
+
"""Create a split configuration."""
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def charge_with_split(
|
|
22
|
+
self,
|
|
23
|
+
amount_minor: int,
|
|
24
|
+
currency: str,
|
|
25
|
+
*,
|
|
26
|
+
split_code_or_params: Mapping[str, Any],
|
|
27
|
+
idempotency_key: str,
|
|
28
|
+
) -> Mapping[str, Any]:
|
|
29
|
+
"""Charge an amount while applying a split configuration."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Online payments (payment intent) interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Optional
|
|
7
|
+
|
|
8
|
+
from .protos import PaymentIntentReqProto, PaymentRefProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IOnlinePayments(ABC):
|
|
12
|
+
"""Operations for managing payment intents."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_payment_intent(self, req: PaymentIntentReqProto) -> PaymentRefProto:
|
|
16
|
+
"""Create a payment intent."""
|
|
17
|
+
|
|
18
|
+
@abstractmethod
|
|
19
|
+
def capture_payment(
|
|
20
|
+
self, payment_id: str, *, idempotency_key: Optional[str] = None
|
|
21
|
+
) -> PaymentRefProto:
|
|
22
|
+
"""Capture a payment intent."""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def cancel_payment(
|
|
26
|
+
self,
|
|
27
|
+
payment_id: str,
|
|
28
|
+
*,
|
|
29
|
+
reason: Optional[str] = None,
|
|
30
|
+
idempotency_key: Optional[str] = None,
|
|
31
|
+
) -> PaymentRefProto:
|
|
32
|
+
"""Cancel a payment intent."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Payment method interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping, Optional, Sequence
|
|
7
|
+
|
|
8
|
+
from .protos import CustomerRefProto, PaymentMethodRefProto, PaymentMethodSpecProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IPaymentMethods(ABC):
|
|
12
|
+
"""Operations for managing payment methods."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_payment_method(
|
|
16
|
+
self, spec: PaymentMethodSpecProto, *, idempotency_key: str
|
|
17
|
+
) -> PaymentMethodRefProto:
|
|
18
|
+
"""Create a payment method."""
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
def detach_payment_method(self, payment_method_id: str) -> Mapping[str, Any]:
|
|
22
|
+
"""Detach a payment method."""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def list_payment_methods(
|
|
26
|
+
self,
|
|
27
|
+
customer: CustomerRefProto,
|
|
28
|
+
*,
|
|
29
|
+
type: Optional[str] = None,
|
|
30
|
+
limit: int = 10,
|
|
31
|
+
) -> Sequence[PaymentMethodRefProto]:
|
|
32
|
+
"""List payment methods for a customer."""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Payout interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from abc import ABC, abstractmethod
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
from .protos import PayoutReqProto
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class IPayouts(ABC):
|
|
12
|
+
"""Operations for creating payouts."""
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def create_payout(
|
|
16
|
+
self, req: PayoutReqProto, *, idempotency_key: str
|
|
17
|
+
) -> Mapping[str, Any]:
|
|
18
|
+
"""Create a payout."""
|