Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/camel-ai/camel
Browse files Browse the repository at this point in the history
In this merge I have integrated Sympy into CAMEL's toolkit folder, this will allow Agents to perform more complex mathematical
operations such as algebraic manipulation, calculus and linear algebra
  • Loading branch information
waleedalzarooni committed Jan 14, 2025
2 parents f7b6b75 + 20aab5d commit b63c69a
Show file tree
Hide file tree
Showing 79 changed files with 14,411 additions and 11,494 deletions.
5 changes: 4 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
# CHUNKR_API_KEY="Fill your API key here"

# Meshy API (https://www.meshy.ai/api)
# MESHY_API_KEY="Fill your API key here"
# MESHY_API_KEY="Fill your API key h ere"

# Dappier API (https://api.dappier.com/)
# DAPPIER_API_KEY="Fill your API key here"

# Discord Bot API (https://discord.com/developers/applications)
# DISCORD_BOT_TOKEN="Fill your API key here"
1 change: 1 addition & 0 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
GEMINI_API_KEY: "${{ secrets.GEMINI_API_KEY }}"
DEEPSEEK_API_KEY: "${{ secrets.DEEPSEEK_API_KEY }}"
DAPPIER_API_KEY: "${{ secrets.DAPPIER_API_KEY }}"
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
run: |
source venv/bin/activate
pytest --fast-test-mode ./test
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pytest_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
GEMINI_API_KEY: "${{ secrets.GEMINI_API_KEY }}"
DEEPSEEK_API_KEY: "${{ secrets.DEEPSEEK_API_KEY }}"
DAPPIER_API_KEY: "${{ secrets.DAPPIER_API_KEY }}"
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
run: poetry run pytest --fast-test-mode test/

pytest_package_llm_test:
Expand Down Expand Up @@ -101,6 +102,7 @@ jobs:
GEMINI_API_KEY: "${{ secrets.GEMINI_API_KEY }}"
DEEPSEEK_API_KEY: "${{ secrets.DEEPSEEK_API_KEY }}"
DAPPIER_API_KEY: "${{ secrets.DAPPIER_API_KEY }}"
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
run: poetry run pytest --llm-test-only test/

