camel-ai 0.1.5.6__py3-none-any.whl → 0.1.5.7__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 +1 -1
- camel/agents/chat_agent.py +1 -1
- camel/configs/gemini_config.py +15 -14
- camel/configs/litellm_config.py +1 -1
- camel/configs/openai_config.py +1 -1
- camel/configs/zhipuai_config.py +1 -1
- camel/models/base_model.py +4 -1
- camel/models/litellm_model.py +16 -0
- camel/models/ollama_model.py +16 -0
- camel/models/zhipuai_model.py +0 -1
- camel/toolkits/__init__.py +36 -0
- camel/toolkits/base.py +1 -1
- camel/toolkits/code_execution.py +1 -1
- camel/toolkits/github_toolkit.py +3 -2
- camel/toolkits/google_maps_toolkit.py +367 -0
- camel/toolkits/math_toolkit.py +79 -0
- camel/toolkits/open_api_toolkit.py +548 -0
- camel/toolkits/retrieval_toolkit.py +76 -0
- camel/toolkits/search_toolkit.py +326 -0
- camel/toolkits/slack_toolkit.py +308 -0
- camel/toolkits/twitter_toolkit.py +522 -0
- camel/toolkits/weather_toolkit.py +173 -0
- camel/utils/async_func.py +1 -1
- {camel_ai-0.1.5.6.dist-info → camel_ai-0.1.5.7.dist-info}/METADATA +2 -2
- {camel_ai-0.1.5.6.dist-info → camel_ai-0.1.5.7.dist-info}/RECORD +52 -53
- camel/functions/__init__.py +0 -51
- camel/functions/google_maps_function.py +0 -335
- camel/functions/math_functions.py +0 -61
- camel/functions/open_api_function.py +0 -508
- camel/functions/retrieval_functions.py +0 -61
- camel/functions/search_functions.py +0 -298
- camel/functions/slack_functions.py +0 -286
- camel/functions/twitter_function.py +0 -479
- camel/functions/weather_functions.py +0 -144
- /camel/{functions → toolkits}/open_api_specs/biztoc/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/biztoc/ai-plugin.json +0 -0
- /camel/{functions → toolkits}/open_api_specs/biztoc/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/coursera/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/coursera/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/create_qr_code/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/create_qr_code/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/klarna/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/klarna/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/nasa_apod/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/nasa_apod/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/ai-plugin.json +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/paths/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/paths/get_classes.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/outschool/paths/search_teachers.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/security_config.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/speak/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/speak/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/web_scraper/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/web_scraper/ai-plugin.json +0 -0
- /camel/{functions → toolkits}/open_api_specs/web_scraper/openapi.yaml +0 -0
- /camel/{functions → toolkits}/open_api_specs/web_scraper/paths/__init__.py +0 -0
- /camel/{functions → toolkits}/open_api_specs/web_scraper/paths/scraper.py +0 -0
- /camel/{functions → toolkits}/openai_function.py +0 -0
- {camel_ai-0.1.5.6.dist-info → camel_ai-0.1.5.7.dist-info}/WHEEL +0 -0
camel/utils/async_func.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: camel-ai
|
|
3
|
-
Version: 0.1.5.
|
|
3
|
+
Version: 0.1.5.7
|
|
4
4
|
Summary: Communicative Agents for AI Society Study
|
|
5
5
|
Home-page: https://www.camel-ai.org/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -191,7 +191,7 @@ conda create --name camel python=3.9
|
|
|
191
191
|
conda activate camel
|
|
192
192
|
|
|
193
193
|
# Clone github repo
|
|
194
|
-
git clone -b v0.1.5.
|
|
194
|
+
git clone -b v0.1.5.7 https://github.com/camel-ai/camel.git
|
|
195
195
|
|
|
196
196
|
# Change directory into project directory
|
|
197
197
|
cd camel
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
camel/__init__.py,sha256=
|
|
1
|
+
camel/__init__.py,sha256=SK47YpajPvRRCOMzYN0wbiZPVZDCJ3KLZw01_0IYZdE,780
|
|
2
2
|
camel/agents/__init__.py,sha256=SSU1wbhZXWwQnE0rRxkpyN57kEu72KklsZNcdLkXfTs,1551
|
|
3
3
|
camel/agents/base.py,sha256=X39qWSiT1WnDqaJ9k3gQrTpOQSwUKzNEVpp5AY6fDH8,1130
|
|
4
|
-
camel/agents/chat_agent.py,sha256=
|
|
4
|
+
camel/agents/chat_agent.py,sha256=j0SbV3eOLJCV5xfKMFkuP8O1zXWr4MbNlzmlK1VjqdQ,27686
|
|
5
5
|
camel/agents/critic_agent.py,sha256=M3XNxRS0wAs5URjc_0kvtXqUlD-KpXq3L5ADz-KCKGU,7199
|
|
6
6
|
camel/agents/deductive_reasoner_agent.py,sha256=8R9hY_yCr_guq_ySuIE3eaYbiPeHVrsh6HKqIWrR0zY,13180
|
|
7
7
|
camel/agents/embodied_agent.py,sha256=Mm2-wvcpduXOvsHMBcavroACyvK06Mxe6QYTf80tdfI,7160
|
|
@@ -15,51 +15,16 @@ camel/agents/tool_agents/hugging_face_tool_agent.py,sha256=1Z5tG6f_86eL0vmtRZ-BJ
|
|
|
15
15
|
camel/configs/__init__.py,sha256=momCJ2GkGVTwfNKmmBuJQZrz3hhsxkwLACxUT1-kLkE,1500
|
|
16
16
|
camel/configs/anthropic_config.py,sha256=zD7VMFUw4s7wmBlr64oSXxpEUkhp7wj9mvAd0WK2zFc,3308
|
|
17
17
|
camel/configs/base_config.py,sha256=CEF8ryl_dkH6LgOhwuP5_EgjaWCUCB-E3GcMWR-2YFE,870
|
|
18
|
-
camel/configs/gemini_config.py,sha256=
|
|
19
|
-
camel/configs/litellm_config.py,sha256=
|
|
18
|
+
camel/configs/gemini_config.py,sha256=JAxd7Xx98VAlTz6l7CAPaZDS4OKz6e-daPJ_joUx96Q,4965
|
|
19
|
+
camel/configs/litellm_config.py,sha256=WU6D53Th7-BC6idoJZjiYZuHjkSHFVc1NEFyK-jJGrI,4884
|
|
20
20
|
camel/configs/ollama_config.py,sha256=npjJMe1lIK_WpnVtSnnKzKE78i2bWb6FPPoPa-nJ3Fo,4396
|
|
21
|
-
camel/configs/openai_config.py,sha256
|
|
22
|
-
camel/configs/zhipuai_config.py,sha256=
|
|
21
|
+
camel/configs/openai_config.py,sha256=-CkNfWoOFhFTyQ7Zy61C3iI8LaalLSBv_aE7mFmEmXg,7592
|
|
22
|
+
camel/configs/zhipuai_config.py,sha256=pjfMUn-dFy9BZSTlAXxyxQIIIjYmdlq_K4j6Rl78-_I,3768
|
|
23
23
|
camel/embeddings/__init__.py,sha256=9TI7392iYxrlYYerPoboDBOFvpEmP_nSSgtEjks1vJQ,1034
|
|
24
24
|
camel/embeddings/base.py,sha256=deX70VXGmWGRAPal3HheXvMaarymRR5I1i90KPWGWXs,2196
|
|
25
25
|
camel/embeddings/openai_embedding.py,sha256=Eh7Hbj6bWMTrX0Tze2IgPdD3-v9aRoBeE8AifG3jF8A,3332
|
|
26
26
|
camel/embeddings/sentence_transformers_embeddings.py,sha256=ayYIBOADdmmhlmo1iZS8tI_mZ-rX0sxjljyQpkuftcw,2730
|
|
27
27
|
camel/embeddings/vlm_embedding.py,sha256=VvD_b737snNrZTRE4ejFvWLjd_YT1DCTKl8yKIgRM-g,5436
|
|
28
|
-
camel/functions/__init__.py,sha256=3d1ZI3xx67DvHeBQhQQAu7IwTohC6Sa-_EPZeDE8_50,1737
|
|
29
|
-
camel/functions/google_maps_function.py,sha256=AmhlIyqkrkZF6Vb4O-wdtEKTQjRh5mMjHjS56ciGgjk,12468
|
|
30
|
-
camel/functions/math_functions.py,sha256=sPHSEOdHOmL38wZWcdyiBj0VEmf7mhQ0MBzya1SFNL0,1703
|
|
31
|
-
camel/functions/open_api_function.py,sha256=QW0zTIGxXT1h-JWIK1iAKsqvDXXX5FrIwHBJg8i6N4g,20518
|
|
32
|
-
camel/functions/open_api_specs/biztoc/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
33
|
-
camel/functions/open_api_specs/biztoc/ai-plugin.json,sha256=IJinQbLv5MFPGFwdN7PbOhwArFVExSEZdJspe-mOBIo,866
|
|
34
|
-
camel/functions/open_api_specs/biztoc/openapi.yaml,sha256=SQ2bYIWb1nVBtkBeFaOihiWQ71oZ2bzz0fCgu6igM8A,610
|
|
35
|
-
camel/functions/open_api_specs/coursera/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
36
|
-
camel/functions/open_api_specs/coursera/openapi.yaml,sha256=iouLcNNpVvXLfmkyKrbJlS3MEjBJ7TgVR48UID8dwfE,1981
|
|
37
|
-
camel/functions/open_api_specs/create_qr_code/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
38
|
-
camel/functions/open_api_specs/create_qr_code/openapi.yaml,sha256=d6ZNFmhCwlqZj8Rp9lmdU1dYPyh3-GnadbEUKHqjBfc,1158
|
|
39
|
-
camel/functions/open_api_specs/klarna/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
40
|
-
camel/functions/open_api_specs/klarna/openapi.yaml,sha256=9wpwRn8NLZL1reN6YUPsZP24hbDJJYvOJeeoWTk7ojQ,2887
|
|
41
|
-
camel/functions/open_api_specs/nasa_apod/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
42
|
-
camel/functions/open_api_specs/nasa_apod/openapi.yaml,sha256=4NPWtk9k7UwNpUihkrbCXzzs4zls-YnEYKe6qmtO8FU,2044
|
|
43
|
-
camel/functions/open_api_specs/outschool/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
44
|
-
camel/functions/open_api_specs/outschool/ai-plugin.json,sha256=QohJo8Ya0RGBvs9cBQR-UgSMl0gXJdNlWO8d2FyqdE8,1089
|
|
45
|
-
camel/functions/open_api_specs/outschool/openapi.yaml,sha256=t9gHdt09CQ8QMVnzEBxkcgH9eG720IsnVwB_6QxzSC4,8700
|
|
46
|
-
camel/functions/open_api_specs/outschool/paths/__init__.py,sha256=2XEfkKfyijEhzTodYGGoD5qvCQLYYlcxboQuNfLGBJs,780
|
|
47
|
-
camel/functions/open_api_specs/outschool/paths/get_classes.py,sha256=1skqdvrOjI_oywSe3KBV4zuqDg_EOpftpA3G6gXCZ8c,1122
|
|
48
|
-
camel/functions/open_api_specs/outschool/paths/search_teachers.py,sha256=p6J9jTxbBNVJTa3M1qaJu3VKtIZEZFX0etxw7a3pdFk,1125
|
|
49
|
-
camel/functions/open_api_specs/security_config.py,sha256=uxdd-Uh1hyHd3wvXdVahBH0hDdf0-IEoVk9Rh2vpAh0,904
|
|
50
|
-
camel/functions/open_api_specs/speak/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
51
|
-
camel/functions/open_api_specs/speak/openapi.yaml,sha256=rmM_-E4tYJ2LOpUlcQxfQtcQSRkVnsBkQWMmKdW2QqQ,6557
|
|
52
|
-
camel/functions/open_api_specs/web_scraper/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
53
|
-
camel/functions/open_api_specs/web_scraper/ai-plugin.json,sha256=jjHvbj0DQ4AYcL9JlSWhyJZ3mFj4eC33E4t6Ci54p3s,1028
|
|
54
|
-
camel/functions/open_api_specs/web_scraper/openapi.yaml,sha256=u_WalQ01e8W1D27VnZviOylpGmJ-zssYrfAgkzqdoyk,2191
|
|
55
|
-
camel/functions/open_api_specs/web_scraper/paths/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
56
|
-
camel/functions/open_api_specs/web_scraper/paths/scraper.py,sha256=SQGbFkshLN4xm-Ya49ssbSvaU1nFVNFYhWsEPYVeFe0,1123
|
|
57
|
-
camel/functions/openai_function.py,sha256=NyN8LBKdNeWizR7SnOp6VwEQhq29OJgskFfXq8EzIFg,14948
|
|
58
|
-
camel/functions/retrieval_functions.py,sha256=ZBwQhBeun86k6AnMDCpf0U-JYNaU0alDJAS1hdnumAQ,2281
|
|
59
|
-
camel/functions/search_functions.py,sha256=LtIGHsZLUveTMkdlaonlNoqFK_Sx1yGujdySeL1-kfg,10882
|
|
60
|
-
camel/functions/slack_functions.py,sha256=XQZnGHLURKcmtiqN1mxsBxdCbG4i8ArX8MnnNn91GQc,8988
|
|
61
|
-
camel/functions/twitter_function.py,sha256=hN8FR0bUtd0RLlCK8MFRDwFbbukYGTry9WhVKQEV_Y8,17121
|
|
62
|
-
camel/functions/weather_functions.py,sha256=CKBh8hS8ylUIAlEH6HlrjdgjLuzT-GM4WcvCBATMl0g,5774
|
|
63
28
|
camel/generators.py,sha256=tcYDoHwSKN0rBiu7u4rWN9pb61O8OaclrNaasCqHSJM,10437
|
|
64
29
|
camel/human.py,sha256=W_T7PSO-ReiJbC5JMX1wPrpt6LVFBqoNEwUdjDScG1M,4963
|
|
65
30
|
camel/interpreters/__init__.py,sha256=rHuOgwyWDLsuRzPLZ_WZteFBb_-zp4G-xfnDP7VFRC8,1115
|
|
@@ -86,17 +51,17 @@ camel/messages/base.py,sha256=1cyYITXxBsp2UCdOjF1Ky4W_PgRegEfitqbrF9PjUPs,13721
|
|
|
86
51
|
camel/messages/func_message.py,sha256=CCVkbz-2pdxXV0vBETI0xt7d7uiN8zACpRI7lCnfTFQ,3841
|
|
87
52
|
camel/models/__init__.py,sha256=832nhDetpPm8tg7h9O18rtLQoyANu4VUXF6J6ElDqlU,1465
|
|
88
53
|
camel/models/anthropic_model.py,sha256=mypGlcn2koBFf3FsgBAqOqWwxvY-c1prINr5nYvjvts,5540
|
|
89
|
-
camel/models/base_model.py,sha256=
|
|
54
|
+
camel/models/base_model.py,sha256=0o3Q4tEm0_i0FNyHZ2NGf0-iMfiZAqT5QZvi-Pw4FIY,4110
|
|
90
55
|
camel/models/gemini_model.py,sha256=xawgEhLjUJCRFWbKRM6zojHbrwNBc2elqki85v9PvIA,7291
|
|
91
|
-
camel/models/litellm_model.py,sha256=
|
|
56
|
+
camel/models/litellm_model.py,sha256=VXyBhNDKOgkx_GtaqCxm_nUcZFiGLTB_0x3GFa1prrc,5428
|
|
92
57
|
camel/models/model_factory.py,sha256=ScPN7stphd2J651VPTABMnh9tCSXS-bKMXwB65uDYYg,4107
|
|
93
58
|
camel/models/nemotron_model.py,sha256=2Idf4wrZervxvfu6av42EKjefFtDnBb6cKnWCJUkqI4,2682
|
|
94
|
-
camel/models/ollama_model.py,sha256=
|
|
59
|
+
camel/models/ollama_model.py,sha256=L-V41PdDnvrQJsl7yNCWdZGDfXIvSpxcf8lrqliyjBc,4677
|
|
95
60
|
camel/models/open_source_model.py,sha256=r8TGq-9xAwOANZ5s_y3fJUGAvS0zDg03RmbZ8X2ga-E,6156
|
|
96
61
|
camel/models/openai_audio_models.py,sha256=_ddOxqzFZCVZaK6h33Z0THU6HXk2XlJTxVWquZ3oOaQ,10042
|
|
97
62
|
camel/models/openai_model.py,sha256=RtUxWEOO9Mn1ClXep2eVgaZxTA4cgXttndF_O-9ulgs,4403
|
|
98
63
|
camel/models/stub_model.py,sha256=kyFXy9WyHgjnXDFO8Sag4q023lHGu4D0vyzfkGTSi9w,3704
|
|
99
|
-
camel/models/zhipuai_model.py,sha256=
|
|
64
|
+
camel/models/zhipuai_model.py,sha256=i-8H-bithdcslrFzybavj6Gf_RE3a80jXEXCoNl6_xQ,4753
|
|
100
65
|
camel/prompts/__init__.py,sha256=tvN1pz132rgjV_C4MoVrSMTqgtOP0SzdfzAPX8rjpaQ,2049
|
|
101
66
|
camel/prompts/ai_society.py,sha256=ApgvIED1Z_mdsWDNc2_u35Ktp7pEKksMrOIQKo_q5cI,6306
|
|
102
67
|
camel/prompts/base.py,sha256=VMde6w97zHPP03OA628wGwXhtJweoccOK1B1f3aESDo,8464
|
|
@@ -140,18 +105,52 @@ camel/terminators/__init__.py,sha256=pE7fcfDUNngdbm1BhzSQPRMXNbdd28rl9YbF4gKWwXE
|
|
|
140
105
|
camel/terminators/base.py,sha256=TSkl3maNEsdjyAniJaSgFfD4UF8RQ1LwNIiGw0dN8Gg,1396
|
|
141
106
|
camel/terminators/response_terminator.py,sha256=zcXuigbvlclUoBv4xcVbfU36ZohUT1RhI-rSnukloUY,4951
|
|
142
107
|
camel/terminators/token_limit_terminator.py,sha256=mK30wVUnoqNAvIo-wxkqY5gUSNay2M04rsAktKqoiOI,2087
|
|
143
|
-
camel/toolkits/__init__.py,sha256=
|
|
144
|
-
camel/toolkits/base.py,sha256=
|
|
145
|
-
camel/toolkits/code_execution.py,sha256=
|
|
146
|
-
camel/toolkits/github_toolkit.py,sha256=
|
|
108
|
+
camel/toolkits/__init__.py,sha256=nhlmtjrM4u8Mb-3biLLBUhwrMuZgAHF7cTgomhSoX3I,2030
|
|
109
|
+
camel/toolkits/base.py,sha256=Z3imvmBrzheGtn-5pcmCxi8WI8pcSPiIGR4L18nLy4Y,924
|
|
110
|
+
camel/toolkits/code_execution.py,sha256=fWBhn1_3adiv7YYuA0gJzEBlc_dYNS6_hVtDbgB-zX0,2425
|
|
111
|
+
camel/toolkits/github_toolkit.py,sha256=6SxHc63wzoBm_5vLSbZgMmaXwKwgX-B1CDMK7fjkErM,11504
|
|
112
|
+
camel/toolkits/google_maps_toolkit.py,sha256=g5PNhrc-ipQ-Vx_O7eilTy3LtYyp-vcErKYOk0OJw5I,14335
|
|
113
|
+
camel/toolkits/math_toolkit.py,sha256=r-85DHvihR87DU6n_W75pecV1P9xV3Hylfp6u-ue7T4,2521
|
|
114
|
+
camel/toolkits/open_api_specs/biztoc/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
115
|
+
camel/toolkits/open_api_specs/biztoc/ai-plugin.json,sha256=IJinQbLv5MFPGFwdN7PbOhwArFVExSEZdJspe-mOBIo,866
|
|
116
|
+
camel/toolkits/open_api_specs/biztoc/openapi.yaml,sha256=SQ2bYIWb1nVBtkBeFaOihiWQ71oZ2bzz0fCgu6igM8A,610
|
|
117
|
+
camel/toolkits/open_api_specs/coursera/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
118
|
+
camel/toolkits/open_api_specs/coursera/openapi.yaml,sha256=iouLcNNpVvXLfmkyKrbJlS3MEjBJ7TgVR48UID8dwfE,1981
|
|
119
|
+
camel/toolkits/open_api_specs/create_qr_code/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
120
|
+
camel/toolkits/open_api_specs/create_qr_code/openapi.yaml,sha256=d6ZNFmhCwlqZj8Rp9lmdU1dYPyh3-GnadbEUKHqjBfc,1158
|
|
121
|
+
camel/toolkits/open_api_specs/klarna/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
122
|
+
camel/toolkits/open_api_specs/klarna/openapi.yaml,sha256=9wpwRn8NLZL1reN6YUPsZP24hbDJJYvOJeeoWTk7ojQ,2887
|
|
123
|
+
camel/toolkits/open_api_specs/nasa_apod/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
124
|
+
camel/toolkits/open_api_specs/nasa_apod/openapi.yaml,sha256=4NPWtk9k7UwNpUihkrbCXzzs4zls-YnEYKe6qmtO8FU,2044
|
|
125
|
+
camel/toolkits/open_api_specs/outschool/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
126
|
+
camel/toolkits/open_api_specs/outschool/ai-plugin.json,sha256=QohJo8Ya0RGBvs9cBQR-UgSMl0gXJdNlWO8d2FyqdE8,1089
|
|
127
|
+
camel/toolkits/open_api_specs/outschool/openapi.yaml,sha256=t9gHdt09CQ8QMVnzEBxkcgH9eG720IsnVwB_6QxzSC4,8700
|
|
128
|
+
camel/toolkits/open_api_specs/outschool/paths/__init__.py,sha256=2XEfkKfyijEhzTodYGGoD5qvCQLYYlcxboQuNfLGBJs,780
|
|
129
|
+
camel/toolkits/open_api_specs/outschool/paths/get_classes.py,sha256=1skqdvrOjI_oywSe3KBV4zuqDg_EOpftpA3G6gXCZ8c,1122
|
|
130
|
+
camel/toolkits/open_api_specs/outschool/paths/search_teachers.py,sha256=p6J9jTxbBNVJTa3M1qaJu3VKtIZEZFX0etxw7a3pdFk,1125
|
|
131
|
+
camel/toolkits/open_api_specs/security_config.py,sha256=uxdd-Uh1hyHd3wvXdVahBH0hDdf0-IEoVk9Rh2vpAh0,904
|
|
132
|
+
camel/toolkits/open_api_specs/speak/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
133
|
+
camel/toolkits/open_api_specs/speak/openapi.yaml,sha256=rmM_-E4tYJ2LOpUlcQxfQtcQSRkVnsBkQWMmKdW2QqQ,6557
|
|
134
|
+
camel/toolkits/open_api_specs/web_scraper/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
135
|
+
camel/toolkits/open_api_specs/web_scraper/ai-plugin.json,sha256=jjHvbj0DQ4AYcL9JlSWhyJZ3mFj4eC33E4t6Ci54p3s,1028
|
|
136
|
+
camel/toolkits/open_api_specs/web_scraper/openapi.yaml,sha256=u_WalQ01e8W1D27VnZviOylpGmJ-zssYrfAgkzqdoyk,2191
|
|
137
|
+
camel/toolkits/open_api_specs/web_scraper/paths/__init__.py,sha256=f3LXNDzN2XWWoF2D0nesG8VuEA6Zd14i2aiTDbCm5bA,708
|
|
138
|
+
camel/toolkits/open_api_specs/web_scraper/paths/scraper.py,sha256=SQGbFkshLN4xm-Ya49ssbSvaU1nFVNFYhWsEPYVeFe0,1123
|
|
139
|
+
camel/toolkits/open_api_toolkit.py,sha256=dFPKPaMSaUmHx6BQQ2aQ3pPO6ZleURaIoMnLgUl6evs,23460
|
|
140
|
+
camel/toolkits/openai_function.py,sha256=NyN8LBKdNeWizR7SnOp6VwEQhq29OJgskFfXq8EzIFg,14948
|
|
141
|
+
camel/toolkits/retrieval_toolkit.py,sha256=XVBKCuGp_RjOaiJQ6dTwKlsQVg6X1JoROiwPyDw1tkE,3021
|
|
142
|
+
camel/toolkits/search_toolkit.py,sha256=05fKN9LYSvu70iXO4Vziv4QOU3WFbVnIW-8sTeilkLY,12932
|
|
143
|
+
camel/toolkits/slack_toolkit.py,sha256=JdgDJe7iExTmG7dDXOG6v5KpVjZ6_My_d_WFTYSxkw4,10839
|
|
144
|
+
camel/toolkits/twitter_toolkit.py,sha256=oQw8wRkU7iDxaocsmWvio4pU75pmq6FJAorPdQ2xEAE,19810
|
|
145
|
+
camel/toolkits/weather_toolkit.py,sha256=n4YrUI_jTIH7oqH918IdHbXLgfQ2BPGIWWK8Jp8G1Uw,7054
|
|
147
146
|
camel/types/__init__.py,sha256=ArKXATj3z_Vv4ISmROVeo6Mv3tj5kE1dTkqfgwyxVY4,1975
|
|
148
147
|
camel/types/enums.py,sha256=ojXbi6vmY3zJm4CslxMh3y9NKIhFpWaPtsGb8G1buwQ,12427
|
|
149
148
|
camel/types/openai_types.py,sha256=BNQ6iCzKTjSvgcXFsAFIgrUS_YUFZBU6bDoyAp387hI,2045
|
|
150
149
|
camel/utils/__init__.py,sha256=m85T6bXzNe_2ObpAlXRMAkud4Qz4886WdLp_SEmJwV8,1867
|
|
151
|
-
camel/utils/async_func.py,sha256=
|
|
150
|
+
camel/utils/async_func.py,sha256=SLo8KPkrNKdsONvFf3KBb33EgFn4gH2EKSX1aI_LKes,1578
|
|
152
151
|
camel/utils/commons.py,sha256=J7AOOh5huQkwTvjDt_gpiXNTXnuk0yM_hdtRU8clpNE,11298
|
|
153
152
|
camel/utils/constants.py,sha256=ZIw5ILfOyJFyjEAYrbJMANeg1_EZI-zMK_xVrkwALbM,1105
|
|
154
153
|
camel/utils/token_counting.py,sha256=euqt0g7WXrHYZTOTBDzcPDL5P4gLzaDpdibH9-8cC3g,17096
|
|
155
|
-
camel_ai-0.1.5.
|
|
156
|
-
camel_ai-0.1.5.
|
|
157
|
-
camel_ai-0.1.5.
|
|
154
|
+
camel_ai-0.1.5.7.dist-info/METADATA,sha256=bet28PiaOYyraBtYdVMSDVc1jaVnLy5qAwdFRtvWPKU,22065
|
|
155
|
+
camel_ai-0.1.5.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
156
|
+
camel_ai-0.1.5.7.dist-info/RECORD,,
|
camel/functions/__init__.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
# ruff: noqa: I001
|
|
15
|
-
from .openai_function import (
|
|
16
|
-
OpenAIFunction,
|
|
17
|
-
get_openai_function_schema,
|
|
18
|
-
get_openai_tool_schema,
|
|
19
|
-
)
|
|
20
|
-
from .open_api_specs.security_config import openapi_security_config
|
|
21
|
-
|
|
22
|
-
from .google_maps_function import MAP_FUNCS
|
|
23
|
-
from .math_functions import MATH_FUNCS
|
|
24
|
-
from .open_api_function import OPENAPI_FUNCS
|
|
25
|
-
from .retrieval_functions import RETRIEVAL_FUNCS
|
|
26
|
-
from .search_functions import SEARCH_FUNCS
|
|
27
|
-
from .twitter_function import TWITTER_FUNCS
|
|
28
|
-
from .weather_functions import WEATHER_FUNCS
|
|
29
|
-
from .slack_functions import SLACK_FUNCS
|
|
30
|
-
|
|
31
|
-
from .open_api_function import (
|
|
32
|
-
apinames_filepaths_to_funs_schemas,
|
|
33
|
-
generate_apinames_filepaths,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
__all__ = [
|
|
37
|
-
'OpenAIFunction',
|
|
38
|
-
'get_openai_function_schema',
|
|
39
|
-
'get_openai_tool_schema',
|
|
40
|
-
'openapi_security_config',
|
|
41
|
-
'apinames_filepaths_to_funs_schemas',
|
|
42
|
-
'generate_apinames_filepaths',
|
|
43
|
-
'MAP_FUNCS',
|
|
44
|
-
'MATH_FUNCS',
|
|
45
|
-
'OPENAPI_FUNCS',
|
|
46
|
-
'RETRIEVAL_FUNCS',
|
|
47
|
-
'SEARCH_FUNCS',
|
|
48
|
-
'TWITTER_FUNCS',
|
|
49
|
-
'WEATHER_FUNCS',
|
|
50
|
-
'SLACK_FUNCS',
|
|
51
|
-
]
|
|
@@ -1,335 +0,0 @@
|
|
|
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
|
-
import os
|
|
15
|
-
from functools import wraps
|
|
16
|
-
from typing import Any, Callable, List, Optional, Tuple, Union
|
|
17
|
-
|
|
18
|
-
from camel.functions.openai_function import OpenAIFunction
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def import_googlemaps_or_raise() -> Any:
|
|
22
|
-
r"""Attempts to import the `googlemaps` library and returns it.
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
module: The `googlemaps` module if successfully imported.
|
|
26
|
-
|
|
27
|
-
Raises:
|
|
28
|
-
ImportError: If the `googlemaps` library is not installed, this error
|
|
29
|
-
is raised with a message instructing how to install the
|
|
30
|
-
library using pip.
|
|
31
|
-
"""
|
|
32
|
-
try:
|
|
33
|
-
import googlemaps
|
|
34
|
-
|
|
35
|
-
return googlemaps
|
|
36
|
-
except ImportError:
|
|
37
|
-
raise ImportError(
|
|
38
|
-
"Please install `googlemaps` first. You can install "
|
|
39
|
-
"it by running `pip install googlemaps`."
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def get_googlemap_api_key() -> str:
|
|
44
|
-
r"""Retrieve the Google Maps API key from environment variables.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
str: The Google Maps API key.
|
|
48
|
-
|
|
49
|
-
Raises:
|
|
50
|
-
ValueError: If the API key is not found in the environment variables.
|
|
51
|
-
"""
|
|
52
|
-
# Get `GOOGLEMAPS_API_KEY` here:
|
|
53
|
-
# https://console.cloud.google.com/apis/credentials
|
|
54
|
-
GOOGLEMAPS_API_KEY = os.environ.get('GOOGLEMAPS_API_KEY')
|
|
55
|
-
if not GOOGLEMAPS_API_KEY:
|
|
56
|
-
raise ValueError(
|
|
57
|
-
"`GOOGLEMAPS_API_KEY` not found in environment "
|
|
58
|
-
"variables. `GOOGLEMAPS_API_KEY` API keys are "
|
|
59
|
-
"generated in the `Credentials` page of the "
|
|
60
|
-
"`APIs & Services` tab of "
|
|
61
|
-
"https://console.cloud.google.com/apis/credentials."
|
|
62
|
-
)
|
|
63
|
-
return GOOGLEMAPS_API_KEY
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def get_address_description(
|
|
67
|
-
address: Union[str, List[str]],
|
|
68
|
-
region_code: Optional[str] = None,
|
|
69
|
-
locality: Optional[str] = None,
|
|
70
|
-
) -> str:
|
|
71
|
-
r"""Validates an address via Google Maps API, returns a descriptive
|
|
72
|
-
summary.
|
|
73
|
-
|
|
74
|
-
Validates an address using Google Maps API, returning a summary that
|
|
75
|
-
includes information on address completion, formatted address, location
|
|
76
|
-
coordinates, and metadata types that are true for the given address.
|
|
77
|
-
|
|
78
|
-
Args:
|
|
79
|
-
address (Union[str, List[str]]): The address or components to validate.
|
|
80
|
-
Can be a single string or a list representing different parts.
|
|
81
|
-
region_code (str, optional): Country code for regional restriction,
|
|
82
|
-
helps narrowing down results. (default: :obj:`None`)
|
|
83
|
-
locality (str, optional): Restricts validation to a specific locality,
|
|
84
|
-
e.g., "Mountain View". (default: :obj:`None`)
|
|
85
|
-
|
|
86
|
-
Returns:
|
|
87
|
-
str: Summary of the address validation results, including information
|
|
88
|
-
on address completion, formatted address, geographical coordinates
|
|
89
|
-
(latitude and longitude), and metadata types true for the address.
|
|
90
|
-
|
|
91
|
-
Raises:
|
|
92
|
-
ImportError: If the `googlemaps` library is not installed.
|
|
93
|
-
Exception: For unexpected errors during the address validation.
|
|
94
|
-
"""
|
|
95
|
-
googlemaps = import_googlemaps_or_raise()
|
|
96
|
-
GOOGLEMAPS_API_KEY = get_googlemap_api_key()
|
|
97
|
-
try:
|
|
98
|
-
gmaps = googlemaps.Client(key=GOOGLEMAPS_API_KEY)
|
|
99
|
-
except Exception as e:
|
|
100
|
-
return f"Error: {e!s}"
|
|
101
|
-
|
|
102
|
-
try:
|
|
103
|
-
addressvalidation_result = gmaps.addressvalidation(
|
|
104
|
-
[address],
|
|
105
|
-
regionCode=region_code,
|
|
106
|
-
locality=locality,
|
|
107
|
-
enableUspsCass=False,
|
|
108
|
-
) # Always False as per requirements
|
|
109
|
-
|
|
110
|
-
# Check if the result contains an error
|
|
111
|
-
if 'error' in addressvalidation_result:
|
|
112
|
-
error_info = addressvalidation_result['error']
|
|
113
|
-
error_message = error_info.get(
|
|
114
|
-
'message', 'An unknown error occurred'
|
|
115
|
-
)
|
|
116
|
-
error_status = error_info.get('status', 'UNKNOWN_STATUS')
|
|
117
|
-
error_code = error_info.get('code', 'UNKNOWN_CODE')
|
|
118
|
-
return (
|
|
119
|
-
f"Address validation failed with error: {error_message} "
|
|
120
|
-
f"Status: {error_status}, Code: {error_code}"
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
# Assuming the successful response structure includes a 'result' key
|
|
124
|
-
result = addressvalidation_result['result']
|
|
125
|
-
verdict = result.get('verdict', {})
|
|
126
|
-
address_info = result.get('address', {})
|
|
127
|
-
geocode = result.get('geocode', {})
|
|
128
|
-
metadata = result.get('metadata', {})
|
|
129
|
-
|
|
130
|
-
# Construct the descriptive string
|
|
131
|
-
address_complete = (
|
|
132
|
-
"Yes" if verdict.get('addressComplete', False) else "No"
|
|
133
|
-
)
|
|
134
|
-
formatted_address = address_info.get(
|
|
135
|
-
'formattedAddress', 'Not available'
|
|
136
|
-
)
|
|
137
|
-
location = geocode.get('location', {})
|
|
138
|
-
latitude = location.get('latitude', 'Not available')
|
|
139
|
-
longitude = location.get('longitude', 'Not available')
|
|
140
|
-
true_metadata_types = [key for key, value in metadata.items() if value]
|
|
141
|
-
true_metadata_types_str = (
|
|
142
|
-
', '.join(true_metadata_types) if true_metadata_types else 'None'
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
description = (
|
|
146
|
-
f"Address completion status: {address_complete}. "
|
|
147
|
-
f"Formatted address: {formatted_address}. "
|
|
148
|
-
f"Location (latitude, longitude): ({latitude}, {longitude}). "
|
|
149
|
-
f"Metadata indicating true types: {true_metadata_types_str}."
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
return description
|
|
153
|
-
except Exception as e:
|
|
154
|
-
return f"An unexpected error occurred: {e!s}"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def handle_googlemaps_exceptions(
|
|
158
|
-
func: Callable[..., Any],
|
|
159
|
-
) -> Callable[..., Any]:
|
|
160
|
-
r"""Decorator to catch and handle exceptions raised by Google Maps API
|
|
161
|
-
calls.
|
|
162
|
-
|
|
163
|
-
Args:
|
|
164
|
-
func (Callable): The function to be wrapped by the decorator.
|
|
165
|
-
|
|
166
|
-
Returns:
|
|
167
|
-
Callable: A wrapper function that calls the wrapped function and
|
|
168
|
-
handles exceptions.
|
|
169
|
-
"""
|
|
170
|
-
|
|
171
|
-
@wraps(func)
|
|
172
|
-
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
173
|
-
try:
|
|
174
|
-
from googlemaps.exceptions import ( # type: ignore[import-untyped] # isort: skip
|
|
175
|
-
ApiError,
|
|
176
|
-
HTTPError,
|
|
177
|
-
Timeout,
|
|
178
|
-
TransportError,
|
|
179
|
-
)
|
|
180
|
-
except ImportError:
|
|
181
|
-
raise ImportError(
|
|
182
|
-
"Please install `googlemaps` first. You can install "
|
|
183
|
-
"it by running `pip install googlemaps`."
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
try:
|
|
187
|
-
return func(*args, **kwargs)
|
|
188
|
-
except ApiError as e:
|
|
189
|
-
return (
|
|
190
|
-
'An exception returned by the remote API. '
|
|
191
|
-
f'Status: {e.status}, Message: {e.message}'
|
|
192
|
-
)
|
|
193
|
-
except HTTPError as e:
|
|
194
|
-
return (
|
|
195
|
-
'An unexpected HTTP error occurred. '
|
|
196
|
-
f'Status Code: {e.status_code}'
|
|
197
|
-
)
|
|
198
|
-
except Timeout:
|
|
199
|
-
return 'The request timed out.'
|
|
200
|
-
except TransportError as e:
|
|
201
|
-
return (
|
|
202
|
-
'Something went wrong while trying to execute the '
|
|
203
|
-
f'request. Details: {e.base_exception}'
|
|
204
|
-
)
|
|
205
|
-
except Exception as e:
|
|
206
|
-
return f'An unexpected error occurred: {e}'
|
|
207
|
-
|
|
208
|
-
return wrapper
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@handle_googlemaps_exceptions
|
|
212
|
-
def get_elevation(lat_lng: Tuple) -> str:
|
|
213
|
-
r"""Retrieves elevation data for a given latitude and longitude.
|
|
214
|
-
|
|
215
|
-
Uses the Google Maps API to fetch elevation data for the specified latitude
|
|
216
|
-
and longitude. It handles exceptions gracefully and returns a description
|
|
217
|
-
of the elevation, including its value in meters and the data resolution.
|
|
218
|
-
|
|
219
|
-
Args:
|
|
220
|
-
lat_lng (Tuple[float, float]): The latitude and longitude for
|
|
221
|
-
which to retrieve elevation data.
|
|
222
|
-
|
|
223
|
-
Returns:
|
|
224
|
-
str: A description of the elevation at the specified location(s),
|
|
225
|
-
including the elevation in meters and the data resolution. If
|
|
226
|
-
elevation data is not available, a message indicating this is
|
|
227
|
-
returned.
|
|
228
|
-
"""
|
|
229
|
-
googlemaps = import_googlemaps_or_raise()
|
|
230
|
-
GOOGLEMAPS_API_KEY = get_googlemap_api_key()
|
|
231
|
-
try:
|
|
232
|
-
gmaps = googlemaps.Client(key=GOOGLEMAPS_API_KEY)
|
|
233
|
-
except Exception as e:
|
|
234
|
-
return f"Error: {e!s}"
|
|
235
|
-
|
|
236
|
-
# Assuming gmaps is a configured Google Maps client instance
|
|
237
|
-
elevation_result = gmaps.elevation(lat_lng)
|
|
238
|
-
|
|
239
|
-
# Extract the elevation data from the first (and presumably only) result
|
|
240
|
-
if elevation_result:
|
|
241
|
-
elevation = elevation_result[0]['elevation']
|
|
242
|
-
location = elevation_result[0]['location']
|
|
243
|
-
resolution = elevation_result[0]['resolution']
|
|
244
|
-
|
|
245
|
-
# Format the elevation data into a natural language description
|
|
246
|
-
description = (
|
|
247
|
-
f"The elevation at latitude {location['lat']}, "
|
|
248
|
-
f"longitude {location['lng']} "
|
|
249
|
-
f"is approximately {elevation:.2f} meters above sea level, "
|
|
250
|
-
f"with a data resolution of {resolution:.2f} meters."
|
|
251
|
-
)
|
|
252
|
-
else:
|
|
253
|
-
description = "Elevation data is not available for the given location."
|
|
254
|
-
|
|
255
|
-
return description
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
def format_offset_to_natural_language(offset: int) -> str:
|
|
259
|
-
r"""Converts a time offset in seconds to a more natural language
|
|
260
|
-
description using hours as the unit, with decimal places to represent
|
|
261
|
-
minutes and seconds.
|
|
262
|
-
|
|
263
|
-
Args:
|
|
264
|
-
offset (int): The time offset in seconds. Can be positive, negative,
|
|
265
|
-
or zero.
|
|
266
|
-
|
|
267
|
-
Returns:
|
|
268
|
-
str: A string representing the offset in hours, such as "+2.50 hours"
|
|
269
|
-
or "-3.75 hours".
|
|
270
|
-
"""
|
|
271
|
-
# Convert the offset to hours as a float
|
|
272
|
-
hours = offset / 3600.0
|
|
273
|
-
hours_str = f"{hours:+.2f} hour{'s' if abs(hours) != 1 else ''}"
|
|
274
|
-
return hours_str
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
@handle_googlemaps_exceptions
|
|
278
|
-
def get_timezone(lat_lng: Tuple) -> str:
|
|
279
|
-
r"""Retrieves timezone information for a given latitude and longitude.
|
|
280
|
-
|
|
281
|
-
This function uses the Google Maps Timezone API to fetch timezone data for
|
|
282
|
-
the specified latitude and longitude. It returns a natural language
|
|
283
|
-
description of the timezone, including the timezone ID, name, standard
|
|
284
|
-
time offset, daylight saving time offset, and the total offset from
|
|
285
|
-
Coordinated Universal Time (UTC).
|
|
286
|
-
|
|
287
|
-
Args:
|
|
288
|
-
lat_lng (Tuple[float, float]): The latitude and longitude for
|
|
289
|
-
which to retrieve elevation data.
|
|
290
|
-
|
|
291
|
-
Returns:
|
|
292
|
-
str: A descriptive string of the timezone information, including the
|
|
293
|
-
timezone ID and name, standard time offset, daylight saving time
|
|
294
|
-
offset, and total offset from UTC.
|
|
295
|
-
"""
|
|
296
|
-
googlemaps = import_googlemaps_or_raise()
|
|
297
|
-
GOOGLEMAPS_API_KEY = get_googlemap_api_key()
|
|
298
|
-
try:
|
|
299
|
-
gmaps = googlemaps.Client(key=GOOGLEMAPS_API_KEY)
|
|
300
|
-
except Exception as e:
|
|
301
|
-
return f"Error: {e!s}"
|
|
302
|
-
|
|
303
|
-
# Get timezone information
|
|
304
|
-
timezone_dict = gmaps.timezone(lat_lng)
|
|
305
|
-
|
|
306
|
-
# Extract necessary information
|
|
307
|
-
dst_offset = timezone_dict[
|
|
308
|
-
'dstOffset'
|
|
309
|
-
] # Daylight Saving Time offset in seconds
|
|
310
|
-
raw_offset = timezone_dict['rawOffset'] # Standard time offset in seconds
|
|
311
|
-
timezone_id = timezone_dict['timeZoneId']
|
|
312
|
-
timezone_name = timezone_dict['timeZoneName']
|
|
313
|
-
|
|
314
|
-
raw_offset_str = format_offset_to_natural_language(raw_offset)
|
|
315
|
-
dst_offset_str = format_offset_to_natural_language(dst_offset)
|
|
316
|
-
total_offset_seconds = dst_offset + raw_offset
|
|
317
|
-
total_offset_str = format_offset_to_natural_language(total_offset_seconds)
|
|
318
|
-
|
|
319
|
-
# Create a natural language description
|
|
320
|
-
description = (
|
|
321
|
-
f"Timezone ID is {timezone_id}, named {timezone_name}. "
|
|
322
|
-
f"The standard time offset is {raw_offset_str}. "
|
|
323
|
-
f"Daylight Saving Time offset is {dst_offset_str}. "
|
|
324
|
-
f"The total offset from Coordinated Universal Time (UTC) is "
|
|
325
|
-
f"{total_offset_str}, including any Daylight Saving Time adjustment "
|
|
326
|
-
f"if applicable. "
|
|
327
|
-
)
|
|
328
|
-
|
|
329
|
-
return description
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
MAP_FUNCS: List[OpenAIFunction] = [
|
|
333
|
-
OpenAIFunction(func) # type: ignore[arg-type]
|
|
334
|
-
for func in [get_address_description, get_elevation, get_timezone]
|
|
335
|
-
]
|
|
@@ -1,61 +0,0 @@
|
|
|
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 typing import List
|
|
16
|
-
|
|
17
|
-
from camel.functions.openai_function import OpenAIFunction
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def add(a: int, b: int) -> int:
|
|
21
|
-
r"""Adds two numbers.
|
|
22
|
-
|
|
23
|
-
Args:
|
|
24
|
-
a (int): The first number to be added.
|
|
25
|
-
b (int): The second number to be added.
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
integer: The sum of the two numbers.
|
|
29
|
-
"""
|
|
30
|
-
return a + b
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def sub(a: int, b: int) -> int:
|
|
34
|
-
r"""Do subtraction between two numbers.
|
|
35
|
-
|
|
36
|
-
Args:
|
|
37
|
-
a (int): The minuend in subtraction.
|
|
38
|
-
b (int): The subtrahend in subtraction.
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
integer: The result of subtracting :obj:`b` from :obj:`a`.
|
|
42
|
-
"""
|
|
43
|
-
return a - b
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def mul(a: int, b: int) -> int:
|
|
47
|
-
r"""Multiplies two integers.
|
|
48
|
-
|
|
49
|
-
Args:
|
|
50
|
-
a (int): The multiplier in the multiplication.
|
|
51
|
-
b (int): The multiplicand in the multiplication.
|
|
52
|
-
|
|
53
|
-
Returns:
|
|
54
|
-
integer: The product of the two numbers.
|
|
55
|
-
"""
|
|
56
|
-
return a * b
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
MATH_FUNCS: List[OpenAIFunction] = [
|
|
60
|
-
OpenAIFunction(func) for func in [add, sub, mul]
|
|
61
|
-
]
|