parent
99fb4b17f6
commit
3013b2fc69
@ -1,10 +0,0 @@
|
|||||||
from swarms.marketplace.add_all_swarms import autoswarm, router
|
|
||||||
from swarms.marketplace.agricultural_optimization import (
|
|
||||||
AgricultureOptimizationSwarm,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"autoswarm",
|
|
||||||
"router",
|
|
||||||
"AgricultureOptimizationSwarm",
|
|
||||||
]
|
|
@ -1,58 +0,0 @@
|
|||||||
import os
|
|
||||||
import importlib.util
|
|
||||||
from typing import List, Type
|
|
||||||
from swarms import AutoSwarm, AutoSwarmRouter, BaseSwarm
|
|
||||||
|
|
||||||
|
|
||||||
def find_base_swarm_classes(
|
|
||||||
folder_path: str = "prebuilt",
|
|
||||||
) -> List[Type[BaseSwarm]]:
|
|
||||||
"""
|
|
||||||
Find and return a list of all classes that inherit from the BaseSwarm class
|
|
||||||
within the specified folder path.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
folder_path (str): The path to the folder containing the swarm classes.
|
|
||||||
Defaults to "prebuilt".
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List[Type[BaseSwarm]]: A list of all classes that inherit from the BaseSwarm class.
|
|
||||||
"""
|
|
||||||
base_swarm_classes: List[Type[BaseSwarm]] = []
|
|
||||||
|
|
||||||
for root, _, files in os.walk(folder_path):
|
|
||||||
for file in files:
|
|
||||||
if file == "__init__.py":
|
|
||||||
module_path: str = os.path.join(root, file)
|
|
||||||
spec = importlib.util.spec_from_file_location(
|
|
||||||
"module.name", module_path
|
|
||||||
)
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
|
||||||
spec.loader.exec_module(module)
|
|
||||||
|
|
||||||
for name, obj in module.__dict__.items():
|
|
||||||
if (
|
|
||||||
isinstance(obj, type)
|
|
||||||
and issubclass(obj, BaseSwarm)
|
|
||||||
and obj is not BaseSwarm
|
|
||||||
):
|
|
||||||
base_swarm_classes.append(obj)
|
|
||||||
|
|
||||||
return base_swarm_classes
|
|
||||||
|
|
||||||
|
|
||||||
# Define the folder containing the prebuilt swarms
|
|
||||||
prebuilt_folder: str = "prebuilt"
|
|
||||||
|
|
||||||
# Find all BaseSwarm classes in the prebuilt folder
|
|
||||||
prebuilt_swarms: List[Type[BaseSwarm]] = find_base_swarm_classes(
|
|
||||||
prebuilt_folder
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add all swarms to the AutoSwarmRouter
|
|
||||||
router: AutoSwarmRouter = AutoSwarmRouter(swarms=prebuilt_swarms)
|
|
||||||
|
|
||||||
# Create an AutoSwarm instance
|
|
||||||
autoswarm: AutoSwarm = AutoSwarm(
|
|
||||||
router=router,
|
|
||||||
)
|
|
@ -1,16 +0,0 @@
|
|||||||
import requests
|
|
||||||
|
|
||||||
url = "https://linkedin-api8.p.rapidapi.com/linkedin-to-email"
|
|
||||||
|
|
||||||
querystring = {
|
|
||||||
"url": "https://www.linkedin.com/in/nicolas-nahas-3ba227170/"
|
|
||||||
}
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"x-rapidapi-key": "8c6cd073d2msh9fc7d37c26ce73bp1dea6ajsn81819935da85",
|
|
||||||
"x-rapidapi-host": "linkedin-api8.p.rapidapi.com",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = requests.get(url, headers=headers, params=querystring)
|
|
||||||
|
|
||||||
print(response.json())
|
|
Loading…
Reference in new issue