|
|
@ -17,240 +17,247 @@ access to the large language model (**LLM**) APIs and services.
|
|
|
|
CallbackManager, AsyncCallbackManager,
|
|
|
|
CallbackManager, AsyncCallbackManager,
|
|
|
|
AIMessage, BaseMessage
|
|
|
|
AIMessage, BaseMessage
|
|
|
|
""" # noqa: E501
|
|
|
|
""" # noqa: E501
|
|
|
|
|
|
|
|
|
|
|
|
from typing import Any, Callable, Dict, Type
|
|
|
|
from typing import Any, Callable, Dict, Type
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from langchain_core._api.deprecation import warn_deprecated
|
|
|
|
from langchain_core.language_models.llms import BaseLLM
|
|
|
|
from langchain_core.language_models.llms import BaseLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_ai21() -> Any:
|
|
|
|
def _import_ai21() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.ai21 import AI21
|
|
|
|
from langchain_community.llms.ai21 import AI21
|
|
|
|
|
|
|
|
|
|
|
|
return AI21
|
|
|
|
return AI21
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_aleph_alpha() -> Any:
|
|
|
|
def _import_aleph_alpha() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.aleph_alpha import AlephAlpha
|
|
|
|
from langchain_community.llms.aleph_alpha import AlephAlpha
|
|
|
|
|
|
|
|
|
|
|
|
return AlephAlpha
|
|
|
|
return AlephAlpha
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_amazon_api_gateway() -> Any:
|
|
|
|
def _import_amazon_api_gateway() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.amazon_api_gateway import AmazonAPIGateway
|
|
|
|
from langchain_community.llms.amazon_api_gateway import AmazonAPIGateway
|
|
|
|
|
|
|
|
|
|
|
|
return AmazonAPIGateway
|
|
|
|
return AmazonAPIGateway
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_anthropic() -> Any:
|
|
|
|
def _import_anthropic() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.anthropic import Anthropic
|
|
|
|
from langchain_community.llms.anthropic import Anthropic
|
|
|
|
|
|
|
|
|
|
|
|
return Anthropic
|
|
|
|
return Anthropic
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_anyscale() -> Any:
|
|
|
|
def _import_anyscale() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.anyscale import Anyscale
|
|
|
|
from langchain_community.llms.anyscale import Anyscale
|
|
|
|
|
|
|
|
|
|
|
|
return Anyscale
|
|
|
|
return Anyscale
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_aphrodite() -> Any:
|
|
|
|
def _import_aphrodite() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.aphrodite import Aphrodite
|
|
|
|
from langchain_community.llms.aphrodite import Aphrodite
|
|
|
|
|
|
|
|
|
|
|
|
return Aphrodite
|
|
|
|
return Aphrodite
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_arcee() -> Any:
|
|
|
|
def _import_arcee() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.arcee import Arcee
|
|
|
|
from langchain_community.llms.arcee import Arcee
|
|
|
|
|
|
|
|
|
|
|
|
return Arcee
|
|
|
|
return Arcee
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_aviary() -> Any:
|
|
|
|
def _import_aviary() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.aviary import Aviary
|
|
|
|
from langchain_community.llms.aviary import Aviary
|
|
|
|
|
|
|
|
|
|
|
|
return Aviary
|
|
|
|
return Aviary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_azureml_endpoint() -> Any:
|
|
|
|
def _import_azureml_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.azureml_endpoint import AzureMLOnlineEndpoint
|
|
|
|
from langchain_community.llms.azureml_endpoint import AzureMLOnlineEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return AzureMLOnlineEndpoint
|
|
|
|
return AzureMLOnlineEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_baichuan() -> Any:
|
|
|
|
def _import_baichuan() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.baichuan import BaichuanLLM
|
|
|
|
from langchain_community.llms.baichuan import BaichuanLLM
|
|
|
|
|
|
|
|
|
|
|
|
return BaichuanLLM
|
|
|
|
return BaichuanLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_baidu_qianfan_endpoint() -> Any:
|
|
|
|
def _import_baidu_qianfan_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint
|
|
|
|
from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return QianfanLLMEndpoint
|
|
|
|
return QianfanLLMEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_bananadev() -> Any:
|
|
|
|
def _import_bananadev() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.bananadev import Banana
|
|
|
|
from langchain_community.llms.bananadev import Banana
|
|
|
|
|
|
|
|
|
|
|
|
return Banana
|
|
|
|
return Banana
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_baseten() -> Any:
|
|
|
|
def _import_baseten() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.baseten import Baseten
|
|
|
|
from langchain_community.llms.baseten import Baseten
|
|
|
|
|
|
|
|
|
|
|
|
return Baseten
|
|
|
|
return Baseten
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_beam() -> Any:
|
|
|
|
def _import_beam() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.beam import Beam
|
|
|
|
from langchain_community.llms.beam import Beam
|
|
|
|
|
|
|
|
|
|
|
|
return Beam
|
|
|
|
return Beam
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_bedrock() -> Any:
|
|
|
|
def _import_bedrock() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.bedrock import Bedrock
|
|
|
|
from langchain_community.llms.bedrock import Bedrock
|
|
|
|
|
|
|
|
|
|
|
|
return Bedrock
|
|
|
|
return Bedrock
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_bittensor() -> Any:
|
|
|
|
def _import_bittensor() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.bittensor import NIBittensorLLM
|
|
|
|
from langchain_community.llms.bittensor import NIBittensorLLM
|
|
|
|
|
|
|
|
|
|
|
|
return NIBittensorLLM
|
|
|
|
return NIBittensorLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_cerebriumai() -> Any:
|
|
|
|
def _import_cerebriumai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.cerebriumai import CerebriumAI
|
|
|
|
from langchain_community.llms.cerebriumai import CerebriumAI
|
|
|
|
|
|
|
|
|
|
|
|
return CerebriumAI
|
|
|
|
return CerebriumAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_chatglm() -> Any:
|
|
|
|
def _import_chatglm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.chatglm import ChatGLM
|
|
|
|
from langchain_community.llms.chatglm import ChatGLM
|
|
|
|
|
|
|
|
|
|
|
|
return ChatGLM
|
|
|
|
return ChatGLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_clarifai() -> Any:
|
|
|
|
def _import_clarifai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.clarifai import Clarifai
|
|
|
|
from langchain_community.llms.clarifai import Clarifai
|
|
|
|
|
|
|
|
|
|
|
|
return Clarifai
|
|
|
|
return Clarifai
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_cohere() -> Any:
|
|
|
|
def _import_cohere() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.cohere import Cohere
|
|
|
|
from langchain_community.llms.cohere import Cohere
|
|
|
|
|
|
|
|
|
|
|
|
return Cohere
|
|
|
|
return Cohere
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_ctransformers() -> Any:
|
|
|
|
def _import_ctransformers() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.ctransformers import CTransformers
|
|
|
|
from langchain_community.llms.ctransformers import CTransformers
|
|
|
|
|
|
|
|
|
|
|
|
return CTransformers
|
|
|
|
return CTransformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_ctranslate2() -> Any:
|
|
|
|
def _import_ctranslate2() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.ctranslate2 import CTranslate2
|
|
|
|
from langchain_community.llms.ctranslate2 import CTranslate2
|
|
|
|
|
|
|
|
|
|
|
|
return CTranslate2
|
|
|
|
return CTranslate2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_databricks() -> Any:
|
|
|
|
def _import_databricks() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.databricks import Databricks
|
|
|
|
from langchain_community.llms.databricks import Databricks
|
|
|
|
|
|
|
|
|
|
|
|
return Databricks
|
|
|
|
return Databricks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_databricks_chat() -> Any:
|
|
|
|
def _import_databricks_chat() -> Any:
|
|
|
|
|
|
|
|
warn_deprecated(
|
|
|
|
|
|
|
|
since="0.0.22",
|
|
|
|
|
|
|
|
removal="0.2",
|
|
|
|
|
|
|
|
alternative_import="langchain_community.chat_models.ChatDatabricks",
|
|
|
|
|
|
|
|
)
|
|
|
|
from langchain_community.chat_models.databricks import ChatDatabricks
|
|
|
|
from langchain_community.chat_models.databricks import ChatDatabricks
|
|
|
|
|
|
|
|
|
|
|
|
return ChatDatabricks
|
|
|
|
return ChatDatabricks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_deepinfra() -> Any:
|
|
|
|
def _import_deepinfra() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.deepinfra import DeepInfra
|
|
|
|
from langchain_community.llms.deepinfra import DeepInfra
|
|
|
|
|
|
|
|
|
|
|
|
return DeepInfra
|
|
|
|
return DeepInfra
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_deepsparse() -> Any:
|
|
|
|
def _import_deepsparse() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.deepsparse import DeepSparse
|
|
|
|
from langchain_community.llms.deepsparse import DeepSparse
|
|
|
|
|
|
|
|
|
|
|
|
return DeepSparse
|
|
|
|
return DeepSparse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_edenai() -> Any:
|
|
|
|
def _import_edenai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.edenai import EdenAI
|
|
|
|
from langchain_community.llms.edenai import EdenAI
|
|
|
|
|
|
|
|
|
|
|
|
return EdenAI
|
|
|
|
return EdenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_fake() -> Any:
|
|
|
|
def _import_fake() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.fake import FakeListLLM
|
|
|
|
from langchain_community.llms.fake import FakeListLLM
|
|
|
|
|
|
|
|
|
|
|
|
return FakeListLLM
|
|
|
|
return FakeListLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_fireworks() -> Any:
|
|
|
|
def _import_fireworks() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.fireworks import Fireworks
|
|
|
|
from langchain_community.llms.fireworks import Fireworks
|
|
|
|
|
|
|
|
|
|
|
|
return Fireworks
|
|
|
|
return Fireworks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_forefrontai() -> Any:
|
|
|
|
def _import_forefrontai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.forefrontai import ForefrontAI
|
|
|
|
from langchain_community.llms.forefrontai import ForefrontAI
|
|
|
|
|
|
|
|
|
|
|
|
return ForefrontAI
|
|
|
|
return ForefrontAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_gigachat() -> Any:
|
|
|
|
def _import_gigachat() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.gigachat import GigaChat
|
|
|
|
from langchain_community.llms.gigachat import GigaChat
|
|
|
|
|
|
|
|
|
|
|
|
return GigaChat
|
|
|
|
return GigaChat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_google_palm() -> Any:
|
|
|
|
def _import_google_palm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.google_palm import GooglePalm
|
|
|
|
from langchain_community.llms.google_palm import GooglePalm
|
|
|
|
|
|
|
|
|
|
|
|
return GooglePalm
|
|
|
|
return GooglePalm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_gooseai() -> Any:
|
|
|
|
def _import_gooseai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.gooseai import GooseAI
|
|
|
|
from langchain_community.llms.gooseai import GooseAI
|
|
|
|
|
|
|
|
|
|
|
|
return GooseAI
|
|
|
|
return GooseAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_gpt4all() -> Any:
|
|
|
|
def _import_gpt4all() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.gpt4all import GPT4All
|
|
|
|
from langchain_community.llms.gpt4all import GPT4All
|
|
|
|
|
|
|
|
|
|
|
|
return GPT4All
|
|
|
|
return GPT4All
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_gradient_ai() -> Any:
|
|
|
|
def _import_gradient_ai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.gradient_ai import GradientLLM
|
|
|
|
from langchain_community.llms.gradient_ai import GradientLLM
|
|
|
|
|
|
|
|
|
|
|
|
return GradientLLM
|
|
|
|
return GradientLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_huggingface_endpoint() -> Any:
|
|
|
|
def _import_huggingface_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
|
|
|
|
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return HuggingFaceEndpoint
|
|
|
|
return HuggingFaceEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_huggingface_hub() -> Any:
|
|
|
|
def _import_huggingface_hub() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.huggingface_hub import HuggingFaceHub
|
|
|
|
from langchain_community.llms.huggingface_hub import HuggingFaceHub
|
|
|
|
|
|
|
|
|
|
|
|
return HuggingFaceHub
|
|
|
|
return HuggingFaceHub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_huggingface_pipeline() -> Any:
|
|
|
|
def _import_huggingface_pipeline() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
|
|
|
|
from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline
|
|
|
|
|
|
|
|
|
|
|
|
return HuggingFacePipeline
|
|
|
|
return HuggingFacePipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_huggingface_text_gen_inference() -> Any:
|
|
|
|
def _import_huggingface_text_gen_inference() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.huggingface_text_gen_inference import (
|
|
|
|
from langchain_community.llms.huggingface_text_gen_inference import (
|
|
|
|
HuggingFaceTextGenInference,
|
|
|
|
HuggingFaceTextGenInference,
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -258,85 +265,90 @@ def _import_huggingface_text_gen_inference() -> Any:
|
|
|
|
return HuggingFaceTextGenInference
|
|
|
|
return HuggingFaceTextGenInference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_human() -> Any:
|
|
|
|
def _import_human() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.human import HumanInputLLM
|
|
|
|
from langchain_community.llms.human import HumanInputLLM
|
|
|
|
|
|
|
|
|
|
|
|
return HumanInputLLM
|
|
|
|
return HumanInputLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_javelin_ai_gateway() -> Any:
|
|
|
|
def _import_javelin_ai_gateway() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.javelin_ai_gateway import JavelinAIGateway
|
|
|
|
from langchain_community.llms.javelin_ai_gateway import JavelinAIGateway
|
|
|
|
|
|
|
|
|
|
|
|
return JavelinAIGateway
|
|
|
|
return JavelinAIGateway
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_koboldai() -> Any:
|
|
|
|
def _import_koboldai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.koboldai import KoboldApiLLM
|
|
|
|
from langchain_community.llms.koboldai import KoboldApiLLM
|
|
|
|
|
|
|
|
|
|
|
|
return KoboldApiLLM
|
|
|
|
return KoboldApiLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_konko() -> Any:
|
|
|
|
def _import_konko() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.konko import Konko
|
|
|
|
from langchain_community.llms.konko import Konko
|
|
|
|
|
|
|
|
|
|
|
|
return Konko
|
|
|
|
return Konko
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_llamacpp() -> Any:
|
|
|
|
def _import_llamacpp() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.llamacpp import LlamaCpp
|
|
|
|
from langchain_community.llms.llamacpp import LlamaCpp
|
|
|
|
|
|
|
|
|
|
|
|
return LlamaCpp
|
|
|
|
return LlamaCpp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_manifest() -> Any:
|
|
|
|
def _import_manifest() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.manifest import ManifestWrapper
|
|
|
|
from langchain_community.llms.manifest import ManifestWrapper
|
|
|
|
|
|
|
|
|
|
|
|
return ManifestWrapper
|
|
|
|
return ManifestWrapper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_minimax() -> Any:
|
|
|
|
def _import_minimax() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.minimax import Minimax
|
|
|
|
from langchain_community.llms.minimax import Minimax
|
|
|
|
|
|
|
|
|
|
|
|
return Minimax
|
|
|
|
return Minimax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_mlflow() -> Any:
|
|
|
|
def _import_mlflow() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.mlflow import Mlflow
|
|
|
|
from langchain_community.llms.mlflow import Mlflow
|
|
|
|
|
|
|
|
|
|
|
|
return Mlflow
|
|
|
|
return Mlflow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_mlflow_chat() -> Any:
|
|
|
|
def _import_mlflow_chat() -> Any:
|
|
|
|
|
|
|
|
warn_deprecated(
|
|
|
|
|
|
|
|
since="0.0.22",
|
|
|
|
|
|
|
|
removal="0.2",
|
|
|
|
|
|
|
|
alternative_import="langchain_community.chat_models.ChatMlflow",
|
|
|
|
|
|
|
|
)
|
|
|
|
from langchain_community.chat_models.mlflow import ChatMlflow
|
|
|
|
from langchain_community.chat_models.mlflow import ChatMlflow
|
|
|
|
|
|
|
|
|
|
|
|
return ChatMlflow
|
|
|
|
return ChatMlflow
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_mlflow_ai_gateway() -> Any:
|
|
|
|
def _import_mlflow_ai_gateway() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.mlflow_ai_gateway import MlflowAIGateway
|
|
|
|
from langchain_community.llms.mlflow_ai_gateway import MlflowAIGateway
|
|
|
|
|
|
|
|
|
|
|
|
return MlflowAIGateway
|
|
|
|
return MlflowAIGateway
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_modal() -> Any:
|
|
|
|
def _import_modal() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.modal import Modal
|
|
|
|
from langchain_community.llms.modal import Modal
|
|
|
|
|
|
|
|
|
|
|
|
return Modal
|
|
|
|
return Modal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_mosaicml() -> Any:
|
|
|
|
def _import_mosaicml() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.mosaicml import MosaicML
|
|
|
|
from langchain_community.llms.mosaicml import MosaicML
|
|
|
|
|
|
|
|
|
|
|
|
return MosaicML
|
|
|
|
return MosaicML
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_nlpcloud() -> Any:
|
|
|
|
def _import_nlpcloud() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.nlpcloud import NLPCloud
|
|
|
|
from langchain_community.llms.nlpcloud import NLPCloud
|
|
|
|
|
|
|
|
|
|
|
|
return NLPCloud
|
|
|
|
return NLPCloud
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_oci_md_tgi() -> Any:
|
|
|
|
def _import_oci_md_tgi() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
|
|
|
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
|
|
|
OCIModelDeploymentTGI,
|
|
|
|
OCIModelDeploymentTGI,
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -344,7 +356,7 @@ def _import_oci_md_tgi() -> Any:
|
|
|
|
return OCIModelDeploymentTGI
|
|
|
|
return OCIModelDeploymentTGI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_oci_md_vllm() -> Any:
|
|
|
|
def _import_oci_md_vllm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
|
|
|
from langchain_community.llms.oci_data_science_model_deployment_endpoint import (
|
|
|
|
OCIModelDeploymentVLLM,
|
|
|
|
OCIModelDeploymentVLLM,
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -352,127 +364,127 @@ def _import_oci_md_vllm() -> Any:
|
|
|
|
return OCIModelDeploymentVLLM
|
|
|
|
return OCIModelDeploymentVLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_oci_gen_ai() -> Any:
|
|
|
|
def _import_oci_gen_ai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.oci_generative_ai import OCIGenAI
|
|
|
|
from langchain_community.llms.oci_generative_ai import OCIGenAI
|
|
|
|
|
|
|
|
|
|
|
|
return OCIGenAI
|
|
|
|
return OCIGenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_octoai_endpoint() -> Any:
|
|
|
|
def _import_octoai_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.octoai_endpoint import OctoAIEndpoint
|
|
|
|
from langchain_community.llms.octoai_endpoint import OctoAIEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return OctoAIEndpoint
|
|
|
|
return OctoAIEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_ollama() -> Any:
|
|
|
|
def _import_ollama() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.ollama import Ollama
|
|
|
|
from langchain_community.llms.ollama import Ollama
|
|
|
|
|
|
|
|
|
|
|
|
return Ollama
|
|
|
|
return Ollama
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_opaqueprompts() -> Any:
|
|
|
|
def _import_opaqueprompts() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.opaqueprompts import OpaquePrompts
|
|
|
|
from langchain_community.llms.opaqueprompts import OpaquePrompts
|
|
|
|
|
|
|
|
|
|
|
|
return OpaquePrompts
|
|
|
|
return OpaquePrompts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_azure_openai() -> Any:
|
|
|
|
def _import_azure_openai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.openai import AzureOpenAI
|
|
|
|
from langchain_community.llms.openai import AzureOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
return AzureOpenAI
|
|
|
|
return AzureOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_openai() -> Any:
|
|
|
|
def _import_openai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.openai import OpenAI
|
|
|
|
from langchain_community.llms.openai import OpenAI
|
|
|
|
|
|
|
|
|
|
|
|
return OpenAI
|
|
|
|
return OpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_openai_chat() -> Any:
|
|
|
|
def _import_openai_chat() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.openai import OpenAIChat
|
|
|
|
from langchain_community.llms.openai import OpenAIChat
|
|
|
|
|
|
|
|
|
|
|
|
return OpenAIChat
|
|
|
|
return OpenAIChat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_openllm() -> Any:
|
|
|
|
def _import_openllm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.openllm import OpenLLM
|
|
|
|
from langchain_community.llms.openllm import OpenLLM
|
|
|
|
|
|
|
|
|
|
|
|
return OpenLLM
|
|
|
|
return OpenLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_openlm() -> Any:
|
|
|
|
def _import_openlm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.openlm import OpenLM
|
|
|
|
from langchain_community.llms.openlm import OpenLM
|
|
|
|
|
|
|
|
|
|
|
|
return OpenLM
|
|
|
|
return OpenLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_pai_eas_endpoint() -> Any:
|
|
|
|
def _import_pai_eas_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.pai_eas_endpoint import PaiEasEndpoint
|
|
|
|
from langchain_community.llms.pai_eas_endpoint import PaiEasEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return PaiEasEndpoint
|
|
|
|
return PaiEasEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_petals() -> Any:
|
|
|
|
def _import_petals() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.petals import Petals
|
|
|
|
from langchain_community.llms.petals import Petals
|
|
|
|
|
|
|
|
|
|
|
|
return Petals
|
|
|
|
return Petals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_pipelineai() -> Any:
|
|
|
|
def _import_pipelineai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.pipelineai import PipelineAI
|
|
|
|
from langchain_community.llms.pipelineai import PipelineAI
|
|
|
|
|
|
|
|
|
|
|
|
return PipelineAI
|
|
|
|
return PipelineAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_predibase() -> Any:
|
|
|
|
def _import_predibase() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.predibase import Predibase
|
|
|
|
from langchain_community.llms.predibase import Predibase
|
|
|
|
|
|
|
|
|
|
|
|
return Predibase
|
|
|
|
return Predibase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_predictionguard() -> Any:
|
|
|
|
def _import_predictionguard() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.predictionguard import PredictionGuard
|
|
|
|
from langchain_community.llms.predictionguard import PredictionGuard
|
|
|
|
|
|
|
|
|
|
|
|
return PredictionGuard
|
|
|
|
return PredictionGuard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_promptlayer() -> Any:
|
|
|
|
def _import_promptlayer() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.promptlayer_openai import PromptLayerOpenAI
|
|
|
|
from langchain_community.llms.promptlayer_openai import PromptLayerOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
return PromptLayerOpenAI
|
|
|
|
return PromptLayerOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_promptlayer_chat() -> Any:
|
|
|
|
def _import_promptlayer_chat() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.promptlayer_openai import PromptLayerOpenAIChat
|
|
|
|
from langchain_community.llms.promptlayer_openai import PromptLayerOpenAIChat
|
|
|
|
|
|
|
|
|
|
|
|
return PromptLayerOpenAIChat
|
|
|
|
return PromptLayerOpenAIChat
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_replicate() -> Any:
|
|
|
|
def _import_replicate() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.replicate import Replicate
|
|
|
|
from langchain_community.llms.replicate import Replicate
|
|
|
|
|
|
|
|
|
|
|
|
return Replicate
|
|
|
|
return Replicate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_rwkv() -> Any:
|
|
|
|
def _import_rwkv() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.rwkv import RWKV
|
|
|
|
from langchain_community.llms.rwkv import RWKV
|
|
|
|
|
|
|
|
|
|
|
|
return RWKV
|
|
|
|
return RWKV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_sagemaker_endpoint() -> Any:
|
|
|
|
def _import_sagemaker_endpoint() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.sagemaker_endpoint import SagemakerEndpoint
|
|
|
|
from langchain_community.llms.sagemaker_endpoint import SagemakerEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
return SagemakerEndpoint
|
|
|
|
return SagemakerEndpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_self_hosted() -> Any:
|
|
|
|
def _import_self_hosted() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.self_hosted import SelfHostedPipeline
|
|
|
|
from langchain_community.llms.self_hosted import SelfHostedPipeline
|
|
|
|
|
|
|
|
|
|
|
|
return SelfHostedPipeline
|
|
|
|
return SelfHostedPipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_self_hosted_hugging_face() -> Any:
|
|
|
|
def _import_self_hosted_hugging_face() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.self_hosted_hugging_face import (
|
|
|
|
from langchain_community.llms.self_hosted_hugging_face import (
|
|
|
|
SelfHostedHuggingFaceLLM,
|
|
|
|
SelfHostedHuggingFaceLLM,
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -480,109 +492,109 @@ def _import_self_hosted_hugging_face() -> Any:
|
|
|
|
return SelfHostedHuggingFaceLLM
|
|
|
|
return SelfHostedHuggingFaceLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_stochasticai() -> Any:
|
|
|
|
def _import_stochasticai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.stochasticai import StochasticAI
|
|
|
|
from langchain_community.llms.stochasticai import StochasticAI
|
|
|
|
|
|
|
|
|
|
|
|
return StochasticAI
|
|
|
|
return StochasticAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_symblai_nebula() -> Any:
|
|
|
|
def _import_symblai_nebula() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.symblai_nebula import Nebula
|
|
|
|
from langchain_community.llms.symblai_nebula import Nebula
|
|
|
|
|
|
|
|
|
|
|
|
return Nebula
|
|
|
|
return Nebula
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_textgen() -> Any:
|
|
|
|
def _import_textgen() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.textgen import TextGen
|
|
|
|
from langchain_community.llms.textgen import TextGen
|
|
|
|
|
|
|
|
|
|
|
|
return TextGen
|
|
|
|
return TextGen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_titan_takeoff() -> Any:
|
|
|
|
def _import_titan_takeoff() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.titan_takeoff import TitanTakeoff
|
|
|
|
from langchain_community.llms.titan_takeoff import TitanTakeoff
|
|
|
|
|
|
|
|
|
|
|
|
return TitanTakeoff
|
|
|
|
return TitanTakeoff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_titan_takeoff_pro() -> Any:
|
|
|
|
def _import_titan_takeoff_pro() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.titan_takeoff_pro import TitanTakeoffPro
|
|
|
|
from langchain_community.llms.titan_takeoff_pro import TitanTakeoffPro
|
|
|
|
|
|
|
|
|
|
|
|
return TitanTakeoffPro
|
|
|
|
return TitanTakeoffPro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_together() -> Any:
|
|
|
|
def _import_together() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.together import Together
|
|
|
|
from langchain_community.llms.together import Together
|
|
|
|
|
|
|
|
|
|
|
|
return Together
|
|
|
|
return Together
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_tongyi() -> Any:
|
|
|
|
def _import_tongyi() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.tongyi import Tongyi
|
|
|
|
from langchain_community.llms.tongyi import Tongyi
|
|
|
|
|
|
|
|
|
|
|
|
return Tongyi
|
|
|
|
return Tongyi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_vertex() -> Any:
|
|
|
|
def _import_vertex() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.vertexai import VertexAI
|
|
|
|
from langchain_community.llms.vertexai import VertexAI
|
|
|
|
|
|
|
|
|
|
|
|
return VertexAI
|
|
|
|
return VertexAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_vertex_model_garden() -> Any:
|
|
|
|
def _import_vertex_model_garden() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.vertexai import VertexAIModelGarden
|
|
|
|
from langchain_community.llms.vertexai import VertexAIModelGarden
|
|
|
|
|
|
|
|
|
|
|
|
return VertexAIModelGarden
|
|
|
|
return VertexAIModelGarden
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_vllm() -> Any:
|
|
|
|
def _import_vllm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.vllm import VLLM
|
|
|
|
from langchain_community.llms.vllm import VLLM
|
|
|
|
|
|
|
|
|
|
|
|
return VLLM
|
|
|
|
return VLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_vllm_openai() -> Any:
|
|
|
|
def _import_vllm_openai() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.vllm import VLLMOpenAI
|
|
|
|
from langchain_community.llms.vllm import VLLMOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
return VLLMOpenAI
|
|
|
|
return VLLMOpenAI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_watsonxllm() -> Any:
|
|
|
|
def _import_watsonxllm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.watsonxllm import WatsonxLLM
|
|
|
|
from langchain_community.llms.watsonxllm import WatsonxLLM
|
|
|
|
|
|
|
|
|
|
|
|
return WatsonxLLM
|
|
|
|
return WatsonxLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_writer() -> Any:
|
|
|
|
def _import_writer() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.writer import Writer
|
|
|
|
from langchain_community.llms.writer import Writer
|
|
|
|
|
|
|
|
|
|
|
|
return Writer
|
|
|
|
return Writer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_xinference() -> Any:
|
|
|
|
def _import_xinference() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.xinference import Xinference
|
|
|
|
from langchain_community.llms.xinference import Xinference
|
|
|
|
|
|
|
|
|
|
|
|
return Xinference
|
|
|
|
return Xinference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_yandex_gpt() -> Any:
|
|
|
|
def _import_yandex_gpt() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.yandex import YandexGPT
|
|
|
|
from langchain_community.llms.yandex import YandexGPT
|
|
|
|
|
|
|
|
|
|
|
|
return YandexGPT
|
|
|
|
return YandexGPT
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_yuan2() -> Any:
|
|
|
|
def _import_yuan2() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.yuan2 import Yuan2
|
|
|
|
from langchain_community.llms.yuan2 import Yuan2
|
|
|
|
|
|
|
|
|
|
|
|
return Yuan2
|
|
|
|
return Yuan2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_volcengine_maas() -> Any:
|
|
|
|
def _import_volcengine_maas() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.volcengine_maas import VolcEngineMaasLLM
|
|
|
|
from langchain_community.llms.volcengine_maas import VolcEngineMaasLLM
|
|
|
|
|
|
|
|
|
|
|
|
return VolcEngineMaasLLM
|
|
|
|
return VolcEngineMaasLLM
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _import_sparkllm() -> Any:
|
|
|
|
def _import_sparkllm() -> Type[BaseLLM]:
|
|
|
|
from langchain_community.llms.sparkllm import SparkLLM
|
|
|
|
from langchain_community.llms.sparkllm import SparkLLM
|
|
|
|
|
|
|
|
|
|
|
|
return SparkLLM
|
|
|
|
return SparkLLM
|
|
|
|