SteamWebAPIWrapper#

class langchain_community.utilities.steam.SteamWebAPIWrapper[source]#

基础类:BaseModel

Steam API 的封装器。

通过解析和验证来自关键字参数的输入数据来创建一个新模型。

如果输入数据无法验证以形成有效模型,则引发 [ValidationError][pydantic_core.ValidationError]。

self 被显式地设为仅位置参数,以允许 self 作为字段名称。

param operations: List[dict] = [{'description': '\n    This tool is a wrapper around python-steam-api\'s steam.apps.search_games API and \n    steam.apps.get_app_details API, useful when you need to search for a game.\n    The input to this tool is a string specifying the name of the game you want to \n    search for. For example, to search for a game called "Counter-Strike: Global \n    Offensive", you would input "Counter-Strike: Global Offensive" as the game name.\n    This input will be passed into steam.apps.search_games to find the game id, link \n    and price, and then the game id will be passed into steam.apps.get_app_details to \n    get the detailed description and supported languages of the game. Finally the \n    results are combined and returned as a string.\n', 'mode': 'get_game_details', 'name': 'Get Game Details'}, {'description': '\n    This tool is a wrapper around python-steam-api\'s steam.users.get_owned_games API \n    and steamspypi\'s steamspypi.download API, useful when you need to get a list of \n    recommended games. The input to this tool is a string specifying the steam id of \n    the user you want to get recommended games for. For example, to get recommended \n    games for a user with steam id 76561197960435530, you would input \n    "76561197960435530" as the steam id.  This steamid is then utilized to form a \n    data_request sent to steamspypi\'s steamspypi.download to retrieve genres of user\'s \n    owned games. Then, calculates the frequency of each genre, identifying the most \n    popular one, and stored it in a dictionary. Subsequently, use steamspypi.download\n    to returns all games in this genre and return 5 most-played games that is not owned\n    by the user.\n\n', 'mode': 'get_recommended_games', 'name': 'Get Recommended Games'}]#
param steam: Any = None#
details_of_games(name: str) str[source]#
Parameters:

名称 (字符串)

Return type:

字符串

响应可能包含多个游戏,因此我们需要选择正确的游戏并返回其ID。

Parameters:

游戏 (字典)

Return type:

字典

get_operations() List[dict][来源]#

返回操作列表。

Return type:

列表[字典]

get_steam_id(name: str) str[source]#
Parameters:

名称 (字符串)

Return type:

字符串

get_users_games(steam_id: str) List[str][来源]#
Parameters:

steam_id (str)

Return type:

列表[str]

parse_to_str(details: dict) str[来源]#

解析详细结果。

Parameters:

详情 (字典)

Return type:

字符串

recommended_games(steam_id: str) str[source]#
Parameters:

steam_id (str)

Return type:

字符串

remove_html_tags(html_string: str) str[来源]#
Parameters:

html_string (str)

Return type:

字符串

run(mode: str, game: str) str[来源]#
Parameters:
  • mode (str)

  • game (str)

Return type:

字符串

使用 SteamWebAPIWrapper 的示例