camel-ai 0.2.3__py3-none-any.whl → 0.2.3a1__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 +69 -93
- camel/agents/knowledge_graph_agent.py +6 -4
- camel/bots/__init__.py +2 -16
- camel/bots/discord_bot.py +206 -0
- camel/configs/__init__.py +2 -1
- camel/configs/anthropic_config.py +5 -2
- camel/configs/base_config.py +6 -6
- camel/configs/groq_config.py +3 -2
- camel/configs/ollama_config.py +2 -1
- camel/configs/openai_config.py +23 -2
- camel/configs/samba_config.py +2 -2
- camel/configs/togetherai_config.py +1 -1
- camel/configs/vllm_config.py +1 -1
- camel/configs/zhipuai_config.py +3 -2
- camel/embeddings/openai_embedding.py +2 -2
- camel/loaders/__init__.py +0 -2
- camel/loaders/firecrawl_reader.py +3 -3
- camel/loaders/unstructured_io.py +33 -35
- camel/messages/__init__.py +0 -1
- camel/models/__init__.py +4 -2
- camel/models/anthropic_model.py +26 -32
- camel/models/azure_openai_model.py +36 -39
- camel/models/base_model.py +20 -31
- camel/models/gemini_model.py +29 -37
- camel/models/groq_model.py +23 -29
- camel/models/litellm_model.py +61 -44
- camel/models/mistral_model.py +29 -32
- camel/models/model_factory.py +76 -66
- camel/models/nemotron_model.py +23 -33
- camel/models/ollama_model.py +47 -42
- camel/models/open_source_model.py +170 -0
- camel/models/{openai_compatible_model.py → openai_compatibility_model.py} +49 -31
- camel/models/openai_model.py +29 -48
- camel/models/reka_model.py +28 -30
- camel/models/samba_model.py +177 -82
- camel/models/stub_model.py +2 -2
- camel/models/togetherai_model.py +43 -37
- camel/models/vllm_model.py +50 -43
- camel/models/zhipuai_model.py +27 -33
- camel/retrievers/auto_retriever.py +10 -28
- camel/retrievers/vector_retriever.py +47 -58
- camel/societies/babyagi_playing.py +3 -6
- camel/societies/role_playing.py +3 -5
- camel/storages/graph_storages/graph_element.py +5 -3
- camel/storages/key_value_storages/json.py +1 -6
- camel/toolkits/__init__.py +7 -20
- camel/toolkits/base.py +3 -2
- camel/toolkits/code_execution.py +7 -6
- camel/toolkits/dalle_toolkit.py +6 -6
- camel/toolkits/github_toolkit.py +10 -9
- camel/toolkits/google_maps_toolkit.py +7 -7
- camel/toolkits/linkedin_toolkit.py +7 -7
- camel/toolkits/math_toolkit.py +8 -8
- camel/toolkits/open_api_toolkit.py +5 -5
- camel/toolkits/{function_tool.py → openai_function.py} +11 -34
- camel/toolkits/reddit_toolkit.py +7 -7
- camel/toolkits/retrieval_toolkit.py +5 -5
- camel/toolkits/search_toolkit.py +9 -9
- camel/toolkits/slack_toolkit.py +11 -11
- camel/toolkits/twitter_toolkit.py +452 -378
- camel/toolkits/weather_toolkit.py +6 -6
- camel/types/__init__.py +1 -6
- camel/types/enums.py +85 -40
- camel/types/openai_types.py +0 -3
- camel/utils/__init__.py +2 -0
- camel/utils/async_func.py +7 -7
- camel/utils/commons.py +3 -32
- camel/utils/token_counting.py +212 -30
- camel/workforce/role_playing_worker.py +1 -1
- camel/workforce/single_agent_worker.py +1 -1
- camel/workforce/task_channel.py +3 -4
- camel/workforce/workforce.py +4 -4
- {camel_ai-0.2.3.dist-info → camel_ai-0.2.3a1.dist-info}/METADATA +56 -27
- {camel_ai-0.2.3.dist-info → camel_ai-0.2.3a1.dist-info}/RECORD +76 -85
- {camel_ai-0.2.3.dist-info → camel_ai-0.2.3a1.dist-info}/WHEEL +1 -1
- camel/bots/discord_app.py +0 -138
- camel/bots/slack/__init__.py +0 -30
- camel/bots/slack/models.py +0 -158
- camel/bots/slack/slack_app.py +0 -255
- camel/loaders/chunkr_reader.py +0 -163
- camel/toolkits/arxiv_toolkit.py +0 -155
- camel/toolkits/ask_news_toolkit.py +0 -653
- camel/toolkits/google_scholar_toolkit.py +0 -146
- camel/toolkits/whatsapp_toolkit.py +0 -177
- camel/types/unified_model_type.py +0 -104
- camel_ai-0.2.3.dist-info/LICENSE +0 -201
|
@@ -1,146 +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 re
|
|
15
|
-
from typing import List, Optional
|
|
16
|
-
|
|
17
|
-
from camel.toolkits import FunctionTool
|
|
18
|
-
from camel.toolkits.base import BaseToolkit
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class GoogleScholarToolkit(BaseToolkit):
|
|
22
|
-
r"""A toolkit for retrieving information about authors and their
|
|
23
|
-
publications from Google Scholar.
|
|
24
|
-
|
|
25
|
-
Attributes:
|
|
26
|
-
author_identifier (Union[str, None]): The author's Google Scholar URL
|
|
27
|
-
or name of the author to search for.
|
|
28
|
-
is_author_name (bool): Flag to indicate if the identifier is a name.
|
|
29
|
-
(default: :obj:`False`)
|
|
30
|
-
scholarly (module): The scholarly module for querying Google Scholar.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
def __init__(
|
|
34
|
-
self, author_identifier: str, is_author_name: bool = False
|
|
35
|
-
) -> None:
|
|
36
|
-
r"""Initializes the GoogleScholarToolkit with the author's identifier.
|
|
37
|
-
|
|
38
|
-
Args:
|
|
39
|
-
author_identifier (str): The author's Google Scholar URL or name
|
|
40
|
-
of the author to search for.
|
|
41
|
-
is_author_name (bool): Flag to indicate if the identifier is a
|
|
42
|
-
name. (default: :obj:`False`)
|
|
43
|
-
"""
|
|
44
|
-
from scholarly import scholarly
|
|
45
|
-
|
|
46
|
-
self.scholarly = scholarly
|
|
47
|
-
self.author_identifier = author_identifier
|
|
48
|
-
self.is_author_name = is_author_name
|
|
49
|
-
|
|
50
|
-
def _extract_author_id(self) -> Optional[str]:
|
|
51
|
-
r"""Extracts the author ID from a Google Scholar URL if provided.
|
|
52
|
-
|
|
53
|
-
Returns:
|
|
54
|
-
Optional[str]: The extracted author ID, or None if not found.
|
|
55
|
-
"""
|
|
56
|
-
match = re.search(r'user=([A-Za-z0-9-]+)', self.author_identifier)
|
|
57
|
-
return match.group(1) if match else None
|
|
58
|
-
|
|
59
|
-
def get_author_detailed_info(
|
|
60
|
-
self,
|
|
61
|
-
) -> dict:
|
|
62
|
-
r"""Retrieves detailed information about the author.
|
|
63
|
-
|
|
64
|
-
Returns:
|
|
65
|
-
dict: A dictionary containing detailed information about the
|
|
66
|
-
author.
|
|
67
|
-
"""
|
|
68
|
-
if self.is_author_name:
|
|
69
|
-
search_query = self.scholarly.search_author(self.author_identifier)
|
|
70
|
-
# Retrieve the first result from the iterator
|
|
71
|
-
first_author_result = next(search_query)
|
|
72
|
-
else:
|
|
73
|
-
author_id = self._extract_author_id()
|
|
74
|
-
first_author_result = self.scholarly.search_author_id(id=author_id)
|
|
75
|
-
|
|
76
|
-
author = self.scholarly.fill(first_author_result)
|
|
77
|
-
return author
|
|
78
|
-
|
|
79
|
-
def get_author_publications(
|
|
80
|
-
self,
|
|
81
|
-
) -> List[str]:
|
|
82
|
-
r"""Retrieves the titles of the author's publications.
|
|
83
|
-
|
|
84
|
-
Returns:
|
|
85
|
-
List[str]: A list of publication titles authored by the author.
|
|
86
|
-
"""
|
|
87
|
-
author = self.get_author_detailed_info()
|
|
88
|
-
publication_titles = [
|
|
89
|
-
pub['bib']['title'] for pub in author['publications']
|
|
90
|
-
]
|
|
91
|
-
return publication_titles
|
|
92
|
-
|
|
93
|
-
def get_publication_by_title(
|
|
94
|
-
self, publication_title: str
|
|
95
|
-
) -> Optional[dict]:
|
|
96
|
-
r"""Retrieves detailed information about a specific publication by its
|
|
97
|
-
title. Note that this method cannot retrieve the full content of the
|
|
98
|
-
paper.
|
|
99
|
-
|
|
100
|
-
Args:
|
|
101
|
-
publication_title (str): The title of the publication to search
|
|
102
|
-
for.
|
|
103
|
-
|
|
104
|
-
Returns:
|
|
105
|
-
Optional[dict]: A dictionary containing detailed information about
|
|
106
|
-
the publication if found; otherwise, `None`.
|
|
107
|
-
"""
|
|
108
|
-
author = self.get_author_detailed_info()
|
|
109
|
-
publications = author['publications']
|
|
110
|
-
for publication in publications:
|
|
111
|
-
if publication['bib']['title'] == publication_title:
|
|
112
|
-
return self.scholarly.fill(publication)
|
|
113
|
-
return None # Return None if not found
|
|
114
|
-
|
|
115
|
-
def get_full_paper_content_by_link(self, pdf_url: str) -> Optional[str]:
|
|
116
|
-
r"""Retrieves the full paper content from a given PDF URL using the
|
|
117
|
-
arxiv2text tool.
|
|
118
|
-
|
|
119
|
-
Args:
|
|
120
|
-
pdf_url (str): The URL of the PDF file.
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
Optional[str]: The full text extracted from the PDF, or `None` if
|
|
124
|
-
an error occurs.
|
|
125
|
-
"""
|
|
126
|
-
from arxiv2text import arxiv_to_text
|
|
127
|
-
|
|
128
|
-
try:
|
|
129
|
-
return arxiv_to_text(pdf_url)
|
|
130
|
-
except Exception:
|
|
131
|
-
return None # Return None in case of any error
|
|
132
|
-
|
|
133
|
-
def get_tools(self) -> List[FunctionTool]:
|
|
134
|
-
r"""Returns a list of FunctionTool objects representing the
|
|
135
|
-
functions in the toolkit.
|
|
136
|
-
|
|
137
|
-
Returns:
|
|
138
|
-
List[FunctionTool]: A list of FunctionTool objects
|
|
139
|
-
representing the functions in the toolkit.
|
|
140
|
-
"""
|
|
141
|
-
return [
|
|
142
|
-
FunctionTool(self.get_author_detailed_info),
|
|
143
|
-
FunctionTool(self.get_author_publications),
|
|
144
|
-
FunctionTool(self.get_publication_by_title),
|
|
145
|
-
FunctionTool(self.get_full_paper_content_by_link),
|
|
146
|
-
]
|
|
@@ -1,177 +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
|
-
import os
|
|
16
|
-
from typing import Any, Dict, List, Union
|
|
17
|
-
|
|
18
|
-
import requests
|
|
19
|
-
|
|
20
|
-
from camel.toolkits import FunctionTool
|
|
21
|
-
from camel.toolkits.base import BaseToolkit
|
|
22
|
-
from camel.utils.commons import retry_request
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class WhatsAppToolkit(BaseToolkit):
|
|
26
|
-
r"""A class representing a toolkit for WhatsApp operations.
|
|
27
|
-
|
|
28
|
-
This toolkit provides methods to interact with the WhatsApp Business API,
|
|
29
|
-
allowing users to send messages, retrieve message templates, and get
|
|
30
|
-
business profile information.
|
|
31
|
-
|
|
32
|
-
Attributes:
|
|
33
|
-
retries (int): Number of retries for API requests in case of failure.
|
|
34
|
-
delay (int): Delay between retries in seconds.
|
|
35
|
-
base_url (str): Base URL for the WhatsApp Business API.
|
|
36
|
-
version (str): API version.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
def __init__(self, retries: int = 3, delay: int = 1):
|
|
40
|
-
r"""Initializes the WhatsAppToolkit with the specified number of
|
|
41
|
-
retries and delay.
|
|
42
|
-
|
|
43
|
-
Args:
|
|
44
|
-
retries (int): Number of times to retry the request in case of
|
|
45
|
-
failure. (default: :obj:`3`)
|
|
46
|
-
delay (int): Time in seconds to wait between retries.
|
|
47
|
-
(default: :obj:`1`)
|
|
48
|
-
"""
|
|
49
|
-
self.retries = retries
|
|
50
|
-
self.delay = delay
|
|
51
|
-
self.base_url = "https://graph.facebook.com"
|
|
52
|
-
self.version = "v17.0"
|
|
53
|
-
|
|
54
|
-
self.access_token = os.environ.get("WHATSAPP_ACCESS_TOKEN", "")
|
|
55
|
-
self.phone_number_id = os.environ.get("WHATSAPP_PHONE_NUMBER_ID", "")
|
|
56
|
-
|
|
57
|
-
if not all([self.access_token, self.phone_number_id]):
|
|
58
|
-
raise ValueError(
|
|
59
|
-
"WhatsApp API credentials are not set. "
|
|
60
|
-
"Please set the WHATSAPP_ACCESS_TOKEN and "
|
|
61
|
-
"WHATSAPP_PHONE_NUMBER_ID environment variables."
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
def send_message(
|
|
65
|
-
self, to: str, message: str
|
|
66
|
-
) -> Union[Dict[str, Any], str]:
|
|
67
|
-
r"""Sends a text message to a specified WhatsApp number.
|
|
68
|
-
|
|
69
|
-
Args:
|
|
70
|
-
to (str): The recipient's WhatsApp number in international format.
|
|
71
|
-
message (str): The text message to send.
|
|
72
|
-
|
|
73
|
-
Returns:
|
|
74
|
-
Union[Dict[str, Any], str]: A dictionary containing
|
|
75
|
-
the API response if successful, or an error message string if
|
|
76
|
-
failed.
|
|
77
|
-
"""
|
|
78
|
-
url = f"{self.base_url}/{self.version}/{self.phone_number_id}/messages"
|
|
79
|
-
headers = {
|
|
80
|
-
"Authorization": f"Bearer {self.access_token}",
|
|
81
|
-
"Content-Type": "application/json",
|
|
82
|
-
}
|
|
83
|
-
data = {
|
|
84
|
-
"messaging_product": "whatsapp",
|
|
85
|
-
"to": to,
|
|
86
|
-
"type": "text",
|
|
87
|
-
"text": {"body": message},
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
try:
|
|
91
|
-
response = retry_request(
|
|
92
|
-
requests.post,
|
|
93
|
-
retries=self.retries,
|
|
94
|
-
delay=self.delay,
|
|
95
|
-
url=url,
|
|
96
|
-
headers=headers,
|
|
97
|
-
json=data,
|
|
98
|
-
)
|
|
99
|
-
response.raise_for_status()
|
|
100
|
-
return response.json()
|
|
101
|
-
except Exception as e:
|
|
102
|
-
return f"Failed to send message: {e!s}"
|
|
103
|
-
|
|
104
|
-
def get_message_templates(self) -> Union[List[Dict[str, Any]], str]:
|
|
105
|
-
r"""Retrieves all message templates for the WhatsApp Business account.
|
|
106
|
-
|
|
107
|
-
Returns:
|
|
108
|
-
Union[List[Dict[str, Any]], str]: A list of dictionaries containing
|
|
109
|
-
template information if successful, or an error message string
|
|
110
|
-
if failed.
|
|
111
|
-
"""
|
|
112
|
-
url = (
|
|
113
|
-
f"{self.base_url}/{self.version}/{self.phone_number_id}"
|
|
114
|
-
"/message_templates"
|
|
115
|
-
)
|
|
116
|
-
headers = {"Authorization": f"Bearer {self.access_token}"}
|
|
117
|
-
|
|
118
|
-
try:
|
|
119
|
-
response = retry_request(
|
|
120
|
-
requests.get,
|
|
121
|
-
retries=self.retries,
|
|
122
|
-
delay=self.delay,
|
|
123
|
-
url=url,
|
|
124
|
-
headers=headers,
|
|
125
|
-
)
|
|
126
|
-
response.raise_for_status()
|
|
127
|
-
return response.json().get("data", [])
|
|
128
|
-
except Exception as e:
|
|
129
|
-
return f"Failed to retrieve message templates: {e!s}"
|
|
130
|
-
|
|
131
|
-
def get_business_profile(self) -> Union[Dict[str, Any], str]:
|
|
132
|
-
r"""Retrieves the WhatsApp Business profile information.
|
|
133
|
-
|
|
134
|
-
Returns:
|
|
135
|
-
Union[Dict[str, Any], str]: A dictionary containing the business
|
|
136
|
-
profile information if successful, or an error message string
|
|
137
|
-
if failed.
|
|
138
|
-
"""
|
|
139
|
-
url = (
|
|
140
|
-
f"{self.base_url}/{self.version}/{self.phone_number_id}"
|
|
141
|
-
"/whatsapp_business_profile"
|
|
142
|
-
)
|
|
143
|
-
headers = {"Authorization": f"Bearer {self.access_token}"}
|
|
144
|
-
params = {
|
|
145
|
-
"fields": (
|
|
146
|
-
"about,address,description,email,profile_picture_url,"
|
|
147
|
-
"websites,vertical"
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
try:
|
|
152
|
-
response = retry_request(
|
|
153
|
-
requests.get,
|
|
154
|
-
retries=self.retries,
|
|
155
|
-
delay=self.delay,
|
|
156
|
-
url=url,
|
|
157
|
-
headers=headers,
|
|
158
|
-
params=params,
|
|
159
|
-
)
|
|
160
|
-
response.raise_for_status()
|
|
161
|
-
return response.json()
|
|
162
|
-
except Exception as e:
|
|
163
|
-
return f"Failed to retrieve business profile: {e!s}"
|
|
164
|
-
|
|
165
|
-
def get_tools(self) -> List[FunctionTool]:
|
|
166
|
-
r"""Returns a list of OpenAIFunction objects representing the
|
|
167
|
-
functions in the toolkit.
|
|
168
|
-
|
|
169
|
-
Returns:
|
|
170
|
-
List[OpenAIFunction]: A list of OpenAIFunction objects for the
|
|
171
|
-
toolkit methods.
|
|
172
|
-
"""
|
|
173
|
-
return [
|
|
174
|
-
FunctionTool(self.send_message),
|
|
175
|
-
FunctionTool(self.get_message_templates),
|
|
176
|
-
FunctionTool(self.get_business_profile),
|
|
177
|
-
]
|
|
@@ -1,104 +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 logging
|
|
15
|
-
from threading import Lock
|
|
16
|
-
from typing import TYPE_CHECKING, ClassVar, Dict, Union, cast
|
|
17
|
-
|
|
18
|
-
if TYPE_CHECKING:
|
|
19
|
-
from camel.types import ModelType
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class UnifiedModelType(str):
|
|
23
|
-
r"""Class used for support both :obj:`ModelType` and :obj:`str` to be used
|
|
24
|
-
to represent a model type in a unified way. This class is a subclass of
|
|
25
|
-
:obj:`str` so that it can be used as string seamlessly.
|
|
26
|
-
|
|
27
|
-
Args:
|
|
28
|
-
value (Union[ModelType, str]): The value of the model type.
|
|
29
|
-
"""
|
|
30
|
-
|
|
31
|
-
_cache: ClassVar[Dict[str, "UnifiedModelType"]] = {}
|
|
32
|
-
_lock: ClassVar[Lock] = Lock()
|
|
33
|
-
|
|
34
|
-
def __new__(cls, value: Union["ModelType", str]) -> "UnifiedModelType":
|
|
35
|
-
with cls._lock:
|
|
36
|
-
if value not in cls._cache:
|
|
37
|
-
instance = super().__new__(cls, value)
|
|
38
|
-
cls._cache[value] = cast(UnifiedModelType, instance)
|
|
39
|
-
else:
|
|
40
|
-
instance = cls._cache[value]
|
|
41
|
-
return instance
|
|
42
|
-
|
|
43
|
-
def __init__(self, value: Union["ModelType", str]) -> None:
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
@property
|
|
47
|
-
def value_for_tiktoken(self) -> str:
|
|
48
|
-
r"""Returns the model name for TikToken."""
|
|
49
|
-
return "gpt-4o-mini"
|
|
50
|
-
|
|
51
|
-
@property
|
|
52
|
-
def token_limit(self) -> int:
|
|
53
|
-
r"""Returns the token limit for the model. Here we set the default
|
|
54
|
-
value as `999_999_999` if it's not provided from `model_config_dict`"""
|
|
55
|
-
logging.warning(
|
|
56
|
-
"Invalid or missing `max_tokens` in `model_config_dict`. "
|
|
57
|
-
"Defaulting to 999_999_999 tokens."
|
|
58
|
-
)
|
|
59
|
-
return 999_999_999
|
|
60
|
-
|
|
61
|
-
@property
|
|
62
|
-
def is_openai(self) -> bool:
|
|
63
|
-
r"""Returns whether the model is an OpenAI model."""
|
|
64
|
-
return True
|
|
65
|
-
|
|
66
|
-
@property
|
|
67
|
-
def is_anthropic(self) -> bool:
|
|
68
|
-
r"""Returns whether the model is an Anthropic model."""
|
|
69
|
-
return True
|
|
70
|
-
|
|
71
|
-
@property
|
|
72
|
-
def is_azure_openai(self) -> bool:
|
|
73
|
-
r"""Returns whether the model is an Azure OpenAI model."""
|
|
74
|
-
return True
|
|
75
|
-
|
|
76
|
-
@property
|
|
77
|
-
def is_groq(self) -> bool:
|
|
78
|
-
r"""Returns whether the model is a Groq served model."""
|
|
79
|
-
return True
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def is_zhipuai(self) -> bool:
|
|
83
|
-
r"""Returns whether the model is a Zhipuai model."""
|
|
84
|
-
return True
|
|
85
|
-
|
|
86
|
-
@property
|
|
87
|
-
def is_gemini(self) -> bool:
|
|
88
|
-
r"""Returns whether the model is a Gemini model."""
|
|
89
|
-
return True
|
|
90
|
-
|
|
91
|
-
@property
|
|
92
|
-
def is_mistral(self) -> bool:
|
|
93
|
-
r"""Returns whether the model is a Mistral model."""
|
|
94
|
-
return True
|
|
95
|
-
|
|
96
|
-
@property
|
|
97
|
-
def is_reka(self) -> bool:
|
|
98
|
-
r"""Returns whether the model is a Reka model."""
|
|
99
|
-
return True
|
|
100
|
-
|
|
101
|
-
@property
|
|
102
|
-
def support_native_tool_calling(self) -> bool:
|
|
103
|
-
r"""Returns whether the model supports native tool calling."""
|
|
104
|
-
return False
|
camel_ai-0.2.3.dist-info/LICENSE
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright 2023 @ CAMEL-AI.org
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|