Skip to content

Commit

Permalink
updated the doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zyzhang1130 committed Aug 15, 2024
1 parent 9089225 commit 4676711
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 26 deletions.
6 changes: 3 additions & 3 deletions docs/sphinx_doc/en/source/tutorial/204-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ The following table outlines the various Service functions by type. These functi
| | `openai_image_to_text` | Convert text to image using OpenAI API
| | `openai_text_to_audio` | Convert text to audio using OpenAI API
| | `openai_audio_to_text` | Convert audio to text using OpenAI API
| Reasoning | `wolfram_alpha_short_answers_query` | Query the Wolfram Alpha Short Answers API and return the answer as a string. |
| Reasoning | `wolfram_alpha_short_answers_query` | Query the Wolfram Alpha Short Answers API and return a brief answer in text. |
| | `wolfram_alpha_simple_query` | Query the Wolfram Alpha Simple API and return the answer as a PNG image. |
| | `wolfram_alpha_show_steps_query` | Query the Wolfram Alpha Show Steps API and return the step-by-step solution as a string. |
| | `wolfram_alpha_llm_query` | Query the Wolfram Alpha LLM API and return the answer from the LLM as a string. |
| | `wolfram_alpha_show_steps_query` | Query the Wolfram Alpha Show Steps API and return the step-by-step solution in text. |
| | `wolfram_alpha_llm_query` | Query the Wolfram Alpha LLM API and return the answer from the LLM in text. |

| *More services coming soon* | | More service functions are in development and will be added to AgentScope to further enhance its capabilities. |

Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx_doc/zh_CN/source/tutorial/204-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
| | `openai_image_to_text` | 使用 OpenAI API 根据图片生成文字。
| | `openai_text_to_audio` | 使用 OpenAI API 根据文本生成音频。
| | `openai_audio_to_text` | 使用OpenAI API将音频转换为文本。
| 推理 | wolfram_alpha_short_answers_query | 查询 Wolfram Alpha Short Answers API, 并以字符串形式返回答案|
| 推理 | wolfram_alpha_short_answers_query | 查询 Wolfram Alpha Short Answers API, 并以文本形式返回简短的答案|
| | wolfram_alpha_simple_query | 查询 Wolfram Alpha Simple API,并以PNG图片形式返回答案。。 |
| | wolfram_alpha_show_steps_query | 查询 Wolfram Alpha Show Steps API,并返回逐步解决方案作为字符串|
| | wolfram_alpha_llm_query | 查询 Wolfram Alpha LLM API,并将LLM返回的答案作为字符串返回|
| | wolfram_alpha_show_steps_query | 查询 Wolfram Alpha Show Steps API,并以文本形式返回返回逐步答案|
| | wolfram_alpha_llm_query | 查询 Wolfram Alpha LLM API,并将LLM返回的答案作为文本形式返回|
| *更多服务即将推出* | | 正在开发更多服务功能,并将添加到 AgentScope 以进一步增强其能力。 |

关于详细的参数、预期输入格式、返回类型,请参阅[API文档](https://modelscope.github.io/agentscope/)
Expand Down
47 changes: 27 additions & 20 deletions src/agentscope/service/reasoning/wolfram_alpha.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
"""Query Wolfram Alpha API"""
import os
from typing import Any, Dict # Corrected import order
import requests # Corrected import order
from loguru import logger # Corrected import order
from typing import Any, Dict
import requests
from loguru import logger
from agentscope.service.service_response import (
ServiceResponse,
ServiceExecStatus,
Expand All @@ -16,11 +16,12 @@ def wolfram_alpha_short_answers_query(
) -> ServiceResponse:
"""
Query the Wolfram Alpha Short Answers API. The Short Answers API returns
a single plain text result directly from Wolfram|Alpha. In general, this
text is taken directly from the Result pod of Wolfram|Alpha output. This
API type is designed to deliver brief answers in the most basic
format possible. Suitable for queries such as simple knowledge/facts
retrieval. See
a single plain text result directly from Wolfram|Alpha.
In general, this text is taken directly from the Result pod of
Wolfram|Alpha output. This API type is designed to deliver brief
answers in the most basic format possible. Suitable for queries
such as simple knowledge/facts retrieval. See
https://products.wolframalpha.com/short-answers-api/documentation
for more details.
Expand Down Expand Up @@ -79,6 +80,7 @@ def wolfram_alpha_simple_query(
"""
Query the Wolfram Alpha Simple API. The Simple API generates full
Wolfram|Alpha output in a universally viewable image format.
Suitable for queries such as knowledge/facts retrieval. See
https://products.wolframalpha.com/simple-api/documentation
for more details.
Expand Down Expand Up @@ -152,12 +154,14 @@ def wolfram_alpha_show_steps_query(
query: str,
) -> ServiceResponse:
"""
Query the Wolfram Alpha Show Steps API. An extension of the
Full Results API, the Show Steps API gives direct access to
Wolfram|Alpha's full for queries in a variety of mathematical
and scientific subjects. These explanations of computed answers
are designed to provide clarity and understanding to the
end user and are especially useful in educational and
Query the Wolfram Alpha Show Steps API, gives step-by-step solution
in text.
An extension of the Full Results API, the Show Steps API gives
direct access to Wolfram|Alpha's full for queries in a variety
of mathematical and scientific subjects. These explanations of
computed answers are designed to provide clarity and understanding
to the end user and are especially useful in educational and
training applications. see
https://products.wolframalpha.com/show-steps-api/documentation
for more details.
Expand Down Expand Up @@ -255,12 +259,15 @@ def wolfram_alpha_llm_query(
query: str,
) -> ServiceResponse:
"""
Query the Wolfram Alpha LLM API. The LLM API is built for
use specifically with large language models and chat products.
Although the majority of data available through the
Wolfram|Alpha website is also available through this API,
certain subjects may be restricted by default. see
https://products.wolframalpha.com/llm-api/documentation for more details.
Query the Wolfram Alpha LLM API and return solution as text.
The LLM API is built for use specifically with large language
models and chat products. Although the majority of data
available through the Wolfram|Alpha website is also available
through this API, certain subjects may be restricted by default.
see
https://products.wolframalpha.com/llm-api/documentation
for more details.
Args:
api_key (`str`):
Expand Down

0 comments on commit 4676711

Please sign in to comment.