pytest_package_very_slow_test:
Expand Down Expand Up @@ -146,4 +148,5 @@ jobs:
GEMINI_API_KEY: "${{ secrets.GEMINI_API_KEY }}"
DEEPSEEK_API_KEY: "${{ secrets.DEEPSEEK_API_KEY }}"
DAPPIER_API_KEY: "${{ secrets.DAPPIER_API_KEY }}"
DISCORD_BOT_TOKEN: "${{ secrets.DISCORD_BOT_TOKEN }}"
run: poetry run pytest --very-slow-test-only test/
201 changes: 60 additions & 141 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,123 +82,29 @@ To install the base CAMEL library:
pip install camel-ai
```

CAMEL offers various optional features through extras. You can install them based on your needs:

- To install with all dependencies (includes all features below):
```bash
pip install 'camel-ai[all]'
```

- For specific features:
- Model Platforms (OpenAI, Google, Mistral, Anthropic Claude, Cohere, etc.):
```bash
pip install 'camel-ai[model_platforms]'
```
- HuggingFace Ecosystem (Transformers, Diffusers, Accelerate, Datasets, PyTorch, etc.):
```bash
pip install 'camel-ai[huggingface]'
```
- RAG Components (Sentence Transformers, Qdrant, Milvus, BM25, etc.):
```bash
pip install 'camel-ai[rag]'
```
- Storage Solutions (Neo4j, Redis, Azure Blob, Google Cloud Storage, AWS S3, etc.):
```bash
pip install 'camel-ai[storage]'
```
- Web Tools (DuckDuckGo, Wikipedia, WolframAlpha, Google Maps, Weather API, etc.):
```bash
pip install 'camel-ai[web_tools]'
```
- Document Processing (PDF, Word, OpenAPI, BeautifulSoup, Unstructured, etc.):
```bash
pip install 'camel-ai[document_tools]'
```
- Media Processing (Image Processing, Audio Processing, YouTube Download, FFmpeg, etc.):
```bash
pip install 'camel-ai[media_tools]'
```
- Communication Platforms (Slack, Discord, Telegram, GitHub, Reddit, Notion, etc.):
```bash
pip install 'camel-ai[communication_tools]'
```
- Data Science & Analytics (Pandas, TextBlob, DataCommons, OpenBB, Stripe, etc.):
```bash
pip install 'camel-ai[data_tools]'
```
- Research Tools (arXiv, Google Scholar, etc.):
```bash
pip install 'camel-ai[research_tools]'
```
- Development Tools (Docker, Jupyter, Tree-sitter, Code Interpreter, etc.):
```bash
pip install 'camel-ai[dev_tools]'
```

You can combine multiple extras by separating them with commas. For example, to set up a RAG system with document processing and web search:
```bash
pip install 'camel-ai[rag,web_tools,document_tools]'
```

### From Source

Install `CAMEL` from source with poetry (Recommended):
```sh
# Make sure your python version is later than 3.10
# You can use pyenv to manage multiple python versions in your system
# Clone github repo
git clone https://github.com/camel-ai/camel.git
# Change directory into project directory
cd camel
# If you didn't install poetry before
pip install poetry # (Optional)
# We suggest using python 3.10
poetry env use python3.10 # (Optional)
# Activate CAMEL virtual environment
poetry shell
> **Note**: Some features may not work without their required dependencies. Install `camel-ai[all]` to ensure all dependencies are available, or install specific extras based on the features you need.
# Install the base CAMEL library
# It takes about 90 seconds
poetry install
# Install CAMEL with all dependencies
poetry install -E all # (Optional)
# Exit the virtual environment
exit
```bash
pip install 'camel-ai[all]' # Replace with options below
```

> [!TIP]
> If you encounter errors when running `poetry install`, it may be due to a cache-related problem. You can try running:
> ```sh
> poetry install --no-cache
> ```


