mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
1adaa3c662
This is a follow up to #18371. These are the changes: - New **Azure AI Services** toolkit and tools to replace those of **Azure Cognitive Services**. - Updated documentation for Microsoft platform. - The image analysis tool has been rewritten to use the new package `azure-ai-vision-imageanalysis`, doing a proper replacement of `azure-ai-vision`. These changes: - Update outdated naming from "Azure Cognitive Services" to "Azure AI Services". - Update documentation to use non-deprecated methods to create and use agents. - Removes need to depend on yanked python package (`azure-ai-vision`) There is one new dependency that is needed as a replacement to `azure-ai-vision`: - `azure-ai-vision-imageanalysis`. This is optional and declared within a function. There is a new `azure_ai_services.ipynb` notebook showing usage; Changes have been linted and formatted. I am leaving the actions of adding deprecation notices and future removal of Azure Cognitive Services up to the LangChain team, as I am not sure what the current practice around this is. --- If this PR makes it, my handle is @galo@mastodon.social --------- Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: ccurme <chester.curme@gmail.com>
32 lines
927 B
Python
32 lines
927 B
Python
from __future__ import annotations
|
|
|
|
from typing import List
|
|
|
|
from langchain_core.tools import BaseTool
|
|
|
|
from langchain_community.agent_toolkits.base import BaseToolkit
|
|
from langchain_community.tools.azure_ai_services import (
|
|
AzureAiServicesDocumentIntelligenceTool,
|
|
AzureAiServicesImageAnalysisTool,
|
|
AzureAiServicesSpeechToTextTool,
|
|
AzureAiServicesTextAnalyticsForHealthTool,
|
|
AzureAiServicesTextToSpeechTool,
|
|
)
|
|
|
|
|
|
class AzureAiServicesToolkit(BaseToolkit):
|
|
"""Toolkit for Azure AI Services."""
|
|
|
|
def get_tools(self) -> List[BaseTool]:
|
|
"""Get the tools in the toolkit."""
|
|
|
|
tools: List[BaseTool] = [
|
|
AzureAiServicesDocumentIntelligenceTool(),
|
|
AzureAiServicesImageAnalysisTool(),
|
|
AzureAiServicesSpeechToTextTool(),
|
|
AzureAiServicesTextToSpeechTool(),
|
|
AzureAiServicesTextAnalyticsForHealthTool(),
|
|
]
|
|
|
|
return tools
|