swarmauri_tool_captchagenerator 0.6.0.dev154__tar.gz

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.
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.3
2
+ Name: swarmauri_tool_captchagenerator
3
+ Version: 0.6.0.dev154
4
+ Summary: Swarmauri Community Captcha Generator Tool
5
+ License: Apache-2.0
6
+ Author: Jacob Stewart
7
+ Author-email: jacob@swarmauri.com
8
+ Requires-Python: >=3.10,<3.13
9
+ Classifier: License :: OSI Approved :: Apache Software License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: captcha (>=0.6.0,<0.7.0)
15
+ Requires-Dist: swarmauri_base (>=0.6.0.dev154,<0.7.0)
16
+ Requires-Dist: swarmauri_core (>=0.6.0.dev154,<0.7.0)
17
+ Project-URL: Repository, http://github.com/swarmauri/swarmauri-sdk
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Swarmauri Example Community Package
@@ -0,0 +1 @@
1
+ # Swarmauri Example Community Package
@@ -0,0 +1,57 @@
1
+ [tool.poetry]
2
+ name = "swarmauri_tool_captchagenerator"
3
+ version = "0.6.0.dev154"
4
+ description = "Swarmauri Community Captcha Generator Tool"
5
+ authors = ["Jacob Stewart <jacob@swarmauri.com>"]
6
+ license = "Apache-2.0"
7
+ readme = "README.md"
8
+ repository = "http://github.com/swarmauri/swarmauri-sdk"
9
+ classifiers = [
10
+ "License :: OSI Approved :: Apache Software License",
11
+ "Programming Language :: Python :: 3.10",
12
+ "Programming Language :: Python :: 3.11",
13
+ "Programming Language :: Python :: 3.12"
14
+ ]
15
+
16
+ [tool.poetry.dependencies]
17
+ python = ">=3.10,<3.13"
18
+
19
+ # Swarmauri
20
+ swarmauri_core = {version = "^0.6.0.dev154"}
21
+ swarmauri_base = {version = "^0.6.0.dev154"}
22
+
23
+ # dependencies
24
+ captcha = "^0.6.0"
25
+
26
+
27
+ [tool.poetry.group.dev.dependencies]
28
+ flake8 = "^7.0"
29
+ pytest = "^8.0"
30
+ pytest-asyncio = ">=0.24.0"
31
+ pytest-xdist = "^3.6.1"
32
+ pytest-json-report = "^1.5.0"
33
+ python-dotenv = "*"
34
+ requests = "^2.32.3"
35
+
36
+ [build-system]
37
+ requires = ["poetry-core>=1.0.0"]
38
+ build-backend = "poetry.core.masonry.api"
39
+
40
+ [tool.pytest.ini_options]
41
+ norecursedirs = ["combined", "scripts"]
42
+
43
+ markers = [
44
+ "test: standard test",
45
+ "unit: Unit tests",
46
+ "integration: Integration tests",
47
+ "acceptance: Acceptance tests",
48
+ "experimental: Experimental tests"
49
+ ]
50
+ log_cli = true
51
+ log_cli_level = "INFO"
52
+ log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
53
+ log_cli_date_format = "%Y-%m-%d %H:%M:%S"
54
+ asyncio_default_fixture_loop_scope = "function"
55
+
56
+ [tool.poetry.plugins."swarmauri.tools"]
57
+ CaptchaGeneratorTool = "swarmauri_tool_captchagenerator.CaptchaGeneratorTool:CaptchaGeneratorTool"
@@ -0,0 +1,44 @@
1
+ # standard/tools/concrete/CaptchaGeneratorTool.py
2
+ import base64
3
+ from typing import List, Literal, Dict
4
+ from captcha.image import ImageCaptcha
5
+ from swarmauri_core.ComponentBase import ComponentBase
6
+ from pydantic import Field
7
+ from swarmauri_base.tools.ToolBase import ToolBase
8
+ from swarmauri_standard.tools.Parameter import Parameter
9
+
10
+
11
+ @ComponentBase.register_type(ToolBase, "CaptchaGeneratorTool")
12
+ class CaptchaGeneratorTool(ToolBase):
13
+ type: Literal["CaptchaGeneratorTool"] = "CaptchaGeneratorTool"
14
+ name: str = Field(
15
+ "CaptchaGeneratorTool", description="Tool to generate CAPTCHA images."
16
+ )
17
+ description: str = Field(
18
+ "This tool generates CAPTCHA images from input text and saves them to a specified file.",
19
+ description="Description of the CaptchaGeneratorTool",
20
+ )
21
+
22
+ parameters: List[Parameter] = Field(
23
+ default_factory=lambda: [
24
+ Parameter(
25
+ name="text",
26
+ type="string",
27
+ description="The text to encode in the CAPTCHA.",
28
+ required=True,
29
+ ),
30
+ ]
31
+ )
32
+
33
+ def __call__(self, text: str) -> Dict[str, str]:
34
+ # Generate CAPTCHA
35
+ image = ImageCaptcha()
36
+ data = image.generate(text)
37
+
38
+ # Encode image to base64
39
+ image_b64 = base64.b64encode(data.getvalue()).decode()
40
+
41
+ # Create dictionary with encoded image
42
+ result = {"image_b64": image_b64}
43
+
44
+ return result
@@ -0,0 +1,12 @@
1
+ from .CaptchaGeneratorTool import CaptchaGeneratorTool
2
+
3
+ __version__ = "0.6.0.dev26"
4
+ __long_desc__ = """
5
+
6
+ # Swarmauri CaptchaGenerator Tool Plugin
7
+
8
+ Visit us at: https://swarmauri.com
9
+ Follow us at: https://github.com/swarmauri
10
+ Star us at: https://github.com/swarmauri/swarmauri-sdk
11
+
12
+ """