camel-ai 0.1.5.1__py3-none-any.whl → 0.1.5.3__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.

Files changed (86) hide show
  1. camel/agents/__init__.py +2 -0
  2. camel/agents/chat_agent.py +237 -52
  3. camel/agents/critic_agent.py +6 -9
  4. camel/agents/deductive_reasoner_agent.py +93 -40
  5. camel/agents/embodied_agent.py +6 -9
  6. camel/agents/knowledge_graph_agent.py +49 -27
  7. camel/agents/role_assignment_agent.py +14 -12
  8. camel/agents/search_agent.py +122 -0
  9. camel/agents/task_agent.py +26 -38
  10. camel/bots/__init__.py +20 -0
  11. camel/bots/discord_bot.py +103 -0
  12. camel/bots/telegram_bot.py +84 -0
  13. camel/configs/__init__.py +3 -0
  14. camel/configs/anthropic_config.py +1 -1
  15. camel/configs/litellm_config.py +113 -0
  16. camel/configs/openai_config.py +14 -0
  17. camel/embeddings/__init__.py +2 -0
  18. camel/embeddings/openai_embedding.py +2 -2
  19. camel/embeddings/sentence_transformers_embeddings.py +6 -5
  20. camel/embeddings/vlm_embedding.py +146 -0
  21. camel/functions/__init__.py +9 -0
  22. camel/functions/open_api_function.py +161 -33
  23. camel/functions/open_api_specs/biztoc/__init__.py +13 -0
  24. camel/functions/open_api_specs/biztoc/ai-plugin.json +34 -0
  25. camel/functions/open_api_specs/biztoc/openapi.yaml +21 -0
  26. camel/functions/open_api_specs/create_qr_code/__init__.py +13 -0
  27. camel/functions/open_api_specs/create_qr_code/openapi.yaml +44 -0
  28. camel/functions/open_api_specs/nasa_apod/__init__.py +13 -0
  29. camel/functions/open_api_specs/nasa_apod/openapi.yaml +72 -0
  30. camel/functions/open_api_specs/outschool/__init__.py +13 -0
  31. camel/functions/open_api_specs/outschool/ai-plugin.json +34 -0
  32. camel/functions/open_api_specs/outschool/openapi.yaml +1 -0
  33. camel/functions/open_api_specs/outschool/paths/__init__.py +14 -0
  34. camel/functions/open_api_specs/outschool/paths/get_classes.py +29 -0
  35. camel/functions/open_api_specs/outschool/paths/search_teachers.py +29 -0
  36. camel/functions/open_api_specs/security_config.py +21 -0
  37. camel/functions/open_api_specs/web_scraper/__init__.py +13 -0
  38. camel/functions/open_api_specs/web_scraper/ai-plugin.json +34 -0
  39. camel/functions/open_api_specs/web_scraper/openapi.yaml +71 -0
  40. camel/functions/open_api_specs/web_scraper/paths/__init__.py +13 -0
  41. camel/functions/open_api_specs/web_scraper/paths/scraper.py +29 -0
  42. camel/functions/openai_function.py +3 -1
  43. camel/functions/search_functions.py +104 -171
  44. camel/functions/slack_functions.py +16 -3
  45. camel/human.py +3 -1
  46. camel/loaders/base_io.py +3 -1
  47. camel/loaders/unstructured_io.py +16 -22
  48. camel/messages/base.py +135 -46
  49. camel/models/__init__.py +8 -0
  50. camel/models/anthropic_model.py +24 -16
  51. camel/models/base_model.py +6 -1
  52. camel/models/litellm_model.py +112 -0
  53. camel/models/model_factory.py +44 -16
  54. camel/models/nemotron_model.py +71 -0
  55. camel/models/ollama_model.py +121 -0
  56. camel/models/open_source_model.py +8 -2
  57. camel/models/openai_model.py +14 -5
  58. camel/models/stub_model.py +3 -1
  59. camel/models/zhipuai_model.py +125 -0
  60. camel/prompts/__init__.py +6 -0
  61. camel/prompts/base.py +2 -1
  62. camel/prompts/descripte_video_prompt.py +33 -0
  63. camel/prompts/generate_text_embedding_data.py +79 -0
  64. camel/prompts/task_prompt_template.py +13 -3
  65. camel/retrievers/auto_retriever.py +20 -11
  66. camel/retrievers/base.py +4 -2
  67. camel/retrievers/bm25_retriever.py +2 -1
  68. camel/retrievers/cohere_rerank_retriever.py +2 -1
  69. camel/retrievers/vector_retriever.py +10 -4
  70. camel/societies/babyagi_playing.py +2 -1
  71. camel/societies/role_playing.py +18 -20
  72. camel/storages/graph_storages/base.py +1 -0
  73. camel/storages/graph_storages/neo4j_graph.py +5 -3
  74. camel/storages/vectordb_storages/base.py +2 -1
  75. camel/storages/vectordb_storages/milvus.py +5 -2
  76. camel/toolkits/github_toolkit.py +120 -26
  77. camel/types/__init__.py +5 -2
  78. camel/types/enums.py +95 -4
  79. camel/utils/__init__.py +11 -2
  80. camel/utils/commons.py +78 -4
  81. camel/utils/constants.py +26 -0
  82. camel/utils/token_counting.py +62 -7
  83. {camel_ai-0.1.5.1.dist-info → camel_ai-0.1.5.3.dist-info}/METADATA +82 -53
  84. camel_ai-0.1.5.3.dist-info/RECORD +151 -0
  85. camel_ai-0.1.5.1.dist-info/RECORD +0 -119
  86. {camel_ai-0.1.5.1.dist-info → camel_ai-0.1.5.3.dist-info}/WHEEL +0 -0