Install `CAMEL` from source with conda and pip:
```sh
# Create a conda virtual environment
conda create --name camel python=3.10
# Activate CAMEL conda environment
conda activate camel
# Clone github repo
git clone -b v0.2.16 https://github.com/camel-ai/camel.git
# Change directory into project directory
cd camel
# Install CAMEL from source
pip install -e .
# Or if you want to use all other extra packages
pip install -e .[all] # (Optional)
Available extras:
- `all`: Includes all features below
- `model_platforms`: OpenAI, Google, Mistral, Anthropic Claude, Cohere etc.
- `huggingface`: Transformers, Diffusers, Accelerate, Datasets, PyTorch etc.
- `rag`: Sentence Transformers, Qdrant, Milvus, BM25 etc.
- `storage`: Neo4j, Redis, Azure Blob, Google Cloud Storage, AWS S3 etc.
- `web_tools`: DuckDuckGo, Wikipedia, WolframAlpha, Google Maps, Weather API etc.
- `document_tools`: PDF, Word, OpenAPI, BeautifulSoup, Unstructured etc.
- `media_tools`: Image Processing, Audio Processing, YouTube Download, FFmpeg etc.
- `communication_tools`: Slack, Discord, Telegram, GitHub, Reddit, Notion etc.
- `data_tools`: Pandas, TextBlob, DataCommons, OpenBB, Stripe etc.
- `research_tools`: arXiv, Google Scholar etc.
- `dev_tools`: Docker, Jupyter, Tree-sitter, Code Interpreter etc.

Multiple extras can be combined using commas:
```bash
pip install 'camel-ai[rag,web_tools,document_tools]' # Example: RAG system with web search and document processing
```

### From Docker
Expand Down Expand Up @@ -320,10 +226,10 @@ The [complete documentation](https://camel-ai.github.io/camel/) pages for the CA
### Agents
Explore different types of agents, their roles, and their applications.
- **[Creating Your First Agent](https://docs.camel-ai.org/cookbooks/create_your_first_agent.html)**
- **[Creating Your First Agent Society](https://docs.camel-ai.org/cookbooks/create_your_first_agents_society.html)**
- **[Embodied Agents](https://docs.camel-ai.org/cookbooks/embodied_agents.html)**
- **[Critic Agents](https://docs.camel-ai.org/cookbooks/critic_agents_and_tree_search.html)**
- **[Creating Your First Agent](https://docs.camel-ai.org/cookbooks/basic_concepts/create_your_first_agent.html)**
- **[Creating Your First Agent Society](https://docs.camel-ai.org/cookbooks/basic_concepts/create_your_first_agents_society.html)**
- **[Embodied Agents](https://docs.camel-ai.org/cookbooks/advanced_features/embodied_agents.html)**
- **[Critic Agents](https://docs.camel-ai.org/cookbooks/advanced_features/critic_agents_and_tree_search.html)**
---
Expand All @@ -348,31 +254,44 @@ Core components and utilities to build, operate, and enhance CAMEL-AI agents and
### Cookbooks
Practical guides and tutorials for implementing specific functionalities in CAMEL-AI agents and societies.
### Basic Concepts
| Cookbook | Description |
|:---|:---|
| **[Creating Your First Agent](https://docs.camel-ai.org/cookbooks/basic_concepts/create_your_first_agent.html)** | A step-by-step guide to building your first agent. |
| **[Creating Your First Agent Society](https://docs.camel-ai.org/cookbooks/basic_concepts/create_your_first_agents_society.html)** | Learn to build a collaborative society of agents. |
| **[Message Cookbook](https://docs.camel-ai.org/cookbooks/basic_concepts/agents_message.html)** | Best practices for message handling in agents. |
### Advanced Features
| Cookbook | Description |
|:---|:---|
| **[Tools Cookbook](https://docs.camel-ai.org/cookbooks/advanced_features/agents_with_tools.html)** | Integrating tools for enhanced functionality. |
| **[Memory Cookbook](https://docs.camel-ai.org/cookbooks/advanced_features/agents_with_memory.html)** | Implementing memory systems in agents. |
| **[RAG Cookbook](https://docs.camel-ai.org/cookbooks/advanced_features/agents_with_rag.html)** | Recipes for Retrieval-Augmented Generation. |
| **[Graph RAG Cookbook](https://docs.camel-ai.org/cookbooks/advanced_features/agents_with_graph_rag.html)** | Leveraging knowledge graphs with RAG. |
| **[Track CAMEL Agents with AgentOps](https://docs.camel-ai.org/cookbooks/advanced_features/agents_tracking.html)** | Tools for tracking and managing agents in operations. |
### Model Training & Data Generation
| Cookbook | Description |
|:---|:---|
| **[Data Generation with CAMEL and Finetuning with Unsloth](https://docs.camel-ai.org/cookbooks/model_training/sft_data_generation_and_unsloth_finetuning_Qwen2_5_7B.html)** | Learn how to generate data with CAMEL and fine-tune models effectively with Unsloth. |
| **[Data Gen with Real Function Calls and Hermes Format](https://docs.camel-ai.org/cookbooks/model_training/data_gen_with_real_function_calls_and_hermes_format.html)** | Explore how to generate data with real function calls and the Hermes format. |
| **[CoT Data Generation and Upload Data to Huggingface](https://docs.camel-ai.org/cookbooks/model_training/cot_data_gen_upload_to_huggingface.html)** | Uncover how to generate CoT data with CAMEL and seamlessly upload it to Huggingface. |
| **[CoT Data Generation and SFT Qwen with Unsolth](https://docs.camel-ai.org/cookbooks/model_training/cot_data_gen_sft_qwen_unsolth_upload_huggingface.html)** | Discover how to generate CoT data using CAMEL and SFT Qwen with Unsolth, and seamlessly upload your data and model to Huggingface. |
### Multi-Agent Systems & Applications
| Cookbook | Description |
|:---|:---|
| **[Role-Playing Scraper for Report & Knowledge Graph Generation](https://docs.camel-ai.org/cookbooks/applications/roleplaying_scraper.html)** | Create role-playing agents for data scraping and reporting. |
| **[Create A Hackathon Judge Committee with Workforce](https://docs.camel-ai.org/cookbooks/multi_agent_society/workforce_judge_committee.html)** | Building a team of agents for collaborative judging. |
| **[Customer Service Discord Bot with Agentic RAG](https://docs.camel-ai.org/cookbooks/applications/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.html)** | Learn how to build a robust customer service bot for Discord using Agentic RAG. |
| **[Customer Service Discord Bot with Local Model](https://docs.camel-ai.org/cookbooks/applications/customer_service_Discord_bot_using_local_model_with_agentic_RAG.html)** | Learn how to build a robust customer service bot for Discord using Agentic RAG which supports local deployment. |
### Data Processing
| Cookbook | Description |
|:---|:---|
| **[Creating Your First Agent](https://docs.camel-ai.org/cookbooks/create_your_first_agent.html)** | A step-by-step guide to building your first agent. |
| **[Creating Your First Agent Society](https://docs.camel-ai.org/cookbooks/create_your_first_agents_society.html)** | Learn to build a collaborative society of agents. |
| **[Society Cookbook](https://docs.camel-ai.org/cookbooks/agents_society.html)** | Advanced configurations for agent societies. |
| **[Model Speed Comparison Cookbook](https://docs.camel-ai.org/cookbooks/model_speed_comparison.html)** | Benchmarking models for performance. |
| **[Message Cookbook](https://docs.camel-ai.org/cookbooks/agents_message.html)** | Best practices for message handling in agents. |
| **[Tools Cookbook](https://docs.camel-ai.org/cookbooks/agents_with_tools.html)** | Integrating tools for enhanced functionality. |
| **[Memory Cookbook](https://docs.camel-ai.org/cookbooks/agents_with_memory.html)** | Implementing memory systems in agents. |
| **[RAG Cookbook](https://docs.camel-ai.org/cookbooks/agents_with_rag.html)** | Recipes for Retrieval-Augmented Generation. |
| **[Prompting Cookbook](https://docs.camel-ai.org/cookbooks/agents_prompting.html)** | Techniques for effective prompt creation. |
| **[Task Generation Cookbook](https://docs.camel-ai.org/cookbooks/task_generation.html)** | Automating task generation for agents. |
| **[Graph RAG Cookbook](https://docs.camel-ai.org/cookbooks/knowledge_graph.html)** | Leveraging knowledge graphs with RAG. |
| **[Role-Playing Scraper for Report & Knowledge Graph Generation](https://docs.camel-ai.org/cookbooks/roleplaying_scraper.html)** | Create role-playing agents for data scraping and reporting. |
| **[Video Analysis](https://docs.camel-ai.org/cookbooks/video_analysis.html)** | Techniques for agents in video data analysis. |
| **[Track CAMEL Agents with AgentOps](https://docs.camel-ai.org/cookbooks/agents_tracking.html)** | Tools for tracking and managing agents in operations. |
| **[Create A Hackathon Judge Committee with Workforce](https://docs.camel-ai.org/cookbooks/workforce_judge_committee.html)** | Building a team of agents for collaborative judging. |
| **[3 Ways to Ingest Data from Websites with Firecrawl](https://docs.camel-ai.org/cookbooks/ingest_data_from_websites_with_Firecrawl.html)** | Explore three methods for extracting and processing data from websites using Firecrawl. |
| **[Data Deneration with CAMEL and Finetuning with Unsloth](https://docs.camel-ai.org/cookbooks/sft_data_generation_and_unsloth_finetuning.html)** | Learn how to generate data with CAMEL and fine-tune models effectively with Unsloth. |
| **[Customer Service Discord Bot with Agentic RAG](https://docs.camel-ai.org/cookbooks/customer_service_Discord_bot_with_agentic_RAG.html)** | Learn how to build a robust customer service bot for Discord using Agentic RAG. |
| **[Create AI Agents that work with your PDFs using Chunkr & Mistral AI](https://docs.camel-ai.org/cookbooks/agent_with_chunkr_for_pdf_parsing.html)** | Learn how to create AI agents that work with your PDFs using Chunkr and Mistral AI. |
| **[Data Gen with Real Function Calls and Hermes Format](https://docs.camel-ai.org/cookbooks/data_gen_with_real_function_calls_and_hermes_format.html)** | Explore how to generate data with real function calls and the Hermes format. |
| **[CoT Data Generation and Upload Data to Huggingface](https://docs.camel-ai.org/cookbooks/cot_data_gen_upload_to_huggingface.html)** | Uncover how to generate CoT data with CAMEL and seamlessly upload it to Huggingface. |
| **[CoT Data Generation and SFT Qwen with Unsolth, Uploading Data and Model to Hugging Face](https://docs.camel-ai.org/cookbooks/cot_data_gen_sft_qwen_unsolth_upload_huggingface.html)** | Discover how to generate CoT data using CAMEL and SFT Qwen with Unsolth, and seamlessly upload your data and model to Huggingface. |
| **[Customer Service Discord Bot with Agentic RAG supports local model deployment](https://docs.camel-ai.org/cookbooks/customer_service_Discord_bot_using_local_model_with_agentic_RAG.html)** | Learn how to build a robust customer service bot for Discord using Agentic RAG which supports local deployment. |
| **[Video Analysis](https://docs.camel-ai.org/cookbooks/data_processing/video_analysis.html)** | Techniques for agents in video data analysis. |
| **[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. |
| **[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. |
## Utilize Various LLMs as Backends
Expand Down
49 changes: 26 additions & 23 deletions apps/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,37 +563,40 @@ def change_society(society_name: str) -> Tuple[Dict, Dict, str]:
lambda v: gr.update(visible=v), task_specifier_cb, ts_word_limit_nb
)

def start_chain():
state = cleanup_on_launch(session_state.value)
state, specified_task, task_prompt, chat, progress = (
role_playing_start(
state,
society_dd.value,
assistant_ta.value,
user_ta.value,
original_task_ta.value,
num_messages_sl.value,
task_specifier_cb.value,
ts_word_limit_nb.value,
language_ta.value,
)
)
state, chat, progress = role_playing_chat_init(state)
return (
state,
specified_task,
task_prompt,
chat,
progress,
)

start_bn.click(
cleanup_on_launch,
session_state,
[session_state, chatbot, start_bn],
queue=False,
).then(
role_playing_start,
[
session_state,
society_dd,
assistant_ta,
user_ta,
original_task_ta,
num_messages_sl,
task_specifier_cb,
ts_word_limit_nb,
language_ta,
],
[
fn=start_chain,
outputs=[
session_state,
specified_task_ta,
task_prompt_ta,
chatbot,
progress_sl,
],
queue=False,
).then(
role_playing_chat_init,
session_state,
[session_state, chatbot, progress_sl],
queue=False,
)

blocks.load(
Expand Down
1 change: 0 additions & 1 deletion apps/agents/test/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
)


@pytest.mark.skip(reason="Skipping this test temporarily")
def test_construct_blocks():
blocks = construct_blocks(None)
assert isinstance(blocks, gr.Blocks)
Expand Down
2 changes: 1 addition & 1 deletion camel/agents/chat_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ def _is_standard_response(self, response: Any) -> bool:
return True

if self.model_type.support_native_tool_calling:
return response.choices[0].message.tool_calls is None
return not response.choices[0].message.tool_calls

return "</function>" not in str(
response.choices[0].message.content or ""
Expand Down
Loading

0 comments on commit b63c69a

Please sign in to comment.