You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/community/tests/integration_tests/utilities/test_steam_api.py

23 lines
691 B
Python

Add: Steam API tool (#14008) - **Description:** Our PR is an integration of a Steam API Tool that makes recommendations on steam games based on user's Steam profile and provides information on games based on user provided queries. - **Issue:** the issue # our PR implements: https://github.com/langchain-ai/langchain/issues/12120 - **Dependencies:** python-steam-api library, steamspypi library and decouple library - **Tag maintainer:** @baskaryan, @hwchase17 - **Twitter handle:** N/A Hello langchain Maintainers, We are a team of 4 University of Toronto students contributing to langchain as part of our course [CSCD01 (link to course page)](https://cscd01.com/work/open-source-project). We hope our changes help the community. We have run make format, make lint and make test locally before submitting the PR. To our knowledge, our changes do not introduce any new errors. Our PR integrates the python-steam-api, steamspypi and decouple packages. We have added integration tests to test our python API integration into langchain and an example notebook is also provided. Our amazing team that contributed to this PR: @JohnY2002, @shenceyang, @andrewqian2001 and @muntaqamahmood Thank you in advance to all the maintainers for reviewing our PR! --------- Co-authored-by: Shence <ysc1412799032@163.com> Co-authored-by: JohnY2002 <johnyuan0526@gmail.com> Co-authored-by: Andrew Qian <andrewqian2001@gmail.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: JohnY <94477598+JohnY2002@users.noreply.github.com>
10 months ago
import ast
community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) Moved the following modules to new package langchain-community in a backwards compatible fashion: ``` mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community mv langchain/langchain/adapters community/langchain_community mv langchain/langchain/callbacks community/langchain_community/callbacks mv langchain/langchain/chat_loaders community/langchain_community mv langchain/langchain/chat_models community/langchain_community mv langchain/langchain/document_loaders community/langchain_community mv langchain/langchain/docstore community/langchain_community mv langchain/langchain/document_transformers community/langchain_community mv langchain/langchain/embeddings community/langchain_community mv langchain/langchain/graphs community/langchain_community mv langchain/langchain/llms community/langchain_community mv langchain/langchain/memory/chat_message_histories community/langchain_community mv langchain/langchain/retrievers community/langchain_community mv langchain/langchain/storage community/langchain_community mv langchain/langchain/tools community/langchain_community mv langchain/langchain/utilities community/langchain_community mv langchain/langchain/vectorstores community/langchain_community mv langchain/langchain/agents/agent_toolkits community/langchain_community mv langchain/langchain/cache.py community/langchain_community ``` Moved the following to core ``` mv langchain/langchain/utils/json_schema.py core/langchain_core/utils mv langchain/langchain/utils/html.py core/langchain_core/utils mv langchain/langchain/utils/strings.py core/langchain_core/utils cat langchain/langchain/utils/env.py >> core/langchain_core/utils/env.py rm langchain/langchain/utils/env.py ``` See .scripts/community_split/script_integrations.sh for all changes
10 months ago
from langchain_community.utilities.steam import SteamWebAPIWrapper
Add: Steam API tool (#14008) - **Description:** Our PR is an integration of a Steam API Tool that makes recommendations on steam games based on user's Steam profile and provides information on games based on user provided queries. - **Issue:** the issue # our PR implements: https://github.com/langchain-ai/langchain/issues/12120 - **Dependencies:** python-steam-api library, steamspypi library and decouple library - **Tag maintainer:** @baskaryan, @hwchase17 - **Twitter handle:** N/A Hello langchain Maintainers, We are a team of 4 University of Toronto students contributing to langchain as part of our course [CSCD01 (link to course page)](https://cscd01.com/work/open-source-project). We hope our changes help the community. We have run make format, make lint and make test locally before submitting the PR. To our knowledge, our changes do not introduce any new errors. Our PR integrates the python-steam-api, steamspypi and decouple packages. We have added integration tests to test our python API integration into langchain and an example notebook is also provided. Our amazing team that contributed to this PR: @JohnY2002, @shenceyang, @andrewqian2001 and @muntaqamahmood Thank you in advance to all the maintainers for reviewing our PR! --------- Co-authored-by: Shence <ysc1412799032@163.com> Co-authored-by: JohnY2002 <johnyuan0526@gmail.com> Co-authored-by: Andrew Qian <andrewqian2001@gmail.com> Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: JohnY <94477598+JohnY2002@users.noreply.github.com>
10 months ago
def test_get_game_details() -> None:
"""Test for getting game details on Steam"""
steam = SteamWebAPIWrapper()
output = steam.run("get_game_details", "Terraria")
assert "id" in output
assert "link" in output
assert "detailed description" in output
assert "supported languages" in output
assert "price" in output
def test_get_recommended_games() -> None:
"""Test for getting recommended games on Steam"""
steam = SteamWebAPIWrapper()
output = steam.run("get_recommended_games", "76561198362745711")
output = ast.literal_eval(output)
assert len(output) == 5