🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
docs: update customer_service_Discord_bot_using_SambaNova_with_agentic_RAG (#1295)
Wendong-Fana9607123a175
diff --git a/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb b/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynbindex 539f331f3..09e957fd4 100644--- a/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb+++ b/docs/cookbooks/customer_service_Discord_bot_using_SambaNova_with_agentic_RAG.ipynb@@ -1,7 +1,6 @@{"cells": [{- "attachments": {},"cell_type": "markdown","metadata": {},"source": [@@ -9,7 +8,6 @@]},{- "attachments": {},"cell_type": "markdown","metadata": {},"source": [@@ -93,7 +91,7 @@"base_uri": "https://localhost:8080/"},"id": "JwWjlgNGO5ne",- "outputId": "6e0c6f84-446f-4ec5-c3e3-0b412d67c843"+ "outputId": "355dc50b-0b8b-410e-c477-45ef9533eeb0"},"outputs": [{@@ -139,7 +137,7 @@"base_uri": "https://localhost:8080/"},"id": "OCMBZ_cbbEDZ",- "outputId": "3dc6eec0-f365-4a86-ec0c-c7bbc65ea31d"+ "outputId": "f0aa2356-bc67-46a4-91c5-e0390df0a993"},"outputs": [{@@ -178,11 +176,24 @@},{"cell_type": "code",- "execution_count": 21,+ "execution_count": 4,"metadata": {- "id": "EEt-Hx-5WtRQ"+ "colab": {+ "base_uri": "https://localhost:8080/"+ },+ "id": "EEt-Hx-5WtRQ",+ "outputId": "0ae199fb-0cdc-47b3-e140-53212991e1d1"},- "outputs": [],+ "outputs": [+ {+ "name": "stderr",+ "output_type": "stream",+ "text": [+ "/usr/local/lib/python3.10/dist-packages/pydantic/_internal/_fields.py:172: UserWarning: Field name \"schema\" in \"FirecrawlApp.ExtractParams\" shadows an attribute in parent \"BaseModel\"\n",+ " warnings.warn(\n"+ ]+ }+ ],"source": ["import os\n","from typing import List\n",@@ -216,14 +227,14 @@"id": "2xM10-BCgPXf"},"source": [- "Qwen is a large language model developed by Alibaba Cloud. It is trained on a massive dataset of text and code and can generate text, translate languages, write different kinds of creative content, and answer your questions in an informative way.\n",+ "Qwen is large language model developed by Alibaba. It is trained on a massive dataset of text and code and can generate text, translate languages, write different kinds of creative content, and answer your questions in an informative way.\n","\n","Use Qwen model with SambaNova Cloud:"]},{"cell_type": "code",- "execution_count": 15,+ "execution_count": 5,"metadata": {"id": "H6q5xbQtajUj"},@@ -243,16 +254,12 @@" model_platform=ModelPlatformType.SAMBA,\n"," model_type=\"Qwen2.5-Coder-32B-Instruct\",\n"," model_config_dict=SambaCloudAPIConfig(max_tokens=4000).as_dict(),\n",- ")\n",- "\n",- "\n",- "# Use Qwen 2.5 70b model\n",- "model = qwen_70b_model"+ ")"]},{"cell_type": "code",- "execution_count": 16,+ "execution_count": 6,"metadata": {"id": "LCGoQ5Q2JuiQ"},@@ -261,16 +268,24 @@"from camel.agents import ChatAgent\n","from camel.messages import BaseMessage\n","\n",- "agent = ChatAgent(\n",+ "chat_agent = ChatAgent(\n"," system_message=\"You're a helpful assistant\",\n",- " message_window_size=10,\n",- " model=model\n",+ " message_window_size=20,\n",+ " # Use Qwen 2.5 70b model\n",+ " model=qwen_70b_model\n",+ ")\n",+ "\n",+ "code_agent = ChatAgent(\n",+ " system_message=\"You're a helpful assistant\",\n",+ " message_window_size=20,\n",+ " # Use Qwen 2.5 coder 32b model\n",+ " model=qwen_coder_32b_model\n",")\n","\n","knowledge_message = BaseMessage.make_user_message(\n"," role_name=\"User\", content=f\"Based on the following knowledge: {knowledge}\"\n",")\n",- "agent.update_memory(knowledge_message, \"user\")"+ "chat_agent.update_memory(knowledge_message, \"user\")"]},{@@ -284,13 +299,13 @@},{"cell_type": "code",- "execution_count": 17,+ "execution_count": 7,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "QI6VUCkKUm8p",- "outputId": "2b1918b9-e1d3-4e44-8d32-fdf61a51bc29"+ "outputId": "7ff27e17-720e-4e1d-f682-56975e78bc60"},"outputs": [{@@ -298,75 +313,37 @@"output_type": "stream","text": ["Start chatting! Type 'exit' to end the conversation.\n",- "User: what is sambanova?\n",- "Assistant: SambaNova Systems is a technology company that specializes in developing advanced artificial intelligence (AI) and machine learning (ML) hardware and software solutions. Founded in 2017 by Stanford University professors Kunle Olukotun, Chris Ré, and Rodrigo Liang, SambaNova is headquartered in Palo Alto, California.\n",+ "User: what is SambaNova?\n",+ "Assistant: SambaNova Systems is a technology company that specializes in developing advanced computing systems for artificial intelligence (AI) and machine learning (ML) applications. Founded in 2017 by Rodrigo Liang, Christopher Ré, and Kunle Olukotun, SambaNova is headquartered in Palo Alto, California.\n","\n",- "### Key Features and Offerings:\n",+ "### Key Features and Products:\n","\n",- "1. **Reconfigurable Dataflow Architecture (RDA):**\n",- " - SambaNova's core technology is based on a reconfigurable dataflow architecture, which is designed to optimize the performance of AI and ML workloads. This architecture allows for more efficient and flexible processing compared to traditional CPU and GPU-based systems.\n",+ "1. **Reconfigurable Dataflow Unit (RDU):**\n",+ " - SambaNova's core technology is the Reconfigurable Dataflow Unit (RDU), which is designed to accelerate AI and ML workloads. The RDU is a highly flexible and efficient processor that can be reconfigured to optimize performance for different types of AI tasks.\n","\n","2. **DataScale Systems:**\n",- " - SambaNova offers DataScale systems, which are high-performance AI and ML platforms. These systems are designed to handle large-scale data processing and complex AI models, making them suitable for a wide range of applications, including natural language processing, computer vision, and recommendation systems.\n",+ " - SambaNova offers DataScale systems, which are integrated hardware and software solutions designed to handle large-scale AI and ML workloads. These systems are built to provide high performance, scalability, and ease of use.\n","\n","3. **Software Stack:**\n",- " - The company provides a comprehensive software stack that includes tools for model training, inference, and deployment. This stack is designed to be user-friendly and to integrate seamlessly with existing AI workflows.\n",- "\n",- "4. **Cloud and On-Premises Solutions:**\n",- " - SambaNova's solutions can be deployed in the cloud or on-premises, giving customers flexibility in how they manage their AI infrastructure.\n",- "\n",- "5. **Industry Applications:**\n",- " - SambaNova's technology is used in various industries, including healthcare, finance, automotive, and research. It is particularly well-suited for applications that require high computational power and efficiency, such as drug discovery, financial modeling, and autonomous driving.\n",- "\n",- "### Notable Achievements:\n",- "\n",- "- **Funding:** SambaNova has raised significant funding from investors, including SoftBank, BlackRock, and Intel Capital.\n",- "- **Partnerships:** The company has formed partnerships with leading organizations and institutions to advance AI research and development.\n",- "- **Performance:** SambaNova's systems have demonstrated superior performance in benchmarks and real-world applications, often outperforming traditional GPU-based solutions.\n",- "\n",- "### Conclusion:\n",- "\n",- "SambaNova Systems is at the forefront of AI and ML innovation, offering cutting-edge hardware and software solutions that are designed to accelerate the development and deployment of AI models. Their reconfigurable dataflow architecture and comprehensive software stack make them a valuable player in the rapidly evolving AI landscape.\n",- "User: what models sambanova support?\n",- "Assistant: SambaNova Systems supports a wide range of AI and machine learning models, leveraging its advanced hardware and software stack to optimize performance and efficiency. Here are some of the key models and types of workloads that SambaNova's systems can handle:\n",- "\n",- "### Natural Language Processing (NLP)\n",- "- **Transformers:** Models like BERT, RoBERTa, T5, and GPT-3, which are widely used for tasks such as text classification, sentiment analysis, and language generation.\n",- "- **Sequence-to-Sequence Models:** Models like LSTM and GRU, which are used for tasks like machine translation and text summarization.\n",+ " - The company provides a comprehensive software stack that includes tools for model training, inference, and deployment. This stack is designed to work seamlessly with the RDU and other components of the DataScale system.\n","\n",- "### Computer Vision\n",- "- **Convolutional Neural Networks (CNNs):** Models like ResNet, Inception, and EfficientNet, which are used for image classification, object detection, and segmentation.\n",- "- **Generative Models:** Models like GANs (Generative Adversarial Networks) and VAEs (Variational Autoencoders), which are used for image generation and data augmentation.\n",+ "4. **Applications:**\n",+ " - SambaNova's technology is used in a variety of applications, including natural language processing (NLP), computer vision, recommendation systems, and scientific computing. It is particularly well-suited for tasks that require high computational power and large datasets.\n","\n",- "### Reinforcement Learning\n",- "- **Policy Gradients:** Algorithms like REINFORCE and PPO (Proximal Policy Optimization), which are used for training agents in complex environments.\n",- "- **Q-Learning:** Algorithms like DQN (Deep Q-Network) and Double DQN, which are used for decision-making tasks.\n",+ "### Market Position and Impact:\n","\n",- "### Recommendation Systems\n",- "- **Matrix Factorization:** Models that decompose user-item interaction matrices to make personalized recommendations.\n",- "- **Neural Collaborative Filtering:** Models that use neural networks to capture complex user-item interactions.\n",+ "- **Innovation in AI Hardware:**\n",+ " - SambaNova is part of a growing trend of companies developing specialized hardware for AI and ML. By focusing on reconfigurable and flexible architectures, SambaNova aims to provide more efficient and powerful solutions compared to traditional GPU-based systems.\n","\n",- "### Time Series Analysis\n",- "- **Recurrent Neural Networks (RNNs):** Models like LSTM and GRU, which are used for forecasting and anomaly detection in time series data.\n",- "- **Transformers for Time Series:** Models that adapt the transformer architecture for time series tasks.\n",+ "- **Partnerships and Customers:**\n",+ " - The company has formed partnerships with leading organizations and has customers in various industries, including healthcare, finance, and research. Notable partnerships include collaborations with the U.S. Department of Energy and major cloud providers.\n","\n",- "### Graph Neural Networks (GNNs)\n",- "- **Graph Convolutional Networks (GCNs):** Models that operate on graph-structured data, used for tasks like node classification and link prediction.\n",- "- **Graph Attention Networks (GATs):** Models that use attention mechanisms to weigh the importance of different nodes in a graph.\n",+ "- **Funding and Growth:**\n",+ " - SambaNova has raised significant funding from investors, including SoftBank, BlackRock, and Intel Capital. This financial backing has allowed the company to rapidly expand its R&D efforts and market presence.\n","\n",- "### Custom Models\n",- "- **User-Defined Models:** SambaNova's platform supports the development and deployment of custom models, allowing researchers and developers to leverage the company's hardware and software stack for their specific needs.\n",- "\n",- "### Frameworks and Libraries\n",- "- **TensorFlow and PyTorch:** SambaNova's systems are compatible with popular deep learning frameworks, making it easy to integrate with existing workflows.\n",- "- **ONNX (Open Neural Network Exchange):** Support for ONNX allows for model interoperability across different frameworks and platforms.\n",- "\n",- "### Performance Optimization\n",- "- **Model Parallelism:** SambaNova's systems can distribute large models across multiple devices to improve training and inference performance.\n",- "- **Data Parallelism:** Support for data parallelism allows for efficient training on large datasets by distributing the data across multiple devices.\n",+ "### Conclusion:\n","\n",- "### Conclusion\n",- "SambaNova Systems is designed to support a broad spectrum of AI and machine learning models, from state-of-the-art deep learning architectures to custom models. Their reconfigurable dataflow architecture and comprehensive software stack ensure that these models can be trained and deployed efficiently, making SambaNova a valuable tool for researchers and organizations working on complex AI projects.\n",+ "SambaNova Systems is a leading innovator in the field of AI and ML hardware, offering advanced computing solutions that are designed to meet the growing demands of data-intensive applications. With its focus on reconfigurable and flexible architectures, SambaNova is well-positioned to play a significant role in the future of AI computing.\n","User: exit\n","Ending conversation.\n"]@@ -381,7 +358,7 @@" print(\"Ending conversation.\")\n"," break\n","\n",- " assistant_response = agent.step(user_input)\n",+ " assistant_response = chat_agent.step(user_input)\n"," print(f\"Assistant: {assistant_response.msgs[0].content}\")"]},@@ -439,13 +416,13 @@},{"cell_type": "code",- "execution_count": 18,+ "execution_count": 8,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "j4jWkKAp24Bk",- "outputId": "7b72fc39-ed84-48cc-a992-77c400c25e74"+ "outputId": "bd6d3042-3509-454b-a3e1-a427c572ad49"},"outputs": [{@@ -475,23 +452,25 @@},{"cell_type": "code",- "execution_count": 19,+ "execution_count": 10,"metadata": {"colab": {"base_uri": "https://localhost:8080/"},"id": "dQUiOk-K_4P6",- "outputId": "e417d78d-b42e-412a-aad7-de1c937d73ff"+ "outputId": "afab9d5c-5c39-4bfa-8731-f75558b1238b"},"outputs": [{"name": "stderr","output_type": "stream","text": [- "\u001b[30;1m2024-12-08 09:44:40\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.client\u001b[0m logging in using static token\n",+ "\u001b[30;1m2024-12-08 15:33:21\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.client\u001b[0m logging in using static token\n",+ "\u001b[30;1m2024-12-08 15:33:21\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.client\u001b[0m logging in using static token\n","INFO:discord.client:logging in using static token\n",- "\u001b[30;1m2024-12-08 09:44:41\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.gateway\u001b[0m Shard ID None has connected to Gateway (Session ID: 2ede6a3c65abf565b779f0e8795e1cdf).\n",- "INFO:discord.gateway:Shard ID None has connected to Gateway (Session ID: 2ede6a3c65abf565b779f0e8795e1cdf).\n"+ "\u001b[30;1m2024-12-08 15:33:23\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.gateway\u001b[0m Shard ID None has connected to Gateway (Session ID: 4f66257db5d223056b2ead47fb0bac2c).\n",+ "\u001b[30;1m2024-12-08 15:33:23\u001b[0m \u001b[34;1mINFO \u001b[0m \u001b[35mdiscord.gateway\u001b[0m Shard ID None has connected to Gateway (Session ID: 4f66257db5d223056b2ead47fb0bac2c).\n",+ "INFO:discord.gateway:Shard ID None has connected to Gateway (Session ID: 4f66257db5d223056b2ead47fb0bac2c).\n"]}],@@ -515,7 +494,7 @@" return\n"," user_input = message.content\n","\n",- " assistant_response = agent.step(user_input)\n",+ " assistant_response = chat_agent.step(user_input) # you can also set coder_agent for code generation\n","\n"," response_content = assistant_response.msgs[0].content\n","\n",@@ -528,6 +507,15 @@"discord_bot.run()"]},+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "3jtjJShr6TID"+ },+ "source": [+ "**Example response from chat_agent:**"+ ]+ },{"cell_type": "markdown","metadata": {@@ -537,6 +525,24 @@""]},+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "NijzPFU_6YN6"+ },+ "source": [+ "**Example response from code_agent:**"+ ]+ },+ {+ "cell_type": "markdown",+ "metadata": {+ "id": "RCmY5-426KnE"+ },+ "source": [+ ""+ ]+ },{"cell_type": "markdown","metadata": {@@ -559,7 +565,7 @@},{"cell_type": "code",- "execution_count": 20,+ "execution_count": null,"metadata": {"colab": {"base_uri": "https://localhost:8080/",@@ -860,7 +866,7 @@},{"cell_type": "code",- "execution_count": 23,+ "execution_count": null,"metadata": {"id": "DCiF-4DQAZIS"},@@ -878,7 +884,7 @@" storage_type=StorageType.QDRANT,\n"," embedding_model=sentence_encoder\n"," )\n",- "sambanova_agent = ChatAgent(system_message=assistant_sys_msg, model=model)"+ "sambanova_agent = ChatAgent(system_message=assistant_sys_msg, model=qwen_70b_model)"]},{@@ -892,7 +898,7 @@},{"cell_type": "code",- "execution_count": 24,+ "execution_count": null,"metadata": {"colab": {"base_uri": "https://localhost:8080/"