camel-ai 0.2.9__py3-none-any.whl → 0.2.11__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 +10 -5
- camel/agents/__init__.py +4 -4
- camel/agents/base.py +4 -4
- camel/agents/chat_agent.py +106 -42
- camel/agents/critic_agent.py +4 -4
- camel/agents/deductive_reasoner_agent.py +8 -5
- camel/agents/embodied_agent.py +4 -4
- camel/agents/knowledge_graph_agent.py +4 -4
- camel/agents/role_assignment_agent.py +4 -4
- camel/agents/search_agent.py +4 -4
- camel/agents/task_agent.py +4 -4
- camel/agents/tool_agents/__init__.py +4 -4
- camel/agents/tool_agents/base.py +4 -4
- camel/agents/tool_agents/hugging_face_tool_agent.py +4 -4
- camel/bots/__init__.py +4 -4
- camel/bots/discord_app.py +4 -4
- camel/bots/slack/__init__.py +4 -4
- camel/bots/slack/models.py +4 -4
- camel/bots/slack/slack_app.py +4 -4
- camel/bots/telegram_bot.py +4 -4
- camel/configs/__init__.py +13 -4
- camel/configs/anthropic_config.py +4 -4
- camel/configs/base_config.py +4 -4
- camel/configs/cohere_config.py +76 -0
- camel/configs/deepseek_config.py +134 -0
- camel/configs/gemini_config.py +85 -127
- camel/configs/groq_config.py +4 -4
- camel/configs/litellm_config.py +4 -4
- camel/configs/mistral_config.py +4 -7
- camel/configs/nvidia_config.py +70 -0
- camel/configs/ollama_config.py +4 -4
- camel/configs/openai_config.py +32 -7
- camel/configs/qwen_config.py +4 -4
- camel/configs/reka_config.py +4 -4
- camel/configs/samba_config.py +4 -4
- camel/configs/togetherai_config.py +4 -4
- camel/configs/vllm_config.py +14 -5
- camel/configs/yi_config.py +4 -4
- camel/configs/zhipuai_config.py +4 -4
- camel/embeddings/__init__.py +6 -4
- camel/embeddings/base.py +4 -4
- camel/embeddings/mistral_embedding.py +4 -4
- camel/embeddings/openai_compatible_embedding.py +91 -0
- camel/embeddings/openai_embedding.py +4 -4
- camel/embeddings/sentence_transformers_embeddings.py +4 -4
- camel/embeddings/vlm_embedding.py +8 -5
- camel/generators.py +4 -4
- camel/human.py +4 -4
- camel/interpreters/__init__.py +4 -4
- camel/interpreters/base.py +4 -4
- camel/interpreters/docker_interpreter.py +11 -6
- camel/interpreters/internal_python_interpreter.py +4 -4
- camel/interpreters/interpreter_error.py +4 -4
- camel/interpreters/ipython_interpreter.py +4 -4
- camel/interpreters/subprocess_interpreter.py +11 -6
- camel/loaders/__init__.py +4 -4
- camel/loaders/apify_reader.py +4 -4
- camel/loaders/base_io.py +4 -4
- camel/loaders/chunkr_reader.py +4 -4
- camel/loaders/firecrawl_reader.py +4 -7
- camel/loaders/jina_url_reader.py +4 -4
- camel/loaders/unstructured_io.py +4 -4
- camel/logger.py +112 -0
- camel/memories/__init__.py +4 -4
- camel/memories/agent_memories.py +4 -4
- camel/memories/base.py +4 -4
- camel/memories/blocks/__init__.py +4 -4
- camel/memories/blocks/chat_history_block.py +4 -4
- camel/memories/blocks/vectordb_block.py +4 -4
- camel/memories/context_creators/__init__.py +4 -4
- camel/memories/context_creators/score_based.py +4 -4
- camel/memories/records.py +4 -4
- camel/messages/__init__.py +20 -4
- camel/messages/base.py +118 -11
- camel/messages/conversion/__init__.py +31 -0
- camel/messages/conversion/alpaca.py +122 -0
- camel/messages/conversion/conversation_models.py +178 -0
- camel/messages/conversion/sharegpt/__init__.py +20 -0
- camel/messages/conversion/sharegpt/function_call_formatter.py +49 -0
- camel/messages/conversion/sharegpt/hermes/__init__.py +19 -0
- camel/messages/conversion/sharegpt/hermes/hermes_function_formatter.py +128 -0
- camel/messages/func_message.py +50 -4
- camel/models/__init__.py +13 -4
- camel/models/anthropic_model.py +4 -4
- camel/models/azure_openai_model.py +4 -4
- camel/models/base_model.py +4 -4
- camel/models/cohere_model.py +282 -0
- camel/models/deepseek_model.py +139 -0
- camel/models/gemini_model.py +61 -146
- camel/models/groq_model.py +4 -4
- camel/models/litellm_model.py +4 -4
- camel/models/mistral_model.py +4 -4
- camel/models/model_factory.py +13 -4
- camel/models/model_manager.py +212 -0
- camel/models/nemotron_model.py +4 -4
- camel/models/nvidia_model.py +141 -0
- camel/models/ollama_model.py +4 -4
- camel/models/openai_audio_models.py +4 -4
- camel/models/openai_compatible_model.py +4 -4
- camel/models/openai_model.py +43 -4
- camel/models/qwen_model.py +4 -4
- camel/models/reka_model.py +4 -4
- camel/models/samba_model.py +6 -5
- camel/models/stub_model.py +4 -4
- camel/models/togetherai_model.py +4 -4
- camel/models/vllm_model.py +4 -4
- camel/models/yi_model.py +4 -4
- camel/models/zhipuai_model.py +4 -4
- camel/personas/__init__.py +17 -0
- camel/personas/persona.py +103 -0
- camel/personas/persona_hub.py +293 -0
- camel/prompts/__init__.py +6 -4
- camel/prompts/ai_society.py +4 -4
- camel/prompts/base.py +4 -4
- camel/prompts/code.py +4 -4
- camel/prompts/evaluation.py +4 -4
- camel/prompts/generate_text_embedding_data.py +4 -4
- camel/prompts/image_craft.py +4 -4
- camel/prompts/misalignment.py +4 -4
- camel/prompts/multi_condition_image_craft.py +4 -4
- camel/prompts/object_recognition.py +4 -4
- camel/prompts/persona_hub.py +61 -0
- camel/prompts/prompt_templates.py +4 -4
- camel/prompts/role_description_prompt_template.py +4 -4
- camel/prompts/solution_extraction.py +4 -4
- camel/prompts/task_prompt_template.py +4 -4
- camel/prompts/translation.py +4 -4
- camel/prompts/video_description_prompt.py +4 -4
- camel/responses/__init__.py +4 -4
- camel/responses/agent_responses.py +4 -4
- camel/retrievers/__init__.py +4 -4
- camel/retrievers/auto_retriever.py +4 -4
- camel/retrievers/base.py +4 -4
- camel/retrievers/bm25_retriever.py +4 -4
- camel/retrievers/cohere_rerank_retriever.py +7 -9
- camel/retrievers/vector_retriever.py +26 -9
- camel/runtime/__init__.py +29 -0
- camel/runtime/api.py +93 -0
- camel/runtime/base.py +45 -0
- camel/runtime/configs.py +56 -0
- camel/runtime/docker_runtime.py +404 -0
- camel/runtime/llm_guard_runtime.py +199 -0
- camel/runtime/remote_http_runtime.py +204 -0
- camel/runtime/utils/__init__.py +20 -0
- camel/runtime/utils/function_risk_toolkit.py +58 -0
- camel/runtime/utils/ignore_risk_toolkit.py +72 -0
- camel/schemas/__init__.py +17 -0
- camel/schemas/base.py +45 -0
- camel/schemas/openai_converter.py +116 -0
- camel/societies/__init__.py +4 -4
- camel/societies/babyagi_playing.py +8 -5
- camel/societies/role_playing.py +4 -4
- camel/societies/workforce/__init__.py +4 -4
- camel/societies/workforce/base.py +4 -4
- camel/societies/workforce/prompts.py +4 -4
- camel/societies/workforce/role_playing_worker.py +4 -4
- camel/societies/workforce/single_agent_worker.py +4 -4
- camel/societies/workforce/task_channel.py +4 -4
- camel/societies/workforce/utils.py +4 -4
- camel/societies/workforce/worker.py +4 -4
- camel/societies/workforce/workforce.py +7 -7
- camel/storages/__init__.py +4 -4
- camel/storages/graph_storages/__init__.py +4 -4
- camel/storages/graph_storages/base.py +4 -4
- camel/storages/graph_storages/graph_element.py +4 -4
- camel/storages/graph_storages/nebula_graph.py +4 -4
- camel/storages/graph_storages/neo4j_graph.py +4 -4
- camel/storages/key_value_storages/__init__.py +4 -4
- camel/storages/key_value_storages/base.py +4 -4
- camel/storages/key_value_storages/in_memory.py +4 -4
- camel/storages/key_value_storages/json.py +4 -4
- camel/storages/key_value_storages/redis.py +4 -4
- camel/storages/object_storages/__init__.py +4 -4
- camel/storages/object_storages/amazon_s3.py +4 -4
- camel/storages/object_storages/azure_blob.py +4 -4
- camel/storages/object_storages/base.py +4 -4
- camel/storages/object_storages/google_cloud.py +4 -4
- camel/storages/vectordb_storages/__init__.py +4 -4
- camel/storages/vectordb_storages/base.py +4 -4
- camel/storages/vectordb_storages/milvus.py +4 -4
- camel/storages/vectordb_storages/qdrant.py +4 -4
- camel/tasks/__init__.py +4 -4
- camel/tasks/task.py +4 -4
- camel/tasks/task_prompt.py +4 -4
- camel/terminators/__init__.py +4 -4
- camel/terminators/base.py +4 -4
- camel/terminators/response_terminator.py +4 -4
- camel/terminators/token_limit_terminator.py +4 -4
- camel/toolkits/__init__.py +16 -17
- camel/toolkits/arxiv_toolkit.py +4 -4
- camel/toolkits/ask_news_toolkit.py +7 -18
- camel/toolkits/base.py +4 -4
- camel/toolkits/code_execution.py +57 -10
- camel/toolkits/dalle_toolkit.py +4 -7
- camel/toolkits/data_commons_toolkit.py +4 -4
- camel/toolkits/function_tool.py +220 -69
- camel/toolkits/github_toolkit.py +4 -4
- camel/toolkits/google_maps_toolkit.py +4 -4
- camel/toolkits/google_scholar_toolkit.py +4 -4
- camel/toolkits/human_toolkit.py +53 -0
- camel/toolkits/linkedin_toolkit.py +4 -4
- camel/toolkits/math_toolkit.py +4 -7
- camel/toolkits/meshy_toolkit.py +185 -0
- camel/toolkits/notion_toolkit.py +4 -4
- camel/toolkits/open_api_specs/biztoc/__init__.py +4 -4
- camel/toolkits/open_api_specs/coursera/__init__.py +4 -4
- camel/toolkits/open_api_specs/create_qr_code/__init__.py +4 -4
- camel/toolkits/open_api_specs/klarna/__init__.py +4 -4
- camel/toolkits/open_api_specs/nasa_apod/__init__.py +4 -4
- camel/toolkits/open_api_specs/outschool/__init__.py +4 -4
- camel/toolkits/open_api_specs/outschool/paths/__init__.py +4 -4
- camel/toolkits/open_api_specs/outschool/paths/get_classes.py +4 -4
- camel/toolkits/open_api_specs/outschool/paths/search_teachers.py +4 -4
- camel/toolkits/open_api_specs/security_config.py +4 -4
- camel/toolkits/open_api_specs/speak/__init__.py +4 -4
- camel/toolkits/open_api_specs/web_scraper/__init__.py +4 -4
- camel/toolkits/open_api_specs/web_scraper/paths/__init__.py +4 -4
- camel/toolkits/open_api_specs/web_scraper/paths/scraper.py +4 -4
- camel/toolkits/open_api_toolkit.py +4 -4
- camel/toolkits/reddit_toolkit.py +4 -4
- camel/toolkits/retrieval_toolkit.py +4 -4
- camel/toolkits/search_toolkit.py +49 -29
- camel/toolkits/slack_toolkit.py +4 -4
- camel/toolkits/twitter_toolkit.py +13 -13
- camel/toolkits/video_toolkit.py +211 -0
- camel/toolkits/weather_toolkit.py +4 -7
- camel/toolkits/whatsapp_toolkit.py +6 -6
- camel/types/__init__.py +6 -4
- camel/types/enums.py +118 -15
- camel/types/openai_types.py +6 -4
- camel/types/unified_model_type.py +9 -4
- camel/utils/__init__.py +35 -33
- camel/utils/async_func.py +4 -4
- camel/utils/commons.py +26 -9
- camel/utils/constants.py +4 -4
- camel/utils/response_format.py +63 -0
- camel/utils/token_counting.py +8 -5
- {camel_ai-0.2.9.dist-info → camel_ai-0.2.11.dist-info}/METADATA +108 -56
- camel_ai-0.2.11.dist-info/RECORD +252 -0
- camel_ai-0.2.9.dist-info/RECORD +0 -215
- {camel_ai-0.2.9.dist-info → camel_ai-0.2.11.dist-info}/LICENSE +0 -0
- {camel_ai-0.2.9.dist-info → camel_ai-0.2.11.dist-info}/WHEEL +0 -0
camel/tasks/__init__.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from .task import Task, TaskManager
|
|
15
15
|
from .task_prompt import TASK_DECOMPOSE_PROMPT, TASK_EVOLVE_PROMPT
|
|
16
16
|
|
camel/tasks/task.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
|
|
15
15
|
import re
|
|
16
16
|
from enum import Enum
|
camel/tasks/task_prompt.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from camel.prompts import TextPrompt
|
|
15
15
|
|
|
16
16
|
# ruff: noqa: E501
|
camel/terminators/__init__.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from .base import BaseTerminator
|
|
15
15
|
from .response_terminator import ResponseTerminator, ResponseWordsTerminator
|
|
16
16
|
from .token_limit_terminator import TokenLimitTerminator
|
camel/terminators/base.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from abc import ABC, abstractmethod
|
|
15
15
|
from typing import List, Optional, Tuple
|
|
16
16
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from collections import defaultdict
|
|
15
15
|
from typing import Dict, List, Optional, Tuple
|
|
16
16
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
from typing import Optional, Tuple
|
|
15
15
|
|
|
16
16
|
from camel.terminators.base import BaseTerminator
|
camel/toolkits/__init__.py
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
# ruff: noqa: I001
|
|
15
15
|
from .function_tool import (
|
|
16
16
|
FunctionTool,
|
|
17
|
-
OpenAIFunction,
|
|
18
17
|
get_openai_function_schema,
|
|
19
18
|
get_openai_tool_schema,
|
|
20
19
|
generate_docstring,
|
|
21
20
|
)
|
|
22
21
|
from .open_api_specs.security_config import openapi_security_config
|
|
23
22
|
|
|
24
|
-
from .math_toolkit import MathToolkit
|
|
25
|
-
from .search_toolkit import SearchToolkit
|
|
26
|
-
from .weather_toolkit import WeatherToolkit
|
|
27
|
-
from .dalle_toolkit import DalleToolkit
|
|
23
|
+
from .math_toolkit import MathToolkit
|
|
24
|
+
from .search_toolkit import SearchToolkit
|
|
25
|
+
from .weather_toolkit import WeatherToolkit
|
|
26
|
+
from .dalle_toolkit import DalleToolkit
|
|
28
27
|
from .ask_news_toolkit import AskNewsToolkit, AsyncAskNewsToolkit
|
|
29
|
-
|
|
30
28
|
from .linkedin_toolkit import LinkedInToolkit
|
|
31
29
|
from .reddit_toolkit import RedditToolkit
|
|
30
|
+
from .meshy_toolkit import MeshyToolkit
|
|
31
|
+
|
|
32
32
|
from .base import BaseToolkit
|
|
33
33
|
from .google_maps_toolkit import GoogleMapsToolkit
|
|
34
34
|
from .code_execution import CodeExecutionToolkit
|
|
@@ -36,15 +36,16 @@ from .github_toolkit import GithubToolkit
|
|
|
36
36
|
from .google_scholar_toolkit import GoogleScholarToolkit
|
|
37
37
|
from .arxiv_toolkit import ArxivToolkit
|
|
38
38
|
from .slack_toolkit import SlackToolkit
|
|
39
|
-
from .twitter_toolkit import TwitterToolkit
|
|
39
|
+
from .twitter_toolkit import TwitterToolkit
|
|
40
40
|
from .open_api_toolkit import OpenAPIToolkit
|
|
41
41
|
from .retrieval_toolkit import RetrievalToolkit
|
|
42
42
|
from .notion_toolkit import NotionToolkit
|
|
43
|
+
from .human_toolkit import HumanToolkit
|
|
44
|
+
from .video_toolkit import VideoDownloaderToolkit
|
|
43
45
|
|
|
44
46
|
__all__ = [
|
|
45
47
|
'BaseToolkit',
|
|
46
48
|
'FunctionTool',
|
|
47
|
-
'OpenAIFunction',
|
|
48
49
|
'get_openai_function_schema',
|
|
49
50
|
'get_openai_tool_schema',
|
|
50
51
|
"generate_docstring",
|
|
@@ -67,9 +68,7 @@ __all__ = [
|
|
|
67
68
|
'GoogleScholarToolkit',
|
|
68
69
|
'NotionToolkit',
|
|
69
70
|
'ArxivToolkit',
|
|
70
|
-
'
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'DALLE_FUNCS',
|
|
74
|
-
'TWITTER_FUNCS',
|
|
71
|
+
'HumanToolkit',
|
|
72
|
+
'VideoDownloaderToolkit',
|
|
73
|
+
'MeshyToolkit',
|
|
75
74
|
]
|
camel/toolkits/arxiv_toolkit.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
|
|
15
15
|
from typing import Dict, Generator, List, Optional
|
|
16
16
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
import os
|
|
15
15
|
from datetime import datetime
|
|
16
16
|
from typing import List, Literal, Optional, Tuple, Union
|
|
@@ -66,15 +66,12 @@ class AskNewsToolkit(BaseToolkit):
|
|
|
66
66
|
r"""Initialize the AskNewsToolkit with API clients.The API keys and
|
|
67
67
|
credentials are retrieved from environment variables.
|
|
68
68
|
"""
|
|
69
|
-
from asknews_sdk import AskNewsSDK
|
|
69
|
+
from asknews_sdk import AskNewsSDK
|
|
70
70
|
|
|
71
71
|
client_id = os.environ.get("ASKNEWS_CLIENT_ID")
|
|
72
72
|
client_secret = os.environ.get("ASKNEWS_CLIENT_SECRET")
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
self.asknews_client = AskNewsSDK(client_id, client_secret)
|
|
76
|
-
else:
|
|
77
|
-
self.asknews_client = None
|
|
74
|
+
self.asknews_client = AskNewsSDK(client_id, client_secret)
|
|
78
75
|
|
|
79
76
|
def get_news(
|
|
80
77
|
self,
|
|
@@ -182,7 +179,6 @@ class AskNewsToolkit(BaseToolkit):
|
|
|
182
179
|
for story in response.stories
|
|
183
180
|
]
|
|
184
181
|
}
|
|
185
|
-
|
|
186
182
|
return stories_data
|
|
187
183
|
|
|
188
184
|
except Exception as e:
|
|
@@ -368,10 +364,7 @@ class AsyncAskNewsToolkit(BaseToolkit):
|
|
|
368
364
|
client_id = os.environ.get("ASKNEWS_CLIENT_ID")
|
|
369
365
|
client_secret = os.environ.get("ASKNEWS_CLIENT_SECRET")
|
|
370
366
|
|
|
371
|
-
|
|
372
|
-
self.asknews_client = AsyncAskNewsSDK(client_id, client_secret)
|
|
373
|
-
else:
|
|
374
|
-
self.asknews_client = None
|
|
367
|
+
self.asknews_client = AsyncAskNewsSDK(client_id, client_secret)
|
|
375
368
|
|
|
376
369
|
async def get_news(
|
|
377
370
|
self,
|
|
@@ -647,7 +640,3 @@ class AsyncAskNewsToolkit(BaseToolkit):
|
|
|
647
640
|
FunctionTool(self.search_reddit),
|
|
648
641
|
FunctionTool(self.query_finance),
|
|
649
642
|
]
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
ASKNEWS_FUNCS: List[FunctionTool] = AskNewsToolkit().get_tools()
|
|
653
|
-
ASYNC_ASKNEWS_FUNCS: List[FunctionTool] = AsyncAskNewsToolkit().get_tools()
|
camel/toolkits/base.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
|
|
15
15
|
from typing import List
|
|
16
16
|
|
camel/toolkits/code_execution.py
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
14
|
-
from typing import List, Literal
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
|
+
from typing import List, Literal, Optional, Union
|
|
15
15
|
|
|
16
|
-
from camel.interpreters import
|
|
16
|
+
from camel.interpreters import (
|
|
17
|
+
DockerInterpreter,
|
|
18
|
+
InternalPythonInterpreter,
|
|
19
|
+
JupyterKernelInterpreter,
|
|
20
|
+
SubprocessInterpreter,
|
|
21
|
+
)
|
|
17
22
|
from camel.toolkits import FunctionTool
|
|
18
23
|
from camel.toolkits.base import BaseToolkit
|
|
19
24
|
|
|
@@ -22,20 +27,62 @@ class CodeExecutionToolkit(BaseToolkit):
|
|
|
22
27
|
r"""A tookit for code execution.
|
|
23
28
|
|
|
24
29
|
Args:
|
|
25
|
-
sandbox (str):
|
|
30
|
+
sandbox (str): The environment type used to execute code.
|
|
31
|
+
verbose (bool): Whether to print the output of the code execution.
|
|
32
|
+
(default: :obj:`False`)
|
|
33
|
+
unsafe_mode (bool): If `True`, the interpreter runs the code
|
|
34
|
+
by `eval()` without any security check. (default: :obj:`False`)
|
|
35
|
+
import_white_list ( Optional[List[str]]): A list of allowed imports.
|
|
36
|
+
(default: :obj:`None`)
|
|
37
|
+
require_confirm (bool): Whether to require confirmation before executing code.
|
|
38
|
+
(default: :obj:`False`)
|
|
26
39
|
"""
|
|
27
40
|
|
|
28
41
|
def __init__(
|
|
29
42
|
self,
|
|
30
43
|
sandbox: Literal[
|
|
31
|
-
"internal_python", "jupyter", "docker"
|
|
44
|
+
"internal_python", "jupyter", "docker", "subprocess"
|
|
32
45
|
] = "internal_python",
|
|
33
46
|
verbose: bool = False,
|
|
47
|
+
unsafe_mode: bool = False,
|
|
48
|
+
import_white_list: Optional[List[str]] = None,
|
|
49
|
+
require_confirm: bool = False,
|
|
34
50
|
) -> None:
|
|
35
|
-
# TODO: Add support for docker and jupyter.
|
|
36
51
|
self.verbose = verbose
|
|
52
|
+
self.unsafe_mode = unsafe_mode
|
|
53
|
+
self.import_white_list = import_white_list or list()
|
|
54
|
+
|
|
55
|
+
# Type annotation for interpreter to allow all possible types
|
|
56
|
+
self.interpreter: Union[
|
|
57
|
+
InternalPythonInterpreter,
|
|
58
|
+
JupyterKernelInterpreter,
|
|
59
|
+
DockerInterpreter,
|
|
60
|
+
SubprocessInterpreter,
|
|
61
|
+
]
|
|
62
|
+
|
|
37
63
|
if sandbox == "internal_python":
|
|
38
|
-
self.interpreter = InternalPythonInterpreter(
|
|
64
|
+
self.interpreter = InternalPythonInterpreter(
|
|
65
|
+
unsafe_mode=self.unsafe_mode,
|
|
66
|
+
import_white_list=self.import_white_list,
|
|
67
|
+
)
|
|
68
|
+
elif sandbox == "jupyter":
|
|
69
|
+
self.interpreter = JupyterKernelInterpreter(
|
|
70
|
+
require_confirm=require_confirm,
|
|
71
|
+
print_stdout=self.verbose,
|
|
72
|
+
print_stderr=self.verbose,
|
|
73
|
+
)
|
|
74
|
+
elif sandbox == "docker":
|
|
75
|
+
self.interpreter = DockerInterpreter(
|
|
76
|
+
require_confirm=require_confirm,
|
|
77
|
+
print_stdout=self.verbose,
|
|
78
|
+
print_stderr=self.verbose,
|
|
79
|
+
)
|
|
80
|
+
elif sandbox == "subprocess":
|
|
81
|
+
self.interpreter = SubprocessInterpreter(
|
|
82
|
+
require_confirm=require_confirm,
|
|
83
|
+
print_stdout=self.verbose,
|
|
84
|
+
print_stderr=self.verbose,
|
|
85
|
+
)
|
|
39
86
|
else:
|
|
40
87
|
raise RuntimeError(
|
|
41
88
|
f"The sandbox type `{sandbox}` is not supported."
|
camel/toolkits/dalle_toolkit.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
import base64
|
|
15
15
|
import os
|
|
16
16
|
import uuid
|
|
@@ -140,6 +140,3 @@ class DalleToolkit(BaseToolkit):
|
|
|
140
140
|
representing the functions in the toolkit.
|
|
141
141
|
"""
|
|
142
142
|
return [FunctionTool(self.get_dalle_img)]
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
DALLE_FUNCS: List[FunctionTool] = DalleToolkit().get_tools()
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Licensed under the Apache License, Version 2.0 (the
|
|
1
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
2
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3
|
# you may not use this file except in compliance with the License.
|
|
4
4
|
# You may obtain a copy of the License at
|
|
5
5
|
#
|
|
6
6
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
7
7
|
#
|
|
8
8
|
# Unless required by applicable law or agreed to in writing, software
|
|
9
|
-
# distributed under the License is distributed on an
|
|
9
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
10
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
# See the License for the specific language governing permissions and
|
|
12
12
|
# limitations under the License.
|
|
13
|
-
#
|
|
13
|
+
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
|
|
14
14
|
import logging
|
|
15
15
|
from typing import Any, Dict, List, Optional, Union
|
|
16
16
|
|