@@ -13,16 +13,15 @@
13
13
  # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
14
14
  import json
15
15
  import os
16
- from typing import Any, Callable, Dict, List, Tuple
16
+ from typing import Any, Callable, Dict, List, Optional, Tuple
17
17
 
18
- import prance
19
18
  import requests
20
19
 
21
- from camel.functions import OpenAIFunction
20
+ from camel.functions import OpenAIFunction, openapi_security_config
22
21
  from camel.types import OpenAPIName
23
22
 
24
23
 
25
- def parse_openapi_file(openapi_spec_path: str) -> Dict[str, Any]:
24
+ def parse_openapi_file(openapi_spec_path: str) -> Optional[Dict[str, Any]]:
26
25
  r"""Load and parse an OpenAPI specification file.
27
26
 
28
27
  This function utilizes the `prance.ResolvingParser` to parse and resolve
@@ -34,11 +33,30 @@ def parse_openapi_file(openapi_spec_path: str) -> Dict[str, Any]:
34
33
  specification.
35
34
 
36
35
  Returns:
37
- Dict[str, Any]: The parsed OpenAPI specification as a dictionary.
36
+ Optional[Dict[str, Any]]: The parsed OpenAPI specification
37
+ as a dictionary. :obj:`None` if the package is not installed.
38
38
  """
39
+ try:
40
+ import prance
41
+ except Exception:
42
+ return None
43
+
39
44
  # Load the OpenAPI spec
40
- parser = prance.ResolvingParser(openapi_spec_path)
45
+ parser = prance.ResolvingParser(
46
+ openapi_spec_path, backend="openapi-spec-validator", strict=False
47
+ )
41
48
  openapi_spec = parser.specification
49
+ version = openapi_spec.get('openapi', {})
50
+ if not version:
51
+ raise ValueError(
52
+ "OpenAPI version not specified in the spec. "
53
+ "Only OPENAPI 3.0.x and 3.1.x are supported."
54
+ )
55
+ if not (version.startswith('3.0') or version.startswith('3.1')):
56
+ raise ValueError(
57
+ f"Unsupported OpenAPI version: {version}. "
58
+ f"Only OPENAPI 3.0.x and 3.1.x are supported."
59
+ )
42
60
  return openapi_spec
43
61
 
44
62
 
