|
| 1 | +# =========== Copyright 2023 @ 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 @ CAMEL-AI.org. All Rights Reserved. =========== |
| 14 | + |
| 15 | +from camel.agents import ChatAgent |
| 16 | +from camel.configs.openai_config import ChatGPTConfig |
| 17 | +from camel.messages import BaseMessage |
| 18 | +from camel.models import ModelFactory |
| 19 | +from camel.toolkits import GoogleScholarToolkit |
| 20 | +from camel.types import ModelPlatformType, ModelType |
| 21 | + |
| 22 | +# Define system message |
| 23 | +sys_msg = BaseMessage.make_assistant_message( |
| 24 | + role_name="Tools calling opertor", content="You are a helpful assistant" |
| 25 | +) |
| 26 | + |
| 27 | +# Set model config |
| 28 | +tools = GoogleScholarToolkit( |
| 29 | + author_identifier="https://scholar.google.com/citations?user=JicYPdAAAAAJ&hl=en&oi=ao" |
| 30 | +).get_tools() |
| 31 | +model_config_dict = ChatGPTConfig( |
| 32 | + temperature=0.0, |
| 33 | +).as_dict() |
| 34 | + |
| 35 | +model = ModelFactory.create( |
| 36 | + model_platform=ModelPlatformType.OPENAI, |
| 37 | + model_type=ModelType.GPT_4O_MINI, |
| 38 | + model_config_dict=model_config_dict, |
| 39 | +) |
| 40 | + |
| 41 | +# Set agent |
| 42 | +camel_agent = ChatAgent( |
| 43 | + system_message=sys_msg, |
| 44 | + model=model, |
| 45 | + tools=tools, |
| 46 | +) |
| 47 | +camel_agent.reset() |
| 48 | + |
| 49 | +# Define a user message |
| 50 | +usr_msg = BaseMessage.make_user_message( |
| 51 | + role_name="CAMEL User", |
| 52 | + content="get the detailed information of this author", |
| 53 | +) |
| 54 | + |
| 55 | +# Get response information |
| 56 | +response = camel_agent.step(usr_msg) |
| 57 | +print(str(response.info['tool_calls'])[:1000]) |
| 58 | +""" |
| 59 | +=============================================================================== |
| 60 | +[FunctionCallingRecord(func_name='get_author_detailed_info', args={}, result= |
| 61 | +{'container_type': 'Author', 'filled': ['basics', 'indices', 'counts', |
| 62 | +'coauthors', 'publications', 'public_access'], 'scholar_id': 'JicYPdAAAAAJ', |
| 63 | +'source': <AuthorSource.AUTHOR_PROFILE_PAGE: 'AUTHOR_PROFILE_PAGE'>, 'name': |
| 64 | +'Geoffrey Hinton', 'url_picture': 'https://scholar.googleusercontent.com/ |
| 65 | +citations?view_op=view_photo&user=JicYPdAAAAAJ&citpid=2', 'affiliation': |
| 66 | +'Emeritus Prof. Computer Science, University of Toronto', 'organization': |
| 67 | +8515235176732148308, 'interests': ['machine learning', 'psychology', |
| 68 | +'artificial intelligence', 'cognitive science', 'computer science'], |
| 69 | +'email_domain': '@cs.toronto.edu', 'homepage': 'http://www.cs.toronto.edu/ |
| 70 | +~hinton', 'citedby': 853541, 'citedby5y': 560063, 'hindex': 186, 'hindex5y': |
| 71 | +137, 'i10index': 483, 'i10index5y': 368, 'cites_per_year': {1989: 2627, 1990: |
| 72 | +3589, 1991: 3766, 1992: 4091, 1993: 4573, 1994: 4499, 1995: 4090, 1996: 3935, |
| 73 | +1997: 3740, 1998: 3744, 1999: 3559, 2000: 3292, 2001: 3398, 2002: 3713, 2003: |
| 74 | +3670, 2004: 3393, 2005: 3813, 2006: 4168, 2007: 4558, 2008: 4349, 2009: 4784, |
| 75 | +2010: 5238, 2011: 5722, 2012: 6746, 2013: 9900, 2014: 12751, 2015: 18999, |
| 76 | +2016: 29932, 2017: 43675, 2018: 63544, 2019: 80800, 2020: 90523, 2021: 101735, |
| 77 | +2022: 104036, 2023: 106452, 2024: 76413}, 'coauthors': [{'container_type': |
| 78 | +'Author', 'filled': [], 'scholar_id': 'm1qAiOUAAAAJ', 'source': <AuthorSource. |
| 79 | +CO_AUTHORS_LIST: 'CO_AUTHORS_LIST'>, 'name': 'Terrence Sejnowski', |
| 80 | +'affiliation': 'Francis Crick Professor, Salk Institute, Distingished |
| 81 | +Professor, UC San Diego'}, {'container_type': 'Author', 'filled': [], |
| 82 | +'scholar_id': 'RnoIxUwAAAAJ', 'source': <AuthorSource.CO_AUTHORS_LIST: |
| 83 | +'CO_AUTHORS_LIST'>, 'name': 'Vinod Nair', 'affiliation': 'Research Scientist, |
| 84 | +DeepMind'}, {'container_type': 'Author', 'filled': [], 'scholar_id': |
| 85 | +'ghbWy-0AAAAJ', 'source': <AuthorSource.CO_AUTHORS_LIST: 'CO_AUTHORS_LIST'>, |
| 86 | +'name': 'George E. Dahl', 'affiliation': 'Google Inc.'}, {'container_ |
| 87 | +=============================================================================== |
| 88 | +""" |
| 89 | + |
| 90 | +# Define a user message |
| 91 | +usr_msg = BaseMessage.make_user_message( |
| 92 | + role_name="CAMEL User", content="get the publications of this author" |
| 93 | +) |
| 94 | + |
| 95 | +# Get response information |
| 96 | +response = camel_agent.step(usr_msg) |
| 97 | +print(str(response.info['tool_calls'])[:1000]) |
| 98 | +""" |
| 99 | +=============================================================================== |
| 100 | +[FunctionCallingRecord(func_name='get_author_publications', args={}, result= |
| 101 | +['Imagenet classification with deep convolutional neural networks', 'Deep |
| 102 | +learning', 'Learning internal representations by error-propagation', 'Dropout: |
| 103 | +a simple way to prevent neural networks from overfitting', 'Visualizing data |
| 104 | +using t-SNE', 'Learning representations by back-propagating errors', 'Learning |
| 105 | +multiple layers of features from tiny images', 'Rectified linear units improve |
| 106 | +restricted boltzmann machines', 'Reducing the dimensionality of data with |
| 107 | +neural networks', 'A fast learning algorithm for deep belief nets', |
| 108 | +'Distilling the Knowledge in a Neural Network', 'A simple framework for |
| 109 | +contrastive learning of visual representations', 'Deep neural networks for |
| 110 | +acoustic modeling in speech recognition: The shared views of four research |
| 111 | +groups', 'Layer normalization', 'Speech recognition with deep recurrent neural |
| 112 | +networks', 'Improving neural networks by preventing co-adaptation of feature |
| 113 | +detectors', 'Lec |
| 114 | +=============================================================================== |
| 115 | +""" |
| 116 | + |
| 117 | +# ruff: noqa: E501 |
| 118 | +# Define a user message |
| 119 | +usr_msg = BaseMessage.make_user_message( |
| 120 | + role_name="CAMEL User", |
| 121 | + content="""get the detailed information for publication with title: `Camel: Communicative agents for" mind" exploration of large language model society`""", |
| 122 | +) |
| 123 | + |
| 124 | +# Get response information |
| 125 | +response = camel_agent.step(usr_msg) |
| 126 | +print(response.info['tool_calls']) |
| 127 | +""" |
| 128 | +=============================================================================== |
| 129 | +[FunctionCallingRecord(func_name='get_publication_by_title', args= |
| 130 | +{'publication_title': 'Camel: Communicative agents for" mind" exploration of |
| 131 | +large language model society'}, result={'container_type': 'Publication', |
| 132 | +'source': <PublicationSource.AUTHOR_PUBLICATION_ENTRY: |
| 133 | +'AUTHOR_PUBLICATION_ENTRY'>, 'bib': {'title': 'Camel: Communicative agents |
| 134 | +for" mind" exploration of large language model society', 'pub_year': 2023, |
| 135 | +'citation': 'Advances in Neural Information Processing Systems 36, 2023', |
| 136 | +'author': 'Guohao Li and Hasan Hammoud and Hani Itani and Dmitrii Khizbullin |
| 137 | +and Bernard Ghanem', 'journal': 'Advances in Neural Information Processing |
| 138 | +Systems', 'volume': '36', 'abstract': 'The rapid advancement of chat-based |
| 139 | +language models has led to remarkable progress in complex task-solving. |
| 140 | +However, their success heavily relies on human input to guide the |
| 141 | +conversation, which can be challenging and time-consuming. This paper explores |
| 142 | +the potential of building scalable techniques to facilitate autonomous |
| 143 | +cooperation among communicative agents, and provides insight into their |
| 144 | +“cognitive” processes. To address the challenges of achieving autonomous |
| 145 | +cooperation, we propose a novel communicative agent framework named |
| 146 | +role-playing. Our approach involves using inception prompting to guide chat |
| 147 | +agents toward task completion while maintaining consistency with human |
| 148 | +intentions. We showcase how role-playing can be used to generate |
| 149 | +conversational data for studying the behaviors and capabilities of a society |
| 150 | +of agents, providing a valuable resource for investigating conversational |
| 151 | +language models. In particular, we conduct comprehensive studies on |
| 152 | +instruction-following cooperation in multi-agent settings. Our contributions |
| 153 | +include introducing a novel communicative agent framework, offering a scalable |
| 154 | +approach for studying the cooperative behaviors and capabilities of |
| 155 | +multi-agent systems, and open-sourcing our library to support research on |
| 156 | +communicative agents and beyond: https://github. com/camel-ai/camel.'}, |
| 157 | +'filled': True, 'author_pub_id': 'J9K-D0sAAAAJ:_Qo2XoVZTnwC', 'num_citations': |
| 158 | +364, 'citedby_url': '/scholar?hl=en&cites=3976259482297250805', 'cites_id': |
| 159 | +['3976259482297250805'], 'pub_url': 'https://proceedings.neurips.cc/ |
| 160 | +paper_files/paper/2023/hash/ |
| 161 | +a3621ee907def47c1b952ade25c67698-Abstract-Conference.html', |
| 162 | +'url_related_articles': '/scholar?oi=bibs&hl=en&q=related:9TMbme6CLjcJ:scholar. |
| 163 | +google.com/', 'cites_per_year': {2023: 95, 2024: 269}})] |
| 164 | +=============================================================================== |
| 165 | +""" |
| 166 | + |
| 167 | +usr_msg = BaseMessage.make_user_message( |
| 168 | + role_name="CAMEL User", |
| 169 | + content="""get the full information for paper from link: `https://hal.science/hal-04206682/document`""", |
| 170 | +) |
| 171 | + |
| 172 | +# Get response information |
| 173 | +response = camel_agent.step(usr_msg) |
| 174 | +print((response.info['tool_calls'])[:1000]) |
| 175 | +""" |
| 176 | +=============================================================================== |
| 177 | +[FunctionCallingRecord(func_name='get_full_paper_content_by_link', args= |
| 178 | +{'pdf_url': 'https://hal.science/hal-04206682/document'}, result='Deep |
| 179 | +learning\nYann Lecun, Yoshua Bengio, Geoffrey Hinton\n\nTo cite this |
| 180 | +version:\n\nYann Lecun, Yoshua Bengio, Geoffrey Hinton. Deep learning. Nature, |
| 181 | +2015, 521 (7553), pp.436-444.\n\uffff10.1038/nature14539\uffff. |
| 182 | +\uffffhal-04206682\uffff\n\nHAL Id: hal-04206682\n\nhttps://hal.science/ |
| 183 | +hal-04206682v1\n\nSubmitted on 14 Sep 2023\n\nHAL is a multi-disciplinary open |
| 184 | +access\narchive for the deposit and dissemination of sci-\nentific research |
| 185 | +documents, whether they are pub-\nlished or not. The documents may come |
| 186 | +from\nteaching and research institutions in France or\nabroad, or from public |
| 187 | +or private research centers.\n\nL'archive ouverte pluridisciplinaire HAL, |
| 188 | +est\ndestinée au dépôt et à la diffusion de documents\nscientifiques de niveau |
| 189 | +recherche, publiés ou non,\némanant des établissements d'enseignement et |
| 190 | +de\nrecherche français ou étrangers, des laboratoires\npublics ou privés. |
| 191 | +\n\n\x0cDeep learning\n\nYann LeCun1,2, Yoshua Bengio3 & Geoffrey Hinton4, |
| 192 | +5\n\n1Facebook AI Research, 770 Broadway, New York, New York 10003 USA\n\n2N.. |
| 193 | +=============================================================================== |
| 194 | +""" |
0 commit comments