The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
Minor: Remove duplicated word in error message (#2706)
vinoyang8073bc849f7b
diff --git a/langchain/chains/llm_requests.py b/langchain/chains/llm_requests.pyindex 2ea34cc7ec..4abab04175 100644--- a/langchain/chains/llm_requests.py+++ b/langchain/chains/llm_requests.py@@ -57,7 +57,7 @@ class LLMRequestsChain(Chain):except ImportError:raise ValueError("Could not import bs4 python package. "- "Please it install it with `pip install bs4`."+ "Please install it with `pip install bs4`.")return valuesdiff --git a/langchain/chains/moderation.py b/langchain/chains/moderation.pyindex f7221c0435..1e76c43604 100644--- a/langchain/chains/moderation.py+++ b/langchain/chains/moderation.py@@ -55,7 +55,7 @@ class OpenAIModerationChain(Chain):except ImportError:raise ValueError("Could not import openai python package. "- "Please it install it with `pip install openai`."+ "Please install it with `pip install openai`.")return valuesdiff --git a/langchain/chains/natbot/crawler.py b/langchain/chains/natbot/crawler.pyindex 7275ce7a2b..91f3b8cc34 100644--- a/langchain/chains/natbot/crawler.py+++ b/langchain/chains/natbot/crawler.py@@ -53,7 +53,7 @@ class Crawler:except ImportError:raise ValueError("Could not import playwright python package. "- "Please it install it with `pip install playwright`."+ "Please install it with `pip install playwright`.")self.browser: Browser = (sync_playwright().start().chromium.launch(headless=False)diff --git a/langchain/chat_models/azure_openai.py b/langchain/chat_models/azure_openai.pyindex 510d28ecb9..1327665af8 100644--- a/langchain/chat_models/azure_openai.py+++ b/langchain/chat_models/azure_openai.py@@ -87,7 +87,7 @@ class AzureChatOpenAI(ChatOpenAI):except ImportError:raise ValueError("Could not import openai python package. "- "Please it install it with `pip install openai`."+ "Please install it with `pip install openai`.")try:values["client"] = openai.ChatCompletiondiff --git a/langchain/chat_models/openai.py b/langchain/chat_models/openai.pyindex eb4b031574..69e3f9fd2a 100644--- a/langchain/chat_models/openai.py+++ b/langchain/chat_models/openai.py@@ -167,7 +167,7 @@ class ChatOpenAI(BaseChatModel):except ImportError:raise ValueError("Could not import openai python package. "- "Please it install it with `pip install openai`."+ "Please install it with `pip install openai`.")try:values["client"] = openai.ChatCompletion@@ -336,7 +336,7 @@ class ChatOpenAI(BaseChatModel):raise ValueError("Could not import tiktoken python package. ""This is needed in order to calculate get_num_tokens. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")# create a GPT-3.5-Turbo encoder instanceenc = tiktoken.encoding_for_model(self.model_name)@@ -358,7 +358,7 @@ class ChatOpenAI(BaseChatModel):raise ValueError("Could not import tiktoken python package. ""This is needed in order to calculate get_num_tokens. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")model = self.model_namediff --git a/langchain/document_loaders/azure_blob_storage_container.py b/langchain/document_loaders/azure_blob_storage_container.pyindex 0598de8852..f63716e0db 100644--- a/langchain/document_loaders/azure_blob_storage_container.py+++ b/langchain/document_loaders/azure_blob_storage_container.py@@ -24,7 +24,7 @@ class AzureBlobStorageContainerLoader(BaseLoader):except ImportError as exc:raise ValueError("Could not import azure storage blob python package. "- "Please it install it with `pip install azure-storage-blob`."+ "Please install it with `pip install azure-storage-blob`.") from exccontainer = ContainerClient.from_connection_string(diff --git a/langchain/document_loaders/azure_blob_storage_file.py b/langchain/document_loaders/azure_blob_storage_file.pyindex 59c8e8c133..2fea91ffb3 100644--- a/langchain/document_loaders/azure_blob_storage_file.py+++ b/langchain/document_loaders/azure_blob_storage_file.py@@ -24,7 +24,7 @@ class AzureBlobStorageFileLoader(BaseLoader):except ImportError as exc:raise ValueError("Could not import azure storage blob python package. "- "Please it install it with `pip install azure-storage-blob`."+ "Please install it with `pip install azure-storage-blob`.") from excclient = BlobClient.from_connection_string(diff --git a/langchain/document_loaders/duckdb_loader.py b/langchain/document_loaders/duckdb_loader.pyindex bd8418747b..5b7b038691 100644--- a/langchain/document_loaders/duckdb_loader.py+++ b/langchain/document_loaders/duckdb_loader.py@@ -35,7 +35,7 @@ class DuckDBLoader(BaseLoader):except ImportError:raise ValueError("Could not import duckdb python package. "- "Please it install it with `pip install duckdb`."+ "Please install it with `pip install duckdb`.")docs = []diff --git a/langchain/document_loaders/gcs_directory.py b/langchain/document_loaders/gcs_directory.pyindex 52939eb3b0..6c38f681c5 100644--- a/langchain/document_loaders/gcs_directory.py+++ b/langchain/document_loaders/gcs_directory.py@@ -22,7 +22,7 @@ class GCSDirectoryLoader(BaseLoader):except ImportError:raise ValueError("Could not import google-cloud-storage python package. "- "Please it install it with `pip install google-cloud-storage`."+ "Please install it with `pip install google-cloud-storage`.")client = storage.Client(project=self.project_name)docs = []diff --git a/langchain/document_loaders/gcs_file.py b/langchain/document_loaders/gcs_file.pyindex d6fb172d93..9397bafe98 100644--- a/langchain/document_loaders/gcs_file.py+++ b/langchain/document_loaders/gcs_file.py@@ -23,7 +23,7 @@ class GCSFileLoader(BaseLoader):except ImportError:raise ValueError("Could not import google-cloud-storage python package. "- "Please it install it with `pip install google-cloud-storage`."+ "Please install it with `pip install google-cloud-storage`.")# Initialise a clientdiff --git a/langchain/document_loaders/s3_directory.py b/langchain/document_loaders/s3_directory.pyindex 98fa440881..31386539d2 100644--- a/langchain/document_loaders/s3_directory.py+++ b/langchain/document_loaders/s3_directory.py@@ -21,7 +21,7 @@ class S3DirectoryLoader(BaseLoader):except ImportError:raise ValueError("Could not import boto3 python package. "- "Please it install it with `pip install boto3`."+ "Please install it with `pip install boto3`.")s3 = boto3.resource("s3")bucket = s3.Bucket(self.bucket)diff --git a/langchain/document_loaders/s3_file.py b/langchain/document_loaders/s3_file.pyindex f78913b21c..ec872a7245 100644--- a/langchain/document_loaders/s3_file.py+++ b/langchain/document_loaders/s3_file.py@@ -23,7 +23,7 @@ class S3FileLoader(BaseLoader):except ImportError:raise ValueError("Could not import boto3 python package. "- "Please it install it with `pip install boto3`."+ "Please install it with `pip install boto3`.")s3 = boto3.client("s3")with tempfile.TemporaryDirectory() as temp_dir:diff --git a/langchain/document_loaders/youtube.py b/langchain/document_loaders/youtube.pyindex 03c74022a2..e8cb1987cf 100644--- a/langchain/document_loaders/youtube.py+++ b/langchain/document_loaders/youtube.py@@ -118,7 +118,7 @@ class YoutubeLoader(BaseLoader):except ImportError:raise ImportError("Could not import youtube_transcript_api python package. "- "Please it install it with `pip install youtube-transcript-api`."+ "Please install it with `pip install youtube-transcript-api`.")metadata = {"source": self.video_id}@@ -159,7 +159,7 @@ class YoutubeLoader(BaseLoader):except ImportError:raise ImportError("Could not import pytube python package. "- "Please it install it with `pip install pytube`."+ "Please install it with `pip install pytube`.")yt = YouTube(f"https://www.youtube.com/watch?v={self.video_id}")video_info = {diff --git a/langchain/embeddings/aleph_alpha.py b/langchain/embeddings/aleph_alpha.pyindex 97da5ff305..aa207d3e25 100644--- a/langchain/embeddings/aleph_alpha.py+++ b/langchain/embeddings/aleph_alpha.py@@ -58,7 +58,7 @@ class AlephAlphaAsymmetricSemanticEmbedding(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import aleph_alpha_client python package. "- "Please it install it with `pip install aleph_alpha_client`."+ "Please install it with `pip install aleph_alpha_client`.")values["client"] = Client(token=aleph_alpha_api_key)return values@@ -81,7 +81,7 @@ class AlephAlphaAsymmetricSemanticEmbedding(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import aleph_alpha_client python package. "- "Please it install it with `pip install aleph_alpha_client`."+ "Please install it with `pip install aleph_alpha_client`.")document_embeddings = []@@ -121,7 +121,7 @@ class AlephAlphaAsymmetricSemanticEmbedding(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import aleph_alpha_client python package. "- "Please it install it with `pip install aleph_alpha_client`."+ "Please install it with `pip install aleph_alpha_client`.")symmetric_params = {"prompt": Prompt.from_text(text),@@ -166,7 +166,7 @@ class AlephAlphaSymmetricSemanticEmbedding(AlephAlphaAsymmetricSemanticEmbeddingexcept ImportError:raise ValueError("Could not import aleph_alpha_client python package. "- "Please it install it with `pip install aleph_alpha_client`."+ "Please install it with `pip install aleph_alpha_client`.")query_params = {"prompt": Prompt.from_text(text),diff --git a/langchain/embeddings/cohere.py b/langchain/embeddings/cohere.pyindex b5dda307c3..527bb2c537 100644--- a/langchain/embeddings/cohere.py+++ b/langchain/embeddings/cohere.py@@ -48,7 +48,7 @@ class CohereEmbeddings(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import cohere python package. "- "Please it install it with `pip install cohere`."+ "Please install it with `pip install cohere`.")return valuesdiff --git a/langchain/embeddings/huggingface_hub.py b/langchain/embeddings/huggingface_hub.pyindex 66c662f055..6273ac2605 100644--- a/langchain/embeddings/huggingface_hub.py+++ b/langchain/embeddings/huggingface_hub.py@@ -73,7 +73,7 @@ class HuggingFaceHubEmbeddings(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import huggingface_hub python package. "- "Please it install it with `pip install huggingface_hub`."+ "Please install it with `pip install huggingface_hub`.")return valuesdiff --git a/langchain/embeddings/jina.py b/langchain/embeddings/jina.pyindex b75a831f46..b5b3d8ce38 100644--- a/langchain/embeddings/jina.py+++ b/langchain/embeddings/jina.py@@ -36,7 +36,7 @@ class JinaEmbeddings(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import `jina` python package. "- "Please it install it with `pip install jina`."+ "Please install it with `pip install jina`.")# Setup clientdiff --git a/langchain/embeddings/openai.py b/langchain/embeddings/openai.pyindex 9a78984bfe..74765c6592 100644--- a/langchain/embeddings/openai.py+++ b/langchain/embeddings/openai.py@@ -188,7 +188,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import openai python package. "- "Please it install it with `pip install openai`."+ "Please install it with `pip install openai`.")return values@@ -242,7 +242,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):raise ValueError("Could not import tiktoken python package. ""This is needed in order to for OpenAIEmbeddings. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")def _embedding_func(self, text: str, *, engine: str) -> List[float]:diff --git a/langchain/embeddings/sagemaker_endpoint.py b/langchain/embeddings/sagemaker_endpoint.pyindex 6fc221873c..e1371a7d99 100644--- a/langchain/embeddings/sagemaker_endpoint.py+++ b/langchain/embeddings/sagemaker_endpoint.py@@ -131,7 +131,7 @@ class SagemakerEndpointEmbeddings(BaseModel, Embeddings):except ImportError:raise ValueError("Could not import boto3 python package. "- "Please it install it with `pip install boto3`."+ "Please install it with `pip install boto3`.")return valuesdiff --git a/langchain/graphs/networkx_graph.py b/langchain/graphs/networkx_graph.pyindex c49a1ad9a6..813eb3f220 100644--- a/langchain/graphs/networkx_graph.py+++ b/langchain/graphs/networkx_graph.py@@ -56,7 +56,7 @@ class NetworkxEntityGraph:except ImportError:raise ValueError("Could not import networkx python package. "- "Please it install it with `pip install networkx`."+ "Please install it with `pip install networkx`.")if graph is not None:if not isinstance(graph, nx.DiGraph):@@ -72,7 +72,7 @@ class NetworkxEntityGraph:except ImportError:raise ValueError("Could not import networkx python package. "- "Please it install it with `pip install networkx`."+ "Please install it with `pip install networkx`.")graph = nx.read_gml(gml_path)return cls(graph)diff --git a/langchain/llms/aleph_alpha.py b/langchain/llms/aleph_alpha.pyindex 238622753a..dd17bc44d6 100644--- a/langchain/llms/aleph_alpha.py+++ b/langchain/llms/aleph_alpha.py@@ -149,7 +149,7 @@ class AlephAlpha(LLM):except ImportError:raise ValueError("Could not import aleph_alpha_client python package. "- "Please it install it with `pip install aleph_alpha_client`."+ "Please install it with `pip install aleph_alpha_client`.")return valuesdiff --git a/langchain/llms/anthropic.py b/langchain/llms/anthropic.pyindex f6b7dee801..bc4cfd4203 100644--- a/langchain/llms/anthropic.py+++ b/langchain/llms/anthropic.py@@ -76,7 +76,7 @@ class Anthropic(LLM):except ImportError:raise ValueError("Could not import anthropic python package. "- "Please it install it with `pip install anthropic`."+ "Please install it with `pip install anthropic`.")return valuesdiff --git a/langchain/llms/cohere.py b/langchain/llms/cohere.pyindex e69aac1d09..91894d1b57 100644--- a/langchain/llms/cohere.py+++ b/langchain/llms/cohere.py@@ -73,7 +73,7 @@ class Cohere(LLM):except ImportError:raise ValueError("Could not import cohere python package. "- "Please it install it with `pip install cohere`."+ "Please install it with `pip install cohere`.")return valuesdiff --git a/langchain/llms/huggingface_endpoint.py b/langchain/llms/huggingface_endpoint.pyindex d2682bc0b0..7f7561c866 100644--- a/langchain/llms/huggingface_endpoint.py+++ b/langchain/llms/huggingface_endpoint.py@@ -70,7 +70,7 @@ class HuggingFaceEndpoint(LLM):except ImportError:raise ValueError("Could not import huggingface_hub python package. "- "Please it install it with `pip install huggingface_hub`."+ "Please install it with `pip install huggingface_hub`.")return valuesdiff --git a/langchain/llms/huggingface_hub.py b/langchain/llms/huggingface_hub.pyindex 4a8c259e77..e7d3af993c 100644--- a/langchain/llms/huggingface_hub.py+++ b/langchain/llms/huggingface_hub.py@@ -66,7 +66,7 @@ class HuggingFaceHub(LLM):except ImportError:raise ValueError("Could not import huggingface_hub python package. "- "Please it install it with `pip install huggingface_hub`."+ "Please install it with `pip install huggingface_hub`.")return valuesdiff --git a/langchain/llms/manifest.py b/langchain/llms/manifest.pyindex f44635e169..f6042144b0 100644--- a/langchain/llms/manifest.py+++ b/langchain/llms/manifest.py@@ -28,7 +28,7 @@ class ManifestWrapper(LLM):except ImportError:raise ValueError("Could not import manifest python package. "- "Please it install it with `pip install manifest-ml`."+ "Please install it with `pip install manifest-ml`.")return valuesdiff --git a/langchain/llms/nlpcloud.py b/langchain/llms/nlpcloud.pyindex 74451d7f92..b3b25d0b5d 100644--- a/langchain/llms/nlpcloud.py+++ b/langchain/llms/nlpcloud.py@@ -76,7 +76,7 @@ class NLPCloud(LLM):except ImportError:raise ValueError("Could not import nlpcloud python package. "- "Please it install it with `pip install nlpcloud`."+ "Please install it with `pip install nlpcloud`.")return valuesdiff --git a/langchain/llms/openai.py b/langchain/llms/openai.pyindex 21a089a40f..b6219f7eda 100644--- a/langchain/llms/openai.py+++ b/langchain/llms/openai.py@@ -446,7 +446,7 @@ class BaseOpenAI(BaseLLM):raise ValueError("Could not import tiktoken python package. ""This is needed in order to calculate get_num_tokens. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")encoder = "gpt2"if self.model_name in ("text-davinci-003", "text-davinci-002"):@@ -611,7 +611,7 @@ class OpenAIChat(BaseLLM):except ImportError:raise ValueError("Could not import openai python package. "- "Please it install it with `pip install openai`."+ "Please install it with `pip install openai`.")try:values["client"] = openai.ChatCompletion@@ -742,7 +742,7 @@ class OpenAIChat(BaseLLM):raise ValueError("Could not import tiktoken python package. ""This is needed in order to calculate get_num_tokens. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")# create a GPT-3.5-Turbo encoder instanceenc = tiktoken.encoding_for_model("gpt-3.5-turbo")diff --git a/langchain/llms/sagemaker_endpoint.py b/langchain/llms/sagemaker_endpoint.pyindex 401b1c88b0..d9efe51a3c 100644--- a/langchain/llms/sagemaker_endpoint.py+++ b/langchain/llms/sagemaker_endpoint.py@@ -176,7 +176,7 @@ class SagemakerEndpoint(LLM):except ImportError:raise ValueError("Could not import boto3 python package. "- "Please it install it with `pip install boto3`."+ "Please install it with `pip install boto3`.")return valuesdiff --git a/langchain/schema.py b/langchain/schema.pyindex cc8e77bedd..2acb427391 100644--- a/langchain/schema.py+++ b/langchain/schema.py@@ -194,7 +194,7 @@ class BaseLanguageModel(BaseModel, ABC):raise ValueError("Could not import transformers python package. ""This is needed in order to calculate get_num_tokens. "- "Please it install it with `pip install transformers`."+ "Please install it with `pip install transformers`.")# create a GPT-3 tokenizer instancetokenizer = GPT2TokenizerFast.from_pretrained("gpt2")diff --git a/langchain/text_splitter.py b/langchain/text_splitter.pyindex 9da309a317..d189296b74 100644--- a/langchain/text_splitter.py+++ b/langchain/text_splitter.py@@ -131,7 +131,7 @@ class TextSplitter(ABC):except ImportError:raise ValueError("Could not import transformers python package. "- "Please it install it with `pip install transformers`."+ "Please install it with `pip install transformers`.")return cls(length_function=_huggingface_tokenizer_length, **kwargs)@@ -150,7 +150,7 @@ class TextSplitter(ABC):raise ValueError("Could not import tiktoken python package. ""This is needed in order to calculate max_tokens_for_prompt. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")# create a GPT-3 encoder instance@@ -205,7 +205,7 @@ class TokenTextSplitter(TextSplitter):raise ValueError("Could not import tiktoken python package. ""This is needed in order to for TokenTextSplitter. "- "Please it install it with `pip install tiktoken`."+ "Please install it with `pip install tiktoken`.")# create a GPT-3 encoder instanceself._tokenizer = tiktoken.get_encoding(encoding_name)diff --git a/langchain/utilities/wikipedia.py b/langchain/utilities/wikipedia.pyindex 259e8a44cc..5b7ab964c0 100644--- a/langchain/utilities/wikipedia.py+++ b/langchain/utilities/wikipedia.py@@ -31,7 +31,7 @@ class WikipediaAPIWrapper(BaseModel):except ImportError:raise ValueError("Could not import wikipedia python package. "- "Please it install it with `pip install wikipedia`."+ "Please install it with `pip install wikipedia`.")return values