You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched existing ideas and did not find a similar one
I added a very descriptive title
I've clearly described the feature request and motivation for it
Feature request
We would like to add a tool that integrates with the Google Books API that can be found at https://developers.google.com/books/docs/overview. This would allow agents to interact with information contained in the Google Books API.
The tool would take a query from an agent, gather the relevant information from Google Books, format the information into a readable output, and return the result to the agent.
Here is some sample usage and output to get a better idea of what we would like to add:
Here are a few books related to artificial intelligence:
1. "Introduction to Artificial Intelligence" by Simplilearn: This AI beginner's guide aims to take the readers through the current AI landscape, provides the key fundamentals and terminologies of AI, and offers practical guidelines on why and how you can be a part of the AI revolution, and also the ways in which you can scale up your AI career.
2. "Artificial Intelligence in Society" by OECD: Artificial Intelligence in SocietyThe artificial intelligence (AI) landscape has evolved significantly from 1950 when Alan Turing first posed the question of whether machines can think. Today, AI is transforming societies and economies. It promises to generate productivity gains, improve well-being and help address global challenges, such as climate change, resource scarcity and health crises.
3. "What Was Artificial Intelligence?" by Sue Curry Jansen: What Was Artificial Intelligence?When it was originally published in 2002, Sue Curry Jansen's "What Was Artificial Intelligence?" attracted little notice. The long essay was published as a chapter in Jansen's Critical Communication Theory, a book whose wisdom and erudition failed to register across the many fields it addressed. One explanation for the neglect, ironic and telling, is that Jansen's sheer scope as an intellectual had few competent readers in the communication studies discipline into which she published the book. "What Was Artificial Intelligence?" was buried treasure. In this mediastudies.press edition, Jansen's prescient autopsy of AI self-selling—the rhetoric of the masculinist sublime—is reprinted with a new introduction. Now an open access book, "What Was Artificial Intelligence?" is a message in a bottle, addressed to Musk, Bezos, and the latest generation of AI myth-makers.
Motivation
Looking at current integrations, we have noticed that there are many GSuite integrations, so this would expand on the current collection. Moreover, currently there are reading material integrations like PubMed and Google Scholar; however, these sources are purely for academic papers. It looks like there is room to add a tool that can return reading material of all types based on agent queries.
Overall, Google Books is the largest API in the world that keeps track of books in a curated manner. It has over 40 million entries, so this will give agents a significant amount of data to work with when generating resources for a user.
Proposal (If applicable)
We (a group of 4) are planning to make an addition to the tools contained in libs/community/langchain_community/tools and follow a similar structure to the existing tools. If this idea is approved, we hope to submit a PR by early November.
Here is an outline of the changes we are anticipating to make:
Modifications to existing files
We plan to modify the following files:
libs/community/langchain_community/agent_toolkits/load_tools.py to register our tool
libs/community/langchain_community/tools/__init__.py to register the tool
libs/langchain/langchain/tools/__init__.py to register the tool
New files
We plan to create the following files:
libs/community/langchain_community/tools/google_books where we will define the class GoogleBooksQueryRun which inherits from BaseTool
libs/community/langchain_community/utilities/google_books which we will define the class GoogleBooksAPIWrapper that inherits from BaseModel
libs/community/tests/integration_tests/utilities/test_google_books.py where we will define test cases to test our tool
Some Sample Code
classGoogleBooksQueryRun(BaseTool):
"""Tool that searches the Google Books API."""name: str="GoogleBooks"description: str= (
"A wrapper around Google Books. "
)
api_wrapper: GoogleBooksApiWrapperdef_run(
self,
query: str,
run_manager: Optional[CallbackManagerForToolRun] =None,
) ->str:
"""Use the Google Books tool."""returnself.api_wrapper.run(query)
classGoogleBooksAPIWrapper(BaseModel):
google_books_api_key: Optional[str] =Nonemodel_config=ConfigDict(
extra="forbid",
)
@root_validator()defvalidate_environment(cls, values: Dict) ->Dict:
"""Validate that api key exists in environment."""google_books_api_key=get_from_dict_or_env(
values, "google_books_api_key", "GOOGLE_BOOKS_API_KEY"
)
values["google_books_api_key"] =google_books_api_keyreturnvaluesdefrun(self, query: str) ->str:
# build Url based on API key and queryrequest_url= ...
# send requestresponse=requests.get(request_url)
# some error handelingifresponse.status_code!=200:
returnresponse.text# send back data (format style tbd)returnself.format(query, response)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Checked
Feature request
We would like to add a tool that integrates with the Google Books API that can be found at https://developers.google.com/books/docs/overview. This would allow agents to interact with information contained in the Google Books API.
The tool would take a query from an agent, gather the relevant information from Google Books, format the information into a readable output, and return the result to the agent.
Here is some sample usage and output to get a better idea of what we would like to add:
Sample Usage
Sample Output
Motivation
Looking at current integrations, we have noticed that there are many GSuite integrations, so this would expand on the current collection. Moreover, currently there are reading material integrations like PubMed and Google Scholar; however, these sources are purely for academic papers. It looks like there is room to add a tool that can return reading material of all types based on agent queries.
Overall, Google Books is the largest API in the world that keeps track of books in a curated manner. It has over 40 million entries, so this will give agents a significant amount of data to work with when generating resources for a user.
Proposal (If applicable)
We (a group of 4) are planning to make an addition to the tools contained in
libs/community/langchain_community/tools
and follow a similar structure to the existing tools. If this idea is approved, we hope to submit a PR by early November.Here is an outline of the changes we are anticipating to make:
Modifications to existing files
We plan to modify the following files:
libs/community/langchain_community/agent_toolkits/load_tools.py
to register our toollibs/community/langchain_community/tools/__init__.py
to register the toollibs/langchain/langchain/tools/__init__.py
to register the toolNew files
We plan to create the following files:
libs/community/langchain_community/tools/google_books
where we will define the classGoogleBooksQueryRun
which inherits fromBaseTool
libs/community/langchain_community/utilities/google_books
which we will define the classGoogleBooksAPIWrapper
that inherits fromBaseModel
libs/community/tests/integration_tests/utilities/test_google_books.py
where we will define test cases to test our toolSome Sample Code
Beta Was this translation helpful? Give feedback.
All reactions