@@ -176,22 +194,33 @@ def openapi_spec_to_openai_schemas(
176
194
 
177
195
 
178
196
  def openapi_function_decorator(
179
- base_url: str, path: str, method: str, operation: Dict[str, Any]
197
+ api_name: str,
198
+ base_url: str,
199
+ path: str,
200
+ method: str,
201
+ openapi_security: List[Dict[str, Any]],
202
+ sec_schemas: Dict[str, Dict[str, Any]],
203
+ operation: Dict[str, Any],
180
204
  ) -> Callable:
181
- r"""Decorate a function to make HTTP requests based on OpenAPI operation
182
- details.
205
+ r"""Decorate a function to make HTTP requests based on OpenAPI
206
+ specification details.
183
207
 
184
- This decorator takes the base URL, path, HTTP method, and operation details
185
- from an OpenAPI specification, and returns a decorator. The decorated
186
- function can then be called with keyword arguments corresponding to the
187
- operation's parameters. The decorator handles constructing the request URL,
188
- setting headers, query parameters, and the request body as specified by the
189
- operation details.
208
+ This decorator dynamically constructs and executes an API request based on
209
+ the provided OpenAPI operation specifications, security requirements, and
210
+ parameters. It supports operations secured with `apiKey` type security
211
+ schemes and automatically injects the necessary API keys from environment
212
+ variables. Parameters in `path`, `query`, `header`, and `cookie` are also
213
+ supported.
190
214
 
191
215
  Args:
216
+ api_name (str): The name of the API, used to retrieve API key names
217
+ and URLs from the configuration.
192
218
  base_url (str): The base URL for the API.
193
219
  path (str): The path for the API endpoint, relative to the base URL.
194
220
  method (str): The HTTP method (e.g., 'get', 'post') for the request.
221
+ openapi_security (List[Dict[str, Any]]): The global security
222
+ definitions as specified in the OpenAPI specs.
223
+ sec_schemas (Dict[str, Dict[str, Any]]): Detailed security schemes.
195
224
  operation (Dict[str, Any]): A dictionary containing the OpenAPI
196
225
  operation details, including parameters and request body
197
226
  definitions.
@@ -200,6 +229,12 @@ def openapi_function_decorator(
200
229
  Callable: A decorator that, when applied to a function, enables the
201
230
  function to make HTTP requests based on the provided OpenAPI
202
231
  operation details.
232
+
233
+ Raises:
234
+ TypeError: If the security requirements include unsupported types.
235
+ ValueError: If required API keys are missing from environment
236
+ variables or if the content type of the request body is
237
+ unsupported.
203
238
  """
204
239
 
205
240
  def inner_decorator(openapi_function: Callable) -> Callable:
@@ -209,6 +244,51 @@ def openapi_function_decorator(
209
244
  params = {}
210
245
  cookies = {}
211
246
 
247
+ # Security definition of operation overrides any declared
248
+ # top-level security.
249
+ sec_requirements = operation.get('security', openapi_security)
250
+ avail_sec_requirement = {}
251
+ # Write to avaliable_security_requirement only if all the
252
+ # security_type are "apiKey"
253
+ for security_requirement in sec_requirements:
254
+ have_unsupported_type = False
255
+ for sec_scheme_name, _ in security_requirement.items():
256
+ sec_type = sec_schemas.get(sec_scheme_name).get('type')
257
+ if sec_type != "apiKey":
258
+ have_unsupported_type = True
259
+ break
260
+ if have_unsupported_type is False:
261
+ avail_sec_requirement = security_requirement
262
+ break
263
+
264
+ if sec_requirements and not avail_sec_requirement:
265
+ raise TypeError(
266
+ "Only security schemas of type `apiKey` are supported."
267
+ )
268
+
269
+ for sec_scheme_name, _ in avail_sec_requirement.items():
270
+ try:
271
+ API_KEY_NAME = openapi_security_config.get(api_name).get(
272
+ sec_scheme_name
273
+ )
274
+ api_key_value = os.environ[API_KEY_NAME]
275
+ except Exception:
276
+ api_key_url = openapi_security_config.get(api_name).get(
277
+ 'get_api_key_url'
278
+ )
279
+ raise ValueError(
280
+ f"`{API_KEY_NAME}` not found in environment "
281
+ f"variables. Get `{API_KEY_NAME}` here: {api_key_url}"
282
+ )
283
+ request_key_name = sec_schemas.get(sec_scheme_name).get('name')
284
+ request_key_in = sec_schemas.get(sec_scheme_name).get('in')
285
+ if request_key_in == 'query':
286
+ params[request_key_name] = api_key_value
287
+ elif request_key_in == 'header':
288
+ headers[request_key_name] = api_key_value
289
+ elif request_key_in == 'coolie':
290
+ cookies[request_key_name] = api_key_value
291
+
212
292
  # Assign parameters to the correct position
213
293
  for param in operation.get('parameters', []):
214
294
  input_param_name = param['name'] + '_in_' + param['in']
@@ -307,6 +387,10 @@ def generate_openapi_funcs(
307
387
  raise ValueError("No server information found in OpenAPI spec.")
308
388
  base_url = servers[0].get('url') # Use the first server URL
309
389
 
390
+ # Security requirement objects for all methods
391
+ openapi_security = openapi_spec.get('security', {})
392
+ # Security schemas which can be reused by different methods
393
+ sec_schemas = openapi_spec.get('components', {}).get('securitySchemes', {})
310
394
  functions = []
311
395
 
312
396
  # Traverse paths and methods
@@ -321,7 +405,15 @@ def generate_openapi_funcs(
321
405
  sanitized_path = path.replace('/', '_').strip('_')
322
406
  function_name = f"{api_name}_{method}_{sanitized_path}"
323
407
 
324
- @openapi_function_decorator(base_url, path, method, operation)
408
+ @openapi_function_decorator(
409
+ api_name,
410
+ base_url,
411
+ path,
412
+ method,
413
+ openapi_security,
414
+ sec_schemas,
415
+ operation,
416
+ )
325
417
  def openapi_function(**kwargs):
326
418
  pass
327
419
 
@@ -332,13 +424,22 @@ def generate_openapi_funcs(
332
424
  return functions
333
425
 
334
426
 
335
- def combine_all_funcs_schemas() -> Tuple[List[Callable], List[Dict[str, Any]]]:
336
- r"""Combines functions and schemas from multiple OpenAPI specifications.
427
+ def apinames_filepaths_to_funs_schemas(
428
+ apinames_filepaths: List[Tuple[str, str]],
429
+ ) -> Tuple[List[Callable], List[Dict[str, Any]]]:
430
+ r"""Combines functions and schemas from multiple OpenAPI specifications,
431
+ using API names as keys.
432
+
433
+ This function iterates over tuples of API names and OpenAPI spec file
434
+ paths, parsing each spec to generate callable functions and schema
435
+ dictionaries, all organized by API name.
337
436
 
338
- Iterates over a list of OpenAPI specs, parses each, and generates functions
339
- and schemas based on the defined operations and schemas respectively.
340
- Assumes specification files are named 'openapi.yaml' located in
341
- `open_api_specs/<api_name>/`.
437
+ Args:
438
+ apinames_filepaths (List[Tuple[str, str]]): A list of tuples, where each
439
+ tuple consists of:
440
+ - The API name (str) as the first element.
441
+ - The file path (str) to the API's OpenAPI specification file as the
442
+ second element.
342
443
 
343
444
  Returns:
344
445
  Tuple[List[Callable], List[Dict[str, Any]]]:: one of callable
@@ -347,34 +448,61 @@ def combine_all_funcs_schemas() -> Tuple[List[Callable], List[Dict[str, Any]]]:
347
448
  """
348
449
  combined_func_lst = []
349
450
  combined_schemas_list = []
350
-
351
- for api_name in OpenAPIName:
451
+ for api_name, file_path in apinames_filepaths:
352
452
  # Parse the OpenAPI specification for each API
353
453
  current_dir = os.path.dirname(__file__)
354
- spec_file_path = os.path.join(
355
- current_dir, 'open_api_specs', f'{api_name.value}', 'openapi.yaml'
454
+ file_path = os.path.join(
455
+ current_dir, 'open_api_specs', f'{api_name}', 'openapi.yaml'
356
456
  )
357
457
 
358
- openapi_spec = parse_openapi_file(spec_file_path)
458
+ openapi_spec = parse_openapi_file(file_path)
459
+ if openapi_spec is None:
460
+ return [], []
359
461
 
360
462
  # Generate and merge function schemas
361
463
  openapi_functions_schemas = openapi_spec_to_openai_schemas(
362
- api_name.value, openapi_spec
464
+ api_name, openapi_spec
363
465
  )
364
466
  combined_schemas_list.extend(openapi_functions_schemas)
365
467
 
366
468
  # Generate and merge function lists
367
- openapi_functions_list = generate_openapi_funcs(
368
- api_name.value, openapi_spec
369
- )
469
+ openapi_functions_list = generate_openapi_funcs(api_name, openapi_spec)
370
470
  combined_func_lst.extend(openapi_functions_list)
371
471
 
372
472
  return combined_func_lst, combined_schemas_list
373
473
 
374
474
 
375
- combined_funcs_lst, combined_schemas_list = combine_all_funcs_schemas()
475
+ def generate_apinames_filepaths() -> List[Tuple[str, str]]:
476
+ """Generates a list of tuples containing API names and their corresponding
477
+ file paths.
478
+
479
+ This function iterates over the OpenAPIName enum, constructs the file path
480
+ for each API's OpenAPI specification file, and appends a tuple of the API
481
+ name and its file path to the list. The file paths are relative to the
482
+ 'open_api_specs' directory located in the same directory as this script.
483
+
484
+ Returns:
485
+ List[Tuple[str, str]]: A list of tuples where each tuple contains two
486
+ elements. The first element of each tuple is a string representing
487
+ the name of an API, and the second element is a string that
488
+ specifies the file path to that API's OpenAPI specification file.
489
+ """
490
+ apinames_filepaths = []
491
+ current_dir = os.path.dirname(__file__)
492
+ for api_name in OpenAPIName:
493
+ file_path = os.path.join(
494
+ current_dir, 'open_api_specs', f'{api_name.value}', 'openapi.yaml'
495
+ )
496
+ apinames_filepaths.append((api_name.value, file_path))
497
+ return apinames_filepaths
498
+
499
+
500
+ apinames_filepaths = generate_apinames_filepaths()
501
+ all_funcs_lst, all_schemas_lst = apinames_filepaths_to_funs_schemas(
502
+ apinames_filepaths
503
+ )
376
504
 
377
505
  OPENAPI_FUNCS: List[OpenAIFunction] = [
378
506
  OpenAIFunction(a_func, a_schema)
379
- for a_func, a_schema in zip(combined_funcs_lst, combined_schemas_list)
507
+ for a_func, a_schema in zip(all_funcs_lst, all_schemas_lst)
380
508
  ]
@@ -0,0 +1,13 @@
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. ===========
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": "plugin-da9afb50-fc07-4d30-b606-51ed1b105bfc",
3
+ "domain": "biztoc.com",
4
+ "namespace": "biztoc",
5
+ "status": "approved",
6
+ "manifest": {
7
+ "schema_version": "v1",
8
+ "name_for_model": "biztoc",
9
+ "name_for_human": "BizToc",
10
+ "description_for_model": "Plugin for querying BizToc for business news.",
11
+ "description_for_human": "Search BizToc for business & finance news.",
12
+ "auth": {
13
+ "type": null
14
+ },
15
+ "api": {
16
+ "type": "openapi",
17
+ "url": "https://ai.biztoc.com/openapi.yaml"
18
+ },
19
+ "logo_url": "https://biztoc.com/favicon.png",
20
+ "contact_email": "mail@biztoc.com",
21
+ "legal_info_url": "https://biztoc.com/s/legal"
22
+ },
23
+ "oauth_client_id": null,
24
+ "user_settings": {
25
+ "is_installed": false,
26
+ "is_authenticated": true
27
+ },
28
+ "categories": [
29
+ {
30
+ "id": "newly_added",
31
+ "title": "New"
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,21 @@
1
+ openapi: 3.0.1
2
+ info:
3
+ title: BizToc
4
+ description: Search BizToc for business & finance news.
5
+ version: 'v1'
6
+ servers:
7
+ - url: https://ai.biztoc.com
8
+ paths:
9
+ /ai/news:
10
+ get:
11
+ operationId: getNews
12
+ summary: Retrieves the latest news whose content contains the query string.
13
+ parameters:
14
+ - in: query
15
+ name: query
16
+ schema:
17
+ type: string
18
+ description: Used to query news articles on their title and body. For example, ?query=apple will return news stories that have 'apple' in their title or body.
19
+ responses:
20
+ "200":
21
+ description: OK
@@ -0,0 +1,13 @@
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. ===========
@@ -0,0 +1,44 @@
1
+ openapi: 3.0.1
2
+ info:
3
+ title: QR Code API
4
+ version: 1.0.0
5
+ description: Create a QR code for any text or url.
6
+ servers:
7
+ - url: https://create-qr-code.modelxy.com
8
+ paths:
9
+ /create-qr-code:
10
+ get:
11
+ operationId: getQRCode
12
+ summary: Create a QR code
13
+ parameters:
14
+ - in: query
15
+ name: data
16
+ schema:
17
+ type: string
18
+ description: The data to encode in the QR code.
19
+ - in: query
20
+ name: size
21
+ schema:
22
+ type: string
23
+ default: '100x100'
24
+ description: The size of the QR code.
25
+ - in: query
26
+ name: alt
27
+ schema:
28
+ type: string
29
+ description: The alt text for the QR code image.
30
+ - in: query
31
+ name: title
32
+ schema:
33
+ type: string
34
+ description: The title for the QR code image.
35
+ responses:
36
+ '200':
37
+ description: A JSON object containing the QR code image tag.
38
+ content:
39
+ application/json:
40
+ schema:
41
+ type: object
42
+ properties:
43
+ img_tag:
44
+ type: string
@@ -0,0 +1,13 @@
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. ===========
@@ -0,0 +1,72 @@
1
+ openapi: 3.0.0
2
+ servers:
3
+ - url: https://api.nasa.gov/planetary
4
+ - url: http://api.nasa.gov/planetary
5
+ info:
6
+ contact:
7
+ email: evan.t.yates@nasa.gov
8
+ description: This endpoint structures the APOD imagery and associated metadata
9
+ so that it can be repurposed for other applications. In addition, if the
10
+ concept_tags parameter is set to True, then keywords derived from the image
11
+ explanation are returned. These keywords could be used as auto-generated
12
+ hashtags for twitter or instagram feeds; but generally help with
13
+ discoverability of relevant imagery
14
+ license:
15
+ name: Apache 2.0
16
+ url: http://www.apache.org/licenses/LICENSE-2.0.html
17
+ title: APOD
18
+ version: 1.0.0
19
+ x-apisguru-categories:
20
+ - media
21
+ - open_data
22
+ x-origin:
23
+ - format: swagger
24
+ url: https://raw.githubusercontent.com/nasa/api-docs/gh-pages/assets/json/APOD
25
+ version: "2.0"
26
+ x-providerName: nasa.gov
27
+ x-serviceName: apod
28
+ tags:
29
+ - description: An example tag
30
+ externalDocs:
31
+ description: Here's a link
32
+ url: https://example.com
33
+ name: request tag
34
+ paths:
35
+ /apod:
36
+ get:
37
+ description: Returns the picture of the day
38
+ parameters:
39
+ - description: The date of the APOD image to retrieve
40
+ in: query
41
+ name: date
42
+ required: false
43
+ schema:
44
+ type: string
45
+ - description: Retrieve the URL for the high resolution image
46
+ in: query
47
+ name: hd
48
+ required: false
49
+ schema:
50
+ type: boolean
51
+ responses:
52
+ "200":
53
+ content:
54
+ application/json:
55
+ schema:
56
+ items:
57
+ x-thing: ok
58
+ type: array
59
+ description: successful operation
60
+ "400":
61
+ description: Date must be between Jun 16, 1995 and Mar 28, 2019.
62
+ security:
63
+ - api_key: []
64
+ summary: Returns images
65
+ tags:
66
+ - request tag
67
+ components:
68
+ securitySchemes:
69
+ api_key:
70
+ in: query
71
+ name: api_key
72
+ type: apiKey
@@ -0,0 +1,13 @@
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. ===========
@@ -0,0 +1,34 @@
1
+ {
2
+ "id": "plugin-9335c256-4658-4376-bac8-a0baa5c1c889",
3
+ "domain": "chatgpt-plugin.outschool.com",
4
+ "namespace": "Outschool",
5
+ "status": "approved",
6
+ "manifest": {
7
+ "schema_version": "v1",
8
+ "name_for_model": "Outschool",
9
+ "name_for_human": "Outschool",
10
+ "description_for_model": "Search for top-quality online classes and teachers on Outschool.",
11
+ "description_for_human": "Search for top-quality online classes and teachers on Outschool.",
12
+ "auth": {
13
+ "type": "none"
14
+ },
15
+ "api": {
16
+ "type": "openapi",
17
+ "url": "https://chatgpt-plugin.outschool.com/openapi.json"
18
+ },
19
+ "logo_url": "https://chatgpt-plugin.outschool.com/logo.png",
20
+ "contact_email": "support@outschool.com",
21
+ "legal_info_url": "https://outschool.com/terms"
22
+ },
23
+ "oauth_client_id": null,
24
+ "user_settings": {
25
+ "is_installed": false,
26
+ "is_authenticated": true
27
+ },
28
+ "categories": [
29
+ {
30
+ "id": "newly_added",
31
+ "title": "New"
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1 @@
1
+ {"openapi":"3.0.1","info":{"title":"Outschool Plugin","description":"Search for top-quality online classes and teachers on Outschool.","version":"v1"},"servers":[{"url":"https://chatgpt-plugin.outschool.com/api"}],"paths":{"/classes":{"get":{"operationId":"searchClasses","description":"Returns a list of online classes","parameters":[{"name":"timeZone","in":"query","required":true,"description":"IANA Time Zone identifier of the user. Either provided by user or derived from their location. Since Outschool parents and teachers can be from different time zones, this is required to search classes that are available in parent's timezone at reasonable hours. Only IANA format is accepted.","schema":{"type":"string"},"examples":{"losAngeles":{"value":"America/Los_Angeles"},"newYork":{"value":"America/New_York"},"london":{"value":"Europe/London"}}},{"name":"age","in":"query","required":true,"description":"Outschool has several classes serving different age groups. The age of the learner(s) helps to find classes that match the best. This is a comma separated list. If the age difference between the children is more than 5 years, it may be better to search for different ages separately to get better search results.","schema":{"type":"string","minimum":3,"maximum":18},"examples":{"12":{"value":"12"},"1213":{"value":"12,13"},"5617":{"value":"5,6,17"}}},{"name":"q","in":"query","required":false,"description":"Keywords to use to search in the class list. Classes matching the keyword closest will be returned.","schema":{"type":"string"}},{"name":"delivery","in":"query","required":false,"explode":true,"description":"Filters classes by delivery type. Description for different enum values:\n One-time: Classes that meets once\n Ongoing: Weekly classes that learners can enroll in any week\n Semester course: Multi-week/session classes, usually more than 4 weeks\n Short course: Multi-week/session classes, usually around 4 weeks\n Camp: Semester or short courses during summer and school breaks\n Group: Async chat groups on a specific topic where learners share ideas and experiences, like clubs","schema":{"type":"array","items":{"type":"string","enum":["One-time","Ongoing","Semester course","Short course","Camp","Group"]}}},{"name":"userUid","in":"query","required":false,"description":"Only search classes taught by a specific teacher. The userUid is the id of the teacher","schema":{"type":"string","format":"uuid"}},{"name":"order","in":"query","description":"Sort results by either upcoming, new, or relevance. Upcoming sorts by next section start date in ascending order, new sorts by class published date in descending order, and relevance sorts by the keyword relevance and popularity of the class.","schema":{"type":"string","enum":["upcoming","new","relevance"],"default":"relevance"}},{"name":"offset","in":"query","required":false,"description":"The offset for the results. Offset and limit used in combination to paginate in results. For instance, if limit is 10, to get next 10 results, the offset should be set to 10.","schema":{"type":"number","default":0}},{"name":"limit","in":"query","required":false,"description":"Number of results to return.","schema":{"type":"number","default":10}},{"name":"startAfter","in":"query","required":false,"description":"Search classes that have a section starting on or after a given date. Only today or future dates are allowed.","schema":{"type":"string","format":"date"},"examples":{"April152023":{"value":"2023-04-15"}}},{"name":"dow","in":"query","description":"The day of week to filter classes and only return classes that have a section on given days of the week.","schema":{"type":"array","items":{"type":"string","enum":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},"style":"form","explode":true,"required":false,"examples":{"Mon":{"value":"Mon"},"Mon_Tue":{"value":"Mon,Tue"},"Mon_Thu":{"value":"Mon,Tue,Wed,Thu"},"Weekdays":{"value":"Mon,Tue,Wed,Thu,Fri"},"Weekend":{"value":"Sat, Sun"}}},{"name":"startAfterTime","in":"query","description":"The start time of the class in 24 hour format as hour of the day normalized by the user's timezone","schema":{"type":"number","minimum":6,"maximum":22}},{"name":"endByTime","in":"query","description":"The end time of the class in 24 hour format as hour of the day normalized by the user's timezone","schema":{"type":"number","minimum":6,"maximum":22}}],"responses":{"200":{"description":"A list of classes","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/class"}}}}}}}},"/teachers":{"get":{"operationId":"searchTeachers","description":"Returns a list of teachers","parameters":[{"name":"name","in":"query","required":true,"description":"Name of the teacher to search for","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Number of results to return.","schema":{"type":"number","default":10}}],"responses":{"200":{"description":"A list of teachers","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/teacher"}}}}}}}}},"components":{"schemas":{"class":{"type":"object","properties":{"uid":{"type":"string","format":"uuid","description":"Unique ID of the class in the system that can be used in other API end points"},"title":{"type":"string","description":"Title of the class"},"summary":{"type":"string","description":"Summary of the class"},"url":{"type":"string","format":"uri","description":"URL to the class detail page"},"photo":{"type":"string","format":"uri","description":"Photo of the class"},"is_ongoing_weekly":{"type":"boolean","description":"Whether this class is an ongoing class or not. When a class is an ongoing class, parents can enroll their children for any week of an ongoing class, because the sections of that class meet every week and the weeks don't depend on each other."},"age_min":{"type":"number","description":"The minimum age a learner should be to enroll in the class. Although Outschool has classes for different age groups, individual classes may only be appropriate for a certain age range."},"age_max":{"type":"number","description":"The maximum age a learner should be to enroll in the class. Although Outschool has classes for different age groups, individual classes may only be appropriate for a certain age range."},"teacher":{"$ref":"#/components/schemas/teacher"},"nextSection":{"$ref":"#/components/schemas/section","nullable":true,"description":"The next section of the class that the parent/caregiver can enroll their children in. This is usually what parents are looking for to enroll in a class."}}},"teacher":{"type":"object","properties":{"uid":{"type":"string","format":"uuid","description":"Unique ID of the teacher in the system that can be used in other API end points"},"name":{"type":"string","description":"Name of the teacher"},"about":{"type":"string","description":"A short summary the teacher provides about themselves"},"photo":{"type":"string","format":"uri","description":"Photo of the teacher"},"url":{"type":"string","format":"uri","description":"URL to the Outschool profile page of the teacher"}}},"section":{"type":"object","description":"Sections are what parents enroll their children in for a given class. They are separate cohorts of a class.","properties":{"uid":{"type":"string","format":"uuid","description":"Unique ID of the section in the system that can be used in other API end points"},"url":{"type":"string","format":"uri","description":"URL pointing to the section page"},"start_time":{"type":"string","format":"datetime","description":"The start time for the first meeting of a section."},"end_time":{"type":"string","format":"datetime","description":"The end time for the last meeting of a section."},"size_max":{"type":"number","description":"How many learners can enroll in the section."},"filledSpaceCount":{"type":"number","description":"How many learners are enrolled in the section. size_max - filledSpaceCount gives how many seats are left to enroll in."},"nextOngoingMeeting":{"$ref":"#/components/schemas/meeting","nullable":true,"description":"If the class is an ongoing class, this points to the next meeting for the section."}}},"meeting":{"type":"object","description":"The online meeting for a section. Meetings are held on Zoom.","properties":{"uid":{"type":"string","format":"uuid","description":"Unique ID of the meeting in the system that can be used in other API end points"},"start_time":{"type":"string","format":"datetime","description":"The start time of the meeting."},"end_time":{"type":"string","format":"datetime","description":"The end time of the meeting."}}}}}}
@@ -0,0 +1,14 @@
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
+ path_dict = {"get_classes": "/classes", "search_teachers": "/teachers"}
@@ -0,0 +1,29 @@
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
+ """Get classes from Outschool API."""
15
+
16
+ from typing import Any, Dict
17
+
18
+ import requests
19
+
20
+
21
+ def call_api(input_json: Dict[str, Any]) -> Dict[str, Any]:
22
+ response = requests.get(
23
+ "https://chatgpt-plugin.outschool.com/api/classes", params=input_json
24
+ )
25
+
26
+ if response.status_code == 200:
27
+ return response.json()
28
+ else:
29
+ return {"status_code": response.status_code, "text": response.text}
@@ -0,0 +1,29 @@
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
+ """Search for teachers on Outschool."""
15
+
16
+ from typing import Any, Dict
17
+
18
+ import requests
19
+
20
+
21
+ def call_api(input_json: Dict[str, Any]) -> Dict[str, Any]:
22
+ response = requests.get(
23
+ "https://chatgpt-plugin.outschool.com/api/teachers", params=input_json
24
+ )
25
+
26
+ if response.status_code == 200:
27
+ return response.json()
28
+ else:
29
+ return {"status_code": response.status_code, "text": response.text}