Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

quick fix: wolfram alpha docstring (#534)

Wendong-Fan14134bdaabc7
diff --git a/camel/functions/search_functions.py b/camel/functions/search_functions.py
index c0fe56ea4..6b45c165b 100644
--- a/camel/functions/search_functions.py
+++ b/camel/functions/search_functions.py
@@ -314,10 +314,11 @@ def search_google_and_summarize(query: str) -> str:
return "Failed to find the answer from google search."
-def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
- r"""Queries Wolfram|Alpha and returns the result. Wolfram|Alpha is a
- search engine that uses algorithms, knowledgebase and AI to compute
- expert-level answers for math, science, society, everyday life and more.
+def query_wolfram_alpha(query: str, is_detailed: bool) -> str:
+ r"""Queries Wolfram|Alpha and returns the result. Wolfram|Alpha is an
+ answer engine developed by Wolfram Research. It is offered as an online
+ service that answers factual queries by computing answers from externally
+ sourced data.
Args:
query (str): The query to send to Wolfram Alpha.
@@ -331,8 +332,7 @@ def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
import wolframalpha
except ImportError:
raise ImportError(
- "Please install `wolframalpha` first. You can install it by "
- "running `pip install wolframalpha`."
+ "Please install `wolframalpha` first. You can install it by running `pip install wolframalpha`."
)
WOLFRAMALPHA_APP_ID = os.environ.get('WOLFRAMALPHA_APP_ID')
@@ -370,5 +370,5 @@ def search_wolfram_alpha(query: str, is_detailed: bool) -> str:
SEARCH_FUNCS: List[OpenAIFunction] = [
OpenAIFunction(func) # type: ignore[arg-type]
- for func in [search_wiki, search_google_and_summarize, search_wolfram_alpha]
+ for func in [search_wiki, search_google_and_summarize, query_wolfram_alpha]
]
diff --git a/test/functions/test_search_functions.py b/test/functions/test_search_functions.py
index 46129effd..fb091a4e7 100644
--- a/test/functions/test_search_functions.py
+++ b/test/functions/test_search_functions.py
@@ -18,9 +18,9 @@ import requests
import wikipedia
from camel.functions.search_functions import (
+ query_wolfram_alpha,
search_google_and_summarize,
search_wiki,
- search_wolfram_alpha,
)
@@ -76,7 +76,7 @@ def test_web_search():
@patch('wolframalpha.Client')
@patch('os.environ.get')
-def test_search_wolfram_alpha(mock_get, mock_client):
+def test_query_wolfram_alpha(mock_get, mock_client):
mock_get.return_value = 'FAKE_APP_ID'
# Create mock subpods objects
@@ -113,7 +113,7 @@ def test_search_wolfram_alpha(mock_get, mock_client):
mock_instance.query.return_value = mock_res
mock_client.return_value = mock_instance
- result = search_wolfram_alpha("calculate limit of sinx^2/x", True)
+ result = query_wolfram_alpha("calculate limit of sinx^2/x", True)
expected_output = (
"Assumption:\n"
"lim_(x->0) (sin^2(x))/x = 0\n\n"