mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-05 12:48:12 +00:00
community[patch]: import flattening fix (#20110)
This PR should make it easier for linters to do type checking and for IDEs to jump to definition of code. See #20050 as a template for this PR. - As a byproduct: Added 3 missed `test_imports`. - Added missed `SolarChat` in to __init___.py Added it into test_import ut. - Added `# type: ignore` to fix linting. It is not clear, why linting errors appear after ^ changes. --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
parent
12190ad728
commit
4cb5f4c353
@ -3,7 +3,129 @@ various services and APIs.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.agent_toolkits.ainetwork.toolkit import (
|
||||||
|
AINetworkToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.amadeus.toolkit import (
|
||||||
|
AmadeusToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.azure_ai_services import (
|
||||||
|
AzureAiServicesToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.azure_cognitive_services import (
|
||||||
|
AzureCognitiveServicesToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.cogniswitch.toolkit import (
|
||||||
|
CogniswitchToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.connery import (
|
||||||
|
ConneryToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.file_management.toolkit import (
|
||||||
|
FileManagementToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.gmail.toolkit import (
|
||||||
|
GmailToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.jira.toolkit import (
|
||||||
|
JiraToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.json.base import (
|
||||||
|
create_json_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.json.toolkit import (
|
||||||
|
JsonToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.multion.toolkit import (
|
||||||
|
MultionToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.nasa.toolkit import (
|
||||||
|
NasaToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.nla.toolkit import (
|
||||||
|
NLAToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.office365.toolkit import (
|
||||||
|
O365Toolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.openapi.base import (
|
||||||
|
create_openapi_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.openapi.toolkit import (
|
||||||
|
OpenAPIToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.playwright.toolkit import (
|
||||||
|
PlayWrightBrowserToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.polygon.toolkit import (
|
||||||
|
PolygonToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.powerbi.base import (
|
||||||
|
create_pbi_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.powerbi.chat_base import (
|
||||||
|
create_pbi_chat_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.powerbi.toolkit import (
|
||||||
|
PowerBIToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.slack.toolkit import (
|
||||||
|
SlackToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.spark_sql.base import (
|
||||||
|
create_spark_sql_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.spark_sql.toolkit import (
|
||||||
|
SparkSQLToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.sql.base import (
|
||||||
|
create_sql_agent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.sql.toolkit import (
|
||||||
|
SQLDatabaseToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.steam.toolkit import (
|
||||||
|
SteamToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.agent_toolkits.zapier.toolkit import (
|
||||||
|
ZapierToolkit, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AINetworkToolkit",
|
||||||
|
"AmadeusToolkit",
|
||||||
|
"AzureAiServicesToolkit",
|
||||||
|
"AzureCognitiveServicesToolkit",
|
||||||
|
"CogniswitchToolkit",
|
||||||
|
"ConneryToolkit",
|
||||||
|
"FileManagementToolkit",
|
||||||
|
"GmailToolkit",
|
||||||
|
"JiraToolkit",
|
||||||
|
"JsonToolkit",
|
||||||
|
"MultionToolkit",
|
||||||
|
"NLAToolkit",
|
||||||
|
"NasaToolkit",
|
||||||
|
"O365Toolkit",
|
||||||
|
"OpenAPIToolkit",
|
||||||
|
"PlayWrightBrowserToolkit",
|
||||||
|
"PolygonToolkit",
|
||||||
|
"PowerBIToolkit",
|
||||||
|
"SQLDatabaseToolkit",
|
||||||
|
"SlackToolkit",
|
||||||
|
"SparkSQLToolkit",
|
||||||
|
"SteamToolkit",
|
||||||
|
"ZapierToolkit",
|
||||||
|
"create_json_agent",
|
||||||
|
"create_openapi_agent",
|
||||||
|
"create_pbi_agent",
|
||||||
|
"create_pbi_chat_agent",
|
||||||
|
"create_spark_sql_agent",
|
||||||
|
"create_sql_agent",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AINetworkToolkit": "langchain_community.agent_toolkits.ainetwork.toolkit",
|
"AINetworkToolkit": "langchain_community.agent_toolkits.ainetwork.toolkit",
|
||||||
|
@ -1998,7 +1998,7 @@ class AzureCosmosDBSemanticCache(BaseCache):
|
|||||||
k=1,
|
k=1,
|
||||||
kind=self.kind,
|
kind=self.kind,
|
||||||
ef_search=self.ef_search,
|
ef_search=self.ef_search,
|
||||||
score_threshold=self.score_threshold,
|
score_threshold=self.score_threshold, # type: ignore[arg-type]
|
||||||
)
|
)
|
||||||
if results:
|
if results:
|
||||||
for document in results:
|
for document in results:
|
||||||
|
@ -19,7 +19,48 @@ WhatsApp. The loaded chat messages can be used for fine-tuning models.
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.chat_loaders.base import (
|
||||||
|
BaseChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.facebook_messenger import (
|
||||||
|
FolderFacebookMessengerChatLoader, # noqa: F401
|
||||||
|
SingleFileFacebookMessengerChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.gmail import (
|
||||||
|
GMailLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.imessage import (
|
||||||
|
IMessageChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.langsmith import (
|
||||||
|
LangSmithDatasetChatLoader, # noqa: F401
|
||||||
|
LangSmithRunChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.slack import (
|
||||||
|
SlackChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.telegram import (
|
||||||
|
TelegramChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_loaders.whatsapp import (
|
||||||
|
WhatsAppChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"BaseChatLoader",
|
||||||
|
"FolderFacebookMessengerChatLoader",
|
||||||
|
"GMailLoader",
|
||||||
|
"IMessageChatLoader",
|
||||||
|
"LangSmithDatasetChatLoader",
|
||||||
|
"LangSmithRunChatLoader",
|
||||||
|
"SingleFileFacebookMessengerChatLoader",
|
||||||
|
"SlackChatLoader",
|
||||||
|
"TelegramChatLoader",
|
||||||
|
"WhatsAppChatLoader",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"BaseChatLoader": "langchain_community.chat_loaders.base",
|
"BaseChatLoader": "langchain_community.chat_loaders.base",
|
||||||
|
@ -16,7 +16,96 @@
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.chat_message_histories.astradb import (
|
||||||
|
AstraDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.cassandra import (
|
||||||
|
CassandraChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.cosmos_db import (
|
||||||
|
CosmosDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.dynamodb import (
|
||||||
|
DynamoDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.elasticsearch import (
|
||||||
|
ElasticsearchChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.file import (
|
||||||
|
FileChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.firestore import (
|
||||||
|
FirestoreChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.in_memory import (
|
||||||
|
ChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.momento import (
|
||||||
|
MomentoChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.mongodb import (
|
||||||
|
MongoDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.neo4j import (
|
||||||
|
Neo4jChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.postgres import (
|
||||||
|
PostgresChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.redis import (
|
||||||
|
RedisChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.rocksetdb import (
|
||||||
|
RocksetChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.singlestoredb import (
|
||||||
|
SingleStoreDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.sql import (
|
||||||
|
SQLChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.streamlit import (
|
||||||
|
StreamlitChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.tidb import (
|
||||||
|
TiDBChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.upstash_redis import (
|
||||||
|
UpstashRedisChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.xata import (
|
||||||
|
XataChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_message_histories.zep import (
|
||||||
|
ZepChatMessageHistory, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AstraDBChatMessageHistory",
|
||||||
|
"CassandraChatMessageHistory",
|
||||||
|
"ChatMessageHistory",
|
||||||
|
"CosmosDBChatMessageHistory",
|
||||||
|
"DynamoDBChatMessageHistory",
|
||||||
|
"ElasticsearchChatMessageHistory",
|
||||||
|
"FileChatMessageHistory",
|
||||||
|
"FirestoreChatMessageHistory",
|
||||||
|
"MomentoChatMessageHistory",
|
||||||
|
"MongoDBChatMessageHistory",
|
||||||
|
"Neo4jChatMessageHistory",
|
||||||
|
"PostgresChatMessageHistory",
|
||||||
|
"RedisChatMessageHistory",
|
||||||
|
"RocksetChatMessageHistory",
|
||||||
|
"SQLChatMessageHistory",
|
||||||
|
"SingleStoreDBChatMessageHistory",
|
||||||
|
"StreamlitChatMessageHistory",
|
||||||
|
"TiDBChatMessageHistory",
|
||||||
|
"UpstashRedisChatMessageHistory",
|
||||||
|
"XataChatMessageHistory",
|
||||||
|
"ZepChatMessageHistory",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AstraDBChatMessageHistory": "langchain_community.chat_message_histories.astradb",
|
"AstraDBChatMessageHistory": "langchain_community.chat_message_histories.astradb",
|
||||||
|
@ -18,7 +18,197 @@ an interface where "chat messages" are the inputs and outputs.
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.chat_models.anthropic import (
|
||||||
|
ChatAnthropic, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.anyscale import (
|
||||||
|
ChatAnyscale, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.azure_openai import (
|
||||||
|
AzureChatOpenAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.baichuan import (
|
||||||
|
ChatBaichuan, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.baidu_qianfan_endpoint import (
|
||||||
|
QianfanChatEndpoint, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.bedrock import (
|
||||||
|
BedrockChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.cohere import (
|
||||||
|
ChatCohere, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.databricks import (
|
||||||
|
ChatDatabricks, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.deepinfra import (
|
||||||
|
ChatDeepInfra, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.ernie import (
|
||||||
|
ErnieBotChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.everlyai import (
|
||||||
|
ChatEverlyAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.fake import (
|
||||||
|
FakeListChatModel, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.fireworks import (
|
||||||
|
ChatFireworks, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.friendli import (
|
||||||
|
ChatFriendli, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.gigachat import (
|
||||||
|
GigaChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.google_palm import (
|
||||||
|
ChatGooglePalm, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.gpt_router import (
|
||||||
|
GPTRouter, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.huggingface import (
|
||||||
|
ChatHuggingFace, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.human import (
|
||||||
|
HumanInputChatModel, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.hunyuan import (
|
||||||
|
ChatHunyuan, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.javelin_ai_gateway import (
|
||||||
|
ChatJavelinAIGateway, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.jinachat import (
|
||||||
|
JinaChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.kinetica import (
|
||||||
|
ChatKinetica, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.konko import (
|
||||||
|
ChatKonko, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.litellm import (
|
||||||
|
ChatLiteLLM, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.litellm_router import (
|
||||||
|
ChatLiteLLMRouter, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.llama_edge import (
|
||||||
|
LlamaEdgeChatService, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.maritalk import (
|
||||||
|
ChatMaritalk, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.minimax import (
|
||||||
|
MiniMaxChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.mlflow import (
|
||||||
|
ChatMlflow, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.mlflow_ai_gateway import (
|
||||||
|
ChatMLflowAIGateway, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.mlx import (
|
||||||
|
ChatMLX, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.ollama import (
|
||||||
|
ChatOllama, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.openai import (
|
||||||
|
ChatOpenAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.pai_eas_endpoint import (
|
||||||
|
PaiEasChatEndpoint, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.perplexity import (
|
||||||
|
ChatPerplexity, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.premai import (
|
||||||
|
ChatPremAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.promptlayer_openai import (
|
||||||
|
PromptLayerChatOpenAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.solar import (
|
||||||
|
SolarChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.sparkllm import (
|
||||||
|
ChatSparkLLM, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.tongyi import (
|
||||||
|
ChatTongyi, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.vertexai import (
|
||||||
|
ChatVertexAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.volcengine_maas import (
|
||||||
|
VolcEngineMaasChat, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.yandex import (
|
||||||
|
ChatYandexGPT, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.yuan2 import (
|
||||||
|
ChatYuan2, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.chat_models.zhipuai import (
|
||||||
|
ChatZhipuAI, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AzureChatOpenAI",
|
||||||
|
"BedrockChat",
|
||||||
|
"ChatAnthropic",
|
||||||
|
"ChatAnyscale",
|
||||||
|
"ChatBaichuan",
|
||||||
|
"ChatCohere",
|
||||||
|
"ChatDatabricks",
|
||||||
|
"ChatDeepInfra",
|
||||||
|
"ChatEverlyAI",
|
||||||
|
"ChatFireworks",
|
||||||
|
"ChatFriendli",
|
||||||
|
"ChatGooglePalm",
|
||||||
|
"ChatHuggingFace",
|
||||||
|
"ChatHunyuan",
|
||||||
|
"ChatJavelinAIGateway",
|
||||||
|
"ChatKinetica",
|
||||||
|
"ChatKonko",
|
||||||
|
"ChatLiteLLM",
|
||||||
|
"ChatLiteLLMRouter",
|
||||||
|
"ChatMLX",
|
||||||
|
"ChatMLflowAIGateway",
|
||||||
|
"ChatMaritalk",
|
||||||
|
"ChatMlflow",
|
||||||
|
"ChatOllama",
|
||||||
|
"ChatOpenAI",
|
||||||
|
"ChatPerplexity",
|
||||||
|
"ChatPremAI",
|
||||||
|
"ChatSparkLLM",
|
||||||
|
"ChatTongyi",
|
||||||
|
"ChatVertexAI",
|
||||||
|
"ChatYandexGPT",
|
||||||
|
"ChatYuan2",
|
||||||
|
"ChatZhipuAI",
|
||||||
|
"ErnieBotChat",
|
||||||
|
"FakeListChatModel",
|
||||||
|
"GPTRouter",
|
||||||
|
"GigaChat",
|
||||||
|
"HumanInputChatModel",
|
||||||
|
"JinaChat",
|
||||||
|
"LlamaEdgeChatService",
|
||||||
|
"MiniMaxChat",
|
||||||
|
"PaiEasChatEndpoint",
|
||||||
|
"PromptLayerChatOpenAI",
|
||||||
|
"QianfanChatEndpoint",
|
||||||
|
"SolarChat",
|
||||||
|
"VolcEngineMaasChat",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AzureChatOpenAI": "langchain_community.chat_models.azure_openai",
|
"AzureChatOpenAI": "langchain_community.chat_models.azure_openai",
|
||||||
@ -63,6 +253,7 @@ _module_lookup = {
|
|||||||
"MiniMaxChat": "langchain_community.chat_models.minimax",
|
"MiniMaxChat": "langchain_community.chat_models.minimax",
|
||||||
"PaiEasChatEndpoint": "langchain_community.chat_models.pai_eas_endpoint",
|
"PaiEasChatEndpoint": "langchain_community.chat_models.pai_eas_endpoint",
|
||||||
"PromptLayerChatOpenAI": "langchain_community.chat_models.promptlayer_openai",
|
"PromptLayerChatOpenAI": "langchain_community.chat_models.promptlayer_openai",
|
||||||
|
"SolarChat": "langchain_community.chat_models.solar",
|
||||||
"QianfanChatEndpoint": "langchain_community.chat_models.baidu_qianfan_endpoint",
|
"QianfanChatEndpoint": "langchain_community.chat_models.baidu_qianfan_endpoint",
|
||||||
"VolcEngineMaasChat": "langchain_community.chat_models.volcengine_maas",
|
"VolcEngineMaasChat": "langchain_community.chat_models.volcengine_maas",
|
||||||
"ChatPremAI": "langchain_community.chat_models.premai",
|
"ChatPremAI": "langchain_community.chat_models.premai",
|
||||||
|
@ -8,7 +8,7 @@ from langchain_community.chat_models import ChatOpenAI
|
|||||||
from langchain_community.llms.moonshot import MOONSHOT_SERVICE_URL_BASE, MoonshotCommon
|
from langchain_community.llms.moonshot import MOONSHOT_SERVICE_URL_BASE, MoonshotCommon
|
||||||
|
|
||||||
|
|
||||||
class MoonshotChat(MoonshotCommon, ChatOpenAI):
|
class MoonshotChat(MoonshotCommon, ChatOpenAI): # type: ignore[misc]
|
||||||
"""Wrapper around Moonshot large language models.
|
"""Wrapper around Moonshot large language models.
|
||||||
|
|
||||||
To use, you should have the ``openai`` python package installed, and the
|
To use, you should have the ``openai`` python package installed, and the
|
||||||
|
@ -9,8 +9,9 @@ from langchain_community.chat_models import ChatOpenAI
|
|||||||
from langchain_community.llms.solar import SOLAR_SERVICE_URL_BASE, SolarCommon
|
from langchain_community.llms.solar import SOLAR_SERVICE_URL_BASE, SolarCommon
|
||||||
|
|
||||||
|
|
||||||
class SolarChat(SolarCommon, ChatOpenAI):
|
class SolarChat(SolarCommon, ChatOpenAI): # type: ignore[misc]
|
||||||
"""Wrapper around Solar large language models.
|
"""Wrapper around Solar large language models.
|
||||||
|
|
||||||
To use, you should have the ``openai`` python package installed, and the
|
To use, you should have the ``openai`` python package installed, and the
|
||||||
environment variable ``SOLAR_API_KEY`` set with your API key.
|
environment variable ``SOLAR_API_KEY`` set with your API key.
|
||||||
(Solar's chat API is compatible with OpenAI's SDK.)
|
(Solar's chat API is compatible with OpenAI's SDK.)
|
||||||
|
@ -16,7 +16,20 @@ The **Docstore** is a simplified version of the Document Loader.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.docstore.arbitrary_fn import (
|
||||||
|
DocstoreFn, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.docstore.in_memory import (
|
||||||
|
InMemoryDocstore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.docstore.wikipedia import (
|
||||||
|
Wikipedia, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = ["DocstoreFn", "InMemoryDocstore", "Wikipedia"]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"DocstoreFn": "langchain_community.docstore.arbitrary_fn",
|
"DocstoreFn": "langchain_community.docstore.arbitrary_fn",
|
||||||
|
@ -1,5 +1,15 @@
|
|||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.document_compressors.llmlingua_filter import (
|
||||||
|
LLMLinguaCompressor, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_compressors.openvino_rerank import (
|
||||||
|
OpenVINOReranker, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = ["LLMLinguaCompressor", "OpenVINOReranker"]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"LLMLinguaCompressor": "langchain_community.document_compressors.llmlingua_filter",
|
"LLMLinguaCompressor": "langchain_community.document_compressors.llmlingua_filter",
|
||||||
|
@ -15,7 +15,674 @@
|
|||||||
Document, <name>TextSplitter
|
Document, <name>TextSplitter
|
||||||
"""
|
"""
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.document_loaders.acreom import (
|
||||||
|
AcreomLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.airbyte import (
|
||||||
|
AirbyteCDKLoader, # noqa: F401
|
||||||
|
AirbyteGongLoader, # noqa: F401
|
||||||
|
AirbyteHubspotLoader, # noqa: F401
|
||||||
|
AirbyteSalesforceLoader, # noqa: F401
|
||||||
|
AirbyteShopifyLoader, # noqa: F401
|
||||||
|
AirbyteStripeLoader, # noqa: F401
|
||||||
|
AirbyteTypeformLoader, # noqa: F401
|
||||||
|
AirbyteZendeskSupportLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.airbyte_json import (
|
||||||
|
AirbyteJSONLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.airtable import (
|
||||||
|
AirtableLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.apify_dataset import (
|
||||||
|
ApifyDatasetLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.arcgis_loader import (
|
||||||
|
ArcGISLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.arxiv import (
|
||||||
|
ArxivLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.assemblyai import (
|
||||||
|
AssemblyAIAudioLoaderById, # noqa: F401
|
||||||
|
AssemblyAIAudioTranscriptLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.astradb import (
|
||||||
|
AstraDBLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.async_html import (
|
||||||
|
AsyncHtmlLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.athena import (
|
||||||
|
AthenaLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.azlyrics import (
|
||||||
|
AZLyricsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.azure_ai_data import (
|
||||||
|
AzureAIDataLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.azure_blob_storage_container import (
|
||||||
|
AzureBlobStorageContainerLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.azure_blob_storage_file import (
|
||||||
|
AzureBlobStorageFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.bibtex import (
|
||||||
|
BibtexLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.bigquery import (
|
||||||
|
BigQueryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.bilibili import (
|
||||||
|
BiliBiliLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.blackboard import (
|
||||||
|
BlackboardLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.blob_loaders import (
|
||||||
|
Blob, # noqa: F401
|
||||||
|
BlobLoader, # noqa: F401
|
||||||
|
FileSystemBlobLoader, # noqa: F401
|
||||||
|
YoutubeAudioLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.blockchain import (
|
||||||
|
BlockchainDocumentLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.brave_search import (
|
||||||
|
BraveSearchLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.browserless import (
|
||||||
|
BrowserlessLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.cassandra import (
|
||||||
|
CassandraLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.chatgpt import (
|
||||||
|
ChatGPTLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.chm import (
|
||||||
|
UnstructuredCHMLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.chromium import (
|
||||||
|
AsyncChromiumLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.college_confidential import (
|
||||||
|
CollegeConfidentialLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.concurrent import (
|
||||||
|
ConcurrentLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.confluence import (
|
||||||
|
ConfluenceLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.conllu import (
|
||||||
|
CoNLLULoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.couchbase import (
|
||||||
|
CouchbaseLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.csv_loader import (
|
||||||
|
CSVLoader, # noqa: F401
|
||||||
|
UnstructuredCSVLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.cube_semantic import (
|
||||||
|
CubeSemanticLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.datadog_logs import (
|
||||||
|
DatadogLogsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.dataframe import (
|
||||||
|
DataFrameLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.diffbot import (
|
||||||
|
DiffbotLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.directory import (
|
||||||
|
DirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.discord import (
|
||||||
|
DiscordChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.doc_intelligence import (
|
||||||
|
AzureAIDocumentIntelligenceLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.docugami import (
|
||||||
|
DocugamiLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.docusaurus import (
|
||||||
|
DocusaurusLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.dropbox import (
|
||||||
|
DropboxLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.duckdb_loader import (
|
||||||
|
DuckDBLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.email import (
|
||||||
|
OutlookMessageLoader, # noqa: F401
|
||||||
|
UnstructuredEmailLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.epub import (
|
||||||
|
UnstructuredEPubLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.etherscan import (
|
||||||
|
EtherscanLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.evernote import (
|
||||||
|
EverNoteLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.excel import (
|
||||||
|
UnstructuredExcelLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.facebook_chat import (
|
||||||
|
FacebookChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.fauna import (
|
||||||
|
FaunaLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.figma import (
|
||||||
|
FigmaFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.gcs_directory import (
|
||||||
|
GCSDirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.gcs_file import (
|
||||||
|
GCSFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.geodataframe import (
|
||||||
|
GeoDataFrameLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.git import (
|
||||||
|
GitLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.gitbook import (
|
||||||
|
GitbookLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.github import (
|
||||||
|
GithubFileLoader, # noqa: F401
|
||||||
|
GitHubIssuesLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.google_speech_to_text import (
|
||||||
|
GoogleSpeechToTextLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.googledrive import (
|
||||||
|
GoogleDriveLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.gutenberg import (
|
||||||
|
GutenbergLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.hn import (
|
||||||
|
HNLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.html import (
|
||||||
|
UnstructuredHTMLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.html_bs import (
|
||||||
|
BSHTMLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.hugging_face_dataset import (
|
||||||
|
HuggingFaceDatasetLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.hugging_face_model import (
|
||||||
|
HuggingFaceModelLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.ifixit import (
|
||||||
|
IFixitLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.image import (
|
||||||
|
UnstructuredImageLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.image_captions import (
|
||||||
|
ImageCaptionLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.imsdb import (
|
||||||
|
IMSDbLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.iugu import (
|
||||||
|
IuguLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.joplin import (
|
||||||
|
JoplinLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.json_loader import (
|
||||||
|
JSONLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.lakefs import (
|
||||||
|
LakeFSLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.larksuite import (
|
||||||
|
LarkSuiteDocLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.llmsherpa import (
|
||||||
|
LLMSherpaFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.markdown import (
|
||||||
|
UnstructuredMarkdownLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.mastodon import (
|
||||||
|
MastodonTootsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.max_compute import (
|
||||||
|
MaxComputeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.mediawikidump import (
|
||||||
|
MWDumpLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.merge import (
|
||||||
|
MergedDataLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.mhtml import (
|
||||||
|
MHTMLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.modern_treasury import (
|
||||||
|
ModernTreasuryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.mongodb import (
|
||||||
|
MongodbLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.news import (
|
||||||
|
NewsURLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.notebook import (
|
||||||
|
NotebookLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.notion import (
|
||||||
|
NotionDirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.notiondb import (
|
||||||
|
NotionDBLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.obs_directory import (
|
||||||
|
OBSDirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.obs_file import (
|
||||||
|
OBSFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.obsidian import (
|
||||||
|
ObsidianLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.odt import (
|
||||||
|
UnstructuredODTLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.onedrive import (
|
||||||
|
OneDriveLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.onedrive_file import (
|
||||||
|
OneDriveFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.open_city_data import (
|
||||||
|
OpenCityDataLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.oracleadb_loader import (
|
||||||
|
OracleAutonomousDatabaseLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.org_mode import (
|
||||||
|
UnstructuredOrgModeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.pdf import (
|
||||||
|
AmazonTextractPDFLoader, # noqa: F401
|
||||||
|
MathpixPDFLoader, # noqa: F401
|
||||||
|
OnlinePDFLoader, # noqa: F401
|
||||||
|
PagedPDFSplitter, # noqa: F401
|
||||||
|
PDFMinerLoader, # noqa: F401
|
||||||
|
PDFMinerPDFasHTMLLoader, # noqa: F401
|
||||||
|
PDFPlumberLoader, # noqa: F401
|
||||||
|
PyMuPDFLoader, # noqa: F401
|
||||||
|
PyPDFDirectoryLoader, # noqa: F401
|
||||||
|
PyPDFium2Loader, # noqa: F401
|
||||||
|
PyPDFLoader, # noqa: F401
|
||||||
|
UnstructuredPDFLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.pebblo import (
|
||||||
|
PebbloSafeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.polars_dataframe import (
|
||||||
|
PolarsDataFrameLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.powerpoint import (
|
||||||
|
UnstructuredPowerPointLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.psychic import (
|
||||||
|
PsychicLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.pubmed import (
|
||||||
|
PubMedLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.pyspark_dataframe import (
|
||||||
|
PySparkDataFrameLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.python import (
|
||||||
|
PythonLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.readthedocs import (
|
||||||
|
ReadTheDocsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.recursive_url_loader import (
|
||||||
|
RecursiveUrlLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.reddit import (
|
||||||
|
RedditPostsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.roam import (
|
||||||
|
RoamLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.rocksetdb import (
|
||||||
|
RocksetLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.rss import (
|
||||||
|
RSSFeedLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.rst import (
|
||||||
|
UnstructuredRSTLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.rtf import (
|
||||||
|
UnstructuredRTFLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.s3_directory import (
|
||||||
|
S3DirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.s3_file import (
|
||||||
|
S3FileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.sharepoint import (
|
||||||
|
SharePointLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.sitemap import (
|
||||||
|
SitemapLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.slack_directory import (
|
||||||
|
SlackDirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.snowflake_loader import (
|
||||||
|
SnowflakeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.spreedly import (
|
||||||
|
SpreedlyLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.sql_database import (
|
||||||
|
SQLDatabaseLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.srt import (
|
||||||
|
SRTLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.stripe import (
|
||||||
|
StripeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.surrealdb import (
|
||||||
|
SurrealDBLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.telegram import (
|
||||||
|
TelegramChatApiLoader, # noqa: F401
|
||||||
|
TelegramChatFileLoader, # noqa: F401
|
||||||
|
TelegramChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tencent_cos_directory import (
|
||||||
|
TencentCOSDirectoryLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tencent_cos_file import (
|
||||||
|
TencentCOSFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tensorflow_datasets import (
|
||||||
|
TensorflowDatasetLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.text import (
|
||||||
|
TextLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tidb import (
|
||||||
|
TiDBLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tomarkdown import (
|
||||||
|
ToMarkdownLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.toml import (
|
||||||
|
TomlLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.trello import (
|
||||||
|
TrelloLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.tsv import (
|
||||||
|
UnstructuredTSVLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.twitter import (
|
||||||
|
TwitterTweetLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.unstructured import (
|
||||||
|
UnstructuredAPIFileIOLoader, # noqa: F401
|
||||||
|
UnstructuredAPIFileLoader, # noqa: F401
|
||||||
|
UnstructuredFileIOLoader, # noqa: F401
|
||||||
|
UnstructuredFileLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.url import (
|
||||||
|
UnstructuredURLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.url_playwright import (
|
||||||
|
PlaywrightURLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.url_selenium import (
|
||||||
|
SeleniumURLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.vsdx import (
|
||||||
|
VsdxLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.weather import (
|
||||||
|
WeatherDataLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.web_base import (
|
||||||
|
WebBaseLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.whatsapp_chat import (
|
||||||
|
WhatsAppChatLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.wikipedia import (
|
||||||
|
WikipediaLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.word_document import (
|
||||||
|
Docx2txtLoader, # noqa: F401
|
||||||
|
UnstructuredWordDocumentLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.xml import (
|
||||||
|
UnstructuredXMLLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.xorbits import (
|
||||||
|
XorbitsLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.youtube import (
|
||||||
|
GoogleApiClient, # noqa: F401
|
||||||
|
GoogleApiYoutubeLoader, # noqa: F401
|
||||||
|
YoutubeLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_loaders.yuque import (
|
||||||
|
YuqueLoader, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AZLyricsLoader",
|
||||||
|
"AcreomLoader",
|
||||||
|
"AirbyteCDKLoader",
|
||||||
|
"AirbyteGongLoader",
|
||||||
|
"AirbyteHubspotLoader",
|
||||||
|
"AirbyteJSONLoader",
|
||||||
|
"AirbyteSalesforceLoader",
|
||||||
|
"AirbyteShopifyLoader",
|
||||||
|
"AirbyteStripeLoader",
|
||||||
|
"AirbyteTypeformLoader",
|
||||||
|
"AirbyteZendeskSupportLoader",
|
||||||
|
"AirtableLoader",
|
||||||
|
"AmazonTextractPDFLoader",
|
||||||
|
"ApifyDatasetLoader",
|
||||||
|
"ArcGISLoader",
|
||||||
|
"ArxivLoader",
|
||||||
|
"AssemblyAIAudioLoaderById",
|
||||||
|
"AssemblyAIAudioTranscriptLoader",
|
||||||
|
"AstraDBLoader",
|
||||||
|
"AsyncChromiumLoader",
|
||||||
|
"AsyncHtmlLoader",
|
||||||
|
"AthenaLoader",
|
||||||
|
"AzureAIDataLoader",
|
||||||
|
"AzureAIDocumentIntelligenceLoader",
|
||||||
|
"AzureBlobStorageContainerLoader",
|
||||||
|
"AzureBlobStorageFileLoader",
|
||||||
|
"BSHTMLLoader",
|
||||||
|
"BibtexLoader",
|
||||||
|
"BigQueryLoader",
|
||||||
|
"BiliBiliLoader",
|
||||||
|
"BlackboardLoader",
|
||||||
|
"Blob",
|
||||||
|
"BlobLoader",
|
||||||
|
"BlockchainDocumentLoader",
|
||||||
|
"BraveSearchLoader",
|
||||||
|
"BrowserlessLoader",
|
||||||
|
"CSVLoader",
|
||||||
|
"CassandraLoader",
|
||||||
|
"ChatGPTLoader",
|
||||||
|
"CoNLLULoader",
|
||||||
|
"CollegeConfidentialLoader",
|
||||||
|
"ConcurrentLoader",
|
||||||
|
"ConfluenceLoader",
|
||||||
|
"CouchbaseLoader",
|
||||||
|
"CubeSemanticLoader",
|
||||||
|
"DataFrameLoader",
|
||||||
|
"DatadogLogsLoader",
|
||||||
|
"DiffbotLoader",
|
||||||
|
"DirectoryLoader",
|
||||||
|
"DiscordChatLoader",
|
||||||
|
"DocugamiLoader",
|
||||||
|
"DocusaurusLoader",
|
||||||
|
"Docx2txtLoader",
|
||||||
|
"DropboxLoader",
|
||||||
|
"DuckDBLoader",
|
||||||
|
"EtherscanLoader",
|
||||||
|
"EverNoteLoader",
|
||||||
|
"FacebookChatLoader",
|
||||||
|
"FaunaLoader",
|
||||||
|
"FigmaFileLoader",
|
||||||
|
"FileSystemBlobLoader",
|
||||||
|
"GCSDirectoryLoader",
|
||||||
|
"GCSFileLoader",
|
||||||
|
"GeoDataFrameLoader",
|
||||||
|
"GitHubIssuesLoader",
|
||||||
|
"GitLoader",
|
||||||
|
"GitbookLoader",
|
||||||
|
"GithubFileLoader",
|
||||||
|
"GoogleApiClient",
|
||||||
|
"GoogleApiYoutubeLoader",
|
||||||
|
"GoogleDriveLoader",
|
||||||
|
"GoogleSpeechToTextLoader",
|
||||||
|
"GutenbergLoader",
|
||||||
|
"HNLoader",
|
||||||
|
"HuggingFaceDatasetLoader",
|
||||||
|
"HuggingFaceModelLoader",
|
||||||
|
"IFixitLoader",
|
||||||
|
"IMSDbLoader",
|
||||||
|
"ImageCaptionLoader",
|
||||||
|
"IuguLoader",
|
||||||
|
"JSONLoader",
|
||||||
|
"JoplinLoader",
|
||||||
|
"LLMSherpaFileLoader",
|
||||||
|
"LakeFSLoader",
|
||||||
|
"LarkSuiteDocLoader",
|
||||||
|
"MHTMLLoader",
|
||||||
|
"MWDumpLoader",
|
||||||
|
"MastodonTootsLoader",
|
||||||
|
"MathpixPDFLoader",
|
||||||
|
"MaxComputeLoader",
|
||||||
|
"MergedDataLoader",
|
||||||
|
"ModernTreasuryLoader",
|
||||||
|
"MongodbLoader",
|
||||||
|
"NewsURLLoader",
|
||||||
|
"NotebookLoader",
|
||||||
|
"NotionDBLoader",
|
||||||
|
"NotionDirectoryLoader",
|
||||||
|
"OBSDirectoryLoader",
|
||||||
|
"OBSFileLoader",
|
||||||
|
"ObsidianLoader",
|
||||||
|
"OneDriveFileLoader",
|
||||||
|
"OneDriveLoader",
|
||||||
|
"OnlinePDFLoader",
|
||||||
|
"OpenCityDataLoader",
|
||||||
|
"OracleAutonomousDatabaseLoader",
|
||||||
|
"OutlookMessageLoader",
|
||||||
|
"PDFMinerLoader",
|
||||||
|
"PDFMinerPDFasHTMLLoader",
|
||||||
|
"PDFPlumberLoader",
|
||||||
|
"PagedPDFSplitter",
|
||||||
|
"PebbloSafeLoader",
|
||||||
|
"PlaywrightURLLoader",
|
||||||
|
"PolarsDataFrameLoader",
|
||||||
|
"PsychicLoader",
|
||||||
|
"PubMedLoader",
|
||||||
|
"PyMuPDFLoader",
|
||||||
|
"PyPDFDirectoryLoader",
|
||||||
|
"PyPDFLoader",
|
||||||
|
"PyPDFium2Loader",
|
||||||
|
"PySparkDataFrameLoader",
|
||||||
|
"PythonLoader",
|
||||||
|
"RSSFeedLoader",
|
||||||
|
"ReadTheDocsLoader",
|
||||||
|
"RecursiveUrlLoader",
|
||||||
|
"RedditPostsLoader",
|
||||||
|
"RoamLoader",
|
||||||
|
"RocksetLoader",
|
||||||
|
"S3DirectoryLoader",
|
||||||
|
"S3FileLoader",
|
||||||
|
"SQLDatabaseLoader",
|
||||||
|
"SRTLoader",
|
||||||
|
"SeleniumURLLoader",
|
||||||
|
"SharePointLoader",
|
||||||
|
"SitemapLoader",
|
||||||
|
"SlackDirectoryLoader",
|
||||||
|
"SnowflakeLoader",
|
||||||
|
"SpreedlyLoader",
|
||||||
|
"StripeLoader",
|
||||||
|
"SurrealDBLoader",
|
||||||
|
"TelegramChatApiLoader",
|
||||||
|
"TelegramChatFileLoader",
|
||||||
|
"TelegramChatLoader",
|
||||||
|
"TencentCOSDirectoryLoader",
|
||||||
|
"TencentCOSFileLoader",
|
||||||
|
"TensorflowDatasetLoader",
|
||||||
|
"TextLoader",
|
||||||
|
"TiDBLoader",
|
||||||
|
"ToMarkdownLoader",
|
||||||
|
"TomlLoader",
|
||||||
|
"TrelloLoader",
|
||||||
|
"TwitterTweetLoader",
|
||||||
|
"UnstructuredAPIFileIOLoader",
|
||||||
|
"UnstructuredAPIFileLoader",
|
||||||
|
"UnstructuredCHMLoader",
|
||||||
|
"UnstructuredCSVLoader",
|
||||||
|
"UnstructuredEPubLoader",
|
||||||
|
"UnstructuredEmailLoader",
|
||||||
|
"UnstructuredExcelLoader",
|
||||||
|
"UnstructuredFileIOLoader",
|
||||||
|
"UnstructuredFileLoader",
|
||||||
|
"UnstructuredHTMLLoader",
|
||||||
|
"UnstructuredImageLoader",
|
||||||
|
"UnstructuredMarkdownLoader",
|
||||||
|
"UnstructuredODTLoader",
|
||||||
|
"UnstructuredOrgModeLoader",
|
||||||
|
"UnstructuredPDFLoader",
|
||||||
|
"UnstructuredPowerPointLoader",
|
||||||
|
"UnstructuredRSTLoader",
|
||||||
|
"UnstructuredRTFLoader",
|
||||||
|
"UnstructuredTSVLoader",
|
||||||
|
"UnstructuredURLLoader",
|
||||||
|
"UnstructuredWordDocumentLoader",
|
||||||
|
"UnstructuredXMLLoader",
|
||||||
|
"VsdxLoader",
|
||||||
|
"WeatherDataLoader",
|
||||||
|
"WebBaseLoader",
|
||||||
|
"WhatsAppChatLoader",
|
||||||
|
"WikipediaLoader",
|
||||||
|
"XorbitsLoader",
|
||||||
|
"YoutubeAudioLoader",
|
||||||
|
"YoutubeLoader",
|
||||||
|
"YuqueLoader",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AZLyricsLoader": "langchain_community.document_loaders.azlyrics",
|
"AZLyricsLoader": "langchain_community.document_loaders.azlyrics",
|
||||||
|
@ -23,7 +23,10 @@ class ConcurrentLoader(GenericLoader):
|
|||||||
"""Load and pars Documents concurrently."""
|
"""Load and pars Documents concurrently."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, blob_loader: BlobLoader, blob_parser: BaseBlobParser, num_workers: int = 4
|
self,
|
||||||
|
blob_loader: BlobLoader, # type: ignore[valid-type]
|
||||||
|
blob_parser: BaseBlobParser,
|
||||||
|
num_workers: int = 4, # type: ignore[valid-type]
|
||||||
) -> None:
|
) -> None:
|
||||||
super().__init__(blob_loader, blob_parser)
|
super().__init__(blob_loader, blob_parser)
|
||||||
self.num_workers = num_workers
|
self.num_workers = num_workers
|
||||||
@ -37,7 +40,7 @@ class ConcurrentLoader(GenericLoader):
|
|||||||
) as executor:
|
) as executor:
|
||||||
futures = {
|
futures = {
|
||||||
executor.submit(self.blob_parser.lazy_parse, blob)
|
executor.submit(self.blob_parser.lazy_parse, blob)
|
||||||
for blob in self.blob_loader.yield_blobs()
|
for blob in self.blob_loader.yield_blobs() # type: ignore[attr-defined]
|
||||||
}
|
}
|
||||||
for future in concurrent.futures.as_completed(futures):
|
for future in concurrent.futures.as_completed(futures):
|
||||||
yield from future.result()
|
yield from future.result()
|
||||||
@ -69,7 +72,7 @@ class ConcurrentLoader(GenericLoader):
|
|||||||
num_workers: Max number of concurrent workers to use.
|
num_workers: Max number of concurrent workers to use.
|
||||||
parser_kwargs: Keyword arguments to pass to the parser.
|
parser_kwargs: Keyword arguments to pass to the parser.
|
||||||
"""
|
"""
|
||||||
blob_loader = FileSystemBlobLoader(
|
blob_loader = FileSystemBlobLoader( # type: ignore[attr-defined, misc]
|
||||||
path,
|
path,
|
||||||
glob=glob,
|
glob=glob,
|
||||||
exclude=exclude,
|
exclude=exclude,
|
||||||
|
@ -78,7 +78,7 @@ class AzureAIDocumentIntelligenceLoader(BaseLoader):
|
|||||||
self.file_path = file_path
|
self.file_path = file_path
|
||||||
self.url_path = url_path
|
self.url_path = url_path
|
||||||
|
|
||||||
self.parser = AzureAIDocumentIntelligenceParser(
|
self.parser = AzureAIDocumentIntelligenceParser( # type: ignore[misc]
|
||||||
api_endpoint=api_endpoint,
|
api_endpoint=api_endpoint,
|
||||||
api_key=api_key,
|
api_key=api_key,
|
||||||
api_version=api_version,
|
api_version=api_version,
|
||||||
@ -92,7 +92,7 @@ class AzureAIDocumentIntelligenceLoader(BaseLoader):
|
|||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Lazy load given path as pages."""
|
"""Lazy load given path as pages."""
|
||||||
if self.file_path is not None:
|
if self.file_path is not None:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
else:
|
else:
|
||||||
yield from self.parser.parse_url(self.url_path) # type: ignore[arg-type]
|
yield from self.parser.parse_url(self.url_path) # type: ignore[arg-type]
|
||||||
|
@ -96,7 +96,7 @@ class GenericLoader(BaseLoader):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
blob_loader: BlobLoader,
|
blob_loader: BlobLoader, # type: ignore[valid-type]
|
||||||
blob_parser: BaseBlobParser,
|
blob_parser: BaseBlobParser,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""A generic document loader.
|
"""A generic document loader.
|
||||||
@ -112,7 +112,7 @@ class GenericLoader(BaseLoader):
|
|||||||
self,
|
self,
|
||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Load documents lazily. Use this when working at a large scale."""
|
"""Load documents lazily. Use this when working at a large scale."""
|
||||||
for blob in self.blob_loader.yield_blobs():
|
for blob in self.blob_loader.yield_blobs(): # type: ignore[attr-defined]
|
||||||
yield from self.blob_parser.lazy_parse(blob)
|
yield from self.blob_parser.lazy_parse(blob)
|
||||||
|
|
||||||
def load_and_split(
|
def load_and_split(
|
||||||
@ -159,7 +159,7 @@ class GenericLoader(BaseLoader):
|
|||||||
Returns:
|
Returns:
|
||||||
A generic document loader.
|
A generic document loader.
|
||||||
"""
|
"""
|
||||||
blob_loader = FileSystemBlobLoader(
|
blob_loader = FileSystemBlobLoader( # type: ignore[attr-defined, misc]
|
||||||
path,
|
path,
|
||||||
glob=glob,
|
glob=glob,
|
||||||
exclude=exclude,
|
exclude=exclude,
|
||||||
|
@ -9,7 +9,7 @@ from langchain_community.document_loaders.blob_loaders import Blob
|
|||||||
class MsWordParser(BaseBlobParser):
|
class MsWordParser(BaseBlobParser):
|
||||||
"""Parse the Microsoft Word documents from a blob."""
|
"""Parse the Microsoft Word documents from a blob."""
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Parse a Microsoft Word document into the Document iterator.
|
"""Parse a Microsoft Word document into the Document iterator.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -33,13 +33,13 @@ class MsWordParser(BaseBlobParser):
|
|||||||
partition_docx
|
partition_docx
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
if blob.mimetype not in (
|
if blob.mimetype not in ( # type: ignore[attr-defined]
|
||||||
"application/msword",
|
"application/msword",
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
):
|
):
|
||||||
raise ValueError("This blob type is not supported for this parser.")
|
raise ValueError("This blob type is not supported for this parser.")
|
||||||
with blob.as_bytes_io() as word_document:
|
with blob.as_bytes_io() as word_document: # type: ignore[attr-defined]
|
||||||
elements = mime_type_parser[blob.mimetype](file=word_document)
|
elements = mime_type_parser[blob.mimetype](file=word_document) # type: ignore[attr-defined]
|
||||||
text = "\n\n".join([str(el) for el in elements])
|
text = "\n\n".join([str(el) for el in elements])
|
||||||
metadata = {"source": blob.source}
|
metadata = {"source": blob.source} # type: ignore[attr-defined]
|
||||||
yield Document(page_content=text, metadata=metadata)
|
yield Document(page_content=text, metadata=metadata)
|
||||||
|
@ -87,17 +87,17 @@ class PyPDFParser(BaseBlobParser):
|
|||||||
self.password = password
|
self.password = password
|
||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
import pypdf
|
import pypdf
|
||||||
|
|
||||||
with blob.as_bytes_io() as pdf_file_obj:
|
with blob.as_bytes_io() as pdf_file_obj: # type: ignore[attr-defined]
|
||||||
pdf_reader = pypdf.PdfReader(pdf_file_obj, password=self.password)
|
pdf_reader = pypdf.PdfReader(pdf_file_obj, password=self.password)
|
||||||
yield from [
|
yield from [
|
||||||
Document(
|
Document(
|
||||||
page_content=page.extract_text()
|
page_content=page.extract_text()
|
||||||
+ self._extract_images_from_page(page),
|
+ self._extract_images_from_page(page),
|
||||||
metadata={"source": blob.source, "page": page_number},
|
metadata={"source": blob.source, "page": page_number}, # type: ignore[attr-defined]
|
||||||
)
|
)
|
||||||
for page_number, page in enumerate(pdf_reader.pages)
|
for page_number, page in enumerate(pdf_reader.pages)
|
||||||
]
|
]
|
||||||
@ -140,16 +140,16 @@ class PDFMinerParser(BaseBlobParser):
|
|||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
self.concatenate_pages = concatenate_pages
|
self.concatenate_pages = concatenate_pages
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
|
|
||||||
if not self.extract_images:
|
if not self.extract_images:
|
||||||
from pdfminer.high_level import extract_text
|
from pdfminer.high_level import extract_text
|
||||||
|
|
||||||
with blob.as_bytes_io() as pdf_file_obj:
|
with blob.as_bytes_io() as pdf_file_obj: # type: ignore[attr-defined]
|
||||||
if self.concatenate_pages:
|
if self.concatenate_pages:
|
||||||
text = extract_text(pdf_file_obj)
|
text = extract_text(pdf_file_obj)
|
||||||
metadata = {"source": blob.source}
|
metadata = {"source": blob.source} # type: ignore[attr-defined]
|
||||||
yield Document(page_content=text, metadata=metadata)
|
yield Document(page_content=text, metadata=metadata)
|
||||||
else:
|
else:
|
||||||
from pdfminer.pdfpage import PDFPage
|
from pdfminer.pdfpage import PDFPage
|
||||||
@ -157,7 +157,7 @@ class PDFMinerParser(BaseBlobParser):
|
|||||||
pages = PDFPage.get_pages(pdf_file_obj)
|
pages = PDFPage.get_pages(pdf_file_obj)
|
||||||
for i, _ in enumerate(pages):
|
for i, _ in enumerate(pages):
|
||||||
text = extract_text(pdf_file_obj, page_numbers=[i])
|
text = extract_text(pdf_file_obj, page_numbers=[i])
|
||||||
metadata = {"source": blob.source, "page": str(i)}
|
metadata = {"source": blob.source, "page": str(i)} # type: ignore[attr-defined]
|
||||||
yield Document(page_content=text, metadata=metadata)
|
yield Document(page_content=text, metadata=metadata)
|
||||||
else:
|
else:
|
||||||
import io
|
import io
|
||||||
@ -168,7 +168,7 @@ class PDFMinerParser(BaseBlobParser):
|
|||||||
from pdfminer.pdfpage import PDFPage
|
from pdfminer.pdfpage import PDFPage
|
||||||
|
|
||||||
text_io = io.StringIO()
|
text_io = io.StringIO()
|
||||||
with blob.as_bytes_io() as pdf_file_obj:
|
with blob.as_bytes_io() as pdf_file_obj: # type: ignore[attr-defined]
|
||||||
pages = PDFPage.get_pages(pdf_file_obj)
|
pages = PDFPage.get_pages(pdf_file_obj)
|
||||||
rsrcmgr = PDFResourceManager()
|
rsrcmgr = PDFResourceManager()
|
||||||
device_for_text = TextConverter(rsrcmgr, text_io, laparams=LAParams())
|
device_for_text = TextConverter(rsrcmgr, text_io, laparams=LAParams())
|
||||||
@ -183,7 +183,7 @@ class PDFMinerParser(BaseBlobParser):
|
|||||||
)
|
)
|
||||||
text_io.truncate(0)
|
text_io.truncate(0)
|
||||||
text_io.seek(0)
|
text_io.seek(0)
|
||||||
metadata = {"source": blob.source, "page": str(i)}
|
metadata = {"source": blob.source, "page": str(i)} # type: ignore[attr-defined]
|
||||||
yield Document(page_content=content, metadata=metadata)
|
yield Document(page_content=content, metadata=metadata)
|
||||||
|
|
||||||
def _extract_images_from_page(self, page: pdfminer.layout.LTPage) -> str:
|
def _extract_images_from_page(self, page: pdfminer.layout.LTPage) -> str:
|
||||||
@ -231,12 +231,12 @@ class PyMuPDFParser(BaseBlobParser):
|
|||||||
self.text_kwargs = text_kwargs or {}
|
self.text_kwargs = text_kwargs or {}
|
||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
import fitz
|
import fitz
|
||||||
|
|
||||||
with blob.as_bytes_io() as file_path:
|
with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
|
||||||
if blob.data is None:
|
if blob.data is None: # type: ignore[attr-defined]
|
||||||
doc = fitz.open(file_path)
|
doc = fitz.open(file_path)
|
||||||
else:
|
else:
|
||||||
doc = fitz.open(stream=file_path, filetype="pdf")
|
doc = fitz.open(stream=file_path, filetype="pdf")
|
||||||
@ -247,8 +247,8 @@ class PyMuPDFParser(BaseBlobParser):
|
|||||||
+ self._extract_images_from_page(doc, page),
|
+ self._extract_images_from_page(doc, page),
|
||||||
metadata=dict(
|
metadata=dict(
|
||||||
{
|
{
|
||||||
"source": blob.source,
|
"source": blob.source, # type: ignore[attr-defined]
|
||||||
"file_path": blob.source,
|
"file_path": blob.source, # type: ignore[attr-defined]
|
||||||
"page": page.number,
|
"page": page.number,
|
||||||
"total_pages": len(doc),
|
"total_pages": len(doc),
|
||||||
},
|
},
|
||||||
@ -297,13 +297,13 @@ class PyPDFium2Parser(BaseBlobParser):
|
|||||||
)
|
)
|
||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
import pypdfium2
|
import pypdfium2
|
||||||
|
|
||||||
# pypdfium2 is really finicky with respect to closing things,
|
# pypdfium2 is really finicky with respect to closing things,
|
||||||
# if done incorrectly creates seg faults.
|
# if done incorrectly creates seg faults.
|
||||||
with blob.as_bytes_io() as file_path:
|
with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
|
||||||
pdf_reader = pypdfium2.PdfDocument(file_path, autoclose=True)
|
pdf_reader = pypdfium2.PdfDocument(file_path, autoclose=True)
|
||||||
try:
|
try:
|
||||||
for page_number, page in enumerate(pdf_reader):
|
for page_number, page in enumerate(pdf_reader):
|
||||||
@ -312,7 +312,7 @@ class PyPDFium2Parser(BaseBlobParser):
|
|||||||
text_page.close()
|
text_page.close()
|
||||||
content += "\n" + self._extract_images_from_page(page)
|
content += "\n" + self._extract_images_from_page(page)
|
||||||
page.close()
|
page.close()
|
||||||
metadata = {"source": blob.source, "page": page_number}
|
metadata = {"source": blob.source, "page": page_number} # type: ignore[attr-defined]
|
||||||
yield Document(page_content=content, metadata=metadata)
|
yield Document(page_content=content, metadata=metadata)
|
||||||
finally:
|
finally:
|
||||||
pdf_reader.close()
|
pdf_reader.close()
|
||||||
@ -349,11 +349,11 @@ class PDFPlumberParser(BaseBlobParser):
|
|||||||
self.dedupe = dedupe
|
self.dedupe = dedupe
|
||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
import pdfplumber
|
import pdfplumber
|
||||||
|
|
||||||
with blob.as_bytes_io() as file_path:
|
with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
|
||||||
doc = pdfplumber.open(file_path) # open document
|
doc = pdfplumber.open(file_path) # open document
|
||||||
|
|
||||||
yield from [
|
yield from [
|
||||||
@ -363,8 +363,8 @@ class PDFPlumberParser(BaseBlobParser):
|
|||||||
+ self._extract_images_from_page(page),
|
+ self._extract_images_from_page(page),
|
||||||
metadata=dict(
|
metadata=dict(
|
||||||
{
|
{
|
||||||
"source": blob.source,
|
"source": blob.source, # type: ignore[attr-defined]
|
||||||
"file_path": blob.source,
|
"file_path": blob.source, # type: ignore[attr-defined]
|
||||||
"page": page.page_number - 1,
|
"page": page.page_number - 1,
|
||||||
"total_pages": len(doc.pages),
|
"total_pages": len(doc.pages),
|
||||||
},
|
},
|
||||||
@ -514,14 +514,14 @@ class AmazonTextractPDFParser(BaseBlobParser):
|
|||||||
else:
|
else:
|
||||||
self.boto3_textract_client = client
|
self.boto3_textract_client = client
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Iterates over the Blob pages and returns an Iterator with a Document
|
"""Iterates over the Blob pages and returns an Iterator with a Document
|
||||||
for each page, like the other parsers If multi-page document, blob.path
|
for each page, like the other parsers If multi-page document, blob.path
|
||||||
has to be set to the S3 URI and for single page docs
|
has to be set to the S3 URI and for single page docs
|
||||||
the blob.data is taken
|
the blob.data is taken
|
||||||
"""
|
"""
|
||||||
|
|
||||||
url_parse_result = urlparse(str(blob.path)) if blob.path else None
|
url_parse_result = urlparse(str(blob.path)) if blob.path else None # type: ignore[attr-defined]
|
||||||
# Either call with S3 path (multi-page) or with bytes (single-page)
|
# Either call with S3 path (multi-page) or with bytes (single-page)
|
||||||
if (
|
if (
|
||||||
url_parse_result
|
url_parse_result
|
||||||
@ -529,13 +529,13 @@ class AmazonTextractPDFParser(BaseBlobParser):
|
|||||||
and url_parse_result.netloc
|
and url_parse_result.netloc
|
||||||
):
|
):
|
||||||
textract_response_json = self.tc.call_textract(
|
textract_response_json = self.tc.call_textract(
|
||||||
input_document=str(blob.path),
|
input_document=str(blob.path), # type: ignore[attr-defined]
|
||||||
features=self.textract_features,
|
features=self.textract_features,
|
||||||
boto3_textract_client=self.boto3_textract_client,
|
boto3_textract_client=self.boto3_textract_client,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
textract_response_json = self.tc.call_textract(
|
textract_response_json = self.tc.call_textract(
|
||||||
input_document=blob.as_bytes(),
|
input_document=blob.as_bytes(), # type: ignore[attr-defined]
|
||||||
features=self.textract_features,
|
features=self.textract_features,
|
||||||
call_mode=self.tc.Textract_Call_Mode.FORCE_SYNC,
|
call_mode=self.tc.Textract_Call_Mode.FORCE_SYNC,
|
||||||
boto3_textract_client=self.boto3_textract_client,
|
boto3_textract_client=self.boto3_textract_client,
|
||||||
@ -546,7 +546,7 @@ class AmazonTextractPDFParser(BaseBlobParser):
|
|||||||
for idx, page in enumerate(document.pages):
|
for idx, page in enumerate(document.pages):
|
||||||
yield Document(
|
yield Document(
|
||||||
page_content=page.get_text(config=self.linearization_config),
|
page_content=page.get_text(config=self.linearization_config),
|
||||||
metadata={"source": blob.source, "page": idx + 1},
|
metadata={"source": blob.source, "page": idx + 1}, # type: ignore[attr-defined]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -566,23 +566,23 @@ class DocumentIntelligenceParser(BaseBlobParser):
|
|||||||
self.client = client
|
self.client = client
|
||||||
self.model = model
|
self.model = model
|
||||||
|
|
||||||
def _generate_docs(self, blob: Blob, result: Any) -> Iterator[Document]:
|
def _generate_docs(self, blob: Blob, result: Any) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
for p in result.pages:
|
for p in result.pages:
|
||||||
content = " ".join([line.content for line in p.lines])
|
content = " ".join([line.content for line in p.lines])
|
||||||
|
|
||||||
d = Document(
|
d = Document(
|
||||||
page_content=content,
|
page_content=content,
|
||||||
metadata={
|
metadata={
|
||||||
"source": blob.source,
|
"source": blob.source, # type: ignore[attr-defined]
|
||||||
"page": p.page_number,
|
"page": p.page_number,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
yield d
|
yield d
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
|
|
||||||
with blob.as_bytes_io() as file_obj:
|
with blob.as_bytes_io() as file_obj: # type: ignore[attr-defined]
|
||||||
poller = self.client.begin_analyze_document(self.model, file_obj)
|
poller = self.client.begin_analyze_document(self.model, file_obj)
|
||||||
result = poller.result()
|
result = poller.result()
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@ from langchain_community.document_loaders.blob_loaders import Blob
|
|||||||
class TextParser(BaseBlobParser):
|
class TextParser(BaseBlobParser):
|
||||||
"""Parser for text blobs."""
|
"""Parser for text blobs."""
|
||||||
|
|
||||||
def lazy_parse(self, blob: Blob) -> Iterator[Document]:
|
def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
|
||||||
"""Lazily parse the blob."""
|
"""Lazily parse the blob."""
|
||||||
yield Document(page_content=blob.as_string(), metadata={"source": blob.source})
|
yield Document(page_content=blob.as_string(), metadata={"source": blob.source}) # type: ignore[attr-defined]
|
||||||
|
@ -187,9 +187,9 @@ class PyPDFLoader(BasePDFLoader):
|
|||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Lazy load given path as pages."""
|
"""Lazy load given path as pages."""
|
||||||
if self.web_path:
|
if self.web_path:
|
||||||
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
|
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
|
|
||||||
|
|
||||||
@ -212,9 +212,9 @@ class PyPDFium2Loader(BasePDFLoader):
|
|||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Lazy load given path as pages."""
|
"""Lazy load given path as pages."""
|
||||||
if self.web_path:
|
if self.web_path:
|
||||||
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
|
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
|
|
||||||
|
|
||||||
@ -301,9 +301,9 @@ class PDFMinerLoader(BasePDFLoader):
|
|||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Lazily load documents."""
|
"""Lazily load documents."""
|
||||||
if self.web_path:
|
if self.web_path:
|
||||||
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
|
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
|
|
||||||
|
|
||||||
@ -378,9 +378,9 @@ class PyMuPDFLoader(BasePDFLoader):
|
|||||||
text_kwargs=text_kwargs, extract_images=self.extract_images
|
text_kwargs=text_kwargs, extract_images=self.extract_images
|
||||||
)
|
)
|
||||||
if self.web_path:
|
if self.web_path:
|
||||||
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
|
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from parser.lazy_parse(blob)
|
yield from parser.lazy_parse(blob)
|
||||||
|
|
||||||
def load(self, **kwargs: Any) -> List[Document]:
|
def load(self, **kwargs: Any) -> List[Document]:
|
||||||
@ -574,9 +574,9 @@ class PDFPlumberLoader(BasePDFLoader):
|
|||||||
extract_images=self.extract_images,
|
extract_images=self.extract_images,
|
||||||
)
|
)
|
||||||
if self.web_path:
|
if self.web_path:
|
||||||
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
|
blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
return parser.parse(blob)
|
return parser.parse(blob)
|
||||||
|
|
||||||
|
|
||||||
@ -691,9 +691,9 @@ class AmazonTextractPDFLoader(BasePDFLoader):
|
|||||||
# raises ValueError when multi-page and not on S3"""
|
# raises ValueError when multi-page and not on S3"""
|
||||||
|
|
||||||
if self.web_path and self._is_s3_url(self.web_path):
|
if self.web_path and self._is_s3_url(self.web_path):
|
||||||
blob = Blob(path=self.web_path)
|
blob = Blob(path=self.web_path) # type: ignore[misc]
|
||||||
else:
|
else:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
if AmazonTextractPDFLoader._get_number_of_pages(blob) > 1:
|
if AmazonTextractPDFLoader._get_number_of_pages(blob) > 1:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"the file {blob.path} is a multi-page document, \
|
f"the file {blob.path} is a multi-page document, \
|
||||||
@ -704,7 +704,7 @@ class AmazonTextractPDFLoader(BasePDFLoader):
|
|||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_number_of_pages(blob: Blob) -> int:
|
def _get_number_of_pages(blob: Blob) -> int: # type: ignore[valid-type]
|
||||||
try:
|
try:
|
||||||
import pypdf
|
import pypdf
|
||||||
from PIL import Image, ImageSequence
|
from PIL import Image, ImageSequence
|
||||||
@ -714,20 +714,20 @@ class AmazonTextractPDFLoader(BasePDFLoader):
|
|||||||
"Could not import pypdf or Pilloe python package. "
|
"Could not import pypdf or Pilloe python package. "
|
||||||
"Please install it with `pip install pypdf Pillow`."
|
"Please install it with `pip install pypdf Pillow`."
|
||||||
)
|
)
|
||||||
if blob.mimetype == "application/pdf":
|
if blob.mimetype == "application/pdf": # type: ignore[attr-defined]
|
||||||
with blob.as_bytes_io() as input_pdf_file:
|
with blob.as_bytes_io() as input_pdf_file: # type: ignore[attr-defined]
|
||||||
pdf_reader = pypdf.PdfReader(input_pdf_file)
|
pdf_reader = pypdf.PdfReader(input_pdf_file)
|
||||||
return len(pdf_reader.pages)
|
return len(pdf_reader.pages)
|
||||||
elif blob.mimetype == "image/tiff":
|
elif blob.mimetype == "image/tiff": # type: ignore[attr-defined]
|
||||||
num_pages = 0
|
num_pages = 0
|
||||||
img = Image.open(blob.as_bytes())
|
img = Image.open(blob.as_bytes()) # type: ignore[attr-defined]
|
||||||
for _, _ in enumerate(ImageSequence.Iterator(img)):
|
for _, _ in enumerate(ImageSequence.Iterator(img)):
|
||||||
num_pages += 1
|
num_pages += 1
|
||||||
return num_pages
|
return num_pages
|
||||||
elif blob.mimetype in ["image/png", "image/jpeg"]:
|
elif blob.mimetype in ["image/png", "image/jpeg"]: # type: ignore[attr-defined]
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"unsupported mime type: {blob.mimetype}")
|
raise ValueError(f"unsupported mime type: {blob.mimetype}") # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
|
||||||
class DocumentIntelligenceLoader(BasePDFLoader):
|
class DocumentIntelligenceLoader(BasePDFLoader):
|
||||||
@ -778,7 +778,7 @@ class DocumentIntelligenceLoader(BasePDFLoader):
|
|||||||
self,
|
self,
|
||||||
) -> Iterator[Document]:
|
) -> Iterator[Document]:
|
||||||
"""Lazy load given path as pages."""
|
"""Lazy load given path as pages."""
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
yield from self.parser.parse(blob)
|
yield from self.parser.parse(blob)
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class VsdxLoader(BaseLoader, ABC):
|
|||||||
elif not os.path.isfile(self.file_path):
|
elif not os.path.isfile(self.file_path):
|
||||||
raise ValueError("File path %s is not a valid file or url" % self.file_path)
|
raise ValueError("File path %s is not a valid file or url" % self.file_path)
|
||||||
|
|
||||||
self.parser = VsdxParser()
|
self.parser = VsdxParser() # type: ignore[misc]
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
if hasattr(self, "temp_file"):
|
if hasattr(self, "temp_file"):
|
||||||
@ -50,5 +50,5 @@ class VsdxLoader(BaseLoader, ABC):
|
|||||||
return bool(parsed.netloc) and bool(parsed.scheme)
|
return bool(parsed.netloc) and bool(parsed.scheme)
|
||||||
|
|
||||||
def load(self) -> List[Document]:
|
def load(self) -> List[Document]:
|
||||||
blob = Blob.from_path(self.file_path)
|
blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
|
||||||
return list(self.parser.parse(blob))
|
return list(self.parser.parse(blob))
|
||||||
|
@ -16,7 +16,56 @@
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.document_transformers.beautiful_soup_transformer import (
|
||||||
|
BeautifulSoupTransformer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.doctran_text_extract import (
|
||||||
|
DoctranPropertyExtractor, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.doctran_text_qa import (
|
||||||
|
DoctranQATransformer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.doctran_text_translate import (
|
||||||
|
DoctranTextTranslator, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.embeddings_redundant_filter import (
|
||||||
|
EmbeddingsClusteringFilter, # noqa: F401
|
||||||
|
EmbeddingsRedundantFilter, # noqa: F401
|
||||||
|
get_stateful_documents, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.google_translate import (
|
||||||
|
GoogleTranslateTransformer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.html2text import (
|
||||||
|
Html2TextTransformer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.long_context_reorder import (
|
||||||
|
LongContextReorder, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.nuclia_text_transform import (
|
||||||
|
NucliaTextTransformer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.document_transformers.openai_functions import (
|
||||||
|
OpenAIMetadataTagger, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"BeautifulSoupTransformer",
|
||||||
|
"DoctranPropertyExtractor",
|
||||||
|
"DoctranQATransformer",
|
||||||
|
"DoctranTextTranslator",
|
||||||
|
"EmbeddingsClusteringFilter",
|
||||||
|
"EmbeddingsRedundantFilter",
|
||||||
|
"GoogleTranslateTransformer",
|
||||||
|
"Html2TextTransformer",
|
||||||
|
"LongContextReorder",
|
||||||
|
"NucliaTextTransformer",
|
||||||
|
"OpenAIMetadataTagger",
|
||||||
|
"get_stateful_documents",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"BeautifulSoupTransformer": "langchain_community.document_transformers.beautiful_soup_transformer", # noqa: E501
|
"BeautifulSoupTransformer": "langchain_community.document_transformers.beautiful_soup_transformer", # noqa: E501
|
||||||
|
@ -10,10 +10,282 @@ from different APIs and services.
|
|||||||
Embeddings --> <name>Embeddings # Examples: OpenAIEmbeddings, HuggingFaceEmbeddings
|
Embeddings --> <name>Embeddings # Examples: OpenAIEmbeddings, HuggingFaceEmbeddings
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.embeddings.aleph_alpha import (
|
||||||
|
AlephAlphaAsymmetricSemanticEmbedding, # noqa: F401
|
||||||
|
AlephAlphaSymmetricSemanticEmbedding, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.anyscale import (
|
||||||
|
AnyscaleEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.awa import (
|
||||||
|
AwaEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.azure_openai import (
|
||||||
|
AzureOpenAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.baichuan import (
|
||||||
|
BaichuanTextEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.baidu_qianfan_endpoint import (
|
||||||
|
QianfanEmbeddingsEndpoint, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.bedrock import (
|
||||||
|
BedrockEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.bookend import (
|
||||||
|
BookendEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.clarifai import (
|
||||||
|
ClarifaiEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.cohere import (
|
||||||
|
CohereEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.dashscope import (
|
||||||
|
DashScopeEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.databricks import (
|
||||||
|
DatabricksEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.deepinfra import (
|
||||||
|
DeepInfraEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.edenai import (
|
||||||
|
EdenAiEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.elasticsearch import (
|
||||||
|
ElasticsearchEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.embaas import (
|
||||||
|
EmbaasEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.ernie import (
|
||||||
|
ErnieEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.fake import (
|
||||||
|
DeterministicFakeEmbedding, # noqa: F401
|
||||||
|
FakeEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.fastembed import (
|
||||||
|
FastEmbedEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.gigachat import (
|
||||||
|
GigaChatEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.google_palm import (
|
||||||
|
GooglePalmEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.gpt4all import (
|
||||||
|
GPT4AllEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.gradient_ai import (
|
||||||
|
GradientEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.huggingface import (
|
||||||
|
HuggingFaceBgeEmbeddings, # noqa: F401
|
||||||
|
HuggingFaceEmbeddings, # noqa: F401
|
||||||
|
HuggingFaceInferenceAPIEmbeddings, # noqa: F401
|
||||||
|
HuggingFaceInstructEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.huggingface_hub import (
|
||||||
|
HuggingFaceHubEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.infinity import (
|
||||||
|
InfinityEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.infinity_local import (
|
||||||
|
InfinityEmbeddingsLocal, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.itrex import (
|
||||||
|
QuantizedBgeEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.javelin_ai_gateway import (
|
||||||
|
JavelinAIGatewayEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.jina import (
|
||||||
|
JinaEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.johnsnowlabs import (
|
||||||
|
JohnSnowLabsEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.laser import (
|
||||||
|
LaserEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.llamacpp import (
|
||||||
|
LlamaCppEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.llamafile import (
|
||||||
|
LlamafileEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.llm_rails import (
|
||||||
|
LLMRailsEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.localai import (
|
||||||
|
LocalAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.minimax import (
|
||||||
|
MiniMaxEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.mlflow import (
|
||||||
|
MlflowCohereEmbeddings, # noqa: F401
|
||||||
|
MlflowEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.mlflow_gateway import (
|
||||||
|
MlflowAIGatewayEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.modelscope_hub import (
|
||||||
|
ModelScopeEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.mosaicml import (
|
||||||
|
MosaicMLInstructorEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.nemo import (
|
||||||
|
NeMoEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.nlpcloud import (
|
||||||
|
NLPCloudEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.oci_generative_ai import (
|
||||||
|
OCIGenAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.octoai_embeddings import (
|
||||||
|
OctoAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.ollama import (
|
||||||
|
OllamaEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.openai import (
|
||||||
|
OpenAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.openvino import (
|
||||||
|
OpenVINOBgeEmbeddings, # noqa: F401
|
||||||
|
OpenVINOEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.optimum_intel import (
|
||||||
|
QuantizedBiEncoderEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.premai import (
|
||||||
|
PremAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.sagemaker_endpoint import (
|
||||||
|
SagemakerEndpointEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.self_hosted import (
|
||||||
|
SelfHostedEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.self_hosted_hugging_face import (
|
||||||
|
SelfHostedHuggingFaceEmbeddings, # noqa: F401
|
||||||
|
SelfHostedHuggingFaceInstructEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.sentence_transformer import (
|
||||||
|
SentenceTransformerEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.solar import (
|
||||||
|
SolarEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.spacy_embeddings import (
|
||||||
|
SpacyEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.sparkllm import (
|
||||||
|
SparkLLMTextEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.tensorflow_hub import (
|
||||||
|
TensorflowHubEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.vertexai import (
|
||||||
|
VertexAIEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.volcengine import (
|
||||||
|
VolcanoEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.voyageai import (
|
||||||
|
VoyageEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.xinference import (
|
||||||
|
XinferenceEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.embeddings.yandex import (
|
||||||
|
YandexGPTEmbeddings, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AlephAlphaAsymmetricSemanticEmbedding",
|
||||||
|
"AlephAlphaSymmetricSemanticEmbedding",
|
||||||
|
"AnyscaleEmbeddings",
|
||||||
|
"AwaEmbeddings",
|
||||||
|
"AzureOpenAIEmbeddings",
|
||||||
|
"BaichuanTextEmbeddings",
|
||||||
|
"BedrockEmbeddings",
|
||||||
|
"BookendEmbeddings",
|
||||||
|
"ClarifaiEmbeddings",
|
||||||
|
"CohereEmbeddings",
|
||||||
|
"DashScopeEmbeddings",
|
||||||
|
"DatabricksEmbeddings",
|
||||||
|
"DeepInfraEmbeddings",
|
||||||
|
"DeterministicFakeEmbedding",
|
||||||
|
"EdenAiEmbeddings",
|
||||||
|
"ElasticsearchEmbeddings",
|
||||||
|
"EmbaasEmbeddings",
|
||||||
|
"ErnieEmbeddings",
|
||||||
|
"FakeEmbeddings",
|
||||||
|
"FastEmbedEmbeddings",
|
||||||
|
"GPT4AllEmbeddings",
|
||||||
|
"GigaChatEmbeddings",
|
||||||
|
"GooglePalmEmbeddings",
|
||||||
|
"GradientEmbeddings",
|
||||||
|
"HuggingFaceBgeEmbeddings",
|
||||||
|
"HuggingFaceEmbeddings",
|
||||||
|
"HuggingFaceHubEmbeddings",
|
||||||
|
"HuggingFaceInferenceAPIEmbeddings",
|
||||||
|
"HuggingFaceInstructEmbeddings",
|
||||||
|
"InfinityEmbeddings",
|
||||||
|
"InfinityEmbeddingsLocal",
|
||||||
|
"JavelinAIGatewayEmbeddings",
|
||||||
|
"JinaEmbeddings",
|
||||||
|
"JohnSnowLabsEmbeddings",
|
||||||
|
"LLMRailsEmbeddings",
|
||||||
|
"LaserEmbeddings",
|
||||||
|
"LlamaCppEmbeddings",
|
||||||
|
"LlamafileEmbeddings",
|
||||||
|
"LocalAIEmbeddings",
|
||||||
|
"MiniMaxEmbeddings",
|
||||||
|
"MlflowAIGatewayEmbeddings",
|
||||||
|
"MlflowCohereEmbeddings",
|
||||||
|
"MlflowEmbeddings",
|
||||||
|
"ModelScopeEmbeddings",
|
||||||
|
"MosaicMLInstructorEmbeddings",
|
||||||
|
"NLPCloudEmbeddings",
|
||||||
|
"NeMoEmbeddings",
|
||||||
|
"OCIGenAIEmbeddings",
|
||||||
|
"OctoAIEmbeddings",
|
||||||
|
"OllamaEmbeddings",
|
||||||
|
"OpenAIEmbeddings",
|
||||||
|
"OpenVINOBgeEmbeddings",
|
||||||
|
"OpenVINOEmbeddings",
|
||||||
|
"PremAIEmbeddings",
|
||||||
|
"QianfanEmbeddingsEndpoint",
|
||||||
|
"QuantizedBgeEmbeddings",
|
||||||
|
"QuantizedBiEncoderEmbeddings",
|
||||||
|
"SagemakerEndpointEmbeddings",
|
||||||
|
"SelfHostedEmbeddings",
|
||||||
|
"SelfHostedHuggingFaceEmbeddings",
|
||||||
|
"SelfHostedHuggingFaceInstructEmbeddings",
|
||||||
|
"SentenceTransformerEmbeddings",
|
||||||
|
"SolarEmbeddings",
|
||||||
|
"SpacyEmbeddings",
|
||||||
|
"SparkLLMTextEmbeddings",
|
||||||
|
"TensorflowHubEmbeddings",
|
||||||
|
"VertexAIEmbeddings",
|
||||||
|
"VolcanoEmbeddings",
|
||||||
|
"VoyageEmbeddings",
|
||||||
|
"XinferenceEmbeddings",
|
||||||
|
"YandexGPTEmbeddings",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AlephAlphaAsymmetricSemanticEmbedding": "langchain_community.embeddings.aleph_alpha", # noqa: E501
|
"AlephAlphaAsymmetricSemanticEmbedding": "langchain_community.embeddings.aleph_alpha", # noqa: E501
|
||||||
|
@ -1,7 +1,68 @@
|
|||||||
"""**Graphs** provide a natural language interface to graph databases."""
|
"""**Graphs** provide a natural language interface to graph databases."""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.graphs.arangodb_graph import (
|
||||||
|
ArangoGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.falkordb_graph import (
|
||||||
|
FalkorDBGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.gremlin_graph import (
|
||||||
|
GremlinGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.hugegraph import (
|
||||||
|
HugeGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.kuzu_graph import (
|
||||||
|
KuzuGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.memgraph_graph import (
|
||||||
|
MemgraphGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.nebula_graph import (
|
||||||
|
NebulaGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.neo4j_graph import (
|
||||||
|
Neo4jGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.neptune_graph import (
|
||||||
|
NeptuneGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.neptune_rdf_graph import (
|
||||||
|
NeptuneRdfGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.networkx_graph import (
|
||||||
|
NetworkxEntityGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.ontotext_graphdb_graph import (
|
||||||
|
OntotextGraphDBGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.rdf_graph import (
|
||||||
|
RdfGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.graphs.tigergraph_graph import (
|
||||||
|
TigerGraph, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"ArangoGraph",
|
||||||
|
"FalkorDBGraph",
|
||||||
|
"GremlinGraph",
|
||||||
|
"HugeGraph",
|
||||||
|
"KuzuGraph",
|
||||||
|
"MemgraphGraph",
|
||||||
|
"NebulaGraph",
|
||||||
|
"Neo4jGraph",
|
||||||
|
"NeptuneGraph",
|
||||||
|
"NeptuneRdfGraph",
|
||||||
|
"NetworkxEntityGraph",
|
||||||
|
"OntotextGraphDBGraph",
|
||||||
|
"RdfGraph",
|
||||||
|
"TigerGraph",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"ArangoGraph": "langchain_community.graphs.arangodb_graph",
|
"ArangoGraph": "langchain_community.graphs.arangodb_graph",
|
||||||
|
@ -32,6 +32,8 @@ class _SolarClient(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class SolarCommon(BaseModel):
|
class SolarCommon(BaseModel):
|
||||||
|
"""Common configuration for Solar LLMs."""
|
||||||
|
|
||||||
_client: _SolarClient
|
_client: _SolarClient
|
||||||
base_url: str = SOLAR_SERVICE_URL_BASE
|
base_url: str = SOLAR_SERVICE_URL_BASE
|
||||||
solar_api_key: Optional[SecretStr] = Field(default=None, alias="api_key")
|
solar_api_key: Optional[SecretStr] = Field(default=None, alias="api_key")
|
||||||
@ -92,6 +94,7 @@ class SolarCommon(BaseModel):
|
|||||||
|
|
||||||
class Solar(SolarCommon, LLM):
|
class Solar(SolarCommon, LLM):
|
||||||
"""Solar large language models.
|
"""Solar large language models.
|
||||||
|
|
||||||
To use, you should have the environment variable
|
To use, you should have the environment variable
|
||||||
``SOLAR_API_KEY`` set with your API key.
|
``SOLAR_API_KEY`` set with your API key.
|
||||||
Referenced from https://console.upstage.ai/services/solar
|
Referenced from https://console.upstage.ai/services/solar
|
||||||
|
@ -19,7 +19,158 @@ the backbone of a retriever, but there are other types of retrievers as well.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.retrievers.arcee import (
|
||||||
|
ArceeRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.arxiv import (
|
||||||
|
ArxivRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.azure_cognitive_search import (
|
||||||
|
AzureCognitiveSearchRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.bedrock import (
|
||||||
|
AmazonKnowledgeBasesRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.bm25 import (
|
||||||
|
BM25Retriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.breebs import (
|
||||||
|
BreebsRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.chaindesk import (
|
||||||
|
ChaindeskRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.chatgpt_plugin_retriever import (
|
||||||
|
ChatGPTPluginRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.cohere_rag_retriever import (
|
||||||
|
CohereRagRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.docarray import (
|
||||||
|
DocArrayRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.dria_index import (
|
||||||
|
DriaRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.elastic_search_bm25 import (
|
||||||
|
ElasticSearchBM25Retriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.embedchain import (
|
||||||
|
EmbedchainRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.google_cloud_documentai_warehouse import (
|
||||||
|
GoogleDocumentAIWarehouseRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.google_vertex_ai_search import (
|
||||||
|
GoogleCloudEnterpriseSearchRetriever, # noqa: F401
|
||||||
|
GoogleVertexAIMultiTurnSearchRetriever, # noqa: F401
|
||||||
|
GoogleVertexAISearchRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.kay import (
|
||||||
|
KayAiRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.kendra import (
|
||||||
|
AmazonKendraRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.knn import (
|
||||||
|
KNNRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.llama_index import (
|
||||||
|
LlamaIndexGraphRetriever, # noqa: F401
|
||||||
|
LlamaIndexRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.metal import (
|
||||||
|
MetalRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.milvus import (
|
||||||
|
MilvusRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.outline import (
|
||||||
|
OutlineRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.pinecone_hybrid_search import (
|
||||||
|
PineconeHybridSearchRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.pubmed import (
|
||||||
|
PubMedRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.qdrant_sparse_vector_retriever import (
|
||||||
|
QdrantSparseVectorRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.remote_retriever import (
|
||||||
|
RemoteLangChainRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.svm import (
|
||||||
|
SVMRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.tavily_search_api import (
|
||||||
|
TavilySearchAPIRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.tfidf import (
|
||||||
|
TFIDFRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.vespa_retriever import (
|
||||||
|
VespaRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.weaviate_hybrid_search import (
|
||||||
|
WeaviateHybridSearchRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.wikipedia import (
|
||||||
|
WikipediaRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.you import (
|
||||||
|
YouRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.zep import (
|
||||||
|
ZepRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.retrievers.zilliz import (
|
||||||
|
ZillizRetriever, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AmazonKendraRetriever",
|
||||||
|
"AmazonKnowledgeBasesRetriever",
|
||||||
|
"ArceeRetriever",
|
||||||
|
"ArxivRetriever",
|
||||||
|
"AzureCognitiveSearchRetriever",
|
||||||
|
"BM25Retriever",
|
||||||
|
"BreebsRetriever",
|
||||||
|
"ChaindeskRetriever",
|
||||||
|
"ChatGPTPluginRetriever",
|
||||||
|
"CohereRagRetriever",
|
||||||
|
"DocArrayRetriever",
|
||||||
|
"DriaRetriever",
|
||||||
|
"ElasticSearchBM25Retriever",
|
||||||
|
"EmbedchainRetriever",
|
||||||
|
"GoogleCloudEnterpriseSearchRetriever",
|
||||||
|
"GoogleDocumentAIWarehouseRetriever",
|
||||||
|
"GoogleVertexAIMultiTurnSearchRetriever",
|
||||||
|
"GoogleVertexAISearchRetriever",
|
||||||
|
"KNNRetriever",
|
||||||
|
"KayAiRetriever",
|
||||||
|
"LlamaIndexGraphRetriever",
|
||||||
|
"LlamaIndexRetriever",
|
||||||
|
"MetalRetriever",
|
||||||
|
"MilvusRetriever",
|
||||||
|
"OutlineRetriever",
|
||||||
|
"PineconeHybridSearchRetriever",
|
||||||
|
"PubMedRetriever",
|
||||||
|
"QdrantSparseVectorRetriever",
|
||||||
|
"RemoteLangChainRetriever",
|
||||||
|
"SVMRetriever",
|
||||||
|
"TFIDFRetriever",
|
||||||
|
"TavilySearchAPIRetriever",
|
||||||
|
"VespaRetriever",
|
||||||
|
"WeaviateHybridSearchRetriever",
|
||||||
|
"WikipediaRetriever",
|
||||||
|
"YouRetriever",
|
||||||
|
"ZepRetriever",
|
||||||
|
"ZillizRetriever",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AmazonKendraRetriever": "langchain_community.retrievers.kendra",
|
"AmazonKendraRetriever": "langchain_community.retrievers.kendra",
|
||||||
|
@ -15,7 +15,32 @@ The primary goal of these storages is to support caching.
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.storage.astradb import (
|
||||||
|
AstraDBByteStore, # noqa: F401
|
||||||
|
AstraDBStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.storage.mongodb import (
|
||||||
|
MongoDBStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.storage.redis import (
|
||||||
|
RedisStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.storage.upstash_redis import (
|
||||||
|
UpstashRedisByteStore, # noqa: F401
|
||||||
|
UpstashRedisStore, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AstraDBByteStore",
|
||||||
|
"AstraDBStore",
|
||||||
|
"MongoDBStore",
|
||||||
|
"RedisStore",
|
||||||
|
"UpstashRedisByteStore",
|
||||||
|
"UpstashRedisStore",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AstraDBByteStore": "langchain_community.storage.astradb",
|
"AstraDBByteStore": "langchain_community.storage.astradb",
|
||||||
|
@ -18,7 +18,433 @@ tool for the job.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_core.tools import (
|
||||||
|
BaseTool, # noqa: F401
|
||||||
|
StructuredTool, # noqa: F401
|
||||||
|
Tool, # noqa: F401
|
||||||
|
tool, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
from langchain_community.tools.ainetwork.app import (
|
||||||
|
AINAppOps, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ainetwork.owner import (
|
||||||
|
AINOwnerOps, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ainetwork.rule import (
|
||||||
|
AINRuleOps, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ainetwork.transfer import (
|
||||||
|
AINTransfer, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ainetwork.value import (
|
||||||
|
AINValueOps, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.arxiv.tool import (
|
||||||
|
ArxivQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.azure_ai_services import (
|
||||||
|
AzureAiServicesDocumentIntelligenceTool, # noqa: F401
|
||||||
|
AzureAiServicesImageAnalysisTool, # noqa: F401
|
||||||
|
AzureAiServicesSpeechToTextTool, # noqa: F401
|
||||||
|
AzureAiServicesTextAnalyticsForHealthTool, # noqa: F401
|
||||||
|
AzureAiServicesTextToSpeechTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.azure_cognitive_services import (
|
||||||
|
AzureCogsFormRecognizerTool, # noqa: F401
|
||||||
|
AzureCogsImageAnalysisTool, # noqa: F401
|
||||||
|
AzureCogsSpeech2TextTool, # noqa: F401
|
||||||
|
AzureCogsText2SpeechTool, # noqa: F401
|
||||||
|
AzureCogsTextAnalyticsHealthTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.bearly.tool import (
|
||||||
|
BearlyInterpreterTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.bing_search.tool import (
|
||||||
|
BingSearchResults, # noqa: F401
|
||||||
|
BingSearchRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.brave_search.tool import (
|
||||||
|
BraveSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.cogniswitch.tool import (
|
||||||
|
CogniswitchKnowledgeRequest, # noqa: F401
|
||||||
|
CogniswitchKnowledgeSourceFile, # noqa: F401
|
||||||
|
CogniswitchKnowledgeSourceURL, # noqa: F401
|
||||||
|
CogniswitchKnowledgeStatus, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.connery import (
|
||||||
|
ConneryAction, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.convert_to_openai import (
|
||||||
|
format_tool_to_openai_function, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ddg_search.tool import (
|
||||||
|
DuckDuckGoSearchResults, # noqa: F401
|
||||||
|
DuckDuckGoSearchRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.e2b_data_analysis.tool import (
|
||||||
|
E2BDataAnalysisTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.edenai import (
|
||||||
|
EdenAiExplicitImageTool, # noqa: F401
|
||||||
|
EdenAiObjectDetectionTool, # noqa: F401
|
||||||
|
EdenAiParsingIDTool, # noqa: F401
|
||||||
|
EdenAiParsingInvoiceTool, # noqa: F401
|
||||||
|
EdenAiSpeechToTextTool, # noqa: F401
|
||||||
|
EdenAiTextModerationTool, # noqa: F401
|
||||||
|
EdenAiTextToSpeechTool, # noqa: F401
|
||||||
|
EdenaiTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.eleven_labs.text2speech import (
|
||||||
|
ElevenLabsText2SpeechTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.file_management import (
|
||||||
|
CopyFileTool, # noqa: F401
|
||||||
|
DeleteFileTool, # noqa: F401
|
||||||
|
FileSearchTool, # noqa: F401
|
||||||
|
ListDirectoryTool, # noqa: F401
|
||||||
|
MoveFileTool, # noqa: F401
|
||||||
|
ReadFileTool, # noqa: F401
|
||||||
|
WriteFileTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.gmail import (
|
||||||
|
GmailCreateDraft, # noqa: F401
|
||||||
|
GmailGetMessage, # noqa: F401
|
||||||
|
GmailGetThread, # noqa: F401
|
||||||
|
GmailSearch, # noqa: F401
|
||||||
|
GmailSendMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.google_cloud.texttospeech import (
|
||||||
|
GoogleCloudTextToSpeechTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.google_places.tool import (
|
||||||
|
GooglePlacesTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.google_search.tool import (
|
||||||
|
GoogleSearchResults, # noqa: F401
|
||||||
|
GoogleSearchRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.google_serper.tool import (
|
||||||
|
GoogleSerperResults, # noqa: F401
|
||||||
|
GoogleSerperRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.graphql.tool import (
|
||||||
|
BaseGraphQLTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.human.tool import (
|
||||||
|
HumanInputRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.ifttt import (
|
||||||
|
IFTTTWebhook, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.interaction.tool import (
|
||||||
|
StdInInquireTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.jira.tool import (
|
||||||
|
JiraAction, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.json.tool import (
|
||||||
|
JsonGetValueTool, # noqa: F401
|
||||||
|
JsonListKeysTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.merriam_webster.tool import (
|
||||||
|
MerriamWebsterQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.metaphor_search import (
|
||||||
|
MetaphorSearchResults, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.nasa.tool import (
|
||||||
|
NasaAction, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.create_draft_message import (
|
||||||
|
O365CreateDraftMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.events_search import (
|
||||||
|
O365SearchEvents, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.messages_search import (
|
||||||
|
O365SearchEmails, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.send_event import (
|
||||||
|
O365SendEvent, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.send_message import (
|
||||||
|
O365SendMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.office365.utils import (
|
||||||
|
authenticate, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.openapi.utils.api_models import (
|
||||||
|
APIOperation, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.openapi.utils.openapi_utils import (
|
||||||
|
OpenAPISpec, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.openweathermap.tool import (
|
||||||
|
OpenWeatherMapQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.playwright import (
|
||||||
|
ClickTool, # noqa: F401
|
||||||
|
CurrentWebPageTool, # noqa: F401
|
||||||
|
ExtractHyperlinksTool, # noqa: F401
|
||||||
|
ExtractTextTool, # noqa: F401
|
||||||
|
GetElementsTool, # noqa: F401
|
||||||
|
NavigateBackTool, # noqa: F401
|
||||||
|
NavigateTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.plugin import (
|
||||||
|
AIPluginTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.polygon.aggregates import (
|
||||||
|
PolygonAggregates, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.polygon.financials import (
|
||||||
|
PolygonFinancials, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.polygon.last_quote import (
|
||||||
|
PolygonLastQuote, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.polygon.ticker_news import (
|
||||||
|
PolygonTickerNews, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.powerbi.tool import (
|
||||||
|
InfoPowerBITool, # noqa: F401
|
||||||
|
ListPowerBITool, # noqa: F401
|
||||||
|
QueryPowerBITool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.pubmed.tool import (
|
||||||
|
PubmedQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.reddit_search.tool import (
|
||||||
|
RedditSearchRun, # noqa: F401
|
||||||
|
RedditSearchSchema, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.requests.tool import (
|
||||||
|
BaseRequestsTool, # noqa: F401
|
||||||
|
RequestsDeleteTool, # noqa: F401
|
||||||
|
RequestsGetTool, # noqa: F401
|
||||||
|
RequestsPatchTool, # noqa: F401
|
||||||
|
RequestsPostTool, # noqa: F401
|
||||||
|
RequestsPutTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.scenexplain.tool import (
|
||||||
|
SceneXplainTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.searchapi.tool import (
|
||||||
|
SearchAPIResults, # noqa: F401
|
||||||
|
SearchAPIRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.searx_search.tool import (
|
||||||
|
SearxSearchResults, # noqa: F401
|
||||||
|
SearxSearchRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.shell.tool import (
|
||||||
|
ShellTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.slack.get_channel import (
|
||||||
|
SlackGetChannel, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.slack.get_message import (
|
||||||
|
SlackGetMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.slack.schedule_message import (
|
||||||
|
SlackScheduleMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.slack.send_message import (
|
||||||
|
SlackSendMessage, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.sleep.tool import (
|
||||||
|
SleepTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.spark_sql.tool import (
|
||||||
|
BaseSparkSQLTool, # noqa: F401
|
||||||
|
InfoSparkSQLTool, # noqa: F401
|
||||||
|
ListSparkSQLTool, # noqa: F401
|
||||||
|
QueryCheckerTool, # noqa: F401
|
||||||
|
QuerySparkSQLTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.sql_database.tool import (
|
||||||
|
BaseSQLDatabaseTool, # noqa: F401
|
||||||
|
InfoSQLDatabaseTool, # noqa: F401
|
||||||
|
ListSQLDatabaseTool, # noqa: F401
|
||||||
|
QuerySQLCheckerTool, # noqa: F401
|
||||||
|
QuerySQLDataBaseTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.stackexchange.tool import (
|
||||||
|
StackExchangeTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.steam.tool import (
|
||||||
|
SteamWebAPIQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.steamship_image_generation import (
|
||||||
|
SteamshipImageGenerationTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.vectorstore.tool import (
|
||||||
|
VectorStoreQATool, # noqa: F401
|
||||||
|
VectorStoreQAWithSourcesTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.wikipedia.tool import (
|
||||||
|
WikipediaQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.wolfram_alpha.tool import (
|
||||||
|
WolframAlphaQueryRun, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.yahoo_finance_news import (
|
||||||
|
YahooFinanceNewsTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.you.tool import (
|
||||||
|
YouSearchTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.youtube.search import (
|
||||||
|
YouTubeSearchTool, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.tools.zapier.tool import (
|
||||||
|
ZapierNLAListActions, # noqa: F401
|
||||||
|
ZapierNLARunAction, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AINAppOps",
|
||||||
|
"AINOwnerOps",
|
||||||
|
"AINRuleOps",
|
||||||
|
"AINTransfer",
|
||||||
|
"AINValueOps",
|
||||||
|
"AIPluginTool",
|
||||||
|
"APIOperation",
|
||||||
|
"ArxivQueryRun",
|
||||||
|
"AzureAiServicesDocumentIntelligenceTool",
|
||||||
|
"AzureAiServicesImageAnalysisTool",
|
||||||
|
"AzureAiServicesSpeechToTextTool",
|
||||||
|
"AzureAiServicesTextAnalyticsForHealthTool",
|
||||||
|
"AzureAiServicesTextToSpeechTool",
|
||||||
|
"AzureCogsFormRecognizerTool",
|
||||||
|
"AzureCogsImageAnalysisTool",
|
||||||
|
"AzureCogsSpeech2TextTool",
|
||||||
|
"AzureCogsText2SpeechTool",
|
||||||
|
"AzureCogsTextAnalyticsHealthTool",
|
||||||
|
"BaseGraphQLTool",
|
||||||
|
"BaseRequestsTool",
|
||||||
|
"BaseSQLDatabaseTool",
|
||||||
|
"BaseSparkSQLTool",
|
||||||
|
"BaseTool",
|
||||||
|
"BearlyInterpreterTool",
|
||||||
|
"BingSearchResults",
|
||||||
|
"BingSearchRun",
|
||||||
|
"BraveSearch",
|
||||||
|
"ClickTool",
|
||||||
|
"CogniswitchKnowledgeRequest",
|
||||||
|
"CogniswitchKnowledgeSourceFile",
|
||||||
|
"CogniswitchKnowledgeSourceURL",
|
||||||
|
"CogniswitchKnowledgeStatus",
|
||||||
|
"ConneryAction",
|
||||||
|
"CopyFileTool",
|
||||||
|
"CurrentWebPageTool",
|
||||||
|
"DeleteFileTool",
|
||||||
|
"DuckDuckGoSearchResults",
|
||||||
|
"DuckDuckGoSearchRun",
|
||||||
|
"E2BDataAnalysisTool",
|
||||||
|
"EdenAiExplicitImageTool",
|
||||||
|
"EdenAiObjectDetectionTool",
|
||||||
|
"EdenAiParsingIDTool",
|
||||||
|
"EdenAiParsingInvoiceTool",
|
||||||
|
"EdenAiSpeechToTextTool",
|
||||||
|
"EdenAiTextModerationTool",
|
||||||
|
"EdenAiTextToSpeechTool",
|
||||||
|
"EdenaiTool",
|
||||||
|
"ElevenLabsText2SpeechTool",
|
||||||
|
"ExtractHyperlinksTool",
|
||||||
|
"ExtractTextTool",
|
||||||
|
"FileSearchTool",
|
||||||
|
"GetElementsTool",
|
||||||
|
"GmailCreateDraft",
|
||||||
|
"GmailGetMessage",
|
||||||
|
"GmailGetThread",
|
||||||
|
"GmailSearch",
|
||||||
|
"GmailSendMessage",
|
||||||
|
"GoogleCloudTextToSpeechTool",
|
||||||
|
"GooglePlacesTool",
|
||||||
|
"GoogleSearchResults",
|
||||||
|
"GoogleSearchRun",
|
||||||
|
"GoogleSerperResults",
|
||||||
|
"GoogleSerperRun",
|
||||||
|
"HumanInputRun",
|
||||||
|
"IFTTTWebhook",
|
||||||
|
"InfoPowerBITool",
|
||||||
|
"InfoSQLDatabaseTool",
|
||||||
|
"InfoSparkSQLTool",
|
||||||
|
"JiraAction",
|
||||||
|
"JsonGetValueTool",
|
||||||
|
"JsonListKeysTool",
|
||||||
|
"ListDirectoryTool",
|
||||||
|
"ListPowerBITool",
|
||||||
|
"ListSQLDatabaseTool",
|
||||||
|
"ListSparkSQLTool",
|
||||||
|
"MerriamWebsterQueryRun",
|
||||||
|
"MetaphorSearchResults",
|
||||||
|
"MoveFileTool",
|
||||||
|
"NasaAction",
|
||||||
|
"NavigateBackTool",
|
||||||
|
"NavigateTool",
|
||||||
|
"O365CreateDraftMessage",
|
||||||
|
"O365SearchEmails",
|
||||||
|
"O365SearchEvents",
|
||||||
|
"O365SendEvent",
|
||||||
|
"O365SendMessage",
|
||||||
|
"OpenAPISpec",
|
||||||
|
"OpenWeatherMapQueryRun",
|
||||||
|
"PolygonAggregates",
|
||||||
|
"PolygonFinancials",
|
||||||
|
"PolygonLastQuote",
|
||||||
|
"PolygonTickerNews",
|
||||||
|
"PubmedQueryRun",
|
||||||
|
"QueryCheckerTool",
|
||||||
|
"QueryPowerBITool",
|
||||||
|
"QuerySQLCheckerTool",
|
||||||
|
"QuerySQLDataBaseTool",
|
||||||
|
"QuerySparkSQLTool",
|
||||||
|
"ReadFileTool",
|
||||||
|
"RedditSearchRun",
|
||||||
|
"RedditSearchSchema",
|
||||||
|
"RequestsDeleteTool",
|
||||||
|
"RequestsGetTool",
|
||||||
|
"RequestsPatchTool",
|
||||||
|
"RequestsPostTool",
|
||||||
|
"RequestsPutTool",
|
||||||
|
"SceneXplainTool",
|
||||||
|
"SearchAPIResults",
|
||||||
|
"SearchAPIRun",
|
||||||
|
"SearxSearchResults",
|
||||||
|
"SearxSearchRun",
|
||||||
|
"ShellTool",
|
||||||
|
"SlackGetChannel",
|
||||||
|
"SlackGetMessage",
|
||||||
|
"SlackScheduleMessage",
|
||||||
|
"SlackSendMessage",
|
||||||
|
"SleepTool",
|
||||||
|
"StackExchangeTool",
|
||||||
|
"StdInInquireTool",
|
||||||
|
"SteamWebAPIQueryRun",
|
||||||
|
"SteamshipImageGenerationTool",
|
||||||
|
"StructuredTool",
|
||||||
|
"Tool",
|
||||||
|
"VectorStoreQATool",
|
||||||
|
"VectorStoreQAWithSourcesTool",
|
||||||
|
"WikipediaQueryRun",
|
||||||
|
"WolframAlphaQueryRun",
|
||||||
|
"WriteFileTool",
|
||||||
|
"YahooFinanceNewsTool",
|
||||||
|
"YouSearchTool",
|
||||||
|
"YouTubeSearchTool",
|
||||||
|
"ZapierNLAListActions",
|
||||||
|
"ZapierNLARunAction",
|
||||||
|
"authenticate",
|
||||||
|
"format_tool_to_openai_function",
|
||||||
|
"tool",
|
||||||
|
]
|
||||||
|
|
||||||
# Used for internal purposes
|
# Used for internal purposes
|
||||||
_DEPRECATED_TOOLS = {"PythonAstREPLTool", "PythonREPLTool"}
|
_DEPRECATED_TOOLS = {"PythonAstREPLTool", "PythonREPLTool"}
|
||||||
|
@ -4,7 +4,222 @@ Other LangChain classes use **Utilities** to interact with third-part systems
|
|||||||
and packages.
|
and packages.
|
||||||
"""
|
"""
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_community.utilities.alpha_vantage import (
|
||||||
|
AlphaVantageAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.apify import (
|
||||||
|
ApifyWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.arcee import (
|
||||||
|
ArceeWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.arxiv import (
|
||||||
|
ArxivAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.awslambda import (
|
||||||
|
LambdaWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.bibtex import (
|
||||||
|
BibtexparserWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.bing_search import (
|
||||||
|
BingSearchAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.brave_search import (
|
||||||
|
BraveSearchWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.dria_index import (
|
||||||
|
DriaAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.duckduckgo_search import (
|
||||||
|
DuckDuckGoSearchAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.golden_query import (
|
||||||
|
GoldenQueryAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_finance import (
|
||||||
|
GoogleFinanceAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_jobs import (
|
||||||
|
GoogleJobsAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_lens import (
|
||||||
|
GoogleLensAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_places_api import (
|
||||||
|
GooglePlacesAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_scholar import (
|
||||||
|
GoogleScholarAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_search import (
|
||||||
|
GoogleSearchAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_serper import (
|
||||||
|
GoogleSerperAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.google_trends import (
|
||||||
|
GoogleTrendsAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.graphql import (
|
||||||
|
GraphQLAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.infobip import (
|
||||||
|
InfobipAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.jira import (
|
||||||
|
JiraAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.max_compute import (
|
||||||
|
MaxComputeAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.merriam_webster import (
|
||||||
|
MerriamWebsterAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.metaphor_search import (
|
||||||
|
MetaphorSearchAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.nasa import (
|
||||||
|
NasaAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.nvidia_riva import (
|
||||||
|
AudioStream, # noqa: F401
|
||||||
|
NVIDIARivaASR, # noqa: F401
|
||||||
|
NVIDIARivaStream, # noqa: F401
|
||||||
|
NVIDIARivaTTS, # noqa: F401
|
||||||
|
RivaASR, # noqa: F401
|
||||||
|
RivaTTS, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.openweathermap import (
|
||||||
|
OpenWeatherMapAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.outline import (
|
||||||
|
OutlineAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.passio_nutrition_ai import (
|
||||||
|
NutritionAIAPI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.portkey import (
|
||||||
|
Portkey, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.powerbi import (
|
||||||
|
PowerBIDataset, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.pubmed import (
|
||||||
|
PubMedAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.python import (
|
||||||
|
PythonREPL, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.requests import (
|
||||||
|
Requests, # noqa: F401
|
||||||
|
RequestsWrapper, # noqa: F401
|
||||||
|
TextRequestsWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.scenexplain import (
|
||||||
|
SceneXplainAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.searchapi import (
|
||||||
|
SearchApiAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.searx_search import (
|
||||||
|
SearxSearchWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.serpapi import (
|
||||||
|
SerpAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.spark_sql import (
|
||||||
|
SparkSQL, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.sql_database import (
|
||||||
|
SQLDatabase, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.stackexchange import (
|
||||||
|
StackExchangeAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.steam import (
|
||||||
|
SteamWebAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.tensorflow_datasets import (
|
||||||
|
TensorflowDatasets, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.twilio import (
|
||||||
|
TwilioAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.wikipedia import (
|
||||||
|
WikipediaAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.wolfram_alpha import (
|
||||||
|
WolframAlphaAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.you import (
|
||||||
|
YouSearchAPIWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.utilities.zapier import (
|
||||||
|
ZapierNLAWrapper, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AlphaVantageAPIWrapper",
|
||||||
|
"ApifyWrapper",
|
||||||
|
"ArceeWrapper",
|
||||||
|
"ArxivAPIWrapper",
|
||||||
|
"AudioStream",
|
||||||
|
"BibtexparserWrapper",
|
||||||
|
"BingSearchAPIWrapper",
|
||||||
|
"BraveSearchWrapper",
|
||||||
|
"DriaAPIWrapper",
|
||||||
|
"DuckDuckGoSearchAPIWrapper",
|
||||||
|
"GoldenQueryAPIWrapper",
|
||||||
|
"GoogleFinanceAPIWrapper",
|
||||||
|
"GoogleJobsAPIWrapper",
|
||||||
|
"GoogleLensAPIWrapper",
|
||||||
|
"GooglePlacesAPIWrapper",
|
||||||
|
"GoogleScholarAPIWrapper",
|
||||||
|
"GoogleSearchAPIWrapper",
|
||||||
|
"GoogleSerperAPIWrapper",
|
||||||
|
"GoogleTrendsAPIWrapper",
|
||||||
|
"GraphQLAPIWrapper",
|
||||||
|
"InfobipAPIWrapper",
|
||||||
|
"JiraAPIWrapper",
|
||||||
|
"LambdaWrapper",
|
||||||
|
"MaxComputeAPIWrapper",
|
||||||
|
"MerriamWebsterAPIWrapper",
|
||||||
|
"MetaphorSearchAPIWrapper",
|
||||||
|
"NVIDIARivaASR",
|
||||||
|
"NVIDIARivaStream",
|
||||||
|
"NVIDIARivaTTS",
|
||||||
|
"NasaAPIWrapper",
|
||||||
|
"NutritionAIAPI",
|
||||||
|
"OpenWeatherMapAPIWrapper",
|
||||||
|
"OutlineAPIWrapper",
|
||||||
|
"Portkey",
|
||||||
|
"PowerBIDataset",
|
||||||
|
"PubMedAPIWrapper",
|
||||||
|
"PythonREPL",
|
||||||
|
"Requests",
|
||||||
|
"RequestsWrapper",
|
||||||
|
"RivaASR",
|
||||||
|
"RivaTTS",
|
||||||
|
"SQLDatabase",
|
||||||
|
"SceneXplainAPIWrapper",
|
||||||
|
"SearchApiAPIWrapper",
|
||||||
|
"SearxSearchWrapper",
|
||||||
|
"SerpAPIWrapper",
|
||||||
|
"SparkSQL",
|
||||||
|
"StackExchangeAPIWrapper",
|
||||||
|
"SteamWebAPIWrapper",
|
||||||
|
"TensorflowDatasets",
|
||||||
|
"TextRequestsWrapper",
|
||||||
|
"TwilioAPIWrapper",
|
||||||
|
"WikipediaAPIWrapper",
|
||||||
|
"WolframAlphaAPIWrapper",
|
||||||
|
"YouSearchAPIWrapper",
|
||||||
|
"ZapierNLAWrapper",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AlphaVantageAPIWrapper": "langchain_community.utilities.alpha_vantage",
|
"AlphaVantageAPIWrapper": "langchain_community.utilities.alpha_vantage",
|
||||||
|
@ -20,7 +20,355 @@ and retrieve the data that are 'most similar' to the embedded query.
|
|||||||
""" # noqa: E501
|
""" # noqa: E501
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from typing import Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from langchain_core.vectorstores import (
|
||||||
|
VectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
from langchain_community.vectorstores.alibabacloud_opensearch import (
|
||||||
|
AlibabaCloudOpenSearch, # noqa: F401
|
||||||
|
AlibabaCloudOpenSearchSettings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.analyticdb import (
|
||||||
|
AnalyticDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.annoy import (
|
||||||
|
Annoy, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.apache_doris import (
|
||||||
|
ApacheDoris, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.astradb import (
|
||||||
|
AstraDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.atlas import (
|
||||||
|
AtlasDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.awadb import (
|
||||||
|
AwaDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.azure_cosmos_db import (
|
||||||
|
AzureCosmosDBVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.azuresearch import (
|
||||||
|
AzureSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.bageldb import (
|
||||||
|
Bagel, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.baiducloud_vector_search import (
|
||||||
|
BESVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.baiduvectordb import (
|
||||||
|
BaiduVectorDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.bigquery_vector_search import (
|
||||||
|
BigQueryVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.cassandra import (
|
||||||
|
Cassandra, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.chroma import (
|
||||||
|
Chroma, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.clarifai import (
|
||||||
|
Clarifai, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.clickhouse import (
|
||||||
|
Clickhouse, # noqa: F401
|
||||||
|
ClickhouseSettings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.couchbase import (
|
||||||
|
CouchbaseVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.dashvector import (
|
||||||
|
DashVector, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.databricks_vector_search import (
|
||||||
|
DatabricksVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.deeplake import (
|
||||||
|
DeepLake, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.dingo import (
|
||||||
|
Dingo, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.docarray import (
|
||||||
|
DocArrayHnswSearch, # noqa: F401
|
||||||
|
DocArrayInMemorySearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.documentdb import (
|
||||||
|
DocumentDBVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.duckdb import (
|
||||||
|
DuckDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.ecloud_vector_search import (
|
||||||
|
EcloudESVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.elastic_vector_search import (
|
||||||
|
ElasticKnnSearch, # noqa: F401
|
||||||
|
ElasticVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.elasticsearch import (
|
||||||
|
ElasticsearchStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.epsilla import (
|
||||||
|
Epsilla, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.faiss import (
|
||||||
|
FAISS, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.hanavector import (
|
||||||
|
HanaDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.hologres import (
|
||||||
|
Hologres, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.infinispanvs import (
|
||||||
|
InfinispanVS, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.inmemory import (
|
||||||
|
InMemoryVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.kdbai import (
|
||||||
|
KDBAI, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.kinetica import (
|
||||||
|
DistanceStrategy, # noqa: F401
|
||||||
|
Kinetica, # noqa: F401
|
||||||
|
KineticaSettings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.lancedb import (
|
||||||
|
LanceDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.lantern import (
|
||||||
|
Lantern, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.llm_rails import (
|
||||||
|
LLMRails, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.marqo import (
|
||||||
|
Marqo, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.matching_engine import (
|
||||||
|
MatchingEngine, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.meilisearch import (
|
||||||
|
Meilisearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.milvus import (
|
||||||
|
Milvus, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.momento_vector_index import (
|
||||||
|
MomentoVectorIndex, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.mongodb_atlas import (
|
||||||
|
MongoDBAtlasVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.myscale import (
|
||||||
|
MyScale, # noqa: F401
|
||||||
|
MyScaleSettings, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.neo4j_vector import (
|
||||||
|
Neo4jVector, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.opensearch_vector_search import (
|
||||||
|
OpenSearchVectorSearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.pathway import (
|
||||||
|
PathwayVectorClient, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.pgembedding import (
|
||||||
|
PGEmbedding, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.pgvector import (
|
||||||
|
PGVector, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.pinecone import (
|
||||||
|
Pinecone, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.qdrant import (
|
||||||
|
Qdrant, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.redis import (
|
||||||
|
Redis, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.rocksetdb import (
|
||||||
|
Rockset, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.scann import (
|
||||||
|
ScaNN, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.semadb import (
|
||||||
|
SemaDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.singlestoredb import (
|
||||||
|
SingleStoreDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.sklearn import (
|
||||||
|
SKLearnVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.sqlitevss import (
|
||||||
|
SQLiteVSS, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.starrocks import (
|
||||||
|
StarRocks, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.supabase import (
|
||||||
|
SupabaseVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.surrealdb import (
|
||||||
|
SurrealDBStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.tair import (
|
||||||
|
Tair, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.tencentvectordb import (
|
||||||
|
TencentVectorDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.thirdai_neuraldb import (
|
||||||
|
NeuralDBVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.tidb_vector import (
|
||||||
|
TiDBVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.tigris import (
|
||||||
|
Tigris, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.tiledb import (
|
||||||
|
TileDB, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.timescalevector import (
|
||||||
|
TimescaleVector, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.typesense import (
|
||||||
|
Typesense, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.usearch import (
|
||||||
|
USearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.vald import (
|
||||||
|
Vald, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.vdms import (
|
||||||
|
VDMS, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.vearch import (
|
||||||
|
Vearch, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.vectara import (
|
||||||
|
Vectara, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.vespa import (
|
||||||
|
VespaStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.weaviate import (
|
||||||
|
Weaviate, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.yellowbrick import (
|
||||||
|
Yellowbrick, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.zep import (
|
||||||
|
ZepVectorStore, # noqa: F401
|
||||||
|
)
|
||||||
|
from langchain_community.vectorstores.zilliz import (
|
||||||
|
Zilliz, # noqa: F401
|
||||||
|
)
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AlibabaCloudOpenSearch",
|
||||||
|
"AlibabaCloudOpenSearchSettings",
|
||||||
|
"AnalyticDB",
|
||||||
|
"Annoy",
|
||||||
|
"ApacheDoris",
|
||||||
|
"AstraDB",
|
||||||
|
"AtlasDB",
|
||||||
|
"AwaDB",
|
||||||
|
"AzureCosmosDBVectorSearch",
|
||||||
|
"AzureSearch",
|
||||||
|
"BESVectorStore",
|
||||||
|
"Bagel",
|
||||||
|
"BaiduVectorDB",
|
||||||
|
"BigQueryVectorSearch",
|
||||||
|
"Cassandra",
|
||||||
|
"Chroma",
|
||||||
|
"Clarifai",
|
||||||
|
"Clickhouse",
|
||||||
|
"ClickhouseSettings",
|
||||||
|
"CouchbaseVectorStore",
|
||||||
|
"DashVector",
|
||||||
|
"DatabricksVectorSearch",
|
||||||
|
"DeepLake",
|
||||||
|
"Dingo",
|
||||||
|
"DistanceStrategy",
|
||||||
|
"DocArrayHnswSearch",
|
||||||
|
"DocArrayInMemorySearch",
|
||||||
|
"DocumentDBVectorSearch",
|
||||||
|
"DuckDB",
|
||||||
|
"EcloudESVectorStore",
|
||||||
|
"ElasticKnnSearch",
|
||||||
|
"ElasticVectorSearch",
|
||||||
|
"ElasticsearchStore",
|
||||||
|
"Epsilla",
|
||||||
|
"FAISS",
|
||||||
|
"HanaDB",
|
||||||
|
"Hologres",
|
||||||
|
"InMemoryVectorStore",
|
||||||
|
"InfinispanVS",
|
||||||
|
"KDBAI",
|
||||||
|
"Kinetica",
|
||||||
|
"KineticaSettings",
|
||||||
|
"LLMRails",
|
||||||
|
"LanceDB",
|
||||||
|
"Lantern",
|
||||||
|
"Marqo",
|
||||||
|
"MatchingEngine",
|
||||||
|
"Meilisearch",
|
||||||
|
"Milvus",
|
||||||
|
"MomentoVectorIndex",
|
||||||
|
"MongoDBAtlasVectorSearch",
|
||||||
|
"MyScale",
|
||||||
|
"MyScaleSettings",
|
||||||
|
"Neo4jVector",
|
||||||
|
"NeuralDBVectorStore",
|
||||||
|
"OpenSearchVectorSearch",
|
||||||
|
"PGEmbedding",
|
||||||
|
"PGVector",
|
||||||
|
"PathwayVectorClient",
|
||||||
|
"Pinecone",
|
||||||
|
"Qdrant",
|
||||||
|
"Redis",
|
||||||
|
"Rockset",
|
||||||
|
"SKLearnVectorStore",
|
||||||
|
"SQLiteVSS",
|
||||||
|
"ScaNN",
|
||||||
|
"SemaDB",
|
||||||
|
"SingleStoreDB",
|
||||||
|
"StarRocks",
|
||||||
|
"SupabaseVectorStore",
|
||||||
|
"SurrealDBStore",
|
||||||
|
"Tair",
|
||||||
|
"TencentVectorDB",
|
||||||
|
"TiDBVectorStore",
|
||||||
|
"Tigris",
|
||||||
|
"TileDB",
|
||||||
|
"TimescaleVector",
|
||||||
|
"Typesense",
|
||||||
|
"USearch",
|
||||||
|
"VDMS",
|
||||||
|
"Vald",
|
||||||
|
"Vearch",
|
||||||
|
"Vectara",
|
||||||
|
"VectorStore",
|
||||||
|
"VespaStore",
|
||||||
|
"Weaviate",
|
||||||
|
"Yellowbrick",
|
||||||
|
"ZepVectorStore",
|
||||||
|
"Zilliz",
|
||||||
|
]
|
||||||
|
|
||||||
_module_lookup = {
|
_module_lookup = {
|
||||||
"AlibabaCloudOpenSearch": "langchain_community.vectorstores.alibabacloud_opensearch", # noqa: E501
|
"AlibabaCloudOpenSearch": "langchain_community.vectorstores.alibabacloud_opensearch", # noqa: E501
|
||||||
|
@ -108,7 +108,7 @@ def test_bedrock_streaming(chat: BedrockChat) -> None:
|
|||||||
|
|
||||||
full = None
|
full = None
|
||||||
for token in chat.stream("I'm Pickle Rick"):
|
for token in chat.stream("I'm Pickle Rick"):
|
||||||
full = token if full is None else full + token
|
full = token if full is None else full + token # type: ignore[operator]
|
||||||
assert isinstance(token.content, str)
|
assert isinstance(token.content, str)
|
||||||
assert isinstance(cast(AIMessageChunk, full).content, str)
|
assert isinstance(cast(AIMessageChunk, full).content, str)
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ def assert_docs(docs: List[Document], all_meta: bool = False) -> None:
|
|||||||
def test_run_success(api_client: OutlineAPIWrapper) -> None:
|
def test_run_success(api_client: OutlineAPIWrapper) -> None:
|
||||||
responses.add(
|
responses.add(
|
||||||
responses.POST,
|
responses.POST,
|
||||||
api_client.outline_instance_url + api_client.outline_search_endpoint,
|
api_client.outline_instance_url + api_client.outline_search_endpoint, # type: ignore[operator]
|
||||||
json=OUTLINE_SUCCESS_RESPONSE,
|
json=OUTLINE_SUCCESS_RESPONSE,
|
||||||
status=200,
|
status=200,
|
||||||
)
|
)
|
||||||
@ -80,7 +80,7 @@ def test_run_success_all_meta(api_client: OutlineAPIWrapper) -> None:
|
|||||||
api_client.load_all_available_meta = True
|
api_client.load_all_available_meta = True
|
||||||
responses.add(
|
responses.add(
|
||||||
responses.POST,
|
responses.POST,
|
||||||
api_client.outline_instance_url + api_client.outline_search_endpoint,
|
api_client.outline_instance_url + api_client.outline_search_endpoint, # type: ignore[operator]
|
||||||
json=OUTLINE_SUCCESS_RESPONSE,
|
json=OUTLINE_SUCCESS_RESPONSE,
|
||||||
status=200,
|
status=200,
|
||||||
)
|
)
|
||||||
@ -93,7 +93,7 @@ def test_run_success_all_meta(api_client: OutlineAPIWrapper) -> None:
|
|||||||
def test_run_no_result(api_client: OutlineAPIWrapper) -> None:
|
def test_run_no_result(api_client: OutlineAPIWrapper) -> None:
|
||||||
responses.add(
|
responses.add(
|
||||||
responses.POST,
|
responses.POST,
|
||||||
api_client.outline_instance_url + api_client.outline_search_endpoint,
|
api_client.outline_instance_url + api_client.outline_search_endpoint, # type: ignore[operator]
|
||||||
json=OUTLINE_EMPTY_RESPONSE,
|
json=OUTLINE_EMPTY_RESPONSE,
|
||||||
status=200,
|
status=200,
|
||||||
)
|
)
|
||||||
@ -106,7 +106,7 @@ def test_run_no_result(api_client: OutlineAPIWrapper) -> None:
|
|||||||
def test_run_error(api_client: OutlineAPIWrapper) -> None:
|
def test_run_error(api_client: OutlineAPIWrapper) -> None:
|
||||||
responses.add(
|
responses.add(
|
||||||
responses.POST,
|
responses.POST,
|
||||||
api_client.outline_instance_url + api_client.outline_search_endpoint,
|
api_client.outline_instance_url + api_client.outline_search_endpoint, # type: ignore[operator]
|
||||||
json=OUTLINE_ERROR_RESPONSE,
|
json=OUTLINE_ERROR_RESPONSE,
|
||||||
status=401,
|
status=401,
|
||||||
)
|
)
|
||||||
|
@ -8,7 +8,7 @@ from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def deeplake_datastore() -> DeepLake:
|
def deeplake_datastore() -> DeepLake: # type: ignore[misc]
|
||||||
texts = ["foo", "bar", "baz"]
|
texts = ["foo", "bar", "baz"]
|
||||||
metadatas = [{"page": str(i)} for i in range(len(texts))]
|
metadatas = [{"page": str(i)} for i in range(len(texts))]
|
||||||
docsearch = DeepLake.from_texts(
|
docsearch = DeepLake.from_texts(
|
||||||
|
@ -85,7 +85,7 @@ def test_lantern_embeddings_distance_strategy() -> None:
|
|||||||
collection_name="test_collection",
|
collection_name="test_collection",
|
||||||
embedding=FakeEmbeddingsWithAdaDimension(),
|
embedding=FakeEmbeddingsWithAdaDimension(),
|
||||||
connection_string=CONNECTION_STRING,
|
connection_string=CONNECTION_STRING,
|
||||||
distance_strategy="hamming",
|
distance_strategy="hamming", # type: ignore[arg-type]
|
||||||
pre_delete_collection=True,
|
pre_delete_collection=True,
|
||||||
)
|
)
|
||||||
output = docsearch.similarity_search("foo", k=1)
|
output = docsearch.similarity_search("foo", k=1)
|
||||||
|
@ -26,7 +26,7 @@ def _milvus_from_texts(
|
|||||||
|
|
||||||
|
|
||||||
def _get_pks(expr: str, docsearch: Milvus) -> List[Any]:
|
def _get_pks(expr: str, docsearch: Milvus) -> List[Any]:
|
||||||
return docsearch.get_pks(expr)
|
return docsearch.get_pks(expr) # type: ignore[return-value]
|
||||||
|
|
||||||
|
|
||||||
def test_milvus() -> None:
|
def test_milvus() -> None:
|
||||||
@ -51,7 +51,7 @@ def test_milvus_with_id() -> None:
|
|||||||
assert output == [Document(page_content="foo")]
|
assert output == [Document(page_content="foo")]
|
||||||
|
|
||||||
output = docsearch.delete(ids=ids)
|
output = docsearch.delete(ids=ids)
|
||||||
assert output.delete_count == len(fake_texts)
|
assert output.delete_count == len(fake_texts) # type: ignore[attr-defined]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ids = ["dup_id" for _ in fake_texts]
|
ids = ["dup_id" for _ in fake_texts]
|
||||||
@ -146,7 +146,7 @@ def test_milvus_upsert_entities() -> None:
|
|||||||
Document(page_content="test_2", metadata={"id": 3}),
|
Document(page_content="test_2", metadata={"id": 3}),
|
||||||
]
|
]
|
||||||
ids = docsearch.upsert(pks, documents)
|
ids = docsearch.upsert(pks, documents)
|
||||||
assert len(ids) == 2
|
assert len(ids) == 2 # type: ignore[arg-type]
|
||||||
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
# if __name__ == "__main__":
|
||||||
|
@ -320,7 +320,7 @@ def test_relevance_score() -> None:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
docsearch_l2.drop_vectorstore()
|
docsearch_l2.drop_vectorstore() # type: ignore[attr-defined]
|
||||||
|
|
||||||
|
|
||||||
def test_retriever_search_threshold() -> None:
|
def test_retriever_search_threshold() -> None:
|
||||||
|
@ -37,7 +37,7 @@ def vdms_client() -> vdms.vdms:
|
|||||||
@pytest.mark.requires("vdms")
|
@pytest.mark.requires("vdms")
|
||||||
def test_init_from_client(vdms_client: vdms.vdms) -> None:
|
def test_init_from_client(vdms_client: vdms.vdms) -> None:
|
||||||
embedding_function = FakeEmbeddings()
|
embedding_function = FakeEmbeddings()
|
||||||
_ = VDMS(
|
_ = VDMS( # type: ignore[call-arg]
|
||||||
embedding_function=embedding_function,
|
embedding_function=embedding_function,
|
||||||
client=vdms_client,
|
client=vdms_client,
|
||||||
)
|
)
|
||||||
@ -331,7 +331,7 @@ def test_with_relevance_score(vdms_client: vdms.vdms) -> None:
|
|||||||
def test_add_documents_no_metadata(vdms_client: vdms.vdms) -> None:
|
def test_add_documents_no_metadata(vdms_client: vdms.vdms) -> None:
|
||||||
collection_name = "test_add_documents_no_metadata"
|
collection_name = "test_add_documents_no_metadata"
|
||||||
embedding_function = FakeEmbeddings()
|
embedding_function = FakeEmbeddings()
|
||||||
db = VDMS(
|
db = VDMS( # type: ignore[call-arg]
|
||||||
collection_name=collection_name,
|
collection_name=collection_name,
|
||||||
embedding_function=embedding_function,
|
embedding_function=embedding_function,
|
||||||
client=vdms_client,
|
client=vdms_client,
|
||||||
@ -343,7 +343,7 @@ def test_add_documents_no_metadata(vdms_client: vdms.vdms) -> None:
|
|||||||
def test_add_documents_mixed_metadata(vdms_client: vdms.vdms) -> None:
|
def test_add_documents_mixed_metadata(vdms_client: vdms.vdms) -> None:
|
||||||
collection_name = "test_add_documents_mixed_metadata"
|
collection_name = "test_add_documents_mixed_metadata"
|
||||||
embedding_function = FakeEmbeddings()
|
embedding_function = FakeEmbeddings()
|
||||||
db = VDMS(
|
db = VDMS( # type: ignore[call-arg]
|
||||||
collection_name=collection_name,
|
collection_name=collection_name,
|
||||||
embedding_function=embedding_function,
|
embedding_function=embedding_function,
|
||||||
client=vdms_client,
|
client=vdms_client,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.agent_toolkits import __all__
|
from langchain_community.agent_toolkits import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AINetworkToolkit",
|
"AINetworkToolkit",
|
||||||
@ -35,3 +35,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.chat_loaders import _module_lookup
|
from langchain_community.chat_loaders import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"BaseChatLoader",
|
"BaseChatLoader",
|
||||||
@ -15,4 +15,6 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(_module_lookup.keys()) == set(EXPECTED_ALL)
|
"""Test that __all__ is correctly set."""
|
||||||
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.chat_message_histories import _module_lookup
|
from langchain_community.chat_message_histories import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AstraDBChatMessageHistory",
|
"AstraDBChatMessageHistory",
|
||||||
@ -26,4 +26,6 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(_module_lookup.keys()) == set(EXPECTED_ALL)
|
"""Test that __all__ is correctly set."""
|
||||||
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -82,7 +82,7 @@ def test_bedrock_combine_llm_output() -> None:
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
model = BedrockChat(model_id=model_id, client=client)
|
model = BedrockChat(model_id=model_id, client=client)
|
||||||
final_output = model._combine_llm_outputs(llm_outputs)
|
final_output = model._combine_llm_outputs(llm_outputs) # type: ignore[arg-type]
|
||||||
assert final_output["model_id"] == model_id
|
assert final_output["model_id"] == model_id
|
||||||
assert final_output["usage"]["completion_tokens"] == 2
|
assert final_output["usage"]["completion_tokens"] == 2
|
||||||
assert final_output["usage"]["prompt_tokens"] == 4
|
assert final_output["usage"]["prompt_tokens"] == 4
|
||||||
|
@ -1,53 +1,56 @@
|
|||||||
from langchain_community.chat_models import __all__
|
from langchain_community.chat_models import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"ChatOpenAI",
|
|
||||||
"BedrockChat",
|
|
||||||
"AzureChatOpenAI",
|
"AzureChatOpenAI",
|
||||||
"FakeListChatModel",
|
"BedrockChat",
|
||||||
"PromptLayerChatOpenAI",
|
|
||||||
"ChatEverlyAI",
|
|
||||||
"ChatAnthropic",
|
"ChatAnthropic",
|
||||||
|
"ChatAnyscale",
|
||||||
|
"ChatBaichuan",
|
||||||
"ChatCohere",
|
"ChatCohere",
|
||||||
"ChatDatabricks",
|
"ChatDatabricks",
|
||||||
"ChatDeepInfra",
|
"ChatDeepInfra",
|
||||||
|
"ChatEverlyAI",
|
||||||
|
"ChatFireworks",
|
||||||
|
"ChatFriendli",
|
||||||
"ChatGooglePalm",
|
"ChatGooglePalm",
|
||||||
"ChatHuggingFace",
|
"ChatHuggingFace",
|
||||||
|
"ChatHunyuan",
|
||||||
|
"ChatJavelinAIGateway",
|
||||||
|
"ChatKinetica",
|
||||||
|
"ChatKonko",
|
||||||
|
"ChatLiteLLM",
|
||||||
|
"ChatLiteLLMRouter",
|
||||||
|
"ChatMLflowAIGateway",
|
||||||
"ChatMaritalk",
|
"ChatMaritalk",
|
||||||
"ChatMlflow",
|
"ChatMlflow",
|
||||||
"ChatMLflowAIGateway",
|
"ChatMLflowAIGateway",
|
||||||
"ChatMLX",
|
"ChatMLX",
|
||||||
"ChatOllama",
|
"ChatOllama",
|
||||||
"ChatVertexAI",
|
"ChatOpenAI",
|
||||||
"JinaChat",
|
"ChatPerplexity",
|
||||||
"HumanInputChatModel",
|
"ChatPremAI",
|
||||||
"MiniMaxChat",
|
|
||||||
"ChatAnyscale",
|
|
||||||
"ChatLiteLLM",
|
|
||||||
"ChatLiteLLMRouter",
|
|
||||||
"ErnieBotChat",
|
|
||||||
"ChatJavelinAIGateway",
|
|
||||||
"ChatKonko",
|
|
||||||
"PaiEasChatEndpoint",
|
|
||||||
"QianfanChatEndpoint",
|
|
||||||
"ChatTongyi",
|
|
||||||
"ChatFireworks",
|
|
||||||
"ChatYandexGPT",
|
|
||||||
"ChatBaichuan",
|
|
||||||
"ChatHunyuan",
|
|
||||||
"GigaChat",
|
|
||||||
"ChatSparkLLM",
|
"ChatSparkLLM",
|
||||||
"VolcEngineMaasChat",
|
"ChatTongyi",
|
||||||
"LlamaEdgeChatService",
|
"ChatVertexAI",
|
||||||
"GPTRouter",
|
"ChatYandexGPT",
|
||||||
"ChatYuan2",
|
"ChatYuan2",
|
||||||
"ChatZhipuAI",
|
"ChatZhipuAI",
|
||||||
"ChatPerplexity",
|
"ErnieBotChat",
|
||||||
"ChatKinetica",
|
"FakeListChatModel",
|
||||||
"ChatFriendli",
|
"GPTRouter",
|
||||||
"ChatPremAI",
|
"GigaChat",
|
||||||
|
"HumanInputChatModel",
|
||||||
|
"JinaChat",
|
||||||
|
"LlamaEdgeChatService",
|
||||||
|
"MiniMaxChat",
|
||||||
|
"PaiEasChatEndpoint",
|
||||||
|
"PromptLayerChatOpenAI",
|
||||||
|
"SolarChat",
|
||||||
|
"QianfanChatEndpoint",
|
||||||
|
"VolcEngineMaasChat",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
from langchain_community.docstore import __all__
|
from langchain_community.docstore import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = ["DocstoreFn", "InMemoryDocstore", "Wikipedia"]
|
EXPECTED_ALL = ["DocstoreFn", "InMemoryDocstore", "Wikipedia"]
|
||||||
|
|
||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
from langchain_community.document_compressors import __all__, _module_lookup
|
||||||
|
|
||||||
|
EXPECTED_ALL = ["LLMLinguaCompressor", "OpenVINOReranker"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_all_imports() -> None:
|
||||||
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.document_loaders import __all__
|
from langchain_community.document_loaders import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AcreomLoader",
|
"AcreomLoader",
|
||||||
@ -190,3 +190,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.document_transformers import __all__
|
from langchain_community.document_transformers import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"BeautifulSoupTransformer",
|
"BeautifulSoupTransformer",
|
||||||
@ -18,3 +18,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.embeddings import __all__
|
from langchain_community.embeddings import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"OpenAIEmbeddings",
|
"OpenAIEmbeddings",
|
||||||
@ -77,3 +77,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.graphs import __all__
|
from langchain_community.graphs import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"MemgraphGraph",
|
"MemgraphGraph",
|
||||||
@ -22,3 +22,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.retrievers import __all__
|
from langchain_community.retrievers import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AmazonKendraRetriever",
|
"AmazonKendraRetriever",
|
||||||
@ -45,3 +45,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.storage import __all__
|
from langchain_community.storage import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AstraDBStore",
|
"AstraDBStore",
|
||||||
@ -12,3 +12,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.tools import __all__
|
from langchain_community.tools import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AINAppOps",
|
"AINAppOps",
|
||||||
@ -142,3 +142,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from langchain_community.utilities import __all__
|
from langchain_community.utilities import __all__, _module_lookup
|
||||||
|
|
||||||
EXPECTED_ALL = [
|
EXPECTED_ALL = [
|
||||||
"AlphaVantageAPIWrapper",
|
"AlphaVantageAPIWrapper",
|
||||||
@ -62,3 +62,4 @@ EXPECTED_ALL = [
|
|||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports() -> None:
|
||||||
assert set(__all__) == set(EXPECTED_ALL)
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -219,7 +219,7 @@ def test_init_direct_access_index() -> None:
|
|||||||
@pytest.mark.requires("databricks", "databricks.vector_search")
|
@pytest.mark.requires("databricks", "databricks.vector_search")
|
||||||
def test_init_fail_no_index() -> None:
|
def test_init_fail_no_index() -> None:
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
DatabricksVectorSearch()
|
DatabricksVectorSearch() # type: ignore[call-arg]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.requires("databricks", "databricks.vector_search")
|
@pytest.mark.requires("databricks", "databricks.vector_search")
|
||||||
@ -420,7 +420,7 @@ def test_add_texts_with_metadata() -> None:
|
|||||||
DEFAULT_PRIMARY_KEY: id_,
|
DEFAULT_PRIMARY_KEY: id_,
|
||||||
DEFAULT_TEXT_COLUMN: text,
|
DEFAULT_TEXT_COLUMN: text,
|
||||||
DEFAULT_VECTOR_COLUMN: vector,
|
DEFAULT_VECTOR_COLUMN: vector,
|
||||||
**metadata,
|
**metadata, # type: ignore[arg-type]
|
||||||
}
|
}
|
||||||
for text, vector, id_, metadata in zip(
|
for text, vector, id_, metadata in zip(
|
||||||
fake_texts, vectors, added_ids, metadatas
|
fake_texts, vectors, added_ids, metadatas
|
||||||
|
@ -1,9 +1,102 @@
|
|||||||
from langchain_core.vectorstores import VectorStore
|
from langchain_core.vectorstores import VectorStore
|
||||||
|
|
||||||
from langchain_community import vectorstores
|
from langchain_community import vectorstores
|
||||||
|
from langchain_community.vectorstores import __all__, _module_lookup
|
||||||
|
|
||||||
|
EXPECTED_ALL = [
|
||||||
|
"AlibabaCloudOpenSearch",
|
||||||
|
"AlibabaCloudOpenSearchSettings",
|
||||||
|
"AnalyticDB",
|
||||||
|
"Annoy",
|
||||||
|
"ApacheDoris",
|
||||||
|
"AstraDB",
|
||||||
|
"AtlasDB",
|
||||||
|
"AwaDB",
|
||||||
|
"AzureCosmosDBVectorSearch",
|
||||||
|
"AzureSearch",
|
||||||
|
"BESVectorStore",
|
||||||
|
"Bagel",
|
||||||
|
"BaiduVectorDB",
|
||||||
|
"BigQueryVectorSearch",
|
||||||
|
"Cassandra",
|
||||||
|
"Chroma",
|
||||||
|
"Clarifai",
|
||||||
|
"Clickhouse",
|
||||||
|
"ClickhouseSettings",
|
||||||
|
"CouchbaseVectorStore",
|
||||||
|
"DashVector",
|
||||||
|
"DatabricksVectorSearch",
|
||||||
|
"DeepLake",
|
||||||
|
"Dingo",
|
||||||
|
"DistanceStrategy",
|
||||||
|
"DocArrayHnswSearch",
|
||||||
|
"DocArrayInMemorySearch",
|
||||||
|
"DocumentDBVectorSearch",
|
||||||
|
"DuckDB",
|
||||||
|
"EcloudESVectorStore",
|
||||||
|
"ElasticKnnSearch",
|
||||||
|
"ElasticVectorSearch",
|
||||||
|
"ElasticsearchStore",
|
||||||
|
"Epsilla",
|
||||||
|
"FAISS",
|
||||||
|
"HanaDB",
|
||||||
|
"Hologres",
|
||||||
|
"InMemoryVectorStore",
|
||||||
|
"InfinispanVS",
|
||||||
|
"KDBAI",
|
||||||
|
"Kinetica",
|
||||||
|
"KineticaSettings",
|
||||||
|
"LLMRails",
|
||||||
|
"LanceDB",
|
||||||
|
"Lantern",
|
||||||
|
"Marqo",
|
||||||
|
"MatchingEngine",
|
||||||
|
"Meilisearch",
|
||||||
|
"Milvus",
|
||||||
|
"MomentoVectorIndex",
|
||||||
|
"MongoDBAtlasVectorSearch",
|
||||||
|
"MyScale",
|
||||||
|
"MyScaleSettings",
|
||||||
|
"Neo4jVector",
|
||||||
|
"NeuralDBVectorStore",
|
||||||
|
"OpenSearchVectorSearch",
|
||||||
|
"PGEmbedding",
|
||||||
|
"PGVector",
|
||||||
|
"PathwayVectorClient",
|
||||||
|
"Pinecone",
|
||||||
|
"Qdrant",
|
||||||
|
"Redis",
|
||||||
|
"Rockset",
|
||||||
|
"SKLearnVectorStore",
|
||||||
|
"SQLiteVSS",
|
||||||
|
"ScaNN",
|
||||||
|
"SemaDB",
|
||||||
|
"SingleStoreDB",
|
||||||
|
"StarRocks",
|
||||||
|
"SupabaseVectorStore",
|
||||||
|
"SurrealDBStore",
|
||||||
|
"Tair",
|
||||||
|
"TencentVectorDB",
|
||||||
|
"TiDBVectorStore",
|
||||||
|
"Tigris",
|
||||||
|
"TileDB",
|
||||||
|
"TimescaleVector",
|
||||||
|
"Typesense",
|
||||||
|
"USearch",
|
||||||
|
"VDMS",
|
||||||
|
"Vald",
|
||||||
|
"Vearch",
|
||||||
|
"Vectara",
|
||||||
|
"VectorStore",
|
||||||
|
"VespaStore",
|
||||||
|
"Weaviate",
|
||||||
|
"Yellowbrick",
|
||||||
|
"ZepVectorStore",
|
||||||
|
"Zilliz",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_all_imports() -> None:
|
def test_all_imports_exclusive() -> None:
|
||||||
"""Simple test to make sure all things can be imported."""
|
"""Simple test to make sure all things can be imported."""
|
||||||
for cls in vectorstores.__all__:
|
for cls in vectorstores.__all__:
|
||||||
if cls not in [
|
if cls not in [
|
||||||
@ -15,3 +108,8 @@ def test_all_imports() -> None:
|
|||||||
"KineticaSettings",
|
"KineticaSettings",
|
||||||
]:
|
]:
|
||||||
assert issubclass(getattr(vectorstores, cls), VectorStore)
|
assert issubclass(getattr(vectorstores, cls), VectorStore)
|
||||||
|
|
||||||
|
|
||||||
|
def test_all_imports() -> None:
|
||||||
|
assert set(__all__) == set(EXPECTED_ALL)
|
||||||
|
assert set(__all__) == set(_module_lookup.keys())
|
||||||
|
@ -116,7 +116,7 @@ class ConversationalAgent(Agent):
|
|||||||
format_instructions=format_instructions,
|
format_instructions=format_instructions,
|
||||||
input_variables=input_variables,
|
input_variables=input_variables,
|
||||||
)
|
)
|
||||||
llm_chain = LLMChain(
|
llm_chain = LLMChain( # type: ignore[misc]
|
||||||
llm=llm,
|
llm=llm,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
callback_manager=callback_manager,
|
callback_manager=callback_manager,
|
||||||
|
@ -125,7 +125,7 @@ class ConversationalChatAgent(Agent):
|
|||||||
input_variables=input_variables,
|
input_variables=input_variables,
|
||||||
output_parser=_output_parser,
|
output_parser=_output_parser,
|
||||||
)
|
)
|
||||||
llm_chain = LLMChain(
|
llm_chain = LLMChain( # type: ignore[misc]
|
||||||
llm=llm,
|
llm=llm,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
callback_manager=callback_manager,
|
callback_manager=callback_manager,
|
||||||
|
@ -110,7 +110,7 @@ class ZeroShotAgent(Agent):
|
|||||||
format_instructions=format_instructions,
|
format_instructions=format_instructions,
|
||||||
input_variables=input_variables,
|
input_variables=input_variables,
|
||||||
)
|
)
|
||||||
llm_chain = LLMChain(
|
llm_chain = LLMChain( # type: ignore[misc]
|
||||||
llm=llm,
|
llm=llm,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
callback_manager=callback_manager,
|
callback_manager=callback_manager,
|
||||||
|
@ -27,7 +27,7 @@ class LLMRequestsChain(Chain):
|
|||||||
See https://python.langchain.com/docs/security for more information.
|
See https://python.langchain.com/docs/security for more information.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
llm_chain: LLMChain
|
llm_chain: LLMChain # type: ignore[valid-type]
|
||||||
requests_wrapper: TextRequestsWrapper = Field(
|
requests_wrapper: TextRequestsWrapper = Field(
|
||||||
default_factory=lambda: TextRequestsWrapper(headers=DEFAULT_HEADERS),
|
default_factory=lambda: TextRequestsWrapper(headers=DEFAULT_HEADERS),
|
||||||
exclude=True,
|
exclude=True,
|
||||||
@ -87,7 +87,7 @@ class LLMRequestsChain(Chain):
|
|||||||
# extract the text from the html
|
# extract the text from the html
|
||||||
soup = BeautifulSoup(res, "html.parser")
|
soup = BeautifulSoup(res, "html.parser")
|
||||||
other_keys[self.requests_key] = soup.get_text()[: self.text_length]
|
other_keys[self.requests_key] = soup.get_text()[: self.text_length]
|
||||||
result = self.llm_chain.predict(
|
result = self.llm_chain.predict( # type: ignore[attr-defined]
|
||||||
callbacks=_run_manager.get_child(), **other_keys
|
callbacks=_run_manager.get_child(), **other_keys
|
||||||
)
|
)
|
||||||
return {self.output_key: result}
|
return {self.output_key: result}
|
||||||
|
@ -134,7 +134,7 @@ def _load_map_reduce_documents_chain(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _load_reduce_documents_chain(config: dict, **kwargs: Any) -> ReduceDocumentsChain:
|
def _load_reduce_documents_chain(config: dict, **kwargs: Any) -> ReduceDocumentsChain: # type: ignore[valid-type]
|
||||||
combine_documents_chain = None
|
combine_documents_chain = None
|
||||||
collapse_documents_chain = None
|
collapse_documents_chain = None
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ def _load_reduce_documents_chain(config: dict, **kwargs: Any) -> ReduceDocuments
|
|||||||
config.pop("collapse_document_chain_path"), **kwargs
|
config.pop("collapse_document_chain_path"), **kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
return ReduceDocumentsChain(
|
return ReduceDocumentsChain( # type: ignore[misc]
|
||||||
combine_documents_chain=combine_documents_chain,
|
combine_documents_chain=combine_documents_chain,
|
||||||
collapse_documents_chain=collapse_documents_chain,
|
collapse_documents_chain=collapse_documents_chain,
|
||||||
**config,
|
**config,
|
||||||
|
@ -52,7 +52,7 @@ def create_openai_fn_chain(
|
|||||||
output_key: str = "function",
|
output_key: str = "function",
|
||||||
output_parser: Optional[BaseLLMOutputParser] = None,
|
output_parser: Optional[BaseLLMOutputParser] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> LLMChain:
|
) -> LLMChain: # type: ignore[valid-type]
|
||||||
"""[Legacy] Create an LLM chain that uses OpenAI functions.
|
"""[Legacy] Create an LLM chain that uses OpenAI functions.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -132,7 +132,7 @@ def create_openai_fn_chain(
|
|||||||
}
|
}
|
||||||
if len(openai_functions) == 1 and enforce_single_function_usage:
|
if len(openai_functions) == 1 and enforce_single_function_usage:
|
||||||
llm_kwargs["function_call"] = {"name": openai_functions[0]["name"]}
|
llm_kwargs["function_call"] = {"name": openai_functions[0]["name"]}
|
||||||
llm_chain = LLMChain(
|
llm_chain = LLMChain( # type: ignore[misc]
|
||||||
llm=llm,
|
llm=llm,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
output_parser=output_parser,
|
output_parser=output_parser,
|
||||||
@ -154,7 +154,7 @@ def create_structured_output_chain(
|
|||||||
output_key: str = "function",
|
output_key: str = "function",
|
||||||
output_parser: Optional[BaseLLMOutputParser] = None,
|
output_parser: Optional[BaseLLMOutputParser] = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> LLMChain:
|
) -> LLMChain: # type: ignore[valid-type]
|
||||||
"""[Legacy] Create an LLMChain that uses an OpenAI function to get a structured output.
|
"""[Legacy] Create an LLMChain that uses an OpenAI function to get a structured output.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -59,7 +59,7 @@ class BaseQAWithSourcesChain(Chain, ABC):
|
|||||||
document_prompt=document_prompt,
|
document_prompt=document_prompt,
|
||||||
document_variable_name="summaries",
|
document_variable_name="summaries",
|
||||||
)
|
)
|
||||||
reduce_documents_chain = ReduceDocumentsChain(
|
reduce_documents_chain = ReduceDocumentsChain( # type: ignore[misc]
|
||||||
combine_documents_chain=combine_results_chain
|
combine_documents_chain=combine_results_chain
|
||||||
)
|
)
|
||||||
combine_documents_chain = MapReduceDocumentsChain(
|
combine_documents_chain = MapReduceDocumentsChain(
|
||||||
|
@ -153,7 +153,7 @@ def _load_map_reduce_chain(
|
|||||||
verbose=verbose, # type: ignore[arg-type]
|
verbose=verbose, # type: ignore[arg-type]
|
||||||
callback_manager=callback_manager,
|
callback_manager=callback_manager,
|
||||||
)
|
)
|
||||||
reduce_documents_chain = ReduceDocumentsChain(
|
reduce_documents_chain = ReduceDocumentsChain( # type: ignore[misc]
|
||||||
combine_documents_chain=combine_documents_chain,
|
combine_documents_chain=combine_documents_chain,
|
||||||
collapse_documents_chain=collapse_chain,
|
collapse_documents_chain=collapse_chain,
|
||||||
token_max=token_max,
|
token_max=token_max,
|
||||||
|
@ -27,10 +27,10 @@ def test_daxquery() -> None:
|
|||||||
|
|
||||||
fast_llm = ChatOpenAI(
|
fast_llm = ChatOpenAI(
|
||||||
temperature=0.5, max_tokens=1000, model_name="gpt-3.5-turbo", verbose=True
|
temperature=0.5, max_tokens=1000, model_name="gpt-3.5-turbo", verbose=True
|
||||||
)
|
) # type: ignore[call-arg]
|
||||||
smart_llm = ChatOpenAI(
|
smart_llm = ChatOpenAI(
|
||||||
temperature=0, max_tokens=100, model_name="gpt-4", verbose=True
|
temperature=0, max_tokens=100, model_name="gpt-4", verbose=True
|
||||||
)
|
) # type: ignore[call-arg]
|
||||||
|
|
||||||
toolkit = PowerBIToolkit(
|
toolkit = PowerBIToolkit(
|
||||||
powerbi=PowerBIDataset(
|
powerbi=PowerBIDataset(
|
||||||
|
Loading…
Reference in New Issue
Block a user