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
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
from typing import List, Union
|
|
15
|
+
|
|
16
|
+
from camel.retrievers import AutoRetriever
|
|
17
|
+
from camel.toolkits import OpenAIFunction
|
|
18
|
+
from camel.toolkits.base import BaseToolkit
|
|
19
|
+
from camel.types import StorageType
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RetrievalToolkit(BaseToolkit):
|
|
23
|
+
r"""A class representing a toolkit for information retrieval.
|
|
24
|
+
|
|
25
|
+
This class provides methods for retrieving information from a local vector
|
|
26
|
+
storage system based on a specified query.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def information_retrieval(
|
|
30
|
+
self, query: str, content_input_paths: Union[str, List[str]]
|
|
31
|
+
) -> str:
|
|
32
|
+
r"""Retrieves information from a local vector storage based on the
|
|
33
|
+
specified query. This function connects to a local vector storage
|
|
34
|
+
system and retrieves relevant information by processing the input
|
|
35
|
+
query. It is essential to use this function when the answer to a
|
|
36
|
+
question requires external knowledge sources.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
query (str): The question or query for which an answer is required.
|
|
40
|
+
content_input_paths (Union[str, List[str]]): Paths to local
|
|
41
|
+
files or remote URLs.
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
str: The information retrieved in response to the query, aggregated
|
|
45
|
+
and formatted as a string.
|
|
46
|
+
|
|
47
|
+
Example:
|
|
48
|
+
# Retrieve information about CAMEL AI.
|
|
49
|
+
information_retrieval(query = "what is CAMEL AI?",
|
|
50
|
+
content_input_paths="https://www.camel-ai.org/")
|
|
51
|
+
"""
|
|
52
|
+
auto_retriever = AutoRetriever(
|
|
53
|
+
vector_storage_local_path="camel/temp_storage",
|
|
54
|
+
storage_type=StorageType.QDRANT,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
retrieved_info = auto_retriever.run_vector_retriever(
|
|
58
|
+
query=query, content_input_paths=content_input_paths, top_k=3
|
|
59
|
+
)
|
|
60
|
+
return retrieved_info
|
|
61
|
+
|
|
62
|
+
def get_tools(self) -> List[OpenAIFunction]:
|
|
63
|
+
r"""Returns a list of OpenAIFunction objects representing the
|
|
64
|
+
functions in the toolkit.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
List[OpenAIFunction]: A list of OpenAIFunction objects
|
|
68
|
+
representing the functions in the toolkit.
|
|
69
|
+
"""
|
|
70
|
+
return [
|
|
71
|
+
OpenAIFunction(self.information_retrieval),
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# add the function to OpenAIFunction list
|
|
76
|
+
RETRIEVAL_FUNCS: List[OpenAIFunction] = RetrievalToolkit().get_tools()
|
|
@@ -0,0 +1,326 @@
|
|
|
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 typing import Any, Dict, List
|
|
16
|
+
|
|
17
|
+
from camel.toolkits.base import BaseToolkit
|
|
18
|
+
from camel.toolkits.openai_function import OpenAIFunction
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SearchToolkit(BaseToolkit):
|
|
22
|
+
r"""A class representing a toolkit for web search.
|
|
23
|
+
|
|
24
|
+
This class provides methods for searching information on the web using
|
|
25
|
+
search engines like Google, DuckDuckGo, Wikipedia and Wolfram Alpha.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def search_wiki(self, entity: str) -> str:
|
|
29
|
+
r"""Search the entity in WikiPedia and return the summary of the
|
|
30
|
+
required page, containing factual information about
|
|
31
|
+
the given entity.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
entity (str): The entity to be searched.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
str: The search result. If the page corresponding to the entity
|
|
38
|
+
exists, return the summary of this entity in a string.
|
|
39
|
+
"""
|
|
40
|
+
try:
|
|
41
|
+
import wikipedia
|
|
42
|
+
except ImportError:
|
|
43
|
+
raise ImportError(
|
|
44
|
+
"Please install `wikipedia` first. You can install it "
|
|
45
|
+
"by running `pip install wikipedia`."
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
result: str
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
result = wikipedia.summary(entity, sentences=5, auto_suggest=False)
|
|
52
|
+
except wikipedia.exceptions.DisambiguationError as e:
|
|
53
|
+
result = wikipedia.summary(
|
|
54
|
+
e.options[0], sentences=5, auto_suggest=False
|
|
55
|
+
)
|
|
56
|
+
except wikipedia.exceptions.PageError:
|
|
57
|
+
result = (
|
|
58
|
+
"There is no page in Wikipedia corresponding to entity "
|
|
59
|
+
f"{entity}, please specify another word to describe the"
|
|
60
|
+
" entity to be searched."
|
|
61
|
+
)
|
|
62
|
+
except wikipedia.exceptions.WikipediaException as e:
|
|
63
|
+
result = f"An exception occurred during the search: {e}"
|
|
64
|
+
|
|
65
|
+
return result
|
|
66
|
+
|
|
67
|
+
def search_duckduckgo(
|
|
68
|
+
self, query: str, source: str = "text", max_results: int = 10
|
|
69
|
+
) -> List[Dict[str, Any]]:
|
|
70
|
+
r"""Use DuckDuckGo search engine to search information for
|
|
71
|
+
the given query.
|
|
72
|
+
|
|
73
|
+
This function queries the DuckDuckGo API for related topics to
|
|
74
|
+
the given search term. The results are formatted into a list of
|
|
75
|
+
dictionaries, each representing a search result.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
query (str): The query to be searched.
|
|
79
|
+
source (str): The type of information to query (e.g., "text",
|
|
80
|
+
"images", "videos"). Defaults to "text".
|
|
81
|
+
max_results (int): Max number of results, defaults to `10`.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
List[Dict[str, Any]]: A list of dictionaries where each dictionary
|
|
85
|
+
represents a search result.
|
|
86
|
+
"""
|
|
87
|
+
from duckduckgo_search import DDGS
|
|
88
|
+
from requests.exceptions import RequestException
|
|
89
|
+
|
|
90
|
+
ddgs = DDGS()
|
|
91
|
+
responses: List[Dict[str, Any]] = []
|
|
92
|
+
|
|
93
|
+
if source == "text":
|
|
94
|
+
try:
|
|
95
|
+
results = ddgs.text(keywords=query, max_results=max_results)
|
|
96
|
+
except RequestException as e:
|
|
97
|
+
# Handle specific exceptions or general request exceptions
|
|
98
|
+
responses.append({"error": f"duckduckgo search failed.{e}"})
|
|
99
|
+
|
|
100
|
+
# Iterate over results found
|
|
101
|
+
for i, result in enumerate(results, start=1):
|
|
102
|
+
# Creating a response object with a similar structure
|
|
103
|
+
response = {
|
|
104
|
+
"result_id": i,
|
|
105
|
+
"title": result["title"],
|
|
106
|
+
"description": result["body"],
|
|
107
|
+
"url": result["href"],
|
|
108
|
+
}
|
|
109
|
+
responses.append(response)
|
|
110
|
+
|
|
111
|
+
elif source == "images":
|
|
112
|
+
try:
|
|
113
|
+
results = ddgs.images(keywords=query, max_results=max_results)
|
|
114
|
+
except RequestException as e:
|
|
115
|
+
# Handle specific exceptions or general request exceptions
|
|
116
|
+
responses.append({"error": f"duckduckgo search failed.{e}"})
|
|
117
|
+
|
|
118
|
+
# Iterate over results found
|
|
119
|
+
for i, result in enumerate(results, start=1):
|
|
120
|
+
# Creating a response object with a similar structure
|
|
121
|
+
response = {
|
|
122
|
+
"result_id": i,
|
|
123
|
+
"title": result["title"],
|
|
124
|
+
"image": result["image"],
|
|
125
|
+
"url": result["url"],
|
|
126
|
+
"source": result["source"],
|
|
127
|
+
}
|
|
128
|
+
responses.append(response)
|
|
129
|
+
|
|
130
|
+
elif source == "videos":
|
|
131
|
+
try:
|
|
132
|
+
results = ddgs.videos(keywords=query, max_results=max_results)
|
|
133
|
+
except RequestException as e:
|
|
134
|
+
# Handle specific exceptions or general request exceptions
|
|
135
|
+
responses.append({"error": f"duckduckgo search failed.{e}"})
|
|
136
|
+
|
|
137
|
+
# Iterate over results found
|
|
138
|
+
for i, result in enumerate(results, start=1):
|
|
139
|
+
# Creating a response object with a similar structure
|
|
140
|
+
response = {
|
|
141
|
+
"result_id": i,
|
|
142
|
+
"title": result["title"],
|
|
143
|
+
"description": result["description"],
|
|
144
|
+
"embed_url": result["embed_url"],
|
|
145
|
+
"publisher": result["publisher"],
|
|
146
|
+
"duration": result["duration"],
|
|
147
|
+
"published": result["published"],
|
|
148
|
+
}
|
|
149
|
+
responses.append(response)
|
|
150
|
+
|
|
151
|
+
# If no answer found, return an empty list
|
|
152
|
+
return responses
|
|
153
|
+
|
|
154
|
+
def search_google(
|
|
155
|
+
self, query: str, num_result_pages: int = 10
|
|
156
|
+
) -> List[Dict[str, Any]]:
|
|
157
|
+
r"""Use Google search engine to search information for the given query.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
query (str): The query to be searched.
|
|
161
|
+
num_result_pages (int): The number of result pages to retrieve.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
List[Dict[str, Any]]: A list of dictionaries where each dictionary
|
|
165
|
+
represents a website.
|
|
166
|
+
Each dictionary contains the following keys:
|
|
167
|
+
- 'result_id': A number in order.
|
|
168
|
+
- 'title': The title of the website.
|
|
169
|
+
- 'description': A brief description of the website.
|
|
170
|
+
- 'long_description': More detail of the website.
|
|
171
|
+
- 'url': The URL of the website.
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
{
|
|
175
|
+
'result_id': 1,
|
|
176
|
+
'title': 'OpenAI',
|
|
177
|
+
'description': 'An organization focused on ensuring that
|
|
178
|
+
artificial general intelligence benefits all of humanity.',
|
|
179
|
+
'long_description': 'OpenAI is a non-profit artificial
|
|
180
|
+
intelligence research company. Our goal is to advance
|
|
181
|
+
digital intelligence in the way that is most likely to
|
|
182
|
+
benefit humanity as a whole',
|
|
183
|
+
'url': 'https://www.openai.com'
|
|
184
|
+
}
|
|
185
|
+
title, description, url of a website.
|
|
186
|
+
"""
|
|
187
|
+
import requests
|
|
188
|
+
|
|
189
|
+
# https://developers.google.com/custom-search/v1/overview
|
|
190
|
+
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
|
191
|
+
# https://cse.google.com/cse/all
|
|
192
|
+
SEARCH_ENGINE_ID = os.getenv("SEARCH_ENGINE_ID")
|
|
193
|
+
|
|
194
|
+
# Using the first page
|
|
195
|
+
start_page_idx = 1
|
|
196
|
+
# Different language may get different result
|
|
197
|
+
search_language = "en"
|
|
198
|
+
# How many pages to return
|
|
199
|
+
num_result_pages = 10
|
|
200
|
+
# Constructing the URL
|
|
201
|
+
# Doc: https://developers.google.com/custom-search/v1/using_rest
|
|
202
|
+
url = (
|
|
203
|
+
f"https://www.googleapis.com/customsearch/v1?"
|
|
204
|
+
f"key={GOOGLE_API_KEY}&cx={SEARCH_ENGINE_ID}&q={query}&start="
|
|
205
|
+
f"{start_page_idx}&lr={search_language}&num={num_result_pages}"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
responses = []
|
|
209
|
+
# Fetch the results given the URL
|
|
210
|
+
try:
|
|
211
|
+
# Make the get
|
|
212
|
+
result = requests.get(url)
|
|
213
|
+
data = result.json()
|
|
214
|
+
|
|
215
|
+
# Get the result items
|
|
216
|
+
if "items" in data:
|
|
217
|
+
search_items = data.get("items")
|
|
218
|
+
|
|
219
|
+
# Iterate over 10 results found
|
|
220
|
+
for i, search_item in enumerate(search_items, start=1):
|
|
221
|
+
if (
|
|
222
|
+
"og:description"
|
|
223
|
+
in search_item["pagemap"]["metatags"][0]
|
|
224
|
+
):
|
|
225
|
+
long_description = search_item["pagemap"]["metatags"][
|
|
226
|
+
0
|
|
227
|
+
]["og:description"]
|
|
228
|
+
else:
|
|
229
|
+
long_description = "N/A"
|
|
230
|
+
# Get the page title
|
|
231
|
+
title = search_item.get("title")
|
|
232
|
+
# Page snippet
|
|
233
|
+
snippet = search_item.get("snippet")
|
|
234
|
+
|
|
235
|
+
# Extract the page url
|
|
236
|
+
link = search_item.get("link")
|
|
237
|
+
response = {
|
|
238
|
+
"result_id": i,
|
|
239
|
+
"title": title,
|
|
240
|
+
"description": snippet,
|
|
241
|
+
"long_description": long_description,
|
|
242
|
+
"url": link,
|
|
243
|
+
}
|
|
244
|
+
responses.append(response)
|
|
245
|
+
else:
|
|
246
|
+
responses.append({"error": "google search failed."})
|
|
247
|
+
|
|
248
|
+
except requests.RequestException:
|
|
249
|
+
# Handle specific exceptions or general request exceptions
|
|
250
|
+
responses.append({"error": "google search failed."})
|
|
251
|
+
# If no answer found, return an empty list
|
|
252
|
+
return responses
|
|
253
|
+
|
|
254
|
+
def query_wolfram_alpha(self, query: str, is_detailed: bool) -> str:
|
|
255
|
+
r"""Queries Wolfram|Alpha and returns the result. Wolfram|Alpha is an
|
|
256
|
+
answer engine developed by Wolfram Research. It is offered as an online
|
|
257
|
+
service that answers factual queries by computing answers from
|
|
258
|
+
externally sourced data.
|
|
259
|
+
|
|
260
|
+
Args:
|
|
261
|
+
query (str): The query to send to Wolfram Alpha.
|
|
262
|
+
is_detailed (bool): Whether to include additional details in the
|
|
263
|
+
result.
|
|
264
|
+
|
|
265
|
+
Returns:
|
|
266
|
+
str: The result from Wolfram Alpha, formatted as a string.
|
|
267
|
+
"""
|
|
268
|
+
try:
|
|
269
|
+
import wolframalpha
|
|
270
|
+
except ImportError:
|
|
271
|
+
raise ImportError(
|
|
272
|
+
"Please install `wolframalpha` first. You can install it by"
|
|
273
|
+
" running `pip install wolframalpha`."
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
WOLFRAMALPHA_APP_ID = os.environ.get('WOLFRAMALPHA_APP_ID')
|
|
277
|
+
if not WOLFRAMALPHA_APP_ID:
|
|
278
|
+
raise ValueError(
|
|
279
|
+
"`WOLFRAMALPHA_APP_ID` not found in environment "
|
|
280
|
+
"variables. Get `WOLFRAMALPHA_APP_ID` here: "
|
|
281
|
+
"`https://products.wolframalpha.com/api/`."
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
try:
|
|
285
|
+
client = wolframalpha.Client(WOLFRAMALPHA_APP_ID)
|
|
286
|
+
res = client.query(query)
|
|
287
|
+
assumption = next(res.pods).text or "No assumption made."
|
|
288
|
+
answer = next(res.results).text or "No answer found."
|
|
289
|
+
except Exception as e:
|
|
290
|
+
if isinstance(e, StopIteration):
|
|
291
|
+
return "Wolfram Alpha wasn't able to answer it"
|
|
292
|
+
else:
|
|
293
|
+
error_message = (
|
|
294
|
+
f"Wolfram Alpha wasn't able to answer it" f"{e!s}."
|
|
295
|
+
)
|
|
296
|
+
return error_message
|
|
297
|
+
|
|
298
|
+
result = f"Assumption:\n{assumption}\n\nAnswer:\n{answer}"
|
|
299
|
+
|
|
300
|
+
# Add additional details in the result
|
|
301
|
+
if is_detailed:
|
|
302
|
+
result += '\n'
|
|
303
|
+
for pod in res.pods:
|
|
304
|
+
result += '\n' + pod['@title'] + ':\n'
|
|
305
|
+
for sub in pod.subpods:
|
|
306
|
+
result += (sub.plaintext or "None") + '\n'
|
|
307
|
+
|
|
308
|
+
return result.rstrip() # Remove trailing whitespace
|
|
309
|
+
|
|
310
|
+
def get_tools(self) -> List[OpenAIFunction]:
|
|
311
|
+
r"""Returns a list of OpenAIFunction objects representing the
|
|
312
|
+
functions in the toolkit.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
List[OpenAIFunction]: A list of OpenAIFunction objects
|
|
316
|
+
representing the functions in the toolkit.
|
|
317
|
+
"""
|
|
318
|
+
return [
|
|
319
|
+
OpenAIFunction(self.search_wiki),
|
|
320
|
+
OpenAIFunction(self.search_google),
|
|
321
|
+
OpenAIFunction(self.search_duckduckgo),
|
|
322
|
+
OpenAIFunction(self.query_wolfram_alpha),
|
|
323
|
+
]
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
SEARCH_FUNCS: List[OpenAIFunction] = SearchToolkit().get_tools()
|