-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Apr 2, 2024
1 parent
71f6aae
commit 8a656f9
Showing
7 changed files
with
207 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "swarms" | ||
version = "4.7.3" | ||
version = "4.7.4" | ||
description = "Swarms - Pytorch" | ||
license = "MIT" | ||
authors = ["Kye Gomez <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import inspect | ||
|
||
def process_tool_docs(item): | ||
""" | ||
Process the documentation for a given item. | ||
Args: | ||
item: The item to process the documentation for. | ||
Returns: | ||
metadata: The processed metadata containing the item's name, documentation, and source code. | ||
""" | ||
# If item is an instance of a class, get its class | ||
if not inspect.isclass(item) and hasattr(item, '__class__'): | ||
item = item.__class__ | ||
|
||
doc = inspect.getdoc(item) | ||
source = inspect.getsource(item) | ||
is_class = inspect.isclass(item) | ||
item_type = "Class Name" if is_class else "Function Name" | ||
metadata = f"{item_type}: {item.__name__}\n\n" | ||
if doc: | ||
metadata += f"Documentation:\n{doc}\n\n" | ||
metadata += f"\n{source}" | ||
return metadata |