Skip to content

Commit 14134bd

Browse files
authored
quick fix: wolfram alpha docstring (#534)
1 parent 70d5e78 commit 14134bd

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

camel/functions/search_functions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,11 @@ def search_google_and_summarize(query: str) -> str:
314314
return "Failed to find the answer from google search."
315315

316316

317-
def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
318-
r"""Queries Wolfram|Alpha and returns the result. Wolfram|Alpha is a
319-
search engine that uses algorithms, knowledgebase and AI to compute
320-
expert-level answers for math, science, society, everyday life and more.
317+
def query_wolfram_alpha(query: str, is_detailed: bool) -> str:
318+
r"""Queries Wolfram|Alpha and returns the result. Wolfram|Alpha is an
319+
answer engine developed by Wolfram Research. It is offered as an online
320+
service that answers factual queries by computing answers from externally
321+
sourced data.
321322
322323
Args:
323324
query (str): The query to send to Wolfram Alpha.
@@ -331,8 +332,7 @@ def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
331332
import wolframalpha
332333
except ImportError:
333334
raise ImportError(
334-
"Please install `wolframalpha` first. You can install it by "
335-
"running `pip install wolframalpha`."
335+
"Please install `wolframalpha` first. You can install it by running `pip install wolframalpha`."
336336
)
337337

338338
WOLFRAMALPHA_APP_ID = os.environ.get('WOLFRAMALPHA_APP_ID')
@@ -370,5 +370,5 @@ def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
370370

371371
SEARCH_FUNCS: List[OpenAIFunction] = [
372372
OpenAIFunction(func) # type: ignore[arg-type]
373-
for func in [search_wiki, search_google_and_summarize, search_wolfram_alpha]
373+
for func in [search_wiki, search_google_and_summarize, query_wolfram_alpha]
374374
]

test/functions/test_search_functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
import wikipedia
1919

2020
from camel.functions.search_functions import (
21+
query_wolfram_alpha,
2122
search_google_and_summarize,
2223
search_wiki,
23-
search_wolfram_alpha,
2424
)
2525

2626

@@ -76,7 +76,7 @@ def test_web_search():
7676

7777
@patch('wolframalpha.Client')
7878
@patch('os.environ.get')
79-
def test_search_wolfram_alpha(mock_get, mock_client):
79+
def test_query_wolfram_alpha(mock_get, mock_client):
8080
mock_get.return_value = 'FAKE_APP_ID'
8181

8282
# Create mock subpods objects
@@ -113,7 +113,7 @@ def test_search_wolfram_alpha(mock_get, mock_client):
113113
mock_instance.query.return_value = mock_res
114114
mock_client.return_value = mock_instance
115115

116-
result = search_wolfram_alpha("calculate limit of sinx^2/x", True)
116+
result = query_wolfram_alpha("calculate limit of sinx^2/x", True)
117117
expected_output = (
118118
"Assumption:\n"
119119
"lim_(x->0) (sin^2(x))/x = 0\n\n"

0 commit comments

Comments
 (0)