camel-ai 0.2.8__py3-none-any.whl → 0.2.10__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 +5 -5
- camel/agents/__init__.py +4 -4
- camel/agents/base.py +4 -4
- camel/agents/chat_agent.py +32 -37
- camel/agents/critic_agent.py +4 -4
- camel/agents/deductive_reasoner_agent.py +4 -4
- 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 +10 -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 -4
- 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 +4 -4
- 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 +4 -4
- 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 +4 -4
- 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 +4 -4
- 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 -4
- camel/loaders/jina_url_reader.py +4 -4
- camel/loaders/unstructured_io.py +4 -4
- 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 +108 -4
- camel/messages/conversion/__init__.py +29 -0
- camel/messages/conversion/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 +8 -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 +10 -4
- camel/models/nemotron_model.py +4 -4
- 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 +42 -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 +4 -4
- 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 +4 -4
- camel/societies/role_playing.py +7 -14
- 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 +13 -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 +20 -7
- 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 +52 -0
- camel/toolkits/linkedin_toolkit.py +4 -4
- camel/toolkits/math_toolkit.py +4 -7
- 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 +10 -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 +77 -7
- 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 +4 -4
- camel/utils/constants.py +4 -4
- camel/utils/response_format.py +63 -0
- camel/utils/token_counting.py +4 -4
- {camel_ai-0.2.8.dist-info → camel_ai-0.2.10.dist-info}/METADATA +108 -56
- camel_ai-0.2.10.dist-info/RECORD +246 -0
- camel_ai-0.2.8.dist-info/RECORD +0 -215
- {camel_ai-0.2.8.dist-info → camel_ai-0.2.10.dist-info}/LICENSE +0 -0
- {camel_ai-0.2.8.dist-info → camel_ai-0.2.10.dist-info}/WHEEL +0 -0
camel/models/togetherai_model.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 os
|
|
16
16
|
from typing import Any, Dict, List, Optional, Union
|
camel/models/vllm_model.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 os
|
|
15
15
|
import subprocess
|
|
16
16
|
from typing import Any, Dict, List, Optional, Union
|
camel/models/yi_model.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 os
|
|
16
16
|
from typing import Any, Dict, List, Optional, Union
|
camel/models/zhipuai_model.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 os
|
|
16
16
|
from typing import Any, Dict, List, Optional, Union
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
from .persona import Persona
|
|
15
|
+
from .persona_hub import PersonaHub
|
|
16
|
+
|
|
17
|
+
__all__ = ['Persona', 'PersonaHub']
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
import json
|
|
15
|
+
import uuid
|
|
16
|
+
from typing import ClassVar, Optional, Union
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, PrivateAttr
|
|
19
|
+
|
|
20
|
+
from camel.prompts import PersonaHubPrompt, TextPrompt
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Persona(BaseModel):
|
|
24
|
+
r"""A persona is a character in the society.
|
|
25
|
+
|
|
26
|
+
Attributes:
|
|
27
|
+
name (Optional[str]): Name of the persona.
|
|
28
|
+
description (Optional[str]): Description of the persona.
|
|
29
|
+
text_to_persona_prompt (Union[TextPrompt, str]): The prompt to convert
|
|
30
|
+
text into a persona.
|
|
31
|
+
persona_to_persona_prompt (Union[TextPrompt, str]): Persona-to-Persona
|
|
32
|
+
interaction prompt.
|
|
33
|
+
id (uuid.UUID): The unique identifier for the persona, automatically
|
|
34
|
+
generated.
|
|
35
|
+
_id (uuid.UUID): Internal unique identifier for the persona,
|
|
36
|
+
generated lazily using `uuid.uuid4`.
|
|
37
|
+
model_config (ClassVar[ConfigDict]): Configuration for the Pydantic
|
|
38
|
+
model. Allows arbitrary types and includes custom JSON schema
|
|
39
|
+
settings.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
name: Optional[str] = None
|
|
43
|
+
description: Optional[str] = None
|
|
44
|
+
_id: uuid.UUID = PrivateAttr(default_factory=uuid.uuid4)
|
|
45
|
+
|
|
46
|
+
# Field with default_factory to avoid circular import issues
|
|
47
|
+
# Union type allows either TextPrompt or str
|
|
48
|
+
text_to_persona_prompt: Union[TextPrompt, str] = Field(
|
|
49
|
+
default_factory=lambda: PersonaHubPrompt.TEXT_TO_PERSONA,
|
|
50
|
+
description="Text to Persona Prompt",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Similar to text_to_persona_prompt, using default_factory for lazy
|
|
54
|
+
# evaluation
|
|
55
|
+
persona_to_persona_prompt: Union[TextPrompt, str] = Field(
|
|
56
|
+
default_factory=lambda: PersonaHubPrompt.PERSONA_TO_PERSONA,
|
|
57
|
+
description="Persona to Persona Prompt",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# Class-level configuration for Pydantic model
|
|
61
|
+
# ClassVar indicates this is a class variable, not an instance variable
|
|
62
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(
|
|
63
|
+
# Allow the use of custom types TextPrompt
|
|
64
|
+
arbitrary_types_allowed=True,
|
|
65
|
+
# Custom JSON schema configuration
|
|
66
|
+
json_schema_extra={
|
|
67
|
+
"properties": {
|
|
68
|
+
# Ensure text_to_persona_prompt and persona_to_persona_prompt
|
|
69
|
+
# are treated as strings in JSON schema
|
|
70
|
+
"text_to_persona_prompt": {"type": "string"},
|
|
71
|
+
"persona_to_persona_prompt": {"type": "string"},
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def id(self) -> uuid.UUID:
|
|
78
|
+
return self._id
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def model_json_schema(cls):
|
|
82
|
+
schema = super().schema()
|
|
83
|
+
schema['properties']['id'] = {'type': 'string', 'format': 'uuid'}
|
|
84
|
+
return schema
|
|
85
|
+
|
|
86
|
+
def dict(self, *args, **kwargs):
|
|
87
|
+
# Output: {'name': 'Alice', 'description': None, 'text_to_persona_prompt': '...', 'persona_to_persona_prompt': '...', 'id': 'f47ac10b-58cc-4372-a567-0e02b2c3d479'} # noqa: E501
|
|
88
|
+
d = super().model_dump(*args, **kwargs)
|
|
89
|
+
d['id'] = str(self.id)
|
|
90
|
+
return d
|
|
91
|
+
|
|
92
|
+
def json(self, *args, **kwargs):
|
|
93
|
+
# Output: '{"name": "Alice", "description": null, "text_to_persona_prompt": "...", "persona_to_persona_prompt": "...", "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"}' # noqa: E501
|
|
94
|
+
d = self.dict(*args, **kwargs)
|
|
95
|
+
return json.dumps(
|
|
96
|
+
d,
|
|
97
|
+
indent=4, # Pretty-print with 4 spaces indentation
|
|
98
|
+
sort_keys=True, # Sort keys alphabetically
|
|
99
|
+
separators=(
|
|
100
|
+
",",
|
|
101
|
+
": ",
|
|
102
|
+
), # Fine-tune separators for better readability
|
|
103
|
+
)
|
|
@@ -0,0 +1,293 @@
|
|
|
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
|
+
import ast
|
|
15
|
+
import re
|
|
16
|
+
import uuid
|
|
17
|
+
from functools import lru_cache
|
|
18
|
+
from typing import Dict, List, Literal, Optional, Union
|
|
19
|
+
|
|
20
|
+
import numpy as np
|
|
21
|
+
from pydantic import BaseModel, Field
|
|
22
|
+
|
|
23
|
+
from camel.agents import ChatAgent
|
|
24
|
+
from camel.embeddings import BaseEmbedding
|
|
25
|
+
from camel.models import BaseModelBackend
|
|
26
|
+
from camel.personas import Persona
|
|
27
|
+
from camel.prompts import TextPrompt
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# Set structured output schema
|
|
31
|
+
class PersonaResponse(BaseModel):
|
|
32
|
+
persona_name: str = Field(description="The name of the persona")
|
|
33
|
+
persona_description: str = Field(
|
|
34
|
+
description="The description of the persona."
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class PersonaHub:
|
|
39
|
+
r"""The PersonaHub adapted from `"Scaling Synthetic Data Creation with 1,
|
|
40
|
+
000,000,000 Personas"
|
|
41
|
+
<https://github.com/tencent-ailab/persona-hub>`_.
|
|
42
|
+
|
|
43
|
+
PersonaHub proposes a novel persona-driven data synthesis methodology
|
|
44
|
+
that leverages various perspectives within a large language model (LLM) to
|
|
45
|
+
create diverse synthetic data. By showcasing PersonaHub's use cases in
|
|
46
|
+
synthesizing high-quality mathematical and logical reasoning problems,
|
|
47
|
+
instructions (i.e., user prompts), knowledge-rich texts, game NPCs and
|
|
48
|
+
tools (functions) at scale, the authors demonstrate persona-driven data
|
|
49
|
+
synthesis is versatile, scalable, flexible, and easy to use, potentially
|
|
50
|
+
driving a paradigm shift in synthetic data creation and applications in
|
|
51
|
+
practice, which may have a profound impact on LLM research and development.
|
|
52
|
+
Please refer to the paper for more details: https://arxiv.org/pdf/2406.20094.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
model (BaseModelBackend, optional): The model to use for persona
|
|
56
|
+
generation and manipulation. (default: :obj:`None`)
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
def __init__(
|
|
60
|
+
self,
|
|
61
|
+
model: Optional[BaseModelBackend] = None,
|
|
62
|
+
):
|
|
63
|
+
self.model = model
|
|
64
|
+
self.personas: Dict[uuid.UUID, Persona] = {}
|
|
65
|
+
|
|
66
|
+
def __setitem__(self, persona: Persona):
|
|
67
|
+
r"""Add a persona to the group.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
persona (Persona): The persona to add.
|
|
71
|
+
"""
|
|
72
|
+
self.personas[persona.id] = persona
|
|
73
|
+
|
|
74
|
+
def __delitem__(self, persona_id: uuid.UUID):
|
|
75
|
+
r"""Remove a persona from the group by ID.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
persona_id (uuid.UUID): The ID of the persona to remove.
|
|
79
|
+
"""
|
|
80
|
+
if persona_id in self.personas:
|
|
81
|
+
del self.personas[persona_id]
|
|
82
|
+
else:
|
|
83
|
+
raise KeyError("Persona ID not found.")
|
|
84
|
+
|
|
85
|
+
def __getitem__(self, persona_id: uuid.UUID) -> Persona:
|
|
86
|
+
r"""Get a persona by ID.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
persona_id (uuid.UUID): The ID of the persona to retrieve.
|
|
90
|
+
"""
|
|
91
|
+
if persona_id in self.personas:
|
|
92
|
+
return self.personas[persona_id]
|
|
93
|
+
else:
|
|
94
|
+
raise KeyError("Persona ID not found.")
|
|
95
|
+
|
|
96
|
+
def text_to_persona(
|
|
97
|
+
self,
|
|
98
|
+
text: str,
|
|
99
|
+
action: Literal["read", "write", "like", "dislike"] = "read",
|
|
100
|
+
) -> Persona:
|
|
101
|
+
r"""Infers a specific persona who is likely to [read|write|like|dislike
|
|
102
|
+
|...] the given text.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
text (str): The input text for which to infer a persona.
|
|
106
|
+
action (str): The action associated with the persona (default is
|
|
107
|
+
"read").
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Persona: The inferred persona.
|
|
111
|
+
"""
|
|
112
|
+
persona = Persona()
|
|
113
|
+
|
|
114
|
+
text_to_persona_prompt: Union[TextPrompt, str] = (
|
|
115
|
+
persona.text_to_persona_prompt
|
|
116
|
+
)
|
|
117
|
+
text_to_persona_prompt_instruction = text_to_persona_prompt.format(
|
|
118
|
+
action=action, text=text
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# Set Agent to generate personal
|
|
122
|
+
t2p_agent = ChatAgent(
|
|
123
|
+
system_message="You are a helpful assistant", model=self.model
|
|
124
|
+
)
|
|
125
|
+
t2p_agent.reset()
|
|
126
|
+
|
|
127
|
+
# Get output from agent
|
|
128
|
+
try:
|
|
129
|
+
response = t2p_agent.step(
|
|
130
|
+
text_to_persona_prompt_instruction,
|
|
131
|
+
response_format=PersonaResponse, # type: ignore[arg-type]
|
|
132
|
+
)
|
|
133
|
+
parsed_content = ast.literal_eval(response.msg.content)
|
|
134
|
+
persona.name = parsed_content["persona_name"]
|
|
135
|
+
persona.description = parsed_content["persona_description"]
|
|
136
|
+
except Exception as e:
|
|
137
|
+
raise RuntimeError(f"Text to persona step failed: {e}")
|
|
138
|
+
|
|
139
|
+
return persona
|
|
140
|
+
|
|
141
|
+
def persona_to_persona(self, persona: Persona) -> Dict[uuid.UUID, Persona]:
|
|
142
|
+
r"""Derives additional personas based on interpersonal relationships
|
|
143
|
+
from this persona.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
persona (Persona): The persona from which to derive related
|
|
147
|
+
personas.
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
Dict[uuid.UUID, Persona]: A dictionary of related personas.
|
|
151
|
+
"""
|
|
152
|
+
persona_to_persona_prompt: Union[TextPrompt, str] = (
|
|
153
|
+
persona.persona_to_persona_prompt
|
|
154
|
+
)
|
|
155
|
+
answer_template = """
|
|
156
|
+
You MUST answer the question according to the format of the ANSWER TEMPLATE, and you can only modify the content within <BLANK>.
|
|
157
|
+
===== ANSWER TEMPLATE =====
|
|
158
|
+
1. persona_name: <BLANK>
|
|
159
|
+
persona_description: <BLANK>
|
|
160
|
+
...
|
|
161
|
+
n. persona_name: <BLANK>
|
|
162
|
+
persona_description: <BLANK>
|
|
163
|
+
""" # noqa: E501
|
|
164
|
+
persona_to_persona_prompt_instruction = (
|
|
165
|
+
persona_to_persona_prompt.format(
|
|
166
|
+
persona_name=persona.name,
|
|
167
|
+
persona_description=persona.description,
|
|
168
|
+
)
|
|
169
|
+
+ answer_template
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
p2p_agent = ChatAgent(
|
|
173
|
+
system_message="You're a helpful assistant.", model=self.model
|
|
174
|
+
)
|
|
175
|
+
p2p_agent.reset()
|
|
176
|
+
|
|
177
|
+
# Get output from agent
|
|
178
|
+
try:
|
|
179
|
+
response = p2p_agent.step(
|
|
180
|
+
persona_to_persona_prompt_instruction # type: ignore[arg-type]
|
|
181
|
+
)
|
|
182
|
+
# Structured output (TODO: Use a more robust parser)
|
|
183
|
+
pattern = r"(\d+)\.\s*persona_name:\s*(.*?)\s*persona_description:\s*(.*?)\s*(?=\d+\.|$)" # noqa: E501
|
|
184
|
+
matches = re.findall(pattern, response.msg.content, re.DOTALL)
|
|
185
|
+
|
|
186
|
+
personas: Dict[uuid.UUID, Persona] = {}
|
|
187
|
+
for match in matches:
|
|
188
|
+
name = match[1].strip()
|
|
189
|
+
description = match[2].strip()
|
|
190
|
+
new_persona = Persona(name=name, description=description)
|
|
191
|
+
personas[new_persona.id] = new_persona
|
|
192
|
+
except Exception as e:
|
|
193
|
+
raise RuntimeError(f"Persona to persona step failed: {e}")
|
|
194
|
+
|
|
195
|
+
return personas
|
|
196
|
+
|
|
197
|
+
def deduplicate(
|
|
198
|
+
self,
|
|
199
|
+
embedding_model: Optional[BaseEmbedding] = None,
|
|
200
|
+
similarity_threshold: float = 0.85,
|
|
201
|
+
) -> None:
|
|
202
|
+
r"""Remove similar personas from the group.
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
embedding_model (BaseEmbedding): The embedding model
|
|
206
|
+
for similarity compairsion. (default is `None`).
|
|
207
|
+
similarity_threshold (float): The similarity threshold for
|
|
208
|
+
deduplication (default is `0.85`).
|
|
209
|
+
"""
|
|
210
|
+
# Changed to default similarity threshold to 0.85 as the default
|
|
211
|
+
# text-embedding-3-small model may give lower similarities than others
|
|
212
|
+
# This is a simplified version. Need to implement a more
|
|
213
|
+
# sophisticated deduplication algorithm as described in the paper.
|
|
214
|
+
if not embedding_model:
|
|
215
|
+
from camel.embeddings import OpenAIEmbedding
|
|
216
|
+
|
|
217
|
+
embedding_model = OpenAIEmbedding()
|
|
218
|
+
unique_personas: Dict[uuid.UUID, Persona] = {}
|
|
219
|
+
for persona_id, persona in self.personas.items():
|
|
220
|
+
if not any(
|
|
221
|
+
self._is_similar(
|
|
222
|
+
persona, up, similarity_threshold, embedding_model
|
|
223
|
+
)
|
|
224
|
+
for up in unique_personas.values()
|
|
225
|
+
):
|
|
226
|
+
unique_personas[persona_id] = persona
|
|
227
|
+
self.personas = unique_personas
|
|
228
|
+
|
|
229
|
+
@staticmethod
|
|
230
|
+
@lru_cache(maxsize=128)
|
|
231
|
+
def _get_embedding(
|
|
232
|
+
embedding_model: BaseEmbedding, description: Optional[str]
|
|
233
|
+
) -> list[float]:
|
|
234
|
+
r"""Cache embeddings to reduce recomputation."""
|
|
235
|
+
return embedding_model.embed(description)
|
|
236
|
+
|
|
237
|
+
@staticmethod
|
|
238
|
+
def _cosine_similarity(vec1: np.ndarray, vec2: np.ndarray) -> float:
|
|
239
|
+
r"""Copmute the cosine similarity of two vectors.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
vec1 (np.ndarray): Vector 1
|
|
243
|
+
vec2 (np.ndarray): Vector 2
|
|
244
|
+
"""
|
|
245
|
+
return np.dot(vec1, vec2) / (
|
|
246
|
+
np.linalg.norm(vec1) * np.linalg.norm(vec2)
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
def _is_similar(
|
|
250
|
+
self,
|
|
251
|
+
persona1: Persona,
|
|
252
|
+
persona2: Persona,
|
|
253
|
+
similarity_threshold: float,
|
|
254
|
+
embedding_model: BaseEmbedding,
|
|
255
|
+
) -> bool:
|
|
256
|
+
r"""Check if two personas are similar by consine similarity
|
|
257
|
+
of the embeddings of their descriptions.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
persona1 (Persona1): A persona.
|
|
261
|
+
persona2 (Persona2): The other persona.
|
|
262
|
+
similarity_threshold (float): The threshold on consine similarity
|
|
263
|
+
to determine whether the two personas are similar.
|
|
264
|
+
embedding_model (BaseEmbedding): The embedding model
|
|
265
|
+
for similarity compairsion.
|
|
266
|
+
"""
|
|
267
|
+
|
|
268
|
+
# Ensure persona descriptions are not None
|
|
269
|
+
persona1_description = persona1.description or ""
|
|
270
|
+
persona2_description = persona2.description or ""
|
|
271
|
+
|
|
272
|
+
persona1_embeddings = self._get_embedding(
|
|
273
|
+
embedding_model, persona1_description
|
|
274
|
+
)
|
|
275
|
+
persona2_embeddings = self._get_embedding(
|
|
276
|
+
embedding_model, persona2_description
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
similarity = self._cosine_similarity(
|
|
280
|
+
np.array(persona1_embeddings), np.array(persona2_embeddings)
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
return similarity >= similarity_threshold
|
|
284
|
+
|
|
285
|
+
def __len__(self):
|
|
286
|
+
return len(self.personas)
|
|
287
|
+
|
|
288
|
+
def __iter__(self):
|
|
289
|
+
return iter(self.personas.values())
|
|
290
|
+
|
|
291
|
+
def get_all_personas(self) -> List[Persona]:
|
|
292
|
+
r"""Return a list of all personas."""
|
|
293
|
+
return list(self.personas.values())
|
camel/prompts/__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 .ai_society import AISocietyPromptTemplateDict
|
|
15
15
|
from .base import CodePrompt, TextPrompt, TextPromptDict
|
|
16
16
|
from .code import CodePromptTemplateDict
|
|
@@ -24,6 +24,7 @@ from .multi_condition_image_craft import (
|
|
|
24
24
|
MultiConditionImageCraftPromptTemplateDict,
|
|
25
25
|
)
|
|
26
26
|
from .object_recognition import ObjectRecognitionPromptTemplateDict
|
|
27
|
+
from .persona_hub import PersonaHubPrompt
|
|
27
28
|
from .prompt_templates import PromptTemplateGenerator
|
|
28
29
|
from .role_description_prompt_template import RoleDescriptionPromptTemplateDict
|
|
29
30
|
from .solution_extraction import SolutionExtractionPromptTemplateDict
|
|
@@ -43,6 +44,7 @@ __all__ = [
|
|
|
43
44
|
'RoleDescriptionPromptTemplateDict',
|
|
44
45
|
'TaskPromptTemplateDict',
|
|
45
46
|
'PromptTemplateGenerator',
|
|
47
|
+
'PersonaHubPrompt',
|
|
46
48
|
'SolutionExtractionPromptTemplateDict',
|
|
47
49
|
'GenerateTextEmbeddingDataPromptTemplateDict',
|
|
48
50
|
'ObjectRecognitionPromptTemplateDict',
|
camel/prompts/ai_society.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 typing import Any
|
|
15
15
|
|
|
16
16
|
from camel.prompts.base import TextPrompt, TextPromptDict
|
camel/prompts/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
|
import inspect
|
|
15
15
|
from typing import Any, Callable, Dict, Optional, Set, TypeVar, Union
|
|
16
16
|
|
camel/prompts/code.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 typing import Any
|
|
15
15
|
|
|
16
16
|
from camel.prompts.base import TextPrompt, TextPromptDict
|
camel/prompts/evaluation.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 typing import Any
|
|
15
15
|
|
|
16
16
|
from camel.prompts.base import TextPrompt, TextPromptDict
|
|
@@ -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 Any
|
|
15
15
|
|
|
16
16
|
from camel.prompts import TextPrompt, TextPromptDict
|