camel-ai 0.2.71a2__py3-none-any.whl → 0.2.71a4__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.
Potentially problematic release.
This version of camel-ai might be problematic. Click here for more details.
- camel/__init__.py +1 -1
- camel/agents/_types.py +6 -2
- camel/agents/chat_agent.py +297 -16
- camel/interpreters/docker_interpreter.py +3 -2
- camel/loaders/base_loader.py +85 -0
- camel/messages/base.py +2 -6
- camel/services/agent_openapi_server.py +380 -0
- camel/societies/workforce/workforce.py +144 -33
- camel/toolkits/__init__.py +7 -4
- camel/toolkits/craw4ai_toolkit.py +2 -2
- camel/toolkits/file_write_toolkit.py +6 -6
- camel/toolkits/{non_visual_browser_toolkit → hybrid_browser_toolkit}/__init__.py +2 -2
- camel/toolkits/{non_visual_browser_toolkit → hybrid_browser_toolkit}/actions.py +47 -11
- camel/toolkits/{non_visual_browser_toolkit → hybrid_browser_toolkit}/agent.py +21 -11
- camel/toolkits/{non_visual_browser_toolkit/nv_browser_session.py → hybrid_browser_toolkit/browser_session.py} +64 -10
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +1008 -0
- camel/toolkits/{non_visual_browser_toolkit → hybrid_browser_toolkit}/snapshot.py +16 -4
- camel/toolkits/{non_visual_browser_toolkit/snapshot.js → hybrid_browser_toolkit/unified_analyzer.js} +202 -23
- camel/toolkits/note_taking_toolkit.py +90 -0
- camel/toolkits/openai_image_toolkit.py +292 -0
- camel/toolkits/slack_toolkit.py +4 -4
- camel/toolkits/terminal_toolkit.py +223 -73
- camel/types/agents/tool_calling_record.py +4 -1
- camel/types/enums.py +24 -24
- camel/utils/mcp_client.py +37 -1
- camel/utils/tool_result.py +44 -0
- {camel_ai-0.2.71a2.dist-info → camel_ai-0.2.71a4.dist-info}/METADATA +58 -5
- {camel_ai-0.2.71a2.dist-info → camel_ai-0.2.71a4.dist-info}/RECORD +30 -26
- camel/toolkits/dalle_toolkit.py +0 -175
- camel/toolkits/non_visual_browser_toolkit/browser_non_visual_toolkit.py +0 -446
- {camel_ai-0.2.71a2.dist-info → camel_ai-0.2.71a4.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.71a2.dist-info → camel_ai-0.2.71a4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: camel-ai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.71a4
|
|
4
4
|
Summary: Communicative Agents for AI Society Study
|
|
5
5
|
Project-URL: Homepage, https://www.camel-ai.org/
|
|
6
6
|
Project-URL: Repository, https://github.com/camel-ai/camel
|
|
@@ -15,7 +15,7 @@ Requires-Dist: docstring-parser<0.16,>=0.15
|
|
|
15
15
|
Requires-Dist: httpx<1.0.0dev,>=0.28.0
|
|
16
16
|
Requires-Dist: jsonschema<5,>=4
|
|
17
17
|
Requires-Dist: mcp>=1.3.0
|
|
18
|
-
Requires-Dist: openai<2,>=1.
|
|
18
|
+
Requires-Dist: openai<2,>=1.86.0
|
|
19
19
|
Requires-Dist: pillow<11.0.0,>=10.1.0
|
|
20
20
|
Requires-Dist: psutil<6,>=5.9.8
|
|
21
21
|
Requires-Dist: pydantic>=2.10.6
|
|
@@ -34,12 +34,12 @@ Requires-Dist: botocore<2,>=1.35.3; extra == 'all'
|
|
|
34
34
|
Requires-Dist: chromadb<1.0.0,>=0.6.0; extra == 'all'
|
|
35
35
|
Requires-Dist: chunkr-ai>=0.0.50; extra == 'all'
|
|
36
36
|
Requires-Dist: cohere<6,>=5.11.0; extra == 'all'
|
|
37
|
-
Requires-Dist: crawl4ai>=0.
|
|
37
|
+
Requires-Dist: crawl4ai>=0.4.0; extra == 'all'
|
|
38
38
|
Requires-Dist: dappier<0.4,>=0.3.3; extra == 'all'
|
|
39
39
|
Requires-Dist: datacommons-pandas<0.0.4,>=0.0.3; extra == 'all'
|
|
40
40
|
Requires-Dist: datacommons<2,>=1.4.3; extra == 'all'
|
|
41
41
|
Requires-Dist: datasets<4,>=3; extra == 'all'
|
|
42
|
-
Requires-Dist: daytona-sdk
|
|
42
|
+
Requires-Dist: daytona-sdk==0.20.0; extra == 'all'
|
|
43
43
|
Requires-Dist: diffusers<0.26,>=0.25.0; extra == 'all'
|
|
44
44
|
Requires-Dist: discord-py<3,>=2.3.2; extra == 'all'
|
|
45
45
|
Requires-Dist: docker<8,>=7.1.0; extra == 'all'
|
|
@@ -183,7 +183,7 @@ Requires-Dist: uv<0.8,>=0.7.0; extra == 'dev'
|
|
|
183
183
|
Provides-Extra: dev-tools
|
|
184
184
|
Requires-Dist: aci-sdk>=1.0.0b1; extra == 'dev-tools'
|
|
185
185
|
Requires-Dist: agentops<0.4,>=0.3.21; extra == 'dev-tools'
|
|
186
|
-
Requires-Dist: daytona-sdk
|
|
186
|
+
Requires-Dist: daytona-sdk==0.20.0; extra == 'dev-tools'
|
|
187
187
|
Requires-Dist: docker<8,>=7.1.0; extra == 'dev-tools'
|
|
188
188
|
Requires-Dist: e2b-code-interpreter<2,>=1.0.3; extra == 'dev-tools'
|
|
189
189
|
Requires-Dist: ipykernel<7,>=6.0.0; extra == 'dev-tools'
|
|
@@ -253,6 +253,7 @@ Requires-Dist: docx2txt<0.9,>=0.8; extra == 'owl'
|
|
|
253
253
|
Requires-Dist: docx>=0.2.4; extra == 'owl'
|
|
254
254
|
Requires-Dist: duckduckgo-search<7,>=6.3.5; extra == 'owl'
|
|
255
255
|
Requires-Dist: e2b-code-interpreter<2,>=1.0.3; extra == 'owl'
|
|
256
|
+
Requires-Dist: exa-py<2,>=1.10.0; extra == 'owl'
|
|
256
257
|
Requires-Dist: ffmpeg-python<0.3,>=0.2.0; extra == 'owl'
|
|
257
258
|
Requires-Dist: html2text>=2024.2.26; extra == 'owl'
|
|
258
259
|
Requires-Dist: imageio[pyav]<3,>=2.34.2; extra == 'owl'
|
|
@@ -752,10 +753,62 @@ Practical guides and tutorials for implementing specific functionalities in CAME
|
|
|
752
753
|
| **[3 Ways to Ingest Data from Websites with Firecrawl](https://docs.camel-ai.org/cookbooks/data_processing/ingest_data_from_websites_with_Firecrawl.html)** | Explore three methods for extracting and processing data from websites using Firecrawl. |
|
|
753
754
|
| **[Create AI Agents that work with your PDFs](https://docs.camel-ai.org/cookbooks/data_processing/agent_with_chunkr_for_pdf_parsing.html)** | Learn how to create AI agents that work with your PDFs using Chunkr and Mistral AI. |
|
|
754
755
|
|
|
756
|
+
<br>
|
|
757
|
+
|
|
758
|
+
## Real-World Usecases
|
|
759
|
+
|
|
760
|
+
Real-world usecases demonstrating how CAMEL’s multi-agent framework enables real business value across infrastructure automation, productivity workflows, retrieval-augmented conversations, intelligent document/video analysis, and collaborative research.
|
|
761
|
+
|
|
762
|
+
### 1 Infrastructure Automation
|
|
763
|
+
|
|
764
|
+
| Usecase | Description |
|
|
765
|
+
| :----------------------------------------------------------- | :----------------------------------------------------------- |
|
|
766
|
+
| **[ACI MCP](https://github.com/camel-ai/camel/tree/master/examples/usecases/aci_mcp)** | Real-world usecases demonstrating how CAMEL’s multi-agent framework enables real business value across infrastructure automation, productivity workflows, retrieval-augmented conversations, intelligent document/video analysis, and collaborative research. |
|
|
767
|
+
| **[Cloudflare MCP CAMEL](https://github.com/camel-ai/camel/tree/master/examples/usecases/cloudfare_mcp_camel)** | Intelligent agents manage Cloudflare resources dynamically, enabling scalable and efficient cloud security and performance tuning. |
|
|
768
|
+
|
|
769
|
+
### 2 Productivity & Business Workflows
|
|
770
|
+
|
|
771
|
+
| Usecase | Description |
|
|
772
|
+
| :----------------------------------------------------------- | :----------------------------------------------------------- |
|
|
773
|
+
| **[Airbnb MCP](https://github.com/camel-ai/camel/tree/master/examples/usecases/airbnb_mcp)** | Coordinate agents to optimize and manage Airbnb listings and host operations. |
|
|
774
|
+
| **[PPTX Toolkit Usecase](https://github.com/camel-ai/camel/tree/master/examples/usecases/pptx_toolkit_usecase)** | Analyze PowerPoint documents and extract structured insights through multi-agent collaboration. |
|
|
775
|
+
|
|
776
|
+
### 3 Retrieval-Augmented Multi-Agent Chat
|
|
777
|
+
|
|
778
|
+
| Usecase | Description |
|
|
779
|
+
| :----------------------------------------------------------- | :----------------------------------------------------------- |
|
|
780
|
+
| **[Chat with GitHub](https://github.com/camel-ai/camel/tree/master/examples/usecases/chat_with_github)** | Query and understand GitHub codebases through CAMEL agents leveraging RAG-style workflows, accelerating developer onboarding and codebase navigation. |
|
|
781
|
+
| **[Chat with YouTube](https://github.com/camel-ai/camel/tree/master/examples/usecases/chat_with_youtube)** | Conversational agents extract and summarize video transcripts, enabling faster content understanding and repurposing. |
|
|
782
|
+
|
|
783
|
+
### 4 Video & Document Intelligence
|
|
784
|
+
|
|
785
|
+
| Usecase | Description |
|
|
786
|
+
| :----------------------------------------------------------- | :----------------------------------------------------------- |
|
|
787
|
+
| **[YouTube OCR](https://github.com/camel-ai/camel/tree/master/examples/usecases/youtube_ocr)** | Agents perform OCR on video screenshots to summarize visual content, supporting media monitoring and compliance. |
|
|
788
|
+
| **[Mistral OCR](https://github.com/camel-ai/camel/tree/master/examples/usecases/mistral_OCR)** | CAMEL agents use OCR with Mistral to analyze documents, reducing manual effort in document understanding workflows. |
|
|
789
|
+
|
|
790
|
+
### 5 Research & Collaboration
|
|
791
|
+
|
|
792
|
+
| Usecase | Description |
|
|
793
|
+
| :----------------------------------------------------------- | :----------------------------------------------------------- |
|
|
794
|
+
| **[Multi-Agent Research Assistant](https://github.com/camel-ai/camel/tree/master/examples/usecases/multi_agent_research_assistant)** | Simulates a team of research agents collaborating on literature review, improving efficiency in exploratory analysis and reporting. |
|
|
755
795
|
|
|
756
796
|
<br>
|
|
757
797
|
|
|
758
798
|
|
|
799
|
+
## 🗓️ Events
|
|
800
|
+
|
|
801
|
+
We are actively involved in community events including:
|
|
802
|
+
|
|
803
|
+
- 🎙️ **Community Meetings** — Weekly virtual syncs with the CAMEL team
|
|
804
|
+
- 🏆 **Competitions** — Hackathons, Bounty Tasks and coding challenges hosted by CAMEL
|
|
805
|
+
- 🤝 **Volunteer Activities** — Contributions, documentation drives, and mentorship
|
|
806
|
+
- 🌍 **Ambassador Programs** — Represent CAMEL in your university or local tech groups
|
|
807
|
+
|
|
808
|
+
> Want to host or participate in a CAMEL event? Join our [Discord](https://discord.com/invite/CNcNpquyDc) or want to be part of [Ambassador Program](https://www.camel-ai.org/ambassador).
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
759
812
|
## Contributing to CAMEL
|
|
760
813
|
|
|
761
814
|
> For those who'd like to contribute code, we appreciate your interest in contributing to our open-source initiative. Please take a moment to review our [contributing guidelines](https://github.com/camel-ai/camel/blob/master/CONTRIBUTING.md) to get started on a smooth collaboration journey.🚀
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=mjhy_f4Jhn7jqAvNkKqu_NA6u45-Xd606dBIlFEvECY,901
|
|
2
2
|
camel/generators.py,sha256=JRqj9_m1PF4qT6UtybzTQ-KBT9MJQt18OAAYvQ_fr2o,13844
|
|
3
3
|
camel/human.py,sha256=Xg8x1cS5KK4bQ1SDByiHZnzsRpvRP-KZViNvmu38xo4,5475
|
|
4
4
|
camel/logger.py,sha256=rZVeOVYuQ9RYJ5Tqyv0usqy0g4zaVEq4qSfZ9nd2640,5755
|
|
5
5
|
camel/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
camel/agents/__init__.py,sha256=64weKqdvmpZcGWyVkO-OKASAmVUdrQjv60JApgPk_SA,1644
|
|
7
|
-
camel/agents/_types.py,sha256=
|
|
7
|
+
camel/agents/_types.py,sha256=MeFZzay2kJA6evALQ-MbBTKW-0lu_0wBuKsxzH_4gWI,1552
|
|
8
8
|
camel/agents/_utils.py,sha256=AR7Qqgbkmn4X2edYUQf1rdksGUyV5hm3iK1z-Dn0Mcg,6266
|
|
9
9
|
camel/agents/base.py,sha256=c4bJYL3G3Z41SaFdMPMn8ZjLdFiFaVOFO6EQIfuCVR8,1124
|
|
10
|
-
camel/agents/chat_agent.py,sha256=
|
|
10
|
+
camel/agents/chat_agent.py,sha256=Lc_dRkrDfbq1SWD0FDAmBfD96m1EzYv45i-exS6L6h4,101405
|
|
11
11
|
camel/agents/critic_agent.py,sha256=L6cTbYjyZB0DCa51tQ6LZLA6my8kHLC4nktHySH78H4,10433
|
|
12
12
|
camel/agents/deductive_reasoner_agent.py,sha256=6BZGaq1hR6hKJuQtOfoYQnk_AkZpw_Mr7mUy2MspQgs,13540
|
|
13
13
|
camel/agents/embodied_agent.py,sha256=XBxBu5ZMmSJ4B2U3Z7SMwvLlgp6yNpaBe8HNQmY9CZA,7536
|
|
@@ -132,7 +132,7 @@ camel/extractors/base.py,sha256=3jvuZpq27nlADDCX3GfubOpeb_zt-E9rzxF3x4lYm8s,1040
|
|
|
132
132
|
camel/extractors/python_strategies.py,sha256=zHAkshnO9o-uvLtCuVOCKoA2PzetBTnkNx1Qy_3j_pE,8113
|
|
133
133
|
camel/interpreters/__init__.py,sha256=NOQUsg7gR84zO8nBXu4JGUatsxSDJqZS6otltjXfop4,1265
|
|
134
134
|
camel/interpreters/base.py,sha256=J3DVt_dGzq1v09-gn8j2XRgEM2WoPrhKFyH9koAjkCU,2281
|
|
135
|
-
camel/interpreters/docker_interpreter.py,sha256=
|
|
135
|
+
camel/interpreters/docker_interpreter.py,sha256=h5BLl6Hs6GIH1teAFfax2OBOMvs7lpBY1zzXP9S0JM8,11372
|
|
136
136
|
camel/interpreters/e2b_interpreter.py,sha256=lNtIsVJWdSdqLoILZS8f5_7WlHI3n457RzLjmeOqH-A,5319
|
|
137
137
|
camel/interpreters/internal_python_interpreter.py,sha256=HjCIfB-HYv2cJz6nUg_8w53zHFB7DwSycqr7H22O_RI,24806
|
|
138
138
|
camel/interpreters/interpreter_error.py,sha256=uEhcmHmmcajt5C9PLeHs21h1fE6cmyt23tCAGie1kTA,880
|
|
@@ -142,6 +142,7 @@ camel/interpreters/docker/Dockerfile,sha256=n3oXzcJhELuN2oYzOyEItICga6RqtwRyjPtS
|
|
|
142
142
|
camel/loaders/__init__.py,sha256=NfXLr0gQUhfyMeB5KpU9EUvhhFLp3X5KNinDs2WO0Q0,1548
|
|
143
143
|
camel/loaders/apify_reader.py,sha256=oaVjKyNhJhG-hTuIwrpZ2hsB4XTL0M-kUksgSL2R0ck,7952
|
|
144
144
|
camel/loaders/base_io.py,sha256=zsbdBPHgSPFyQrtiUgAsHvy39QHWUObRYNaVvr-pPk0,10190
|
|
145
|
+
camel/loaders/base_loader.py,sha256=sZd-fHDNav1U0b2C3IKl4nX42OzrqRioCgRLajb6VdE,3080
|
|
145
146
|
camel/loaders/chunkr_reader.py,sha256=LC2zZvq2BiT1j2ukWPCttgo8a3RlOhFDfijYsEEQ_9I,6452
|
|
146
147
|
camel/loaders/crawl4ai_reader.py,sha256=ugfGMpWhfLnKf_XEOyDGI2ekpViDnSATg9eSxHyWX7M,7653
|
|
147
148
|
camel/loaders/firecrawl_reader.py,sha256=whHBhixQkCtJZYhhr7TgU7aMcbnfDR8LXx5If5Ci_kg,5687
|
|
@@ -162,7 +163,7 @@ camel/memories/blocks/vectordb_block.py,sha256=r0mRGLV14YUr8aruLdylBjKdSm11oprsi
|
|
|
162
163
|
camel/memories/context_creators/__init__.py,sha256=pqzkBM2ro5JZD7RhWg05TjinphhCq0QTIqBJlIL1sJ0,800
|
|
163
164
|
camel/memories/context_creators/score_based.py,sha256=OQ7eEECkzu4Op5sS9qS1dVgZl-cchSkUZj8Puh8C024,16488
|
|
164
165
|
camel/messages/__init__.py,sha256=Px-gTFp2Kcgbeb2sZQ_f4tqjoLHE-QEOiMHIMfPrvTw,1949
|
|
165
|
-
camel/messages/base.py,sha256=
|
|
166
|
+
camel/messages/base.py,sha256=u67NdYW5G0v-ZgojP8MQpoW5OKP2_AJKEz1JHoRxJ3U,19553
|
|
166
167
|
camel/messages/func_message.py,sha256=7e6HsU2FmiDwxhQCFhUenAhms6s9q22ol2Eg7FJa3yw,6892
|
|
167
168
|
camel/messages/conversion/__init__.py,sha256=8B4C-0wj-dm925YRKNyx31WYK25PWpME7Q9jPtx2jkY,1047
|
|
168
169
|
camel/messages/conversion/alpaca.py,sha256=jBU2bMhzNjzptGuoasThYvFov_cYPCYt3pEfs0T7z7U,4163
|
|
@@ -266,6 +267,7 @@ camel/schemas/__init__.py,sha256=UHt0krcozkPQFqD00q2Vk6hLbwV0ySrgaq17MJEZK1c,863
|
|
|
266
267
|
camel/schemas/base.py,sha256=x0H0oIwbQR6UGdEvR5v-srI25MJ8uTrEw8nnygvLwjw,1604
|
|
267
268
|
camel/schemas/openai_converter.py,sha256=SEnYsYcboZgVmjcC1YP5xke3c0MYPESPRmYQWsDGZ4Y,4362
|
|
268
269
|
camel/schemas/outlines_converter.py,sha256=OYKPR1fNyrYs9eh5RiXEAccMbnRc9WTwSVJYbh9HkKE,8738
|
|
270
|
+
camel/services/agent_openapi_server.py,sha256=NUCBLNZBvi4C-J1ESMyRHiRX1NDhPdPkXTMJTl0oUQo,14698
|
|
269
271
|
camel/societies/__init__.py,sha256=NOHjtlsY-gV9UCF2xXgcbG-xXyuigmbwbpLpNsDgEJ4,826
|
|
270
272
|
camel/societies/babyagi_playing.py,sha256=KbTdpHfZ2V8AripVck0bNTOyF-RSaMPCRARz3DvzWfQ,11855
|
|
271
273
|
camel/societies/role_playing.py,sha256=0XScr3WfxX1QOC71RhBLmrcS5y2c7DMQB_mAFOHU34M,31421
|
|
@@ -277,7 +279,7 @@ camel/societies/workforce/single_agent_worker.py,sha256=-TJZtRBSUWhu9sGLwbaxHzRm
|
|
|
277
279
|
camel/societies/workforce/task_channel.py,sha256=uqQQI67Tr4awbR4bjZXdx8_4gL6-ON5IjQk_H_ryqT4,7431
|
|
278
280
|
camel/societies/workforce/utils.py,sha256=Gjlz7pLo4r1b6iNHtlIMxeEuat4d6tEEQMI40JAU3kY,6190
|
|
279
281
|
camel/societies/workforce/worker.py,sha256=36tkOyz4G2wfBdrFjt9NBPXsx4UbE6uL5on8sP2aoqk,6414
|
|
280
|
-
camel/societies/workforce/workforce.py,sha256=
|
|
282
|
+
camel/societies/workforce/workforce.py,sha256=kw8RkSi3bTxqjE7prVN92ajAXlydaF4AMn6RgWtVBGM,115738
|
|
281
283
|
camel/societies/workforce/workforce_logger.py,sha256=ihBS0NMigFWjNS3GatFYq_ViPnmYSr2jznOe4VjvxVk,24817
|
|
282
284
|
camel/storages/__init__.py,sha256=RwpEyvxpMbJzVDZJJygeBg4AzyYMkTjjkfB53hTuqGo,2141
|
|
283
285
|
camel/storages/graph_storages/__init__.py,sha256=G29BNn651C0WTOpjCl4QnVM-4B9tcNh8DdmsCiONH8Y,948
|
|
@@ -313,7 +315,7 @@ camel/terminators/__init__.py,sha256=t8uqrkUnXEOYMXQDgaBkMFJ0EXFKI0kmx4cUimli3Ls
|
|
|
313
315
|
camel/terminators/base.py,sha256=xmJzERX7GdSXcxZjAHHODa0rOxRChMSRboDCNHWSscs,1511
|
|
314
316
|
camel/terminators/response_terminator.py,sha256=n3G5KP6Oj7-7WlRN0yFcrtLpqAJKaKS0bmhrWlFfCgQ,4982
|
|
315
317
|
camel/terminators/token_limit_terminator.py,sha256=YWv6ZR8R9yI2Qnf_3xES5bEE_O5bb2CxQ0EUXfMh34c,2118
|
|
316
|
-
camel/toolkits/__init__.py,sha256=
|
|
318
|
+
camel/toolkits/__init__.py,sha256=3GFRwtjqrNYRf8yUiv0bJdyw6B-E30y9d6V7AfqOQtc,5555
|
|
317
319
|
camel/toolkits/aci_toolkit.py,sha256=39AsXloBb16hHB7DKi6mFU6NPZ3iVpM2FZgaP4o4eLE,16060
|
|
318
320
|
camel/toolkits/arxiv_toolkit.py,sha256=mw629nIN_ozaAxNv3nbvhonJKNI2-97ScRCBS3gVqNo,6297
|
|
319
321
|
camel/toolkits/ask_news_toolkit.py,sha256=WfWaqwEo1Apbil3-Rb5y65Ws43NU4rAFWZu5VHe4los,23448
|
|
@@ -324,13 +326,12 @@ camel/toolkits/bohrium_toolkit.py,sha256=453t-m0h0IGjurG6tCHUejGzfRAN2SAkhIoY8V-
|
|
|
324
326
|
camel/toolkits/browser_toolkit.py,sha256=Ntn_LmCrhqqIBWq9HtiIKw-M0cL5ebn74Ej1GBoZiC8,44400
|
|
325
327
|
camel/toolkits/browser_toolkit_commons.py,sha256=uuc1V5tN3YJmTSe6NHAVJqwsL4iYD7IiSZWxPLYW67A,22196
|
|
326
328
|
camel/toolkits/code_execution.py,sha256=ptexsx8t9teGse8ROnAHCYaLlDg843p-9p1ek-8JpWU,5620
|
|
327
|
-
camel/toolkits/craw4ai_toolkit.py,sha256=
|
|
328
|
-
camel/toolkits/dalle_toolkit.py,sha256=GSnV7reQsVmhMi9sbQy1Ks_5Vs57Dlir_AbT2PPCZwo,6153
|
|
329
|
+
camel/toolkits/craw4ai_toolkit.py,sha256=av8mqY68QgMSm27htnSdq0aqE6z3yWMVDSrNafQ6ORw,3298
|
|
329
330
|
camel/toolkits/dappier_toolkit.py,sha256=OEHOYXX_oXhgbVtWYAy13nO9uXf9i5qEXSwY4PexNFg,8194
|
|
330
331
|
camel/toolkits/data_commons_toolkit.py,sha256=aHZUSL1ACpnYGaf1rE2csVKTmXTmN8lMGRUBYhZ_YEk,14168
|
|
331
332
|
camel/toolkits/edgeone_pages_mcp_toolkit.py,sha256=1TFpAGHUNLggFQeN1OEw7P5laijwnlrCkfxBtgxFuUY,2331
|
|
332
333
|
camel/toolkits/excel_toolkit.py,sha256=9Uk5GLWl719c4W-NcGPJTNMtodAbEE5gUgLsFkIInbk,32564
|
|
333
|
-
camel/toolkits/file_write_toolkit.py,sha256=
|
|
334
|
+
camel/toolkits/file_write_toolkit.py,sha256=3fDx24XxHerPyH68Z1YvPxc34Y7yY1xp9ACOlqMpAoE,19828
|
|
334
335
|
camel/toolkits/function_tool.py,sha256=xCDzjxTRCVj_kmbnMFBuwK-3NuzM4JNe_kv9HLtjnIA,33644
|
|
335
336
|
camel/toolkits/github_toolkit.py,sha256=iUyRrjWGAW_iljZVfNyfkm1Vi55wJxK6PsDAQs9pOag,13099
|
|
336
337
|
camel/toolkits/google_calendar_toolkit.py,sha256=E-sdgdbtNBs_CXbhht9t1dsVr4DsTr5NguHkx4fvSmc,15410
|
|
@@ -349,9 +350,11 @@ camel/toolkits/memory_toolkit.py,sha256=TeKYd5UMwgjVpuS2orb-ocFL13eUNKujvrFOruDC
|
|
|
349
350
|
camel/toolkits/meshy_toolkit.py,sha256=NbgdOBD3FYLtZf-AfonIv6-Q8-8DW129jsaP1PqI2rs,7126
|
|
350
351
|
camel/toolkits/mineru_toolkit.py,sha256=vRX9LholLNkpbJ6axfEN4pTG85aWb0PDmlVy3rAAXhg,6868
|
|
351
352
|
camel/toolkits/networkx_toolkit.py,sha256=C7pUCZTzzGkFyqdkrmhRKpAHmHWfLKeuzYHC_BHPtbk,8826
|
|
353
|
+
camel/toolkits/note_taking_toolkit.py,sha256=LBJ-_zZriSmmb4PKiT1z7P0uFcRAYLuOOpdf3kTdpXI,3389
|
|
352
354
|
camel/toolkits/notion_toolkit.py,sha256=jmmVWk_WazRNWnx4r9DAvhFTAL-n_ige0tb32UHJ_ik,9752
|
|
353
355
|
camel/toolkits/open_api_toolkit.py,sha256=Venfq8JwTMQfzRzzB7AYmYUMEX35hW0BjIv_ozFMiNk,23316
|
|
354
356
|
camel/toolkits/openai_agent_toolkit.py,sha256=hT2ancdQigngAiY1LNnGJzZeiBDHUxrRGv6BdZTJizc,4696
|
|
357
|
+
camel/toolkits/openai_image_toolkit.py,sha256=-7_3utTx3T2GgDSW5Sdz4yBDzUcBMimC2QUaXXvDWXg,11168
|
|
355
358
|
camel/toolkits/openbb_toolkit.py,sha256=8yBZL9E2iSgskosBQhD3pTP56oV6gerWpFjIJc_2UMo,28935
|
|
356
359
|
camel/toolkits/page_script.js,sha256=mXepZPnQNVLp_Wgb64lv7DMQIJYl_XIHJHLVt1OFZO4,13146
|
|
357
360
|
camel/toolkits/playwright_mcp_toolkit.py,sha256=TRweKatFu-7UzfiuXrud2D_4OQjbf4tdP_sCBJ69FG8,3018
|
|
@@ -364,11 +367,11 @@ camel/toolkits/retrieval_toolkit.py,sha256=BKjEyOqW3cGEPTS5yHPYb-Qg795iNNPIs1wjo
|
|
|
364
367
|
camel/toolkits/search_toolkit.py,sha256=5BOBQS5LV33mpRwO9vnnexn9Lsqu6MkO3IgaXJBp7ZQ,43742
|
|
365
368
|
camel/toolkits/searxng_toolkit.py,sha256=a2GtE4FGSrmaIVvX6Yide-abBYD1wsHqitnDlx9fdVg,7664
|
|
366
369
|
camel/toolkits/semantic_scholar_toolkit.py,sha256=Rh7eA_YPxV5pvPIzhjjvpr3vtlaCniJicrqzkPWW9_I,11634
|
|
367
|
-
camel/toolkits/slack_toolkit.py,sha256=
|
|
370
|
+
camel/toolkits/slack_toolkit.py,sha256=4Bj8P2ardLwfiyUz3ha5QobSvziV54E9zipysCg9GuI,11208
|
|
368
371
|
camel/toolkits/stripe_toolkit.py,sha256=07swo5znGTnorafC1uYLKB4NRcJIOPOx19J7tkpLYWk,10102
|
|
369
372
|
camel/toolkits/sympy_toolkit.py,sha256=BAQnI8EFJydNUpKQWXBdleQ1Cm-srDBhFlqp9V9pbPQ,33757
|
|
370
373
|
camel/toolkits/task_planning_toolkit.py,sha256=Ttw9fHae4omGC1SA-6uaeXVHJ1YkwiVloz_hO-fm1gw,4855
|
|
371
|
-
camel/toolkits/terminal_toolkit.py,sha256=
|
|
374
|
+
camel/toolkits/terminal_toolkit.py,sha256=fvFE-VJl5dgAmp27pplxc1y1Bw1KlkUjCU5jlnrdWKA,50543
|
|
372
375
|
camel/toolkits/thinking_toolkit.py,sha256=nZYLvKWIx2BM1DYu69I9B5EISAG7aYcLYXKv9663BVk,8000
|
|
373
376
|
camel/toolkits/twitter_toolkit.py,sha256=Px4N8aUxUzy01LhGSWkdrC2JgwKkrY3cvxgMeJ2XYfU,15939
|
|
374
377
|
camel/toolkits/video_analysis_toolkit.py,sha256=Wh08MAVvs3PtgXN88Sk0TXYaGfVmQAol8FPCXMPPpIM,23375
|
|
@@ -377,13 +380,13 @@ camel/toolkits/weather_toolkit.py,sha256=fs9x9aC38Wsvni6A4PPpbRX6-aBnZiqs2Jix39y
|
|
|
377
380
|
camel/toolkits/whatsapp_toolkit.py,sha256=udUQXkXyeWsmrUlOJZsGBhHtc_jhB05Axe_TchhibsU,5760
|
|
378
381
|
camel/toolkits/wolfram_alpha_toolkit.py,sha256=qeIM8ySn5ilcExBWtx-hDOc35bNcebLVnZ67kt1H3mQ,9295
|
|
379
382
|
camel/toolkits/zapier_toolkit.py,sha256=A83y1UcfuopH7Fx82pORzypl1StbhBjB2HhyOqYa300,7124
|
|
380
|
-
camel/toolkits/
|
|
381
|
-
camel/toolkits/
|
|
382
|
-
camel/toolkits/
|
|
383
|
-
camel/toolkits/
|
|
384
|
-
camel/toolkits/
|
|
385
|
-
camel/toolkits/
|
|
386
|
-
camel/toolkits/
|
|
383
|
+
camel/toolkits/hybrid_browser_toolkit/__init__.py,sha256=vxjWhq7GjUKE5I9RGQU_GoikZJ-AVK4ertdvEqp9pd0,802
|
|
384
|
+
camel/toolkits/hybrid_browser_toolkit/actions.py,sha256=687NtNdjkx8MfXQRSY7hSUAshZnVBxCbYYHZjnal_Go,8746
|
|
385
|
+
camel/toolkits/hybrid_browser_toolkit/agent.py,sha256=nYTNeLEaPg1bhzl65IcG9JkjiS9cRNV3bjsyct4pzM8,10881
|
|
386
|
+
camel/toolkits/hybrid_browser_toolkit/browser_session.py,sha256=ZbPTKoRJaA4kcd-i9B9J98MEaAgPZ3FGjNzs3IJdoWs,11034
|
|
387
|
+
camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py,sha256=4RoVnodjIEUNg64Qz9gOQdqWT2Exh0l5Cz7XyZqV5wo,38188
|
|
388
|
+
camel/toolkits/hybrid_browser_toolkit/snapshot.py,sha256=0gVhOsGujUmv-LdQ5FZGfRNmKaECmJah5W-FOAOu64Q,8489
|
|
389
|
+
camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js,sha256=FXzbnjjXRRaMo5PBFgxa84UFWLn5jymBnFvW_yHdzCM,17378
|
|
387
390
|
camel/toolkits/open_api_specs/security_config.py,sha256=ZVnBa_zEifaE_ao2xsvV5majuJHpn2Tn7feMDOnj-eo,898
|
|
388
391
|
camel/toolkits/open_api_specs/biztoc/__init__.py,sha256=OKCZrQCDwaWtXIN_2rA9FSqEvgpQRieRoHh7Ek6N16A,702
|
|
389
392
|
camel/toolkits/open_api_specs/biztoc/ai-plugin.json,sha256=IJinQbLv5MFPGFwdN7PbOhwArFVExSEZdJspe-mOBIo,866
|
|
@@ -410,12 +413,12 @@ camel/toolkits/open_api_specs/web_scraper/openapi.yaml,sha256=u_WalQ01e8W1D27VnZ
|
|
|
410
413
|
camel/toolkits/open_api_specs/web_scraper/paths/__init__.py,sha256=OKCZrQCDwaWtXIN_2rA9FSqEvgpQRieRoHh7Ek6N16A,702
|
|
411
414
|
camel/toolkits/open_api_specs/web_scraper/paths/scraper.py,sha256=aWy1_ppV4NVVEZfnbN3tu9XA9yAPAC9bRStJ5JuXMRU,1117
|
|
412
415
|
camel/types/__init__.py,sha256=pFTg3CWGSCfwFdoxPDTf4dKV8DdJS1x-bBPuEOmtdf0,2549
|
|
413
|
-
camel/types/enums.py,sha256=
|
|
416
|
+
camel/types/enums.py,sha256=tUTwrEj5-R6EEXxclxiMkrThLL4SotpYX3saXQI01vo,62822
|
|
414
417
|
camel/types/mcp_registries.py,sha256=dl4LgYtSaUhsqAKpz28k_SA9La11qxqBvDLaEuyzrFE,4971
|
|
415
418
|
camel/types/openai_types.py,sha256=8ZFzLe-zGmKNPfuVZFzxlxAX98lGf18gtrPhOgMmzus,2104
|
|
416
419
|
camel/types/unified_model_type.py,sha256=ZweHiS4MQ1QbDEX3a3oUc-pvgueYP27Zt0SlAPcYg_4,5623
|
|
417
420
|
camel/types/agents/__init__.py,sha256=cbvVkogPoZgcwZrgxLH6EtpGXk0kavF79nOic0Dc1vg,786
|
|
418
|
-
camel/types/agents/tool_calling_record.py,sha256=
|
|
421
|
+
camel/types/agents/tool_calling_record.py,sha256=xG0a9TJu-nQQ9aAxpZwYmgqnpjEbnm2cRjjG8uDSIbg,1979
|
|
419
422
|
camel/utils/__init__.py,sha256=qQeMHZJ8Bbgpm4tBu-LWc_P3iFjXBlVfALdKTiD_s8I,3305
|
|
420
423
|
camel/utils/async_func.py,sha256=KqoktGSWjZBuAMQ2CV0X6FRgHGlzCKLfeaWvp-f1Qz8,1568
|
|
421
424
|
camel/utils/commons.py,sha256=hJNvcegHXruFkPaFHh6r9kwHErN9j4vbkLUhSbInbNU,37067
|
|
@@ -424,10 +427,11 @@ camel/utils/deduplication.py,sha256=UHikAtOW1TTDunf2t_wa2kFbmkrXWf7HfOKwLvwCxzo,
|
|
|
424
427
|
camel/utils/filename.py,sha256=HYNc1wbSCgNR1CN21cwHxdAhpnsf5ySJ6jUDfeqOK20,2532
|
|
425
428
|
camel/utils/langfuse.py,sha256=OowR6A790XG-b0UHiTYduYvS18PvSGFdmqki2Poogo0,8578
|
|
426
429
|
camel/utils/mcp.py,sha256=iuthL8VuUXIRU34Nvx8guq7frfglpZoxewUKuAg3e1s,5077
|
|
427
|
-
camel/utils/mcp_client.py,sha256
|
|
430
|
+
camel/utils/mcp_client.py,sha256=-EIUj6v2hXB75Xvj2FyEedwUMEpUUVXzXWNLLYGrJfE,37305
|
|
428
431
|
camel/utils/message_summarizer.py,sha256=7AvPDlevle5uU3mXtfvSFS--nDjp9yqfrf546qTe9rE,5939
|
|
429
432
|
camel/utils/response_format.py,sha256=xZcx6xBxeg3A0e7R0JCMJdNm2oQ1-diqVLs0JsiCkZU,5319
|
|
430
433
|
camel/utils/token_counting.py,sha256=apkERzNoVc4sgvJvWVosvepX3KH8pVypVjrL4AA7RB4,17521
|
|
434
|
+
camel/utils/tool_result.py,sha256=8dyf20_GHKxsHq8e0BmqVff3JZlmT6MV4npKZuXlcTc,1821
|
|
431
435
|
camel/utils/chunker/__init__.py,sha256=6iN6HL6sblIjDuJTILk-9qKcHBZ97t8b6tZCWPZ0OYI,899
|
|
432
436
|
camel/utils/chunker/base.py,sha256=9CuqymFCRncyAdEST-IcRonB732YAPhusznqH-RES3E,960
|
|
433
437
|
camel/utils/chunker/code_chunker.py,sha256=9h4rd39H9ngbOWAjd_12xt-EzVMh0e_fZnC4my8h_Jg,6823
|
|
@@ -438,7 +442,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
|
|
|
438
442
|
camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
|
|
439
443
|
camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
|
|
440
444
|
camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
|
|
441
|
-
camel_ai-0.2.
|
|
442
|
-
camel_ai-0.2.
|
|
443
|
-
camel_ai-0.2.
|
|
444
|
-
camel_ai-0.2.
|
|
445
|
+
camel_ai-0.2.71a4.dist-info/METADATA,sha256=3CoGV8F81-m6rHNRF3x6avCTCHP_T20FC3hge3w-fWQ,49893
|
|
446
|
+
camel_ai-0.2.71a4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
447
|
+
camel_ai-0.2.71a4.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
|
|
448
|
+
camel_ai-0.2.71a4.dist-info/RECORD,,
|
camel/toolkits/dalle_toolkit.py
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
-
# you may not use this file except in compliance with the License.
|
|
4
|
-
# You may obtain a copy of the License at
|
|
5
|
-
#
|
|
6
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
-
#
|
|
8
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
-
# See the License for the specific language governing permissions and
|
|
12
|
-
# limitations under the License.
|
|
13
|
-
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
-
|
|
15
|
-
# Enables postponed evaluation of annotations (for string-based type hints)
|
|
16
|
-
from __future__ import annotations
|
|
17
|
-
|
|
18
|
-
import base64
|
|
19
|
-
import os
|
|
20
|
-
import uuid
|
|
21
|
-
from io import BytesIO
|
|
22
|
-
from typing import List, Optional
|
|
23
|
-
|
|
24
|
-
from openai import OpenAI
|
|
25
|
-
from PIL import Image
|
|
26
|
-
|
|
27
|
-
from camel.logger import get_logger
|
|
28
|
-
from camel.toolkits import FunctionTool
|
|
29
|
-
from camel.toolkits.base import BaseToolkit
|
|
30
|
-
from camel.utils import MCPServer
|
|
31
|
-
|
|
32
|
-
logger = get_logger(__name__)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@MCPServer()
|
|
36
|
-
class DalleToolkit(BaseToolkit):
|
|
37
|
-
r"""A class representing a toolkit for image generation using OpenAI's
|
|
38
|
-
DALL-E model.
|
|
39
|
-
"""
|
|
40
|
-
|
|
41
|
-
def __init__(
|
|
42
|
-
self,
|
|
43
|
-
timeout: Optional[float] = None,
|
|
44
|
-
):
|
|
45
|
-
r"""Initializes a new instance of the DalleToolkit class.
|
|
46
|
-
|
|
47
|
-
Args:
|
|
48
|
-
timeout (Optional[float]): The timeout value for API requests
|
|
49
|
-
in seconds. If None, no timeout is applied.
|
|
50
|
-
(default: :obj:`None`)
|
|
51
|
-
"""
|
|
52
|
-
super().__init__(timeout=timeout)
|
|
53
|
-
|
|
54
|
-
def base64_to_image(self, base64_string: str) -> Optional[Image.Image]:
|
|
55
|
-
r"""Converts a base64 encoded string into a PIL Image object.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
base64_string (str): The base64 encoded string of the image.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
Optional[Image.Image]: The PIL Image object or None if conversion
|
|
62
|
-
fails.
|
|
63
|
-
"""
|
|
64
|
-
try:
|
|
65
|
-
# Decode the base64 string to get the image data
|
|
66
|
-
image_data = base64.b64decode(base64_string)
|
|
67
|
-
# Create a memory buffer for the image data
|
|
68
|
-
image_buffer = BytesIO(image_data)
|
|
69
|
-
# Open the image using the PIL library
|
|
70
|
-
image = Image.open(image_buffer)
|
|
71
|
-
return image
|
|
72
|
-
except Exception as e:
|
|
73
|
-
error_msg = (
|
|
74
|
-
f"An error occurred while converting base64 to image: {e}"
|
|
75
|
-
)
|
|
76
|
-
logger.error(error_msg)
|
|
77
|
-
return None
|
|
78
|
-
|
|
79
|
-
def image_path_to_base64(self, image_path: str) -> str:
|
|
80
|
-
r"""Converts the file path of an image to a Base64 encoded string.
|
|
81
|
-
|
|
82
|
-
Args:
|
|
83
|
-
image_path (str): The path to the image file.
|
|
84
|
-
|
|
85
|
-
Returns:
|
|
86
|
-
str: A Base64 encoded string representing the content of the image
|
|
87
|
-
file.
|
|
88
|
-
"""
|
|
89
|
-
try:
|
|
90
|
-
with open(image_path, "rb") as image_file:
|
|
91
|
-
return base64.b64encode(image_file.read()).decode('utf-8')
|
|
92
|
-
except Exception as e:
|
|
93
|
-
error_msg = (
|
|
94
|
-
f"An error occurred while converting image path to base64: {e}"
|
|
95
|
-
)
|
|
96
|
-
logger.error(error_msg)
|
|
97
|
-
return error_msg
|
|
98
|
-
|
|
99
|
-
def image_to_base64(self, image: Image.Image) -> str:
|
|
100
|
-
r"""Converts an image into a base64-encoded string.
|
|
101
|
-
|
|
102
|
-
This function takes an image object as input, encodes the image into a
|
|
103
|
-
PNG format base64 string, and returns it.
|
|
104
|
-
If the encoding process encounters an error, it prints the error
|
|
105
|
-
message and returns None.
|
|
106
|
-
|
|
107
|
-
Args:
|
|
108
|
-
image: The image object to be encoded, supports any image format
|
|
109
|
-
that can be saved in PNG format.
|
|
110
|
-
|
|
111
|
-
Returns:
|
|
112
|
-
str: A base64-encoded string of the image.
|
|
113
|
-
"""
|
|
114
|
-
try:
|
|
115
|
-
with BytesIO() as buffered_image:
|
|
116
|
-
image.save(buffered_image, format="PNG")
|
|
117
|
-
buffered_image.seek(0)
|
|
118
|
-
image_bytes = buffered_image.read()
|
|
119
|
-
base64_str = base64.b64encode(image_bytes).decode('utf-8')
|
|
120
|
-
return base64_str
|
|
121
|
-
except Exception as e:
|
|
122
|
-
error_msg = f"An error occurred: {e}"
|
|
123
|
-
logger.error(error_msg)
|
|
124
|
-
return error_msg
|
|
125
|
-
|
|
126
|
-
def get_dalle_img(self, prompt: str, image_dir: str = "img") -> str:
|
|
127
|
-
r"""Generate an image using OpenAI's DALL-E model.
|
|
128
|
-
The generated image is saved to the specified directory.
|
|
129
|
-
|
|
130
|
-
Args:
|
|
131
|
-
prompt (str): The text prompt based on which the image is
|
|
132
|
-
generated.
|
|
133
|
-
image_dir (str): The directory to save the generated image.
|
|
134
|
-
Defaults to 'img'.
|
|
135
|
-
|
|
136
|
-
Returns:
|
|
137
|
-
str: The path to the saved image.
|
|
138
|
-
"""
|
|
139
|
-
|
|
140
|
-
dalle_client = OpenAI()
|
|
141
|
-
response = dalle_client.images.generate(
|
|
142
|
-
model="dall-e-3",
|
|
143
|
-
prompt=prompt,
|
|
144
|
-
size="1024x1792",
|
|
145
|
-
quality="standard",
|
|
146
|
-
n=1, # NOTE: now dall-e-3 only supports n=1
|
|
147
|
-
response_format="b64_json",
|
|
148
|
-
)
|
|
149
|
-
if response.data is None or len(response.data) == 0:
|
|
150
|
-
error_msg = "No image data returned from DALL-E API."
|
|
151
|
-
logger.error(error_msg)
|
|
152
|
-
return error_msg
|
|
153
|
-
image_b64 = response.data[0].b64_json
|
|
154
|
-
image = self.base64_to_image(image_b64) # type: ignore[arg-type]
|
|
155
|
-
|
|
156
|
-
if image is None:
|
|
157
|
-
error_msg = "Failed to convert base64 string to image."
|
|
158
|
-
logger.error(error_msg)
|
|
159
|
-
return error_msg
|
|
160
|
-
|
|
161
|
-
os.makedirs(image_dir, exist_ok=True)
|
|
162
|
-
image_path = os.path.join(image_dir, f"{uuid.uuid4()}.png")
|
|
163
|
-
image.save(image_path)
|
|
164
|
-
|
|
165
|
-
return image_path
|
|
166
|
-
|
|
167
|
-
def get_tools(self) -> List[FunctionTool]:
|
|
168
|
-
r"""Returns a list of FunctionTool objects representing the
|
|
169
|
-
functions in the toolkit.
|
|
170
|
-
|
|
171
|
-
Returns:
|
|
172
|
-
List[FunctionTool]: A list of FunctionTool objects
|
|
173
|
-
representing the functions in the toolkit.
|
|
174
|
-
"""
|
|
175
|
-
return [FunctionTool(self.get_dalle_img)]
|