Skip to content

The agent engineering platform.

infra: rm unused # noqa violations (#22049)

Bagatur50186da0a1fa
diff --git a/.github/scripts/check_diff.py b/.github/scripts/check_diff.py
index 3489018d80..e5fe87843b 100644
--- a/.github/scripts/check_diff.py
+++ b/.github/scripts/check_diff.py
@@ -91,4 +91,4 @@ if __name__ == "__main__":
}
for key, value in outputs.items():
json_output = json.dumps(value)
- print(f"{key}={json_output}") # noqa: T201
+ print(f"{key}={json_output}")
diff --git a/.github/scripts/get_min_versions.py b/.github/scripts/get_min_versions.py
index a26cc021db..e942b4b528 100644
--- a/.github/scripts/get_min_versions.py
+++ b/.github/scripts/get_min_versions.py
@@ -76,4 +76,4 @@ if __name__ == "__main__":
print(
" ".join([f"{lib}=={version}" for lib, version in min_versions.items()])
- ) # noqa: T201
+ )
diff --git a/.github/workflows/extract_ignored_words_list.py b/.github/workflows/extract_ignored_words_list.py
index bb949d14f7..7c800e0df0 100644
--- a/.github/workflows/extract_ignored_words_list.py
+++ b/.github/workflows/extract_ignored_words_list.py
@@ -7,4 +7,4 @@ ignore_words_list = (
pyproject_toml.get("tool", {}).get("codespell", {}).get("ignore-words-list")
)
-print(f"::set-output name=ignore_words_list::{ignore_words_list}") # noqa: T201
+print(f"::set-output name=ignore_words_list::{ignore_words_list}")
diff --git a/cookbook/rag_with_quantized_embeddings.ipynb b/cookbook/rag_with_quantized_embeddings.ipynb
index 79a85d5cc5..a071ec21b1 100644
--- a/cookbook/rag_with_quantized_embeddings.ipynb
+++ b/cookbook/rag_with_quantized_embeddings.ipynb
@@ -39,12 +39,10 @@
"from langchain_community.document_loaders.recursive_url_loader import (\n",
" RecursiveUrlLoader,\n",
")\n",
- "\n",
- "# noqa\n",
"from langchain_community.vectorstores import Chroma\n",
"\n",
"# For our example, we'll load docs from the web\n",
- "from langchain_text_splitters import RecursiveCharacterTextSplitter # noqa\n",
+ "from langchain_text_splitters import RecursiveCharacterTextSplitter\n",
"\n",
"DOCSTORE_DIR = \".\"\n",
"DOCSTORE_ID_KEY = \"doc_id\""
diff --git a/docs/api_reference/create_api_rst.py b/docs/api_reference/create_api_rst.py
index a43aadf72d..504d71a5b9 100644
--- a/docs/api_reference/create_api_rst.py
+++ b/docs/api_reference/create_api_rst.py
@@ -187,7 +187,7 @@ def _load_package_modules(
modules_by_namespace[top_namespace] = _module_members
except ImportError as e:
- print(f"Error: Unable to import module '{namespace}' with error: {e}") # noqa: T201
+ print(f"Error: Unable to import module '{namespace}' with error: {e}")
return modules_by_namespace
diff --git a/docs/docs/how_to/graph_mapping.ipynb b/docs/docs/how_to/graph_mapping.ipynb
index 93c0013441..df3d08b8b8 100644
--- a/docs/docs/how_to/graph_mapping.ipynb
+++ b/docs/docs/how_to/graph_mapping.ipynb
@@ -300,7 +300,7 @@
"Entities in the question map to the following database values:\n",
"{entities_list}\n",
"Question: {question}\n",
- "Cypher query:\"\"\" # noqa: E501\n",
+ "Cypher query:\"\"\"\n",
"\n",
"cypher_prompt = ChatPromptTemplate.from_messages(\n",
" [\n",
@@ -377,7 +377,7 @@
"response_template = \"\"\"Based on the the question, Cypher query, and Cypher response, write a natural language response:\n",
"Question: {question}\n",
"Cypher query: {query}\n",
- "Cypher Response: {response}\"\"\" # noqa: E501\n",
+ "Cypher Response: {response}\"\"\"\n",
"\n",
"response_prompt = ChatPromptTemplate.from_messages(\n",
" [\n",
diff --git a/docs/docs/how_to/sql_csv.ipynb b/docs/docs/how_to/sql_csv.ipynb
index 3e3ed1ce51..fc379c219d 100644
--- a/docs/docs/how_to/sql_csv.ipynb
+++ b/docs/docs/how_to/sql_csv.ipynb
@@ -503,7 +503,7 @@
}
],
"source": [
- "chain = prompt | llm_with_tools | parser | tool # noqa\n",
+ "chain = prompt | llm_with_tools | parser | tool\n",
"chain.invoke({\"question\": \"What's the correlation between age and fare\"})"
]
},
diff --git a/docs/docs/how_to/sql_large_db.ipynb b/docs/docs/how_to/sql_large_db.ipynb
index 6b98c1c516..199c3c4f76 100644
--- a/docs/docs/how_to/sql_large_db.ipynb
+++ b/docs/docs/how_to/sql_large_db.ipynb
@@ -262,7 +262,7 @@
" return tables\n",
"\n",
"\n",
- "table_chain = category_chain | get_tables # noqa\n",
+ "table_chain = category_chain | get_tables\n",
"table_chain.invoke({\"input\": \"What are all the genres of Alanis Morisette songs\"})"
]
},
diff --git a/docs/docs/integrations/chat/anthropic.ipynb b/docs/docs/integrations/chat/anthropic.ipynb
index 6ca0db0e5a..0120e7f044 100644
--- a/docs/docs/integrations/chat/anthropic.ipynb
+++ b/docs/docs/integrations/chat/anthropic.ipynb
@@ -670,7 +670,7 @@
" \"type\": \"image_url\",\n",
" \"image_url\": {\n",
" # langchain logo\n",
- " \"url\": f\"data:image/png;base64,{img_base64}\", # noqa: E501\n",
+ " \"url\": f\"data:image/png;base64,{img_base64}\",\n",
" },\n",
" },\n",
" {\"type\": \"text\", \"text\": \"What is this logo for?\"},\n",
diff --git a/docs/docs/integrations/chat_loaders/discord.ipynb b/docs/docs/integrations/chat_loaders/discord.ipynb
index 515d8cf27f..6b4c2529e9 100644
--- a/docs/docs/integrations/chat_loaders/discord.ipynb
+++ b/docs/docs/integrations/chat_loaders/discord.ipynb
@@ -95,7 +95,7 @@
" \"\"\"\n",
" self.path = path\n",
" self._message_line_regex = re.compile(\n",
- " r\"(.+?) — (\\w{3,9} \\d{1,2}(?:st|nd|rd|th)?(?:, \\d{4})? \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
+ " r\"(.+?) — (\\w{3,9} \\d{1,2}(?:st|nd|rd|th)?(?:, \\d{4})? \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
" flags=re.DOTALL,\n",
" )\n",
"\n",
@@ -120,7 +120,7 @@
" current_content = []\n",
" for line in lines:\n",
" if re.match(\n",
- " r\".+? — (\\d{2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
+ " r\".+? — (\\d{2}/\\d{2}/\\d{4} \\d{1,2}:\\d{2} (?:AM|PM)|Today at \\d{1,2}:\\d{2} (?:AM|PM)|Yesterday at \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
" line,\n",
" ):\n",
" if current_sender and current_content:\n",
diff --git a/docs/docs/integrations/chat_loaders/wechat.ipynb b/docs/docs/integrations/chat_loaders/wechat.ipynb
index b2602070ae..40aee0e1ee 100644
--- a/docs/docs/integrations/chat_loaders/wechat.ipynb
+++ b/docs/docs/integrations/chat_loaders/wechat.ipynb
@@ -94,7 +94,7 @@
" \"\"\"\n",
" self.path = path\n",
" self._message_line_regex = re.compile(\n",
- " r\"(?P<sender>.+?) (?P<timestamp>\\d{4}/\\d{2}/\\d{2} \\d{1,2}:\\d{2} (?:AM|PM))\", # noqa\n",
+ " r\"(?P<sender>.+?) (?P<timestamp>\\d{4}/\\d{2}/\\d{2} \\d{1,2}:\\d{2} (?:AM|PM))\",\n",
" # flags=re.DOTALL,\n",
" )\n",
"\n",
diff --git a/docs/docs/integrations/document_loaders/example_data/source_code/example.py b/docs/docs/integrations/document_loaders/example_data/source_code/example.py
index 5838764ee4..2a2760b6a6 100644
--- a/docs/docs/integrations/document_loaders/example_data/source_code/example.py
+++ b/docs/docs/integrations/document_loaders/example_data/source_code/example.py
@@ -3,7 +3,7 @@ class MyClass:
self.name = name
def greet(self):
- print(f"Hello, {self.name}!") # noqa: T201
+ print(f"Hello, {self.name}!")
def main():
diff --git a/docs/scripts/arxiv_references.py b/docs/scripts/arxiv_references.py
index 76e22526c3..7657b788bf 100644
--- a/docs/scripts/arxiv_references.py
+++ b/docs/scripts/arxiv_references.py
@@ -389,7 +389,7 @@ class ArxivAPIWrapper(BaseModel):
Returns:
List of ArxivPaper objects.
- """ # noqa: E501
+ """
def cut_authors(authors: list) -> list[str]:
if len(authors) > 3:
diff --git a/docs/scripts/generate_api_reference_links.py b/docs/scripts/generate_api_reference_links.py
index 31f4b22fa4..9084b381f5 100644
--- a/docs/scripts/generate_api_reference_links.py
+++ b/docs/scripts/generate_api_reference_links.py
@@ -186,7 +186,7 @@ def replace_imports(file):
data = code_block_re.sub(replacer, data)
# if all_imports:
- # print(f"Adding {len(all_imports)} links for imports in {file}") # noqa: T201
+ # print(f"Adding {len(all_imports)} links for imports in {file}")
with open(file, "w") as f:
f.write(data)
return all_imports
diff --git a/docs/scripts/model_feat_table.py b/docs/scripts/model_feat_table.py
index eb3ac8679a..725ff21800 100644
--- a/docs/scripts/model_feat_table.py
+++ b/docs/scripts/model_feat_table.py
@@ -116,7 +116,7 @@ Each LLM integration can optionally provide native implementations for async, st
{table}
-""" # noqa: E501
+"""
CHAT_MODEL_TEMPLATE = """\
---
@@ -133,7 +133,7 @@ The following table shows all the chat models that support one or more advanced
{table}
-""" # noqa: E501
+"""
def get_llm_table():
diff --git a/libs/cli/tests/unit_tests/migrate/test_replace_imports.py b/libs/cli/tests/unit_tests/migrate/test_replace_imports.py
index c75b1db74f..627acb49f2 100644
--- a/libs/cli/tests/unit_tests/migrate/test_replace_imports.py
+++ b/libs/cli/tests/unit_tests/migrate/test_replace_imports.py
@@ -17,7 +17,7 @@ ReplaceImportsCodemod = generate_import_replacer(
"langchain_to_core",
"community_to_core",
]
-) # type: ignore[attr-defined] # noqa: E501
+) # type: ignore[attr-defined]
class TestReplaceImportsCommand(CodemodTest):
diff --git a/libs/community/langchain_community/callbacks/manager.py b/libs/community/langchain_community/callbacks/manager.py
index f5b4530ea2..ba94208495 100644
--- a/libs/community/langchain_community/callbacks/manager.py
+++ b/libs/community/langchain_community/callbacks/manager.py
@@ -28,7 +28,7 @@ bedrock_anthropic_callback_var: (ContextVar)[
wandb_tracing_callback_var: ContextVar[Optional[WandbTracer]] = ContextVar(
"tracing_wandb_callback", default=None
)
-comet_tracing_callback_var: ContextVar[Optional[CometTracer]] = ContextVar( # noqa: E501
+comet_tracing_callback_var: ContextVar[Optional[CometTracer]] = ContextVar(
"tracing_comet_callback", default=None
)
diff --git a/libs/community/langchain_community/chat_loaders/langsmith.py b/libs/community/langchain_community/chat_loaders/langsmith.py
index 02a16d895e..7d099632c0 100644
--- a/libs/community/langchain_community/chat_loaders/langsmith.py
+++ b/libs/community/langchain_community/chat_loaders/langsmith.py
@@ -143,7 +143,7 @@ class LangSmithDatasetChatLoader(BaseChatLoader):
:return: Iterator of chat sessions containing messages.
"""
- from langchain_community.adapters import openai as oai_adapter # noqa: E402
+ from langchain_community.adapters import openai as oai_adapter
data = self.client.read_dataset_openai_finetuning(
dataset_name=self.dataset_name
diff --git a/libs/community/langchain_community/chat_message_histories/cosmos_db.py b/libs/community/langchain_community/chat_message_histories/cosmos_db.py
index 4210d7a707..87fc1e8be5 100644
--- a/libs/community/langchain_community/chat_message_histories/cosmos_db.py
+++ b/libs/community/langchain_community/chat_message_histories/cosmos_db.py
@@ -62,7 +62,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
self.messages: List[BaseMessage] = []
try:
- from azure.cosmos import ( # pylint: disable=import-outside-toplevel # noqa: E501
+ from azure.cosmos import ( # pylint: disable=import-outside-toplevel
CosmosClient,
)
except ImportError as exc:
@@ -91,7 +91,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
Use this function or the context manager to make sure your database is ready.
"""
try:
- from azure.cosmos import ( # pylint: disable=import-outside-toplevel # noqa: E501
+ from azure.cosmos import ( # pylint: disable=import-outside-toplevel
PartitionKey,
)
except ImportError as exc:
@@ -128,7 +128,7 @@ class CosmosDBChatMessageHistory(BaseChatMessageHistory):
if not self._container:
raise ValueError("Container not initialized")
try:
- from azure.cosmos.exceptions import ( # pylint: disable=import-outside-toplevel # noqa: E501
+ from azure.cosmos.exceptions import ( # pylint: disable=import-outside-toplevel
CosmosHttpResponseError,
)
except ImportError as exc:
diff --git a/libs/community/langchain_community/chat_models/azure_openai.py b/libs/community/langchain_community/chat_models/azure_openai.py
index 3834668c1f..3238cabe74 100644
--- a/libs/community/langchain_community/chat_models/azure_openai.py
+++ b/libs/community/langchain_community/chat_models/azure_openai.py
@@ -85,7 +85,7 @@ class AzureChatOpenAI(ChatOpenAI):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
diff --git a/libs/community/langchain_community/chat_models/azureml_endpoint.py b/libs/community/langchain_community/chat_models/azureml_endpoint.py
index 5f2a3f59c3..2629c5a0ba 100644
--- a/libs/community/langchain_community/chat_models/azureml_endpoint.py
+++ b/libs/community/langchain_community/chat_models/azureml_endpoint.py
@@ -233,7 +233,7 @@ class AzureMLChatOnlineEndpoint(BaseChatModel, AzureMLBaseEndpoint):
endpoint_api_key="my-api-key",
content_formatter=chat_content_formatter,
)
- """ # noqa: E501
+ """
@property
def _identifying_params(self) -> Dict[str, Any]:
diff --git a/libs/community/langchain_community/document_loaders/__init__.py b/libs/community/langchain_community/document_loaders/__init__.py
index 1977498691..7f111b1aae 100644
--- a/libs/community/langchain_community/document_loaders/__init__.py
+++ b/libs/community/langchain_community/document_loaders/__init__.py
@@ -214,7 +214,7 @@ if TYPE_CHECKING:
GitHubIssuesLoader,
)
from langchain_community.document_loaders.glue_catalog import (
- GlueCatalogLoader, # noqa: F401
+ GlueCatalogLoader,
)
from langchain_community.document_loaders.google_speech_to_text import (
GoogleSpeechToTextLoader,
@@ -332,8 +332,8 @@ if TYPE_CHECKING:
OracleAutonomousDatabaseLoader,
)
from langchain_community.document_loaders.oracleai import (
- OracleDocLoader, # noqa: F401
- OracleTextSplitter, # noqa: F401
+ OracleDocLoader,
+ OracleTextSplitter,
)
from langchain_community.document_loaders.org_mode import (
UnstructuredOrgModeLoader,
diff --git a/libs/community/langchain_community/document_loaders/blackboard.py b/libs/community/langchain_community/document_loaders/blackboard.py
index 682eafb3ce..0141f2af91 100644
--- a/libs/community/langchain_community/document_loaders/blackboard.py
+++ b/libs/community/langchain_community/document_loaders/blackboard.py
@@ -31,7 +31,7 @@ class BlackboardLoader(WebBaseLoader):
)
documents = loader.load()
- """ # noqa: E501
+ """
def __init__(
self,
diff --git a/libs/community/langchain_community/document_loaders/evernote.py b/libs/community/langchain_community/document_loaders/evernote.py
index 07ade0ce5d..296e4bcd7e 100644
--- a/libs/community/langchain_community/document_loaders/evernote.py
+++ b/libs/community/langchain_community/document_loaders/evernote.py
@@ -34,7 +34,7 @@ class EverNoteLoader(BaseLoader):
notes into a single long Document.
If this is set to True (default) then the only metadata on the document will be
the 'source' which contains the file name of the export.
- """ # noqa: E501
+ """
def __init__(self, file_path: Union[str, Path], load_single_document: bool = True):
"""Initialize with file path."""
diff --git a/libs/community/langchain_community/document_loaders/pebblo.py b/libs/community/langchain_community/document_loaders/pebblo.py
index 4bc3aa1db5..8a710a9a5b 100644
--- a/libs/community/langchain_community/document_loaders/pebblo.py
+++ b/libs/community/langchain_community/document_loaders/pebblo.py
@@ -208,9 +208,9 @@ class PebbloSafeLoader(BaseLoader):
if loading_end is True:
payload["loading_end"] = "true"
if "loader_details" in payload:
- payload["loader_details"]["source_aggregate_size"] = ( # noqa
- self.source_aggregate_size
- )
+ payload["loader_details"][
+ "source_aggregate_size"
+ ] = self.source_aggregate_size
payload = Doc(**payload).dict(exclude_unset=True)
load_doc_url = f"{self.classifier_url}{LOADER_DOC_URL}"
classified_docs = []
diff --git a/libs/community/langchain_community/document_transformers/__init__.py b/libs/community/langchain_community/document_transformers/__init__.py
index 1fb3154d0c..14aa448841 100644
--- a/libs/community/langchain_community/document_transformers/__init__.py
+++ b/libs/community/langchain_community/document_transformers/__init__.py
@@ -81,7 +81,7 @@ _module_lookup = {
"GoogleTranslateTransformer": "langchain_community.document_transformers.google_translate", # noqa: E501
"Html2TextTransformer": "langchain_community.document_transformers.html2text",
"LongContextReorder": "langchain_community.document_transformers.long_context_reorder", # noqa: E501
- "MarkdownifyTransformer": "langchain_community.document_transformers.markdownify", # noqa: E501
+ "MarkdownifyTransformer": "langchain_community.document_transformers.markdownify",
"NucliaTextTransformer": "langchain_community.document_transformers.nuclia_text_transform", # noqa: E501
"OpenAIMetadataTagger": "langchain_community.document_transformers.openai_functions", # noqa: E501
"get_stateful_documents": "langchain_community.document_transformers.embeddings_redundant_filter", # noqa: E501
diff --git a/libs/community/langchain_community/document_transformers/openai_functions.py b/libs/community/langchain_community/document_transformers/openai_functions.py
index 5c9dec22e6..ccad6ab1ec 100644
--- a/libs/community/langchain_community/document_transformers/openai_functions.py
+++ b/libs/community/langchain_community/document_transformers/openai_functions.py
@@ -57,7 +57,7 @@ class OpenAIMetadataTagger(BaseDocumentTransformer, BaseModel):
new_documents = []
for document in documents:
- extracted_metadata: Dict = self.tagging_chain.run(document.page_content) # type: ignore[assignment] # noqa: E501
+ extracted_metadata: Dict = self.tagging_chain.run(document.page_content) # type: ignore[assignment]
new_document = Document(
page_content=document.page_content,
metadata={**extracted_metadata, **document.metadata},
diff --git a/libs/community/langchain_community/embeddings/__init__.py b/libs/community/langchain_community/embeddings/__init__.py
index b6e3f88361..5f72f23299 100644
--- a/libs/community/langchain_community/embeddings/__init__.py
+++ b/libs/community/langchain_community/embeddings/__init__.py
@@ -173,7 +173,7 @@ if TYPE_CHECKING:
QuantizedBiEncoderEmbeddings,
)
from langchain_community.embeddings.oracleai import (
- OracleEmbeddings, # noqa: F401
+ OracleEmbeddings,
)
from langchain_community.embeddings.premai import (
PremAIEmbeddings,
diff --git a/libs/community/langchain_community/embeddings/azure_openai.py b/libs/community/langchain_community/embeddings/azure_openai.py
index c8eb14ddac..f8eeca2b2c 100644
--- a/libs/community/langchain_community/embeddings/azure_openai.py
+++ b/libs/community/langchain_community/embeddings/azure_openai.py
@@ -44,7 +44,7 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
diff --git a/libs/community/langchain_community/embeddings/elasticsearch.py b/libs/community/langchain_community/embeddings/elasticsearch.py
index 80596b6fd9..ea080ab9aa 100644
--- a/libs/community/langchain_community/embeddings/elasticsearch.py
+++ b/libs/community/langchain_community/embeddings/elasticsearch.py
@@ -25,7 +25,7 @@ class ElasticsearchEmbeddings(Embeddings):
In Elasticsearch you need to have an embedding model loaded and deployed.
- https://www.elastic.co/guide/en/elasticsearch/reference/current/infer-trained-model.html
- https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-deploy-models.html
- """ # noqa: E501
+ """
def __init__(
self,
diff --git a/libs/community/langchain_community/embeddings/infinity.py b/libs/community/langchain_community/embeddings/infinity.py
index f5068e64f6..9af640baf6 100644
--- a/libs/community/langchain_community/embeddings/infinity.py
+++ b/libs/community/langchain_community/embeddings/infinity.py
@@ -182,7 +182,7 @@ class TinyAsyncOpenAIInfinityEmbeddingClient: #: :meta private:
length_sorted_idx = np.argsort([-sorter(sen) for sen in texts])
texts_sorted = [texts[idx] for idx in length_sorted_idx]
- return texts_sorted, lambda unsorted_embeddings: [ # noqa E731
+ return texts_sorted, lambda unsorted_embeddings: [ # E731
unsorted_embeddings[idx] for idx in np.argsort(length_sorted_idx)
]
diff --git a/libs/community/langchain_community/embeddings/localai.py b/libs/community/langchain_community/embeddings/localai.py
index b5a926e8fe..fe620e9a6f 100644
--- a/libs/community/langchain_community/embeddings/localai.py
+++ b/libs/community/langchain_community/embeddings/localai.py
@@ -254,7 +254,7 @@ class LocalAIEmbeddings(BaseModel, Embeddings):
openai.proxy = {
"http": self.openai_proxy,
"https": self.openai_proxy,
- } # type: ignore[assignment] # noqa: E501
+ } # type: ignore[assignment]
return openai_args
def _embedding_func(self, text: str, *, engine: str) -> List[float]:
diff --git a/libs/community/langchain_community/embeddings/openai.py b/libs/community/langchain_community/embeddings/openai.py
index 3edff9055e..22ddac802a 100644
--- a/libs/community/langchain_community/embeddings/openai.py
+++ b/libs/community/langchain_community/embeddings/openai.py
@@ -390,7 +390,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
openai.proxy = {
"http": self.openai_proxy,
"https": self.openai_proxy,
- } # type: ignore[assignment] # noqa: E501
+ } # type: ignore[assignment]
return openai_args
# please refer to
diff --git a/libs/community/langchain_community/embeddings/yandex.py b/libs/community/langchain_community/embeddings/yandex.py
index 603ca91943..f396239d4f 100644
--- a/libs/community/langchain_community/embeddings/yandex.py
+++ b/libs/community/langchain_community/embeddings/yandex.py
@@ -107,13 +107,13 @@ class YandexGPTEmbeddings(BaseModel, Embeddings):
raise ValueError("'doc_model_uri' or 'folder_id' must be provided.")
values[
"doc_model_uri"
- ] = f"emb://{values['folder_id']}/{values['doc_model_name']}/{values['model_version']}" # noqa: E501
+ ] = f"emb://{values['folder_id']}/{values['doc_model_name']}/{values['model_version']}"
if not values.get("model_uri"):
if values["folder_id"] == "":
raise ValueError("'model_uri' or 'folder_id' must be provided.")
values[
"model_uri"
- ] = f"emb://{values['folder_id']}/{values['model_name']}/{values['model_version']}" # noqa: E501
+ ] = f"emb://{values['folder_id']}/{values['model_name']}/{values['model_version']}"
if values["disable_request_logging"]:
values["_grpc_metadata"].append(
(
diff --git a/libs/community/langchain_community/graphs/arangodb_graph.py b/libs/community/langchain_community/graphs/arangodb_graph.py
index b9e4530058..dd2ad16614 100644
--- a/libs/community/langchain_community/graphs/arangodb_graph.py
+++ b/libs/community/langchain_community/graphs/arangodb_graph.py
@@ -174,9 +174,9 @@ def get_arangodb_client(
"Unable to import arango, please install with `pip install python-arango`."
) from e
- _url: str = url or os.environ.get("ARANGODB_URL", "http://localhost:8529") # type: ignore[assignment] # noqa: E501
- _dbname: str = dbname or os.environ.get("ARANGODB_DBNAME", "_system") # type: ignore[assignment] # noqa: E501
- _username: str = username or os.environ.get("ARANGODB_USERNAME", "root") # type: ignore[assignment] # noqa: E501
- _password: str = password or os.environ.get("ARANGODB_PASSWORD", "") # type: ignore[assignment] # noqa: E501
+ _url: str = url or os.environ.get("ARANGODB_URL", "http://localhost:8529") # type: ignore[assignment]
+ _dbname: str = dbname or os.environ.get("ARANGODB_DBNAME", "_system") # type: ignore[assignment]
+ _username: str = username or os.environ.get("ARANGODB_USERNAME", "root") # type: ignore[assignment]
+ _password: str = password or os.environ.get("ARANGODB_PASSWORD", "") # type: ignore[assignment]
return ArangoClient(_url).db(_dbname, _username, _password, verify=True)
diff --git a/libs/community/langchain_community/llms/azureml_endpoint.py b/libs/community/langchain_community/llms/azureml_endpoint.py
index 925c43661d..f1edd98851 100644
--- a/libs/community/langchain_community/llms/azureml_endpoint.py
+++ b/libs/community/langchain_community/llms/azureml_endpoint.py
@@ -496,7 +496,7 @@ class AzureMLOnlineEndpoint(BaseLLM, AzureMLBaseEndpoint):
timeout=120,
content_formatter=content_formatter,
)
- """ # noqa: E501
+ """
@property
def _identifying_params(self) -> Mapping[str, Any]:
diff --git a/libs/community/langchain_community/llms/openai.py b/libs/community/langchain_community/llms/openai.py
index 0d891c299f..757e3d85ba 100644
--- a/libs/community/langchain_community/llms/openai.py
+++ b/libs/community/langchain_community/llms/openai.py
@@ -604,7 +604,7 @@ class BaseOpenAI(BaseLLM):
if self.openai_proxy:
import openai
- openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy} # type: ignore[assignment] # noqa: E501
+ openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy} # type: ignore[assignment]
return {**openai_creds, **self._default_params}
@property
@@ -800,7 +800,7 @@ class AzureOpenAI(BaseOpenAI):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
@@ -1055,7 +1055,7 @@ class OpenAIChat(BaseLLM):
if openai_organization:
openai.organization = openai_organization
if openai_proxy:
- openai.proxy = {"http": openai_proxy, "https": openai_proxy} # type: ignore[assignment] # noqa: E501
+ openai.proxy = {"http": openai_proxy, "https": openai_proxy} # type: ignore[assignment]
except ImportError:
raise ImportError(
"Could not import openai python package. "
diff --git a/libs/community/langchain_community/llms/symblai_nebula.py b/libs/community/langchain_community/llms/symblai_nebula.py
index afe6598f23..9e0b2687a2 100644
--- a/libs/community/langchain_community/llms/symblai_nebula.py
+++ b/libs/community/langchain_community/llms/symblai_nebula.py
@@ -41,7 +41,7 @@ class Nebula(LLM):
nebula_service_path="NEBULA_SERVICE_PATH",
nebula_api_key="NEBULA_API_KEY",
)
- """ # noqa: E501
+ """
"""Key/value arguments to pass to the model. Reserved for future use"""
model_kwargs: Optional[dict] = None
diff --git a/libs/community/langchain_community/output_parsers/ernie_functions.py b/libs/community/langchain_community/output_parsers/ernie_functions.py
index 223284649f..93fe9771cb 100644
--- a/libs/community/langchain_community/output_parsers/ernie_functions.py
+++ b/libs/community/langchain_community/output_parsers/ernie_functions.py
@@ -164,7 +164,7 @@ class PydanticOutputFunctionsParser(OutputFunctionsParser):
else:
fn_name = _result["name"]
_args = _result["arguments"]
- pydantic_args = self.pydantic_schema[fn_name].parse_raw(_args) # type: ignore # noqa: E501
+ pydantic_args = self.pydantic_schema[fn_name].parse_raw(_args) # type: ignore
return pydantic_args
diff --git a/libs/community/langchain_community/retrievers/google_vertex_ai_search.py b/libs/community/langchain_community/retrievers/google_vertex_ai_search.py
index 7c4351bc3c..11cb6c58a7 100644
--- a/libs/community/langchain_community/retrievers/google_vertex_ai_search.py
+++ b/libs/community/langchain_community/retrievers/google_vertex_ai_search.py
@@ -190,7 +190,7 @@ class _BaseGoogleVertexAISearchRetriever(BaseModel):
print( # noqa: T201
"Make sure that your data store is using Advanced Website "
"Indexing.\n"
- "https://cloud.google.com/generative-ai-app-builder/docs/about-advanced-features#advanced-website-indexing" # noqa: E501
+ "https://cloud.google.com/generative-ai-app-builder/docs/about-advanced-features#advanced-website-indexing"
)
return documents
diff --git a/libs/community/langchain_community/tools/bearly/tool.py b/libs/community/langchain_community/tools/bearly/tool.py
index 286e024f64..cd20e80a37 100644
--- a/libs/community/langchain_community/tools/bearly/tool.py
+++ b/libs/community/langchain_community/tools/bearly/tool.py
@@ -59,7 +59,7 @@ If you have any files outputted write them to "output/" relative to the executio
path. Output can only be read from the directory, stdout, and stdin. \
Do not use things like plot.show() as it will \
not work instead write them out `output/` and a link to the file will be returned. \
-print() any output and results so you can capture the output.""" # noqa: T201
+print() any output and results so you can capture the output."""
class FileInfo(BaseModel):
diff --git a/libs/community/langchain_community/tools/powerbi/tool.py b/libs/community/langchain_community/tools/powerbi/tool.py
index 9f54ec453d..77c1c48266 100644
--- a/libs/community/langchain_community/tools/powerbi/tool.py
+++ b/libs/community/langchain_community/tools/powerbi/tool.py
@@ -51,7 +51,7 @@ class QueryPowerBITool(BaseTool):
for var in llm_chain.prompt.input_variables:
if var not in ["tool_input", "tables", "schemas", "examples"]:
raise ValueError(
- "LLM chain for QueryPowerBITool must have input variables ['tool_input', 'tables', 'schemas', 'examples'], found %s", # noqa: C0301 E501 # pylint: disable=C0301
+ "LLM chain for QueryPowerBITool must have input variables ['tool_input', 'tables', 'schemas', 'examples'], found %s", # noqa: E501 # pylint: disable=C0301
llm_chain.prompt.input_variables,
)
return llm_chain
diff --git a/libs/community/langchain_community/utilities/__init__.py b/libs/community/langchain_community/utilities/__init__.py
index 5aea1de062..3a5184e7c0 100644
--- a/libs/community/langchain_community/utilities/__init__.py
+++ b/libs/community/langchain_community/utilities/__init__.py
@@ -105,7 +105,7 @@ if TYPE_CHECKING:
OpenWeatherMapAPIWrapper,
)
from langchain_community.utilities.oracleai import (
- OracleSummary, # noqa: F401
+ OracleSummary,
)
from langchain_community.utilities.outline import (
OutlineAPIWrapper,
diff --git a/libs/community/langchain_community/utilities/arxiv.py b/libs/community/langchain_community/utilities/arxiv.py
index 7b92041562..bab2df8061 100644
--- a/libs/community/langchain_community/utilities/arxiv.py
+++ b/libs/community/langchain_community/utilities/arxiv.py
@@ -103,7 +103,7 @@ class ArxivAPIWrapper(BaseModel):
Args:
query: a plaintext search query
- """ # noqa: E501
+ """
try:
if self.is_arxiv_identifier(query):
results = self.arxiv_search(
@@ -142,7 +142,7 @@ class ArxivAPIWrapper(BaseModel):
Args:
query: a plaintext search query
- """ # noqa: E501
+ """
try:
if self.is_arxiv_identifier(query):
results = self.arxiv_search(
diff --git a/libs/community/langchain_community/utilities/awslambda.py b/libs/community/langchain_community/utilities/awslambda.py
index 1b497dd5dd..8dbaca563a 100644
--- a/libs/community/langchain_community/utilities/awslambda.py
+++ b/libs/community/langchain_community/utilities/awslambda.py
@@ -60,7 +60,7 @@ class LambdaWrapper(BaseModel):
query: an input to passed to the lambda
function as the ``body`` of a JSON
object.
- """ # noqa: E501
+ """
res = self.lambda_client.invoke(
FunctionName=self.function_name,
InvocationType="RequestResponse",
diff --git a/libs/community/langchain_community/utilities/powerbi.py b/libs/community/langchain_community/utilities/powerbi.py
index 93d4886796..085c9b8a0a 100644
--- a/libs/community/langchain_community/utilities/powerbi.py
+++ b/libs/community/langchain_community/utilities/powerbi.py
@@ -61,7 +61,7 @@ class PowerBIDataset(BaseModel):
"""Get the request url."""
if self.group_id:
return f"{BASE_URL}/groups/{self.group_id}/datasets/{self.dataset_id}/executeQueries" # noqa: E501 # pylint: disable=C0301
- return f"{BASE_URL}/datasets/{self.dataset_id}/executeQueries" # noqa: E501 # pylint: disable=C0301
+ return f"{BASE_URL}/datasets/{self.dataset_id}/executeQueries" # pylint: disable=C0301
@property
def headers(self) -> Dict[str, str]:
diff --git a/libs/community/langchain_community/utilities/tavily_search.py b/libs/community/langchain_community/utilities/tavily_search.py
index 97dc45363f..95eb52266a 100644
--- a/libs/community/langchain_community/utilities/tavily_search.py
+++ b/libs/community/langchain_community/utilities/tavily_search.py
@@ -97,7 +97,7 @@ class TavilySearchAPIWrapper(BaseModel):
content: The content of the result.
score: The score of the result.
raw_content: The raw content of the result.
- """ # noqa: E501
+ """
raw_search_results = self.raw_results(
query,
max_results=max_results,
diff --git a/libs/community/langchain_community/utilities/twilio.py b/libs/community/langchain_community/utilities/twilio.py
index a3ff0b2369..d1c3fce582 100644
--- a/libs/community/langchain_community/utilities/twilio.py
+++ b/libs/community/langchain_community/utilities/twilio.py
@@ -40,7 +40,7 @@ class TwilioAPIWrapper(BaseModel):
Twilio also work here. You cannot, for example, spoof messages from a private
cell phone number. If you are using `messaging_service_sid`, this parameter
must be empty.
- """ # noqa: E501
+ """
class Config:
"""Configuration for this pydantic object."""
@@ -77,6 +77,6 @@ class TwilioAPIWrapper(BaseModel):
SMS/MMS or
[Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses)
for other 3rd-party channels.
- """ # noqa: E501
+ """
message = self.client.messages.create(to, from_=self.from_number, body=body)
return message.sid
diff --git a/libs/community/langchain_community/vectorstores/__init__.py b/libs/community/langchain_community/vectorstores/__init__.py
index 7e21ad78d2..0bd50ad673 100644
--- a/libs/community/langchain_community/vectorstores/__init__.py
+++ b/libs/community/langchain_community/vectorstores/__init__.py
@@ -182,7 +182,7 @@ if TYPE_CHECKING:
OpenSearchVectorSearch,
)
from langchain_community.vectorstores.oraclevs import (
- OracleVS, # noqa: F401
+ OracleVS,
)
from langchain_community.vectorstores.pathway import (
PathwayVectorClient,
@@ -448,7 +448,7 @@ _module_lookup = {
"MyScale": "langchain_community.vectorstores.myscale",
"MyScaleSettings": "langchain_community.vectorstores.myscale",
"Neo4jVector": "langchain_community.vectorstores.neo4j_vector",
- "NeuralDBClientVectorStore": "langchain_community.vectorstores.thirdai_neuraldb", # noqa: E501
+ "NeuralDBClientVectorStore": "langchain_community.vectorstores.thirdai_neuraldb",
"NeuralDBVectorStore": "langchain_community.vectorstores.thirdai_neuraldb",
"OpenSearchVectorSearch": "langchain_community.vectorstores.opensearch_vector_search", # noqa: E501
"OracleVS": "langchain_community.vectorstores.oraclevs",
diff --git a/libs/community/langchain_community/vectorstores/jaguar.py b/libs/community/langchain_community/vectorstores/jaguar.py
index 3a6bae51f9..a7a5556428 100644
--- a/libs/community/langchain_community/vectorstores/jaguar.py
+++ b/libs/community/langchain_community/vectorstores/jaguar.py
@@ -431,7 +431,7 @@ class Jaguar(VectorStore):
def prt(self, msg: str) -> None:
with open("/tmp/debugjaguar.log", "a") as file:
- print(f"msg={msg}", file=file, flush=True) # noqa: T201
+ print(f"msg={msg}", file=file, flush=True)
def _parseMeta(self, nvmap: dict, filecol: str) -> Tuple[List[str], List[str], str]:
filepath = ""
diff --git a/libs/community/langchain_community/vectorstores/momento_vector_index.py b/libs/community/langchain_community/vectorstores/momento_vector_index.py
index 4e2e03dd79..ebfa3c4d0e 100644
--- a/libs/community/langchain_community/vectorstores/momento_vector_index.py
+++ b/libs/community/langchain_community/vectorstores/momento_vector_index.py
@@ -397,7 +397,7 @@ class MomentoVectorIndex(VectorStore):
)
selected = [response.hits[i].metadata for i in mmr_selected]
return [
- Document(page_content=metadata.pop(self.text_field, ""), metadata=metadata) # type: ignore # noqa: E501
+ Document(page_content=metadata.pop(self.text_field, ""), metadata=metadata) # type: ignore
for metadata in selected
]
diff --git a/libs/community/langchain_community/vectorstores/qdrant.py b/libs/community/langchain_community/vectorstores/qdrant.py
index 799007530b..6d02332ceb 100644
--- a/libs/community/langchain_community/vectorstores/qdrant.py
+++ b/libs/community/langchain_community/vectorstores/qdrant.py
@@ -1681,7 +1681,7 @@ class Qdrant(VectorStore):
f"Existing Qdrant collection {collection_name} uses named vectors. "
f"If you want to reuse it, please set `vector_name` to any of the "
f"existing named vectors: "
- f"{', '.join(current_vector_config.keys())}." # noqa
+ f"{', '.join(current_vector_config.keys())}."
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
@@ -1846,7 +1846,7 @@ class Qdrant(VectorStore):
f"Existing Qdrant collection {collection_name} uses named vectors. "
f"If you want to reuse it, please set `vector_name` to any of the "
f"existing named vectors: "
- f"{', '.join(current_vector_config.keys())}." # noqa
+ f"{', '.join(current_vector_config.keys())}."
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
diff --git a/libs/community/langchain_community/vectorstores/redis/base.py b/libs/community/langchain_community/vectorstores/redis/base.py
index c9a19f8e7e..8a885aff39 100644
--- a/libs/community/langchain_community/vectorstores/redis/base.py
+++ b/libs/community/langchain_community/vectorstores/redis/base.py
@@ -383,7 +383,7 @@ class Redis(VectorStore):
# type check for metadata
if metadatas:
- if isinstance(metadatas, list) and len(metadatas) != len(texts): # type: ignore # noqa: E501
+ if isinstance(metadatas, list) and len(metadatas) != len(texts): # type: ignore
raise ValueError("Number of metadatas must match number of texts")
if not (isinstance(metadatas, list) and isinstance(metadatas[0], dict)):
raise ValueError("Metadatas must be a list of dicts")
@@ -704,7 +704,7 @@ class Redis(VectorStore):
# type check for metadata
if metadatas:
- if isinstance(metadatas, list) and len(metadatas) != len(texts): # type: ignore # noqa: E501
+ if isinstance(metadatas, list) and len(metadatas) != len(texts): # type: ignore
raise ValueError("Number of metadatas must match number of texts")
if not (isinstance(metadatas, list) and isinstance(metadatas[0], dict)):
raise ValueError("Metadatas must be a list of dicts")
@@ -832,7 +832,7 @@ class Redis(VectorStore):
# Perform vector search
# ignore type because redis-py is wrong about bytes
try:
- results = self.client.ft(self.index_name).search(redis_query, params_dict) # type: ignore # noqa: E501
+ results = self.client.ft(self.index_name).search(redis_query, params_dict) # type: ignore
except redis.exceptions.ResponseError as e:
# split error message and see if it starts with "Syntax"
if str(e).split(" ")[0] == "Syntax":
@@ -947,7 +947,7 @@ class Redis(VectorStore):
# Perform vector search
# ignore type because redis-py is wrong about bytes
try:
- results = self.client.ft(self.index_name).search(redis_query, params_dict) # type: ignore # noqa: E501
+ results = self.client.ft(self.index_name).search(redis_query, params_dict) # type: ignore
except redis.exceptions.ResponseError as e:
# split error message and see if it starts with "Syntax"
if str(e).split(" ")[0] == "Syntax":
diff --git a/libs/community/langchain_community/vectorstores/timescalevector.py b/libs/community/langchain_community/vectorstores/timescalevector.py
index 5e3e3c41ad..4793163418 100644
--- a/libs/community/langchain_community/vectorstores/timescalevector.py
+++ b/libs/community/langchain_community/vectorstores/timescalevector.py
@@ -66,7 +66,7 @@ class TimescaleVector(VectorStore):
collection_name=COLLECTION_NAME,
service_url=SERVICE_URL,
)
- """ # noqa: E501
+ """
def __init__(
self,
diff --git a/libs/community/tests/integration_tests/document_loaders/test_tensorflow_datasets.py b/libs/community/tests/integration_tests/document_loaders/test_tensorflow_datasets.py
index 7498b65e56..956b868313 100644
--- a/libs/community/tests/integration_tests/document_loaders/test_tensorflow_datasets.py
+++ b/libs/community/tests/integration_tests/document_loaders/test_tensorflow_datasets.py
@@ -12,7 +12,7 @@ from langchain_community.document_loaders.tensorflow_datasets import (
)
if TYPE_CHECKING:
- import tensorflow as tf # noqa: E402
+ import tensorflow as tf
def decode_to_str(item: tf.Tensor) -> str:
diff --git a/libs/community/tests/integration_tests/utilities/test_tensorflow_datasets.py b/libs/community/tests/integration_tests/utilities/test_tensorflow_datasets.py
index 01990bc2c4..6e207dd7bc 100644
--- a/libs/community/tests/integration_tests/utilities/test_tensorflow_datasets.py
+++ b/libs/community/tests/integration_tests/utilities/test_tensorflow_datasets.py
@@ -10,7 +10,7 @@ from langchain_core.pydantic_v1 import ValidationError
from langchain_community.utilities.tensorflow_datasets import TensorflowDatasets
if TYPE_CHECKING:
- import tensorflow as tf # noqa: E402
+ import tensorflow as tf
def decode_to_str(item: tf.Tensor) -> str:
diff --git a/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py b/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py
index df15626b0f..ab7ecebd6d 100644
--- a/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py
+++ b/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_add_texts.py
@@ -7,7 +7,7 @@ from langchain_community.vectorstores import Qdrant
from tests.integration_tests.vectorstores.fake_embeddings import (
ConsistentFakeEmbeddings,
)
-from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import ( # noqa
+from tests.integration_tests.vectorstores.qdrant.async_api.fixtures import (
qdrant_locations,
)
diff --git a/libs/community/tests/integration_tests/vectorstores/test_azure_cosmos_db.py b/libs/community/tests/integration_tests/vectorstores/test_azure_cosmos_db.py
index 483c6ee50d..6f132af44a 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_azure_cosmos_db.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_azure_cosmos_db.py
@@ -74,7 +74,7 @@ class TestAzureCosmosDBVectorSearch:
# insure the test collection is empty
collection = prepare_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index] # noqa: E501
+ assert collection.count_documents({}) == 0 # type: ignore[index]
@classmethod
def teardown_class(cls) -> None:
diff --git a/libs/community/tests/integration_tests/vectorstores/test_documentdb.py b/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
index 261d98751b..805e46599e 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
@@ -70,7 +70,7 @@ class TestDocumentDBVectorSearch:
# insure the test collection is empty
collection = prepare_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index] # noqa: E501
+ assert collection.count_documents({}) == 0 # type: ignore[index]
@classmethod
def teardown_class(cls) -> None:
diff --git a/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py b/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py
index d88c1d34a6..d5a0b547df 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py
@@ -34,7 +34,7 @@ class TestMongoDBAtlasVectorSearch:
def setup_class(cls) -> None:
# insure the test collection is empty
collection = get_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index] # noqa: E501
+ assert collection.count_documents({}) == 0 # type: ignore[index]
@classmethod
def teardown_class(cls) -> None:
diff --git a/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py b/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py
index afb50b8345..dab2ea8474 100644
--- a/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py
+++ b/libs/community/tests/unit_tests/document_loaders/parsers/language/test_lua.py
@@ -33,7 +33,7 @@ end"""
@pytest.mark.skip(
reason=(
"Flakey. To be investigated. See "
- "https://github.com/langchain-ai/langchain/actions/runs/7907779756/job/21585580650." # noqa: E501
+ "https://github.com/langchain-ai/langchain/actions/runs/7907779756/job/21585580650."
)
)
def test_extract_functions_classes(self) -> None:
@@ -46,7 +46,7 @@ end"""
reason=(
"Flakey. To be investigated. See "
"https://github.com/langchain-ai/langchain/actions/runs/7923203031/job/21632416298?pr=17599 " # noqa: E501
- "and https://github.com/langchain-ai/langchain/actions/runs/7923784089/job/2163420864." # noqa: E501
+ "and https://github.com/langchain-ai/langchain/actions/runs/7923784089/job/2163420864."
)
)
def test_simplify_code(self) -> None:
diff --git a/libs/community/tests/unit_tests/llms/test_llamafile.py b/libs/community/tests/unit_tests/llms/test_llamafile.py
index 10fea66a5a..186629149f 100644
--- a/libs/community/tests/unit_tests/llms/test_llamafile.py
+++ b/libs/community/tests/unit_tests/llms/test_llamafile.py
@@ -42,7 +42,7 @@ def mock_response() -> requests.Response:
def mock_response_stream(): # type: ignore[no-untyped-def]
mock_response = deque(
[
- b'data: {"content":"the","multimodal":false,"slot_id":0,"stop":false}\n\n', # noqa
+ b'data: {"content":"the","multimodal":false,"slot_id":0,"stop":false}\n\n',
b'data: {"content":" quick","multimodal":false,"slot_id":0,"stop":false}\n\n', # noqa
]
)
diff --git a/libs/community/tests/unit_tests/test_cache.py b/libs/community/tests/unit_tests/test_cache.py
index 75798ba853..d3c9388021 100644
--- a/libs/community/tests/unit_tests/test_cache.py
+++ b/libs/community/tests/unit_tests/test_cache.py
@@ -22,7 +22,7 @@ except ImportError:
from langchain.globals import get_llm_cache, set_llm_cache
from langchain_core.outputs import Generation, LLMResult
-from langchain_community.cache import SQLAlchemyCache # noqa: E402
+from langchain_community.cache import SQLAlchemyCache
from tests.unit_tests.llms.fake_llm import FakeLLM
diff --git a/libs/community/tests/unit_tests/test_document_transformers.py b/libs/community/tests/unit_tests/test_document_transformers.py
index 88f1d6dc9d..78b0f08c77 100644
--- a/libs/community/tests/unit_tests/test_document_transformers.py
+++ b/libs/community/tests/unit_tests/test_document_transformers.py
@@ -3,7 +3,7 @@ import pytest
pytest.importorskip("langchain_community")
-from langchain_community.document_transformers.embeddings_redundant_filter import ( # noqa: E402,E501
+from langchain_community.document_transformers.embeddings_redundant_filter import ( # noqa: E402
_filter_similar_embeddings,
)
from langchain_community.utils.math import cosine_similarity # noqa: E402
diff --git a/libs/core/langchain_core/messages/ai.py b/libs/core/langchain_core/messages/ai.py
index 0f14caecf5..4ab316b9d0 100644
--- a/libs/core/langchain_core/messages/ai.py
+++ b/libs/core/langchain_core/messages/ai.py
@@ -110,7 +110,7 @@ class AIMessageChunk(AIMessage, BaseMessageChunk):
# Ignoring mypy re-assignment here since we're overriding the value
# to make sure that the chunk variant can be discriminated from the
# non-chunk variant.
- type: Literal["AIMessageChunk"] = "AIMessageChunk" # type: ignore[assignment] # noqa: E501
+ type: Literal["AIMessageChunk"] = "AIMessageChunk" # type: ignore[assignment]
tool_call_chunks: List[ToolCallChunk] = []
"""If provided, tool call chunks associated with the message."""
diff --git a/libs/core/langchain_core/messages/human.py b/libs/core/langchain_core/messages/human.py
index b89860a562..f57b678fe8 100644
--- a/libs/core/langchain_core/messages/human.py
+++ b/libs/core/langchain_core/messages/human.py
@@ -28,7 +28,7 @@ class HumanMessageChunk(HumanMessage, BaseMessageChunk):
# Ignoring mypy re-assignment here since we're overriding the value
# to make sure that the chunk variant can be discriminated from the
# non-chunk variant.
- type: Literal["HumanMessageChunk"] = "HumanMessageChunk" # type: ignore[assignment] # noqa: E501
+ type: Literal["HumanMessageChunk"] = "HumanMessageChunk" # type: ignore[assignment]
@classmethod
def get_lc_namespace(cls) -> List[str]:
diff --git a/libs/core/langchain_core/messages/system.py b/libs/core/langchain_core/messages/system.py
index c86a60f91f..7211d5327e 100644
--- a/libs/core/langchain_core/messages/system.py
+++ b/libs/core/langchain_core/messages/system.py
@@ -25,7 +25,7 @@ class SystemMessageChunk(SystemMessage, BaseMessageChunk):
# Ignoring mypy re-assignment here since we're overriding the value
# to make sure that the chunk variant can be discriminated from the
# non-chunk variant.
- type: Literal["SystemMessageChunk"] = "SystemMessageChunk" # type: ignore[assignment] # noqa: E501
+ type: Literal["SystemMessageChunk"] = "SystemMessageChunk" # type: ignore[assignment]
@classmethod
def get_lc_namespace(cls) -> List[str]:
diff --git a/libs/core/langchain_core/output_parsers/openai_functions.py b/libs/core/langchain_core/output_parsers/openai_functions.py
index 721ab180ba..08391f5243 100644
--- a/libs/core/langchain_core/output_parsers/openai_functions.py
+++ b/libs/core/langchain_core/output_parsers/openai_functions.py
@@ -205,7 +205,7 @@ class PydanticOutputFunctionsParser(OutputFunctionsParser):
else:
fn_name = _result["name"]
_args = _result["arguments"]
- pydantic_args = self.pydantic_schema[fn_name].parse_raw(_args) # type: ignore # noqa: E501
+ pydantic_args = self.pydantic_schema[fn_name].parse_raw(_args) # type: ignore
return pydantic_args
diff --git a/libs/core/langchain_core/outputs/chat_generation.py b/libs/core/langchain_core/outputs/chat_generation.py
index 17ce470053..e95c538926 100644
--- a/libs/core/langchain_core/outputs/chat_generation.py
+++ b/libs/core/langchain_core/outputs/chat_generation.py
@@ -61,7 +61,7 @@ class ChatGenerationChunk(ChatGeneration):
message: BaseMessageChunk
# Override type to be ChatGeneration, ignore mypy error as this is intentional
- type: Literal["ChatGenerationChunk"] = "ChatGenerationChunk" # type: ignore[assignment] # noqa: E501
+ type: Literal["ChatGenerationChunk"] = "ChatGenerationChunk" # type: ignore[assignment]
"""Type is used exclusively for serialization purposes."""
@classmethod
diff --git a/libs/core/langchain_core/prompts/chat.py b/libs/core/langchain_core/prompts/chat.py
index 4316dc5bdd..eea59202cf 100644
--- a/libs/core/langchain_core/prompts/chat.py
+++ b/libs/core/langchain_core/prompts/chat.py
@@ -431,7 +431,7 @@ class _StringImageMessagePromptTemplate(BaseMessagePromptTemplate):
if isinstance(tmpl, str):
text: str = tmpl
else:
- text = cast(_TextTemplateParam, tmpl)["text"] # type: ignore[assignment] # noqa: E501
+ text = cast(_TextTemplateParam, tmpl)["text"] # type: ignore[assignment]
prompt.append(
PromptTemplate.from_template(
text, template_format=template_format
diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py
index 67e1f7851b..9ee3c7707c 100644
--- a/libs/core/langchain_core/runnables/base.py
+++ b/libs/core/langchain_core/runnables/base.py
@@ -517,7 +517,7 @@ class Runnable(Generic[Input, Output], ABC):
json_and_bytes_chain.invoke("[1, 2, 3]")
# -> {"json": [1, 2, 3], "bytes": b"[1, 2, 3]"}
- """ # noqa: E501
+ """
from langchain_core.runnables.passthrough import RunnablePick
return self | RunnablePick(keys)
diff --git a/libs/core/langchain_core/runnables/graph_ascii.py b/libs/core/langchain_core/runnables/graph_ascii.py
index 089cdb9923..47992e2faa 100644
--- a/libs/core/langchain_core/runnables/graph_ascii.py
+++ b/libs/core/langchain_core/runnables/graph_ascii.py
@@ -244,8 +244,8 @@ def draw_ascii(vertices: Mapping[str, str], edges: Sequence[LangEdge]) -> str:
# NOTE: coordinates might me negative, so we need to shift
# everything to the positive plane before we actually draw it.
- Xs = [] # noqa: N806
- Ys = [] # noqa: N806
+ Xs = []
+ Ys = []
sug = _build_sugiyama_layout(vertices, edges)
diff --git a/libs/core/langchain_core/runnables/history.py b/libs/core/langchain_core/runnables/history.py
index c35cd42de5..3ff6df09d7 100644
--- a/libs/core/langchain_core/runnables/history.py
+++ b/libs/core/langchain_core/runnables/history.py
@@ -214,7 +214,7 @@ class RunnableWithMessageHistory(RunnableBindingBase):
config={"configurable": {"user_id": "123", "conversation_id": "1"}}
)
- """ # noqa: E501
+ """
get_session_history: GetSessionHistoryCallable
input_messages_key: Optional[str] = None
@@ -297,7 +297,7 @@ class RunnableWithMessageHistory(RunnableBindingBase):
into the get_session_history factory.
**kwargs: Arbitrary additional kwargs to pass to parent class
``RunnableBindingBase`` init.
- """ # noqa: E501
+ """
history_chain: Runnable = RunnableLambda(
self._enter_history, self._aenter_history
).with_config(run_name="load_history")
diff --git a/libs/core/langchain_core/tracers/context.py b/libs/core/langchain_core/tracers/context.py
index caadcfc685..00e5d3d3da 100644
--- a/libs/core/langchain_core/tracers/context.py
+++ b/libs/core/langchain_core/tracers/context.py
@@ -33,10 +33,10 @@ if TYPE_CHECKING:
tracing_callback_var: Any = None
tracing_v2_callback_var: ContextVar[Optional[LangChainTracer]] = ContextVar(
"tracing_callback_v2", default=None
-) # noqa: E501
+)
run_collector_var: ContextVar[Optional[RunCollectorCallbackHandler]] = ContextVar(
"run_collector", default=None
-) # noqa: E501
+)
@contextmanager
diff --git a/libs/core/langchain_core/utils/input.py b/libs/core/langchain_core/utils/input.py
index beb8b653d1..2e52a0e282 100644
--- a/libs/core/langchain_core/utils/input.py
+++ b/libs/core/langchain_core/utils/input.py
@@ -38,6 +38,6 @@ def print_text(
) -> None:
"""Print text with highlighting and no end characters."""
text_to_print = get_colored_text(text, color) if color else text
- print(text_to_print, end=end, file=file) # noqa: T201
+ print(text_to_print, end=end, file=file)
if file:
file.flush() # ensure all printed content are written to file
diff --git a/libs/core/tests/unit_tests/runnables/test_utils.py b/libs/core/tests/unit_tests/runnables/test_utils.py
index fa82826857..b309287f0b 100644
--- a/libs/core/tests/unit_tests/runnables/test_utils.py
+++ b/libs/core/tests/unit_tests/runnables/test_utils.py
@@ -42,7 +42,7 @@ def test_indent_lines_after_first(text: str, prefix: str, expected_output: str)
def test_nonlocals() -> None:
- agent = RunnableLambda(lambda x: x * 2) # noqa: F841
+ agent = RunnableLambda(lambda x: x * 2)
def my_func(input: str, agent: Dict[str, str]) -> str:
return agent.get("agent_name", input)
diff --git a/libs/core/tests/unit_tests/test_messages.py b/libs/core/tests/unit_tests/test_messages.py
index 1ae7320e15..aa86b2f49e 100644
--- a/libs/core/tests/unit_tests/test_messages.py
+++ b/libs/core/tests/unit_tests/test_messages.py
@@ -143,7 +143,7 @@ def test_chat_message_chunks() -> None:
role="User", content=" indeed."
) == AIMessageChunk(
content="I am indeed."
- ), "Other MessageChunk + ChatMessageChunk should be a MessageChunk as the left side" # noqa: E501
+ ), "Other MessageChunk + ChatMessageChunk should be a MessageChunk as the left side"
def test_function_message_chunks() -> None:
diff --git a/libs/core/tests/unit_tests/test_tools.py b/libs/core/tests/unit_tests/test_tools.py
index 78a4441743..f61cac1b54 100644
--- a/libs/core/tests/unit_tests/test_tools.py
+++ b/libs/core/tests/unit_tests/test_tools.py
@@ -626,7 +626,7 @@ def test_exception_handling_callable() -> None:
expected = "foo bar"
def handling(e: ToolException) -> str:
- return expected # noqa: E731
+ return expected
_tool = _FakeExceptionTool(handle_tool_error=handling)
actual = _tool.run({})
@@ -657,7 +657,7 @@ async def test_async_exception_handling_callable() -> None:
expected = "foo bar"
def handling(e: ToolException) -> str:
- return expected # noqa: E731
+ return expected
_tool = _FakeExceptionTool(handle_tool_error=handling)
actual = await _tool.arun({})
@@ -723,7 +723,7 @@ def test_validation_error_handling_callable() -> None:
expected = "foo bar"
def handling(e: ValidationError) -> str:
- return expected # noqa: E731
+ return expected
_tool = _MockStructuredTool(handle_validation_error=handling)
actual = _tool.run({})
@@ -785,7 +785,7 @@ async def test_async_validation_error_handling_callable() -> None:
expected = "foo bar"
def handling(e: ValidationError) -> str:
- return expected # noqa: E731
+ return expected
_tool = _MockStructuredTool(handle_validation_error=handling)
actual = await _tool.arun({})
diff --git a/libs/experimental/langchain_experimental/agents/__init__.py b/libs/experimental/langchain_experimental/agents/__init__.py
index fc1e4ef897..68ca3c0350 100644
--- a/libs/experimental/langchain_experimental/agents/__init__.py
+++ b/libs/experimental/langchain_experimental/agents/__init__.py
@@ -6,7 +6,7 @@ a language model is used as a reasoning engine to determine which actions
to take and in which order.
Agents select and use **Tools** and **Toolkits** for actions.
-""" # noqa: E501
+"""
from langchain_experimental.agents.agent_toolkits import (
create_csv_agent,
create_pandas_dataframe_agent,
diff --git a/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py b/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py
index 98e8403661..6fe319fa3e 100644
--- a/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py
+++ b/libs/experimental/langchain_experimental/agents/agent_toolkits/pandas/base.py
@@ -220,7 +220,7 @@ def create_pandas_dataframe_agent(
verbose=True
)
- """ # noqa: E501
+ """
try:
if engine == "modin":
import modin.pandas as pd
diff --git a/libs/experimental/langchain_experimental/chat_models/llm_wrapper.py b/libs/experimental/langchain_experimental/chat_models/llm_wrapper.py
index e02855a761..8ff4d01afd 100644
--- a/libs/experimental/langchain_experimental/chat_models/llm_wrapper.py
+++ b/libs/experimental/langchain_experimental/chat_models/llm_wrapper.py
@@ -149,7 +149,7 @@ class Llama2Chat(ChatWrapper):
class Mixtral(ChatWrapper):
- """See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format""" # noqa: E501
+ """See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format"""
@property
def _llm_type(self) -> str:
diff --git a/libs/experimental/langchain_experimental/llm_bash/bash.py b/libs/experimental/langchain_experimental/llm_bash/bash.py
index 6221e05e59..fc94d091c9 100644
--- a/libs/experimental/langchain_experimental/llm_bash/bash.py
+++ b/libs/experimental/langchain_experimental/llm_bash/bash.py
@@ -88,7 +88,7 @@ class BashProcess:
Args:
Prompt(str): the bash command to execute
- """ # noqa: E501
+ """
pexpect = self._lazy_import_pexpect()
process = pexpect.spawn(
"env", ["-i", "bash", "--norc", "--noprofile"], encoding="utf-8"
@@ -107,7 +107,7 @@ class BashProcess:
Args:
commands(List[str]): a list of commands to
execute in the session
- """ # noqa: E501
+ """
if isinstance(commands, str):
commands = [commands]
commands = ";".join(commands)
@@ -125,7 +125,7 @@ class BashProcess:
Args:
command: The command to run
- """ # noqa: E501
+ """
try:
output = subprocess.run(
command,
@@ -149,7 +149,7 @@ class BashProcess:
Args:
output: a process' output string
command: the executed command
- """ # noqa: E501
+ """
pattern = re.escape(command) + r"\s*\n"
output = re.sub(pattern, "", output, count=1)
return output.strip()
@@ -161,7 +161,7 @@ class BashProcess:
Args:
command: the command to execute
- """ # noqa: E501
+ """
pexpect = self._lazy_import_pexpect()
if self.process is None:
raise ValueError("Process not initialized")
diff --git a/libs/experimental/langchain_experimental/pal_chain/__init__.py b/libs/experimental/langchain_experimental/pal_chain/__init__.py
index bba4e717f4..363465136a 100644
--- a/libs/experimental/langchain_experimental/pal_chain/__init__.py
+++ b/libs/experimental/langchain_experimental/pal_chain/__init__.py
@@ -3,7 +3,7 @@
See the paper: https://arxiv.org/pdf/2211.10435.pdf.
This chain is vulnerable to [arbitrary code execution](https://github.com/langchain-ai/langchain/issues/5872).
-""" # noqa: E501
+"""
from langchain_experimental.pal_chain.base import PALChain
__all__ = ["PALChain"]
diff --git a/libs/experimental/langchain_experimental/recommenders/__init__.py b/libs/experimental/langchain_experimental/recommenders/__init__.py
index 1c05b72faf..aa02599d13 100644
--- a/libs/experimental/langchain_experimental/recommenders/__init__.py
+++ b/libs/experimental/langchain_experimental/recommenders/__init__.py
@@ -3,7 +3,7 @@
[Amazon Personalize](https://docs.aws.amazon.com/personalize/latest/dg/what-is-personalize.html)
is a fully managed machine learning service that uses your data to generate
item recommendations for your users.
-""" # noqa: E501
+"""
from langchain_experimental.recommenders.amazon_personalize import AmazonPersonalize
from langchain_experimental.recommenders.amazon_personalize_chain import (
AmazonPersonalizeChain,
diff --git a/libs/experimental/langchain_experimental/rl_chain/base.py b/libs/experimental/langchain_experimental/rl_chain/base.py
index 33fc226835..2e501ae734 100644
--- a/libs/experimental/langchain_experimental/rl_chain/base.py
+++ b/libs/experimental/langchain_experimental/rl_chain/base.py
@@ -475,7 +475,7 @@ class RLChain(Chain, Generic[TEvent]):
def save_progress(self) -> None:
"""
This function should be called to save the state of the learned policy model.
- """ # noqa: E501
+ """
self.active_policy.save()
def _validate_inputs(self, inputs: Dict[str, Any]) -> None:
diff --git a/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_mixtral.py b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_mixtral.py
index 797c608023..63871ea30e 100644
--- a/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_mixtral.py
+++ b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_mixtral.py
@@ -25,7 +25,7 @@ def test_prompt(model: Mixtral) -> None:
actual = model.invoke(messages).content # type: ignore
expected = (
- "<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]" # noqa: E501
+ "<s>[INST] sys-msg\nusr-msg-1 [/INST] ai-msg-1 </s> [INST] usr-msg-2 [/INST]"
)
assert actual == expected
diff --git a/libs/experimental/tests/unit_tests/python/test_python_2.py b/libs/experimental/tests/unit_tests/python/test_python_2.py
index 65fc8f62cb..56ebaaaf24 100644
--- a/libs/experimental/tests/unit_tests/python/test_python_2.py
+++ b/libs/experimental/tests/unit_tests/python/test_python_2.py
@@ -78,7 +78,7 @@ string = "racecar"
if string == string[::-1]:
print(string, "is a palindrome") # noqa: T201
else:
- print(string, "is not a palindrome")""" # noqa: T201
+ print(string, "is not a palindrome")"""
tool = PythonAstREPLTool()
assert tool.run(program) == "racecar is a palindrome\n"
diff --git a/libs/langchain/langchain/agents/agent_toolkits/conversational_retrieval/openai_functions.py b/libs/langchain/langchain/agents/agent_toolkits/conversational_retrieval/openai_functions.py
index 344c134a2b..6443b43e89 100644
--- a/libs/langchain/langchain/agents/agent_toolkits/conversational_retrieval/openai_functions.py
+++ b/libs/langchain/langchain/agents/agent_toolkits/conversational_retrieval/openai_functions.py
@@ -1,4 +1,4 @@
-from typing import Any, List, Optional # noqa: E501
+from typing import Any, List, Optional
from langchain_core.language_models import BaseLanguageModel
from langchain_core.memory import BaseMemory
diff --git a/libs/langchain/langchain/callbacks/tracers/logging.py b/libs/langchain/langchain/callbacks/tracers/logging.py
index f661c7be8f..7cfc9a72f0 100644
--- a/libs/langchain/langchain/callbacks/tracers/logging.py
+++ b/libs/langchain/langchain/callbacks/tracers/logging.py
@@ -33,8 +33,8 @@ class LoggingCallbackHandler(FunctionCallbackHandler):
text: str,
*,
run_id: UUID,
- parent_run_id: Optional[UUID] = None, # noqa: ARG002
- **kwargs: Any, # noqa: ARG002
+ parent_run_id: Optional[UUID] = None,
+ **kwargs: Any,
) -> None:
try:
crumbs_str = f"[{self.get_breadcrumbs(run=self._get_run(run_id=run_id))}] "
diff --git a/libs/langchain/langchain/chains/openai_functions/openapi.py b/libs/langchain/langchain/chains/openai_functions/openapi.py
index 86819dc9ee..79c78fdc2e 100644
--- a/libs/langchain/langchain/chains/openai_functions/openapi.py
+++ b/libs/langchain/langchain/chains/openai_functions/openapi.py
@@ -76,7 +76,7 @@ def _openapi_params_to_json_schema(params: List[Parameter], spec: OpenAPISpec) -
if p.param_schema:
schema = spec.get_schema(p.param_schema)
else:
- media_type_schema = list(p.content.values())[0].media_type_schema # type: ignore # noqa: E501
+ media_type_schema = list(p.content.values())[0].media_type_schema # type: ignore
schema = spec.get_schema(media_type_schema)
if p.description and not schema.description:
schema.description = p.description
@@ -237,7 +237,7 @@ class SimpleRequestChain(Chain):
else:
try:
response = api_response.json()
- except Exception: # noqa: E722
+ except Exception:
response = api_response.text
return {self.output_key: response}
@@ -280,7 +280,7 @@ def get_openapi_chain(
break
except ImportError as e:
raise e
- except Exception: # noqa: E722
+ except Exception:
pass
if isinstance(spec, str):
raise ValueError(f"Unable to parse spec from source {spec}")
diff --git a/libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py b/libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py
index 3b80f4ae98..e0e0790621 100644
--- a/libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py
+++ b/libs/langchain/langchain/evaluation/agents/trajectory_eval_chain.py
@@ -141,7 +141,7 @@ class TrajectoryEvalChain(AgentTrajectoryEvaluator, LLMEvalChain):
)
print(result["score"]) # noqa: T201
# 0
- """ # noqa: E501
+ """
agent_tools: Optional[List[BaseTool]] = None
"""A list of tools available to the agent."""
diff --git a/libs/langchain/langchain/evaluation/criteria/eval_chain.py b/libs/langchain/langchain/evaluation/criteria/eval_chain.py
index 9df3853195..00f9188502 100644
--- a/libs/langchain/langchain/evaluation/criteria/eval_chain.py
+++ b/libs/langchain/langchain/evaluation/criteria/eval_chain.py
@@ -142,7 +142,7 @@ def resolve_criteria(
>>> criterion = "relevance"
>>> CriteriaEvalChain.resolve_criteria(criteria)
{'relevance': 'Is the submission referring to a real quote from the text?'}
- """ # noqa: E501
+ """
if criteria is None:
return {
"helpfulness": _SUPPORTED_CRITERIA[Criteria.HELPFULNESS],
@@ -307,7 +307,7 @@ class CriteriaEvalChain(StringEvaluator, LLMEvalChain, LLMChain):
>>> criterion = "relevance"
>>> CriteriaEvalChain.resolve_criteria(criteria)
{'relevance': 'Is the submission referring to a real quote from the text?'}
- """ # noqa: E501
+ """
return resolve_criteria(criteria)
@classmethod
diff --git a/libs/langchain/langchain/evaluation/loading.py b/libs/langchain/langchain/evaluation/loading.py
index 27a8f348e4..cc092de946 100644
--- a/libs/langchain/langchain/evaluation/loading.py
+++ b/libs/langchain/langchain/evaluation/loading.py
@@ -56,7 +56,7 @@ def load_dataset(uri: str) -> List[Dict]:
from langchain.evaluation import load_dataset
ds = load_dataset("llm-math")
- """ # noqa: E501
+ """
try:
from datasets import load_dataset
except ImportError:
diff --git a/libs/langchain/langchain/evaluation/scoring/eval_chain.py b/libs/langchain/langchain/evaluation/scoring/eval_chain.py
index c73de5f21a..e4a9a9d43c 100644
--- a/libs/langchain/langchain/evaluation/scoring/eval_chain.py
+++ b/libs/langchain/langchain/evaluation/scoring/eval_chain.py
@@ -439,7 +439,7 @@ class LabeledScoreStringEvalChain(ScoreStringEvalChain):
Raises:
ValueError: If the input variables are not as expected.
- """ # noqa: E501
+ """
expected_input_vars = {
"prediction",
"input",
diff --git a/libs/langchain/langchain/smith/evaluation/config.py b/libs/langchain/langchain/smith/evaluation/config.py
index d73bba2262..e9bdd32477 100644
--- a/libs/langchain/langchain/smith/evaluation/config.py
+++ b/libs/langchain/langchain/smith/evaluation/config.py
@@ -133,7 +133,7 @@ class RunEvalConfig(BaseModel):
as `EvaluatorType.QA`, the evaluator type string ("qa"), or a configuration for a
given evaluator
(e.g.,
- :class:`RunEvalConfig.QA <langchain.smith.evaluation.config.RunEvalConfig.QA>`).""" # noqa: E501
+ :class:`RunEvalConfig.QA <langchain.smith.evaluation.config.RunEvalConfig.QA>`)."""
custom_evaluators: Optional[List[CUSTOM_EVALUATOR_TYPE]] = None
"""Custom evaluators to apply to the dataset run."""
batch_evaluators: Optional[List[BATCH_EVALUATOR_LIKE]] = None
diff --git a/libs/langchain/langchain/smith/evaluation/runner_utils.py b/libs/langchain/langchain/smith/evaluation/runner_utils.py
index 1df4872a8c..9cd018d9b9 100644
--- a/libs/langchain/langchain/smith/evaluation/runner_utils.py
+++ b/libs/langchain/langchain/smith/evaluation/runner_utils.py
@@ -225,7 +225,7 @@ def _wrap_in_chain_factory(
return lambda: RunnableLambda(constructor)
else:
# Typical correct case
- return constructor # noqa
+ return constructor
return llm_or_chain_factory
diff --git a/libs/partners/anthropic/tests/integration_tests/test_experimental.py b/libs/partners/anthropic/tests/integration_tests/test_experimental.py
index cc035d4589..4e23e0f442 100644
--- a/libs/partners/anthropic/tests/integration_tests/test_experimental.py
+++ b/libs/partners/anthropic/tests/integration_tests/test_experimental.py
@@ -165,5 +165,5 @@ def test_anthropic_complex_structured_output() -> None:
{
"email": "From: Erick. The email is about the new project. The tone is positive. The action items are to send the report and to schedule a meeting." # noqa: E501
}
- ) # noqa: E501
+ )
assert isinstance(response, Email)
diff --git a/libs/partners/mongodb/tests/integration_tests/test_vectorstores.py b/libs/partners/mongodb/tests/integration_tests/test_vectorstores.py
index 16d4b17baf..451ff29113 100644
--- a/libs/partners/mongodb/tests/integration_tests/test_vectorstores.py
+++ b/libs/partners/mongodb/tests/integration_tests/test_vectorstores.py
@@ -51,7 +51,7 @@ class TestMongoDBAtlasVectorSearch:
# insure the test collection is empty
collection = get_collection()
if collection.count_documents({}):
- collection.delete_many({}) # type: ignore[index] # noqa: E501
+ collection.delete_many({}) # type: ignore[index]
@classmethod
def teardown_class(cls) -> None:
diff --git a/libs/partners/mongodb/tests/unit_tests/test_vectorstores.py b/libs/partners/mongodb/tests/unit_tests/test_vectorstores.py
index 9c6c781208..0dc4b7fa2a 100644
--- a/libs/partners/mongodb/tests/unit_tests/test_vectorstores.py
+++ b/libs/partners/mongodb/tests/unit_tests/test_vectorstores.py
@@ -46,7 +46,7 @@ class TestMongoDBAtlasVectorSearch:
def setup_class(cls) -> None:
# ensure the test collection is empty
collection = get_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index] # noqa: E501
+ assert collection.count_documents({}) == 0 # type: ignore[index]
@classmethod
def teardown_class(cls) -> None:
diff --git a/libs/partners/openai/langchain_openai/chat_models/azure.py b/libs/partners/openai/langchain_openai/chat_models/azure.py
index 0f5133a4e5..f820228787 100644
--- a/libs/partners/openai/langchain_openai/chat_models/azure.py
+++ b/libs/partners/openai/langchain_openai/chat_models/azure.py
@@ -81,7 +81,7 @@ class AzureChatOpenAI(BaseChatOpenAI):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
@@ -178,7 +178,7 @@ class AzureChatOpenAI(BaseChatOpenAI):
'azure_endpoint="https://xxx.openai.azure.com/", '
'azure_deployment="my-deployment"\n\n'
"Or you can equivalently specify:\n\n"
- 'base_url="https://xxx.openai.azure.com/openai/deployments/my-deployment"' # noqa: E501
+ 'base_url="https://xxx.openai.azure.com/openai/deployments/my-deployment"'
)
client_params = {
"api_version": values["openai_api_version"],
diff --git a/libs/partners/openai/langchain_openai/embeddings/azure.py b/libs/partners/openai/langchain_openai/embeddings/azure.py
index de53c8058c..f4a0bd18c9 100644
--- a/libs/partners/openai/langchain_openai/embeddings/azure.py
+++ b/libs/partners/openai/langchain_openai/embeddings/azure.py
@@ -49,7 +49,7 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
diff --git a/libs/partners/openai/langchain_openai/llms/azure.py b/libs/partners/openai/langchain_openai/llms/azure.py
index cf9be00c64..35ad5e7967 100644
--- a/libs/partners/openai/langchain_openai/llms/azure.py
+++ b/libs/partners/openai/langchain_openai/llms/azure.py
@@ -54,7 +54,7 @@ class AzureOpenAI(BaseOpenAI):
For more:
https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id.
- """ # noqa: E501
+ """
azure_ad_token_provider: Union[Callable[[], str], None] = None
"""A function that returns an Azure Active Directory token.
diff --git a/libs/partners/qdrant/langchain_qdrant/vectorstores.py b/libs/partners/qdrant/langchain_qdrant/vectorstores.py
index 766a70d0fb..7f43885416 100644
--- a/libs/partners/qdrant/langchain_qdrant/vectorstores.py
+++ b/libs/partners/qdrant/langchain_qdrant/vectorstores.py
@@ -1657,7 +1657,7 @@ class Qdrant(VectorStore):
f"Existing Qdrant collection {collection_name} uses named vectors. "
f"If you want to reuse it, please set `vector_name` to any of the "
f"existing named vectors: "
- f"{', '.join(current_vector_config.keys())}." # noqa
+ f"{', '.join(current_vector_config.keys())}."
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
@@ -1816,7 +1816,7 @@ class Qdrant(VectorStore):
f"Existing Qdrant collection {collection_name} uses named vectors. "
f"If you want to reuse it, please set `vector_name` to any of the "
f"existing named vectors: "
- f"{', '.join(current_vector_config.keys())}." # noqa
+ f"{', '.join(current_vector_config.keys())}."
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
diff --git a/libs/partners/together/tests/unit_tests/test_llms.py b/libs/partners/together/tests/unit_tests/test_llms.py
index 7cb2e8c6e6..0e32e24b9e 100644
--- a/libs/partners/together/tests/unit_tests/test_llms.py
+++ b/libs/partners/together/tests/unit_tests/test_llms.py
@@ -27,7 +27,7 @@ def test_together_api_key_masked_when_passed_from_env(
temperature=0.2,
max_tokens=250,
)
- print(llm.together_api_key, end="") # noqa: T201
+ print(llm.together_api_key, end="")
captured = capsys.readouterr()
assert captured.out == "**********"
@@ -43,7 +43,7 @@ def test_together_api_key_masked_when_passed_via_constructor(
temperature=0.2,
max_tokens=250,
)
- print(llm.together_api_key, end="") # noqa: T201
+ print(llm.together_api_key, end="")
captured = capsys.readouterr()
assert captured.out == "**********"
diff --git a/templates/anthropic-iterative-search/main.py b/templates/anthropic-iterative-search/main.py
index c04830d110..27b7aa1aa6 100644
--- a/templates/anthropic-iterative-search/main.py
+++ b/templates/anthropic-iterative-search/main.py
@@ -5,7 +5,7 @@ if __name__ == "__main__":
"Which movie came out first: Oppenheimer, or "
"Are You There God It's Me Margaret?"
)
- print( # noqa: T201
+ print(
final_chain.with_config(configurable={"chain": "retrieve"}).invoke(
{"query": query}
)
diff --git a/templates/cassandra-entomology-rag/cassandra_entomology_rag/__init__.py b/templates/cassandra-entomology-rag/cassandra_entomology_rag/__init__.py
index f54b58aa1a..1816e8c7fd 100644
--- a/templates/cassandra-entomology-rag/cassandra_entomology_rag/__init__.py
+++ b/templates/cassandra-entomology-rag/cassandra_entomology_rag/__init__.py
@@ -42,7 +42,7 @@ retriever = vector_store.as_retriever(search_kwargs={"k": 3})
# Please remove this and/or adapt to your use case!
inserted_lines = populate(vector_store)
if inserted_lines:
- print(f"Done ({inserted_lines} lines inserted).") # noqa: T201
+ print(f"Done ({inserted_lines} lines inserted).")
entomology_template = """
You are an expert entomologist, tasked with answering enthusiast biologists' questions.
diff --git a/templates/csv-agent/main.py b/templates/csv-agent/main.py
index b0fba50cef..8814b92478 100644
--- a/templates/csv-agent/main.py
+++ b/templates/csv-agent/main.py
@@ -2,4 +2,4 @@ from csv_agent.agent import agent_executor
if __name__ == "__main__":
question = "who was in cabin c28?"
- print(agent_executor.invoke({"input": question})) # noqa: T201
+ print(agent_executor.invoke({"input": question}))
diff --git a/templates/elastic-query-generator/main.py b/templates/elastic-query-generator/main.py
index 6f1ff0b8c3..4f848b6e88 100644
--- a/templates/elastic-query-generator/main.py
+++ b/templates/elastic-query-generator/main.py
@@ -1,4 +1,4 @@
from elastic_query_generator.chain import chain
if __name__ == "__main__":
- print(chain.invoke({"input": "how many customers named Carol"})) # noqa: T201
+ print(chain.invoke({"input": "how many customers named Carol"}))
diff --git a/templates/neo4j-advanced-rag/main.py b/templates/neo4j-advanced-rag/main.py
index a50f7d56f5..2b339491cd 100644
--- a/templates/neo4j-advanced-rag/main.py
+++ b/templates/neo4j-advanced-rag/main.py
@@ -2,7 +2,7 @@ from neo4j_advanced_rag.chain import chain
if __name__ == "__main__":
original_query = "What is the plot of the Dune?"
- print( # noqa: T201
+ print(
chain.invoke(
{"question": original_query},
{"configurable": {"strategy": "parent_strategy"}},
diff --git a/templates/neo4j-cypher-ft/main.py b/templates/neo4j-cypher-ft/main.py
index 36b7ac41e3..490d454253 100644
--- a/templates/neo4j-cypher-ft/main.py
+++ b/templates/neo4j-cypher-ft/main.py
@@ -2,4 +2,4 @@ from neo4j_cypher_ft.chain import chain
if __name__ == "__main__":
original_query = "Did tom cruis act in top gun?"
- print(chain.invoke({"question": original_query})) # noqa: T201
+ print(chain.invoke({"question": original_query}))
diff --git a/templates/neo4j-cypher-memory/main.py b/templates/neo4j-cypher-memory/main.py
index 0250de251b..735fac9965 100644
--- a/templates/neo4j-cypher-memory/main.py
+++ b/templates/neo4j-cypher-memory/main.py
@@ -2,7 +2,7 @@ from neo4j_cypher_memory.chain import chain
if __name__ == "__main__":
original_query = "Who played in Top Gun?"
- print( # noqa: T201
+ print(
chain.invoke(
{
"question": original_query,
@@ -12,7 +12,7 @@ if __name__ == "__main__":
)
)
follow_up_query = "Did they play in any other movies?"
- print( # noqa: T201
+ print(
chain.invoke(
{
"question": follow_up_query,
diff --git a/templates/neo4j-cypher/main.py b/templates/neo4j-cypher/main.py
index 7962b8f0ff..611cbe2aff 100644
--- a/templates/neo4j-cypher/main.py
+++ b/templates/neo4j-cypher/main.py
@@ -2,4 +2,4 @@ from neo4j_cypher.chain import chain
if __name__ == "__main__":
original_query = "Who played in Top Gun?"
- print(chain.invoke({"question": original_query})) # noqa: T201
+ print(chain.invoke({"question": original_query}))
diff --git a/templates/neo4j-generation/main.py b/templates/neo4j-generation/main.py
index 1068b9fe10..578a18013f 100644
--- a/templates/neo4j-generation/main.py
+++ b/templates/neo4j-generation/main.py
@@ -4,7 +4,7 @@ if __name__ == "__main__":
text = "Harrison works at LangChain, which is located in San Francisco"
allowed_nodes = ["Person", "Organization", "Location"]
allowed_relationships = ["WORKS_AT", "LOCATED_IN"]
- print( # noqa: T201
+ print(
chain(
text,
allowed_nodes=allowed_nodes,
diff --git a/templates/neo4j-parent/main.py b/templates/neo4j-parent/main.py
index e109d57e5f..ac52947e3f 100644
--- a/templates/neo4j-parent/main.py
+++ b/templates/neo4j-parent/main.py
@@ -2,4 +2,4 @@ from neo4j_parent.chain import chain
if __name__ == "__main__":
original_query = "What is the plot of the Dune?"
- print(chain.invoke(original_query)) # noqa: T201
+ print(chain.invoke(original_query))
diff --git a/templates/neo4j-semantic-layer/main.py b/templates/neo4j-semantic-layer/main.py
index cbe3517d5a..681c6a20d6 100644
--- a/templates/neo4j-semantic-layer/main.py
+++ b/templates/neo4j-semantic-layer/main.py
@@ -11,7 +11,7 @@ if __name__ == "__main__":
"\n\n1. John Travolta\n2. John McDonough",
)
]
- print(agent_executor.invoke({"input": original_query})) # noqa: T201
- print( # noqa: T201
+ print(agent_executor.invoke({"input": original_query}))
+ print(
agent_executor.invoke({"input": followup_query, "chat_history": chat_history})
)
diff --git a/templates/neo4j-semantic-layer/neo4j_semantic_layer/memory_tool.py b/templates/neo4j-semantic-layer/neo4j_semantic_layer/memory_tool.py
index 6e3e0a8664..784ba8f432 100644
--- a/templates/neo4j-semantic-layer/neo4j_semantic_layer/memory_tool.py
+++ b/templates/neo4j-semantic-layer/neo4j_semantic_layer/memory_tool.py
@@ -34,7 +34,7 @@ def store_movie_rating(movie: str, rating: int):
try:
return response[0]["response"]
except Exception as e:
- print(e) # noqa: T201
+ print(e)
return "Something went wrong"
diff --git a/templates/neo4j-semantic-ollama/main.py b/templates/neo4j-semantic-ollama/main.py
index 3f8fe2b283..d6ee3a9196 100644
--- a/templates/neo4j-semantic-ollama/main.py
+++ b/templates/neo4j-semantic-ollama/main.py
@@ -11,7 +11,7 @@ if __name__ == "__main__":
"\n\n1. John Travolta\n2. John McDonough",
)
]
- print(agent_executor.invoke({"input": original_query})) # noqa: T201
- print( # noqa: T201
+ print(agent_executor.invoke({"input": original_query}))
+ print(
agent_executor.invoke({"input": followup_query, "chat_history": chat_history})
)
diff --git a/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/memory_tool.py b/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/memory_tool.py
index e0399af1d1..f455f70c4b 100644
--- a/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/memory_tool.py
+++ b/templates/neo4j-semantic-ollama/neo4j_semantic_ollama/memory_tool.py
@@ -35,7 +35,7 @@ def store_movie_rating(movie: str, rating: int):
try:
return response[0]["response"]
except Exception as e:
- print(e) # noqa: T201
+ print(e)
return "Something went wrong"
diff --git a/templates/neo4j-vector-memory/main.py b/templates/neo4j-vector-memory/main.py
index ca7f16ca3c..732f0954d5 100644
--- a/templates/neo4j-vector-memory/main.py
+++ b/templates/neo4j-vector-memory/main.py
@@ -4,13 +4,13 @@ if __name__ == "__main__":
user_id = "user_id_1"
session_id = "session_id_1"
original_query = "What is the plot of the Dune?"
- print( # noqa: T201
+ print(
chain.invoke(
{"question": original_query, "user_id": user_id, "session_id": session_id}
)
)
follow_up_query = "Tell me more about Leto"
- print( # noqa: T201
+ print(
chain.invoke(
{"question": follow_up_query, "user_id": user_id, "session_id": session_id}
)
diff --git a/templates/nvidia-rag-canonical/ingest.py b/templates/nvidia-rag-canonical/ingest.py
index e4ebd0fc2b..d7851cfaed 100644
--- a/templates/nvidia-rag-canonical/ingest.py
+++ b/templates/nvidia-rag-canonical/ingest.py
@@ -7,7 +7,7 @@ from langchain_nvidia_aiplay import NVIDIAEmbeddings
from langchain_text_splitters.character import CharacterTextSplitter
if os.environ.get("NVIDIA_API_KEY", "").startswith("nvapi-"):
- print("Valid NVIDIA_API_KEY already in environment. Delete to reset") # noqa: T201
+ print("Valid NVIDIA_API_KEY already in environment. Delete to reset")
else:
nvapi_key = getpass.getpass("NVAPI Key (starts with nvapi-): ")
assert nvapi_key.startswith("nvapi-"), f"{nvapi_key[:5]}... is not a valid key"
diff --git a/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py b/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py
index 98f1b8fc7b..78d5e8e28c 100644
--- a/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py
+++ b/templates/nvidia-rag-canonical/nvidia_rag_canonical/chain.py
@@ -23,7 +23,7 @@ INGESTION_CHUNK_SIZE = 500
INGESTION_CHUNK_OVERLAP = 0
if os.environ.get("NVIDIA_API_KEY", "").startswith("nvapi-"):
- print("Valid NVIDIA_API_KEY already in environment. Delete to reset") # noqa: T201
+ print("Valid NVIDIA_API_KEY already in environment. Delete to reset")
else:
nvapi_key = getpass.getpass("NVAPI Key (starts with nvapi-): ")
assert nvapi_key.startswith("nvapi-"), f"{nvapi_key[:5]}... is not a valid key"
diff --git a/templates/openai-functions-agent-gmail/main.py b/templates/openai-functions-agent-gmail/main.py
index 93e23ef6d4..90fcfcc30d 100644
--- a/templates/openai-functions-agent-gmail/main.py
+++ b/templates/openai-functions-agent-gmail/main.py
@@ -6,4 +6,4 @@ if __name__ == "__main__":
"First do background research on the sender and topics to make sure you"
" understand the context, then write the draft."
)
- print(agent_executor.invoke({"input": question, "chat_history": []})) # noqa: T201
+ print(agent_executor.invoke({"input": question, "chat_history": []}))
diff --git a/templates/openai-functions-agent/main.py b/templates/openai-functions-agent/main.py
index 0e612d69f4..f0e1f5963f 100644
--- a/templates/openai-functions-agent/main.py
+++ b/templates/openai-functions-agent/main.py
@@ -2,4 +2,4 @@ from openai_functions_agent.agent import agent_executor
if __name__ == "__main__":
question = "who won the womens world cup in 2023?"
- print(agent_executor.invoke({"input": question, "chat_history": []})) # noqa: T201
+ print(agent_executor.invoke({"input": question, "chat_history": []}))
diff --git a/templates/plate-chain/plate_chain/prompts.py b/templates/plate-chain/plate_chain/prompts.py
index 56f81262fd..9b8eb7380c 100644
--- a/templates/plate-chain/plate_chain/prompts.py
+++ b/templates/plate-chain/plate_chain/prompts.py
@@ -18,7 +18,7 @@ FULL_PROMPT = """# Context
```json
{json_format}
```
-""" # noqa: E50
+"""
NUM_PLATES_PROMPT = """- There {num_plates_str} in this data."""
ROWS_PROMPT = """- Each plate has {num_rows} rows."""
diff --git a/templates/propositional-retrieval/propositional_retrieval/ingest.py b/templates/propositional-retrieval/propositional_retrieval/ingest.py
index 336f8410b7..1af11ad3f9 100644
--- a/templates/propositional-retrieval/propositional_retrieval/ingest.py
+++ b/templates/propositional-retrieval/propositional_retrieval/ingest.py
@@ -68,7 +68,7 @@ if __name__ == "__main__":
from langchain_text_splitters import RecursiveCharacterTextSplitter # noqa
from langchain_community.document_loaders.recursive_url_loader import (
RecursiveUrlLoader,
- ) # noqa
+ )
# The attention is all you need paper
# Could add more parsing here, as it's very raw.
diff --git a/templates/rag-astradb/astradb_entomology_rag/__init__.py b/templates/rag-astradb/astradb_entomology_rag/__init__.py
index 3f8e807cab..7997d5909a 100644
--- a/templates/rag-astradb/astradb_entomology_rag/__init__.py
+++ b/templates/rag-astradb/astradb_entomology_rag/__init__.py
@@ -26,7 +26,7 @@ retriever = vector_store.as_retriever(search_kwargs={"k": 3})
inserted_lines = populate(vector_store)
if inserted_lines:
- print(f"Done ({inserted_lines} lines inserted).") # noqa: T201
+ print(f"Done ({inserted_lines} lines inserted).")
entomology_template = """
You are an expert entomologist, tasked with answering enthusiast biologists' questions.
diff --git a/templates/rag-astradb/main.py b/templates/rag-astradb/main.py
index e049d7f743..f80b1b6626 100644
--- a/templates/rag-astradb/main.py
+++ b/templates/rag-astradb/main.py
@@ -2,4 +2,4 @@ from astradb_entomology_rag import chain
if __name__ == "__main__":
response = chain.invoke("Are there more coleoptera or bugs?")
- print(response) # noqa: T201
+ print(response)
diff --git a/templates/rag-aws-bedrock/main.py b/templates/rag-aws-bedrock/main.py
index 7be600d6bc..d0a3c2f48c 100644
--- a/templates/rag-aws-bedrock/main.py
+++ b/templates/rag-aws-bedrock/main.py
@@ -3,4 +3,4 @@ from rag_aws_bedrock.chain import chain
if __name__ == "__main__":
query = "What is this data about?"
- print(chain.invoke(query)) # noqa: T201
+ print(chain.invoke(query))
diff --git a/templates/rag-aws-kendra/main.py b/templates/rag-aws-kendra/main.py
index a44556cfe3..ceb1daa7af 100644
--- a/templates/rag-aws-kendra/main.py
+++ b/templates/rag-aws-kendra/main.py
@@ -3,4 +3,4 @@ from rag_aws_kendra.chain import chain
if __name__ == "__main__":
query = "Does Kendra support table extraction?"
- print(chain.invoke(query)) # noqa: T201
+ print(chain.invoke(query))
diff --git a/templates/rag-chroma-multi-modal-multi-vector/ingest.py b/templates/rag-chroma-multi-modal-multi-vector/ingest.py
index 941a8b6670..9447ca478e 100644
--- a/templates/rag-chroma-multi-modal-multi-vector/ingest.py
+++ b/templates/rag-chroma-multi-modal-multi-vector/ingest.py
@@ -66,7 +66,7 @@ def generate_img_summaries(img_base64_list):
image_summaries.append(image_summarize(base64_image, prompt))
processed_images.append(base64_image)
except Exception as e:
- print(f"Error with image {i+1}: {e}") # noqa: T201
+ print(f"Error with image {i+1}: {e}")
return image_summaries, processed_images
@@ -178,14 +178,14 @@ def create_multi_vector_retriever(
# Load PDF
doc_path = Path(__file__).parent / "docs/DDOG_Q3_earnings_deck.pdf"
rel_doc_path = doc_path.relative_to(Path.cwd())
-print("Extract slides as images") # noqa: T201
+print("Extract slides as images")
pil_images = get_images_from_pdf(rel_doc_path)
# Convert to b64
images_base_64 = [convert_to_base64(i) for i in pil_images]
# Image summaries
-print("Generate image summaries") # noqa: T201
+print("Generate image summaries")
image_summaries, images_base_64_processed = generate_img_summaries(images_base_64)
# The vectorstore to use to index the images summaries
diff --git a/templates/rag-chroma-multi-modal/ingest.py b/templates/rag-chroma-multi-modal/ingest.py
index 98d4f701a4..67c5f070c5 100644
--- a/templates/rag-chroma-multi-modal/ingest.py
+++ b/templates/rag-chroma-multi-modal/ingest.py
@@ -27,14 +27,14 @@ doc_path = Path(__file__).parent / "docs/DDOG_Q3_earnings_deck.pdf"
img_dump_path = Path(__file__).parent / "docs/"
rel_doc_path = doc_path.relative_to(Path.cwd())
rel_img_dump_path = img_dump_path.relative_to(Path.cwd())
-print("pdf index") # noqa: T201
+print("pdf index")
pil_images = get_images_from_pdf(rel_doc_path, rel_img_dump_path)
-print("done") # noqa: T201
+print("done")
vectorstore = Path(__file__).parent / "chroma_db_multi_modal"
re_vectorstore_path = vectorstore.relative_to(Path.cwd())
# Load embedding function
-print("Loading embedding function") # noqa: T201
+print("Loading embedding function")
embedding = OpenCLIPEmbeddings(model_name="ViT-H-14", checkpoint="laion2b_s32b_b79k")
# Create chroma
@@ -54,5 +54,5 @@ image_uris = sorted(
)
# Add images
-print("Embedding images") # noqa: T201
+print("Embedding images")
vectorstore_mmembd.add_images(uris=image_uris)
diff --git a/templates/rag-elasticsearch/main.py b/templates/rag-elasticsearch/main.py
index 8da3a6ab06..4034ab08f2 100644
--- a/templates/rag-elasticsearch/main.py
+++ b/templates/rag-elasticsearch/main.py
@@ -14,7 +14,7 @@ if __name__ == "__main__":
"chat_history": [],
}
)
- print(response) # noqa: T201
+ print(response)
follow_up_question = "What are their objectives?"
@@ -30,4 +30,4 @@ if __name__ == "__main__":
}
)
- print(response) # noqa: T201
+ print(response)
diff --git a/templates/rag-fusion/main.py b/templates/rag-fusion/main.py
index 8d6fe45edf..ed32889561 100644
--- a/templates/rag-fusion/main.py
+++ b/templates/rag-fusion/main.py
@@ -2,4 +2,4 @@ from rag_fusion.chain import chain
if __name__ == "__main__":
original_query = "impact of climate change"
- print(chain.invoke(original_query)) # noqa: T201
+ print(chain.invoke(original_query))
diff --git a/templates/rag-gemini-multi-modal/ingest.py b/templates/rag-gemini-multi-modal/ingest.py
index 98d4f701a4..67c5f070c5 100644
--- a/templates/rag-gemini-multi-modal/ingest.py
+++ b/templates/rag-gemini-multi-modal/ingest.py
@@ -27,14 +27,14 @@ doc_path = Path(__file__).parent / "docs/DDOG_Q3_earnings_deck.pdf"
img_dump_path = Path(__file__).parent / "docs/"
rel_doc_path = doc_path.relative_to(Path.cwd())
rel_img_dump_path = img_dump_path.relative_to(Path.cwd())
-print("pdf index") # noqa: T201
+print("pdf index")
pil_images = get_images_from_pdf(rel_doc_path, rel_img_dump_path)
-print("done") # noqa: T201
+print("done")
vectorstore = Path(__file__).parent / "chroma_db_multi_modal"
re_vectorstore_path = vectorstore.relative_to(Path.cwd())
# Load embedding function
-print("Loading embedding function") # noqa: T201
+print("Loading embedding function")
embedding = OpenCLIPEmbeddings(model_name="ViT-H-14", checkpoint="laion2b_s32b_b79k")
# Create chroma
@@ -54,5 +54,5 @@ image_uris = sorted(
)
# Add images
-print("Embedding images") # noqa: T201
+print("Embedding images")
vectorstore_mmembd.add_images(uris=image_uris)
diff --git a/templates/rag-google-cloud-sensitive-data-protection/main.py b/templates/rag-google-cloud-sensitive-data-protection/main.py
index a69f075673..30c6fa53c3 100644
--- a/templates/rag-google-cloud-sensitive-data-protection/main.py
+++ b/templates/rag-google-cloud-sensitive-data-protection/main.py
@@ -6,4 +6,4 @@ if __name__ == "__main__":
"is 555-555-5555. And my email is [email protected]. Have a nice day.",
"chat_history": [],
}
- print(chain.invoke(query)) # noqa: T201
+ print(chain.invoke(query))
diff --git a/templates/rag-google-cloud-vertexai-search/main.py b/templates/rag-google-cloud-vertexai-search/main.py
index 6912be7e2a..a96c83c8bb 100644
--- a/templates/rag-google-cloud-vertexai-search/main.py
+++ b/templates/rag-google-cloud-vertexai-search/main.py
@@ -2,4 +2,4 @@ from rag_google_cloud_vertexai_search.chain import chain
if __name__ == "__main__":
query = "Who is the CEO of Google Cloud?"
- print(chain.invoke(query)) # noqa: T201
+ print(chain.invoke(query))
diff --git a/templates/rag-multi-modal-local/ingest.py b/templates/rag-multi-modal-local/ingest.py
index e1ad090af0..9aad0cf656 100644
--- a/templates/rag-multi-modal-local/ingest.py
+++ b/templates/rag-multi-modal-local/ingest.py
@@ -20,7 +20,7 @@ vectorstore = Path(__file__).parent / "chroma_db_multi_modal"
re_vectorstore_path = vectorstore.relative_to(Path.cwd())
# Load embedding function
-print("Loading embedding function") # noqa: T201
+print("Loading embedding function")
embedding = OpenCLIPEmbeddings(model_name="ViT-H-14", checkpoint="laion2b_s32b_b79k")
# Create chroma
@@ -31,5 +31,5 @@ vectorstore_mmembd = Chroma(
)
# Add images
-print("Embedding images") # noqa: T201
+print("Embedding images")
vectorstore_mmembd.add_images(uris=image_uris)
diff --git a/templates/rag-multi-modal-mv-local/ingest.py b/templates/rag-multi-modal-mv-local/ingest.py
index 72b9dbf769..4e3f711bd2 100644
--- a/templates/rag-multi-modal-mv-local/ingest.py
+++ b/templates/rag-multi-modal-mv-local/ingest.py
@@ -63,7 +63,7 @@ def generate_img_summaries(img_base64_list):
image_summaries.append(image_summarize(base64_image, prompt))
processed_images.append(base64_image)
except Exception as e:
- print(f"Error with image {i+1}: {e}") # noqa: T201
+ print(f"Error with image {i+1}: {e}")
return image_summaries, processed_images
@@ -162,14 +162,14 @@ def create_multi_vector_retriever(vectorstore, image_summaries, images):
# Load images
doc_path = Path(__file__).parent / "docs/"
rel_doc_path = doc_path.relative_to(Path.cwd())
-print("Read images") # noqa: T201
+print("Read images")
pil_images = get_images(rel_doc_path)
# Convert to b64
images_base_64 = [convert_to_base64(i) for i in pil_images]
# Image summaries
-print("Generate image summaries") # noqa: T201
+print("Generate image summaries")
image_summaries, images_base_64_processed = generate_img_summaries(images_base_64)
# The vectorstore to use to index the images summaries
diff --git a/templates/rag-opensearch/dummy_index_setup.py b/templates/rag-opensearch/dummy_index_setup.py
index e3bc286444..bb658adf51 100644
--- a/templates/rag-opensearch/dummy_index_setup.py
+++ b/templates/rag-opensearch/dummy_index_setup.py
@@ -41,7 +41,7 @@ index_settings = {
response = client.indices.create(index=OPENSEARCH_INDEX_NAME, body=index_settings)
-print(response) # noqa: T201
+print(response)
# Insert docs
@@ -57,4 +57,4 @@ for each in docs:
response = client.index(index=OPENSEARCH_INDEX_NAME, body=document, refresh=True)
- print(response) # noqa: T201
+ print(response)
diff --git a/templates/rag-redis-multi-modal-multi-vector/ingest.py b/templates/rag-redis-multi-modal-multi-vector/ingest.py
index 00d6d02987..e916dd52fa 100644
--- a/templates/rag-redis-multi-modal-multi-vector/ingest.py
+++ b/templates/rag-redis-multi-modal-multi-vector/ingest.py
@@ -62,7 +62,7 @@ def generate_img_summaries(img_base64_list):
image_summaries.append(image_summarize(base64_image, prompt))
processed_images.append(base64_image)
except Exception as e:
- print(f"Error with image {i+1}: {e}") # noqa: T201
+ print(f"Error with image {i+1}: {e}")
return image_summaries, processed_images
@@ -151,14 +151,14 @@ if __name__ == "__main__":
doc_path = Path(__file__).parent / "docs/nvda-f3q24-investor-presentation-final.pdf"
rel_doc_path = doc_path.relative_to(Path.cwd())
- print("Extract slides as images") # noqa: T201
+ print("Extract slides as images")
pil_images = get_images_from_pdf(rel_doc_path)
# Convert to b64
images_base_64 = [convert_to_base64(i) for i in pil_images]
# Generate image summaries
- print("Generate image summaries") # noqa: T201
+ print("Generate image summaries")
image_summaries, images_base_64_processed = generate_img_summaries(images_base_64)
# Create documents
diff --git a/templates/rag-redis/ingest.py b/templates/rag-redis/ingest.py
index b4963f6dc5..db6413daa1 100644
--- a/templates/rag-redis/ingest.py
+++ b/templates/rag-redis/ingest.py
@@ -17,7 +17,7 @@ def ingest_documents():
data_path = "data/"
doc = [os.path.join(data_path, file) for file in os.listdir(data_path)][0]
- print("Parsing 10k filing doc for NIKE", doc) # noqa: T201
+ print("Parsing 10k filing doc for NIKE", doc)
text_splitter = RecursiveCharacterTextSplitter(
chunk_size=1500, chunk_overlap=100, add_start_index=True
@@ -25,7 +25,7 @@ def ingest_documents():
loader = UnstructuredFileLoader(doc, mode="single", strategy="fast")
chunks = loader.load_and_split(text_splitter)
- print("Done preprocessing. Created", len(chunks), "chunks of the original pdf") # noqa: T201
+ print("Done preprocessing. Created", len(chunks), "chunks of the original pdf")
# Create vectorstore
embedder = HuggingFaceEmbeddings(model_name=EMBED_MODEL)
diff --git a/templates/rag-self-query/main.py b/templates/rag-self-query/main.py
index 8385dfaa4f..83a1dc4c6c 100644
--- a/templates/rag-self-query/main.py
+++ b/templates/rag-self-query/main.py
@@ -14,7 +14,7 @@ if __name__ == "__main__":
"chat_history": [],
}
)
- print(response) # noqa: T201
+ print(response)
follow_up_question = "What are their objectives?"
@@ -30,4 +30,4 @@ if __name__ == "__main__":
}
)
- print(response) # noqa: T201
+ print(response)
diff --git a/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py b/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py
index 223e76194b..111d08b59d 100644
--- a/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py
+++ b/templates/rag-timescale-conversation/rag_timescale_conversation/load_sample_dataset.py
@@ -47,7 +47,7 @@ def load_ts_git_dataset(
with open(json_file_path, "w") as json_file:
json_file.write(response.text)
else:
- print(f"Failed to download JSON file. Status code: {response.status_code}") # noqa: T201
+ print(f"Failed to download JSON file. Status code: {response.status_code}")
loader = JSONLoader(
file_path=json_file_path,
diff --git a/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/load_sample_dataset.py b/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/load_sample_dataset.py
index 223e76194b..111d08b59d 100644
--- a/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/load_sample_dataset.py
+++ b/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/load_sample_dataset.py
@@ -47,7 +47,7 @@ def load_ts_git_dataset(
with open(json_file_path, "w") as json_file:
json_file.write(response.text)
else:
- print(f"Failed to download JSON file. Status code: {response.status_code}") # noqa: T201
+ print(f"Failed to download JSON file. Status code: {response.status_code}")
loader = JSONLoader(
file_path=json_file_path,
diff --git a/templates/research-assistant/research_assistant/search/web.py b/templates/research-assistant/research_assistant/search/web.py
index 5f647904ab..52ea08542d 100644
--- a/templates/research-assistant/research_assistant/search/web.py
+++ b/templates/research-assistant/research_assistant/search/web.py
@@ -40,7 +40,7 @@ def scrape_text(url: str):
else:
return f"Failed to retrieve the webpage: Status code {response.status_code}"
except Exception as e:
- print(e) # noqa: T201
+ print(e)
return f"Failed to retrieve the webpage: {e}"
diff --git a/templates/sql-llamacpp/sql_llamacpp/chain.py b/templates/sql-llamacpp/sql_llamacpp/chain.py
index dd749681c6..1dd53f69a5 100644
--- a/templates/sql-llamacpp/sql_llamacpp/chain.py
+++ b/templates/sql-llamacpp/sql_llamacpp/chain.py
@@ -19,15 +19,15 @@ url = (
)
# Check if file is present in the current directory
if not os.path.exists(file_name):
- print(f"'{file_name}' not found. Downloading...") # noqa: T201
+ print(f"'{file_name}' not found. Downloading...")
# Download the file
response = requests.get(url)
response.raise_for_status() # Raise an exception for HTTP errors
with open(file_name, "wb") as f:
f.write(response.content)
- print(f"'{file_name}' has been downloaded.") # noqa: T201
+ print(f"'{file_name}' has been downloaded.")
else:
- print(f"'{file_name}' already exists in the current directory.") # noqa: T201
+ print(f"'{file_name}' already exists in the current directory.")
# Add the LLM downloaded from HF
model_path = file_name
diff --git a/templates/sql-research-assistant/sql_research_assistant/chain.py b/templates/sql-research-assistant/sql_research_assistant/chain.py
index 56f025df92..d04e14efd8 100644
--- a/templates/sql-research-assistant/sql_research_assistant/chain.py
+++ b/templates/sql-research-assistant/sql_research_assistant/chain.py
@@ -17,6 +17,6 @@ chain = chain_notypes.with_types(input_type=InputType)
if __name__ == "__main__":
- print( # noqa: T201
+ print(
chain.invoke({"question": "who is typically older: point guards or centers?"})
)
diff --git a/templates/sql-research-assistant/sql_research_assistant/search/web.py b/templates/sql-research-assistant/sql_research_assistant/search/web.py
index d1ac84c941..cb8b8aa41a 100644
--- a/templates/sql-research-assistant/sql_research_assistant/search/web.py
+++ b/templates/sql-research-assistant/sql_research_assistant/search/web.py
@@ -40,7 +40,7 @@ def scrape_text(url: str):
else:
return f"Failed to retrieve the webpage: Status code {response.status_code}"
except Exception as e:
- print(e) # noqa: T201
+ print(e)
return f"Failed to retrieve the webpage: {e}"
diff --git a/templates/xml-agent/main.py b/templates/xml-agent/main.py
index 55786914da..02647eb845 100644
--- a/templates/xml-agent/main.py
+++ b/templates/xml-agent/main.py
@@ -2,4 +2,4 @@ from xml_agent.agent import agent_executor
if __name__ == "__main__":
question = "who won the womens world cup in 2023?"
- print(agent_executor.invoke({"question": question, "chat_history": []})) # noqa: T201
+ print(agent_executor.invoke({"question": question, "chat_history": []}))