2024-04-10 17:01:19 +00:00
|
|
|
from langchain_community.tools import __all__, _module_lookup
|
2023-05-02 02:07:26 +00:00
|
|
|
|
2023-12-11 21:53:30 +00:00
|
|
|
EXPECTED_ALL = [
|
2023-08-22 15:03:33 +00:00
|
|
|
"AINAppOps",
|
|
|
|
"AINOwnerOps",
|
|
|
|
"AINRuleOps",
|
|
|
|
"AINTransfer",
|
|
|
|
"AINValueOps",
|
2023-05-02 02:07:26 +00:00
|
|
|
"AIPluginTool",
|
|
|
|
"APIOperation",
|
2023-06-18 23:55:18 +00:00
|
|
|
"ArxivQueryRun",
|
2024-03-28 03:19:02 +00:00
|
|
|
"AzureAiServicesDocumentIntelligenceTool",
|
|
|
|
"AzureAiServicesImageAnalysisTool",
|
|
|
|
"AzureAiServicesSpeechToTextTool",
|
|
|
|
"AzureAiServicesTextToSpeechTool",
|
|
|
|
"AzureAiServicesTextAnalyticsForHealthTool",
|
2023-05-23 13:45:48 +00:00
|
|
|
"AzureCogsFormRecognizerTool",
|
|
|
|
"AzureCogsImageAnalysisTool",
|
|
|
|
"AzureCogsSpeech2TextTool",
|
|
|
|
"AzureCogsText2SpeechTool",
|
2023-11-20 02:44:01 +00:00
|
|
|
"AzureCogsTextAnalyticsHealthTool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"BaseGraphQLTool",
|
|
|
|
"BaseRequestsTool",
|
|
|
|
"BaseSQLDatabaseTool",
|
|
|
|
"BaseSparkSQLTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"BaseTool",
|
2023-10-31 21:58:09 +00:00
|
|
|
"BearlyInterpreterTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"BingSearchResults",
|
|
|
|
"BingSearchRun",
|
2023-06-18 23:55:18 +00:00
|
|
|
"BraveSearch",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ClickTool",
|
2024-02-19 18:54:13 +00:00
|
|
|
"CogniswitchKnowledgeSourceFile",
|
|
|
|
"CogniswitchKnowledgeSourceURL",
|
|
|
|
"CogniswitchKnowledgeRequest",
|
|
|
|
"CogniswitchKnowledgeStatus",
|
2024-01-29 20:45:03 +00:00
|
|
|
"ConneryAction",
|
2023-05-02 02:07:26 +00:00
|
|
|
"CopyFileTool",
|
|
|
|
"CurrentWebPageTool",
|
2024-04-13 23:27:16 +00:00
|
|
|
"DataheraldTextToSQL",
|
2023-05-02 02:07:26 +00:00
|
|
|
"DeleteFileTool",
|
|
|
|
"DuckDuckGoSearchResults",
|
|
|
|
"DuckDuckGoSearchRun",
|
2023-10-31 21:58:09 +00:00
|
|
|
"E2BDataAnalysisTool",
|
Add EdenAI Tools (#9764)
This PR follows the Eden AI (LLM + embeddings) integration. #8633
We added different Tools to empower agents with new capabilities :
- text: explicit content detection
- image: explicit content detection
- image: object detection
- OCR: invoice parsing
- OCR: ID parsing
- audio: speech to text
- audio: text to speech
We plan to add more in the future (like translation, language detection,
+ others).
Usage:
```python
llm=EdenAI(feature="text",provider="openai", params={"temperature" : 0.2,"max_tokens" : 250})
tools = [
EdenAiTextModerationTool(providers=["openai"],language="en"),
EdenAiObjectDetectionTool(providers=["google","api4ai"]),
EdenAiTextToSpeechTool(providers=["amazon"],language="en",voice="MALE"),
EdenAiExplicitImageTool(providers=["amazon","google"]),
EdenAiSpeechToTextTool(providers=["amazon"]),
EdenAiParsingIDTool(providers=["amazon","klippa"],language="en"),
EdenAiParsingInvoiceTool(providers=["amazon","google"],language="en"),
]
agent_chain = initialize_agent(
tools,
llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
return_intermediate_steps=True,
)
result = agent_chain(""" i have this text : 'i want to slap you'
first : i want to know if this text contains explicit content or not .
second : if it does contain explicit content i want to know what is the explicit content in this text,
third : i want to make the text into speech .
if there is URL in the observations , you will always put it in the output (final answer) .
""")
```
output:
> Entering new AgentExecutor chain...
> I need to extract the information from the ID and then convert it to
text and then to speech
> Action: edenai_identity_parsing
> Action Input:
"https://www.citizencard.com/images/citizencard-uk-id-card-2023.jpg"
> Observation: last_name :
> value : ANGELA
> given_names :
> value : GREENE
> birth_place :
> birth_date :
> value : 2000-11-09
> issuance_date :
> expire_date :
> document_id :
> issuing_state :
> address :
> age :
> country :
> document_type :
> value : DRIVER LICENSE FRONT
> gender :
> image_id :
> image_signature :
> mrz :
> nationality :
> Thought: I now need to convert the information to text and then to
speech
> Action: edenai_text_to_speech
> Action Input: "Welcome Angela Greene!"
> Observation:
https://d14uq1pz7dzsdq.cloudfront.net/0c494819-0bbc-4433-bfa4-6e99bd9747ea_.mp3?Expires=1693316851&Signature=YcMoVQgPuIMEOuSpFuvhkFM8JoBMSoGMcZb7MVWdqw7JEf5~67q9dEI90o5todE5mYXB5zSYoib6rGrmfBl4Rn5~yqDwZ~Tmc24K75zpQZIEyt5~ZSnHuXy4IFWGmlIVuGYVGMGKxTGNeCRNUXDhT6TXGZlr4mwa79Ei1YT7KcNyc1dsTrYB96LphnsqOERx4X9J9XriSwxn70X8oUPFfQmLcitr-syDhiwd9Wdpg6J5yHAJjf657u7Z1lFTBMoXGBuw1VYmyno-3TAiPeUcVlQXPueJ-ymZXmwaITmGOfH7HipZngZBziofRAFdhMYbIjYhegu5jS7TxHwRuox32A__&Key-Pair-Id=K1F55BTI9AHGIK
> Thought: I now know the final answer
> Final Answer:
https://d14uq1pz7dzsdq.cloudfront.net/0c494819-0bbc-4433-bfa4-6e99bd9747ea_.mp3?Expires=1693316851&Signature=YcMoVQgPuIMEOuSpFuvhkFM8JoBMSoGMcZb7MVWdqw7JEf5~67q9dEI90o5todE5mYXB5zSYoib6rGrmfBl4Rn5~yqDwZ~Tmc24K75zpQZIEyt5~ZSnHuXy4IFWGmlIVuGYVGMGKxTGNeCRNUXDhT6TXGZlr4mwa79Ei1YT7KcNyc1dsTrYB96LphnsqOERx4X9J9XriSwxn70X8oUPFfQmLcitr-syDhiwd9Wdpg6J5y
>
> Finished chain.
Other examples are available in the jupyter notebook.
This PR is made in parallel with EdenAI LLM update #8963
I apologize for the messy PR. While working in implementing Tools we
realized there was a few problems we needed to fix on LLM as well.
Ping: @hwchase17, @baskaryan
---------
Co-authored-by: RedhaWassim <rwasssim@gmail.com>
2023-09-01 15:26:56 +00:00
|
|
|
"EdenAiExplicitImageTool",
|
|
|
|
"EdenAiObjectDetectionTool",
|
|
|
|
"EdenAiParsingIDTool",
|
|
|
|
"EdenAiParsingInvoiceTool",
|
|
|
|
"EdenAiSpeechToTextTool",
|
|
|
|
"EdenAiTextModerationTool",
|
|
|
|
"EdenAiTextToSpeechTool",
|
|
|
|
"EdenaiTool",
|
2023-08-31 14:02:24 +00:00
|
|
|
"ElevenLabsText2SpeechTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ExtractHyperlinksTool",
|
|
|
|
"ExtractTextTool",
|
|
|
|
"FileSearchTool",
|
|
|
|
"GetElementsTool",
|
2023-05-08 16:13:05 +00:00
|
|
|
"GmailCreateDraft",
|
|
|
|
"GmailGetMessage",
|
|
|
|
"GmailGetThread",
|
|
|
|
"GmailSearch",
|
|
|
|
"GmailSendMessage",
|
2023-10-30 21:05:39 +00:00
|
|
|
"GoogleCloudTextToSpeechTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"GooglePlacesTool",
|
|
|
|
"GoogleSearchResults",
|
|
|
|
"GoogleSearchRun",
|
2023-05-04 05:35:48 +00:00
|
|
|
"GoogleSerperResults",
|
|
|
|
"GoogleSerperRun",
|
2023-05-02 02:07:26 +00:00
|
|
|
"HumanInputRun",
|
|
|
|
"IFTTTWebhook",
|
2023-05-22 18:58:28 +00:00
|
|
|
"InfoPowerBITool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"InfoSQLDatabaseTool",
|
|
|
|
"InfoSparkSQLTool",
|
|
|
|
"JiraAction",
|
|
|
|
"JsonGetValueTool",
|
|
|
|
"JsonListKeysTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ListDirectoryTool",
|
2023-05-22 18:58:28 +00:00
|
|
|
"ListPowerBITool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"ListSQLDatabaseTool",
|
|
|
|
"ListSparkSQLTool",
|
2023-05-14 04:45:05 +00:00
|
|
|
"MetaphorSearchResults",
|
2023-05-02 02:07:26 +00:00
|
|
|
"MoveFileTool",
|
2023-12-04 21:43:11 +00:00
|
|
|
"NasaAction",
|
2023-05-02 02:07:26 +00:00
|
|
|
"NavigateBackTool",
|
|
|
|
"NavigateTool",
|
2023-10-31 21:58:09 +00:00
|
|
|
"O365CreateDraftMessage",
|
2023-07-05 19:46:21 +00:00
|
|
|
"O365SearchEmails",
|
|
|
|
"O365SearchEvents",
|
|
|
|
"O365SendEvent",
|
2023-10-31 21:58:09 +00:00
|
|
|
"O365SendMessage",
|
2023-05-02 02:07:26 +00:00
|
|
|
"OpenAPISpec",
|
2023-05-15 01:50:45 +00:00
|
|
|
"OpenWeatherMapQueryRun",
|
2023-06-18 23:55:18 +00:00
|
|
|
"PubmedQueryRun",
|
2024-03-11 18:58:10 +00:00
|
|
|
"PolygonAggregates",
|
2024-02-29 18:56:05 +00:00
|
|
|
"PolygonFinancials",
|
2024-01-21 23:08:55 +00:00
|
|
|
"PolygonLastQuote",
|
2024-02-20 18:15:29 +00:00
|
|
|
"PolygonTickerNews",
|
Add multi-input Reddit search tool (#13893)
- **Description:** Added a tool called RedditSearchRun and an
accompanying API wrapper, which searches Reddit for posts with support
for time filtering, post sorting, query string and subreddit filtering.
- **Issue:** #13891
- **Dependencies:** `praw` module is used to search Reddit
- **Tag maintainer:** @baskaryan , and any of the other maintainers if
needed
- **Twitter handle:** None.
Hello,
This is our first PR and we hope that our changes will be helpful to 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 `praw` package which is already used by
RedditPostsLoader in LangChain. Nonetheless, we have added integration
tests and edited unit tests to test our changes. An example notebook is
also provided. These changes were put together by me, @Anika2000,
@CharlesXu123, and @Jeremy-Cheng-stack
Thank you in advance to the maintainers for their time.
---------
Co-authored-by: What-Is-A-Username <49571870+What-Is-A-Username@users.noreply.github.com>
Co-authored-by: Anika2000 <anika.sultana@mail.utoronto.ca>
Co-authored-by: Jeremy Cheng <81793294+Jeremy-Cheng-stack@users.noreply.github.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-11-30 01:16:40 +00:00
|
|
|
"RedditSearchRun",
|
2024-03-12 22:18:54 +00:00
|
|
|
"RedditSearchSchema",
|
2023-06-18 23:55:18 +00:00
|
|
|
"QueryCheckerTool",
|
2023-05-22 18:58:28 +00:00
|
|
|
"QueryPowerBITool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"QuerySQLCheckerTool",
|
|
|
|
"QuerySQLDataBaseTool",
|
|
|
|
"QuerySparkSQLTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ReadFileTool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"RequestsDeleteTool",
|
|
|
|
"RequestsGetTool",
|
|
|
|
"RequestsPatchTool",
|
|
|
|
"RequestsPostTool",
|
|
|
|
"RequestsPutTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"SceneXplainTool",
|
2023-12-05 00:34:15 +00:00
|
|
|
"SearchAPIRun",
|
2023-12-11 21:53:30 +00:00
|
|
|
"SearchAPIResults",
|
2023-06-18 23:55:18 +00:00
|
|
|
"SearxSearchResults",
|
|
|
|
"SearxSearchRun",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ShellTool",
|
2023-12-03 18:25:38 +00:00
|
|
|
"SlackGetChannel",
|
|
|
|
"SlackGetMessage",
|
|
|
|
"SlackScheduleMessage",
|
|
|
|
"SlackSendMessage",
|
2023-06-18 23:55:18 +00:00
|
|
|
"SleepTool",
|
2023-11-29 18:32:07 +00:00
|
|
|
"StackExchangeTool",
|
2023-12-11 21:53:30 +00:00
|
|
|
"StdInInquireTool",
|
|
|
|
"SteamWebAPIQueryRun",
|
2023-05-12 17:35:01 +00:00
|
|
|
"SteamshipImageGenerationTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"StructuredTool",
|
|
|
|
"Tool",
|
|
|
|
"VectorStoreQATool",
|
|
|
|
"VectorStoreQAWithSourcesTool",
|
|
|
|
"WikipediaQueryRun",
|
|
|
|
"WolframAlphaQueryRun",
|
|
|
|
"WriteFileTool",
|
2023-10-31 21:58:09 +00:00
|
|
|
"YahooFinanceNewsTool",
|
2024-03-03 22:30:05 +00:00
|
|
|
"YouSearchTool",
|
2023-06-18 23:55:18 +00:00
|
|
|
"YouTubeSearchTool",
|
2023-05-02 02:07:26 +00:00
|
|
|
"ZapierNLAListActions",
|
|
|
|
"ZapierNLARunAction",
|
2023-10-31 21:58:09 +00:00
|
|
|
"authenticate",
|
2023-06-13 17:40:49 +00:00
|
|
|
"format_tool_to_openai_function",
|
2023-06-18 23:55:18 +00:00
|
|
|
"tool",
|
2023-12-11 21:53:30 +00:00
|
|
|
"MerriamWebsterQueryRun",
|
2023-05-02 02:07:26 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2023-12-11 21:53:30 +00:00
|
|
|
def test_all_imports() -> None:
|
|
|
|
assert set(__all__) == set(EXPECTED_ALL)
|
2024-04-10 17:01:19 +00:00
|
|
|
assert set(__all__) == set(_module_lookup.keys())
|