diff --git a/libs/community/langchain_community/adapters/openai.py b/libs/community/langchain_community/adapters/openai.py
index cc40b581122..09b0f5d1d51 100644
--- a/libs/community/langchain_community/adapters/openai.py
+++ b/libs/community/langchain_community/adapters/openai.py
@@ -104,7 +104,7 @@ def convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
additional_kwargs["name"] = _dict["name"]
return ToolMessage(
content=_dict.get("content", ""),
- tool_call_id=_dict.get("tool_call_id"), # type: ignore[arg-type]
+ tool_call_id=_dict.get("tool_call_id"),
additional_kwargs=additional_kwargs,
)
else:
diff --git a/libs/community/langchain_community/agent_toolkits/azure_ai_services.py b/libs/community/langchain_community/agent_toolkits/azure_ai_services.py
index 4b3b529c370..1a69fa7c5bd 100644
--- a/libs/community/langchain_community/agent_toolkits/azure_ai_services.py
+++ b/libs/community/langchain_community/agent_toolkits/azure_ai_services.py
@@ -22,7 +22,7 @@ class AzureAiServicesToolkit(BaseToolkit):
tools: List[BaseTool] = [
AzureAiServicesDocumentIntelligenceTool(), # type: ignore[call-arg]
- AzureAiServicesImageAnalysisTool(), # type: ignore[call-arg]
+ AzureAiServicesImageAnalysisTool(),
AzureAiServicesSpeechToTextTool(), # type: ignore[call-arg]
AzureAiServicesTextToSpeechTool(), # type: ignore[call-arg]
AzureAiServicesTextAnalyticsForHealthTool(), # type: ignore[call-arg]
diff --git a/libs/community/langchain_community/agent_toolkits/file_management/toolkit.py b/libs/community/langchain_community/agent_toolkits/file_management/toolkit.py
index 90b1f618ec1..82c4f3d5cc9 100644
--- a/libs/community/langchain_community/agent_toolkits/file_management/toolkit.py
+++ b/libs/community/langchain_community/agent_toolkits/file_management/toolkit.py
@@ -81,7 +81,7 @@ class FileManagementToolkit(BaseToolkit):
tools: List[BaseTool] = []
for tool in allowed_tools:
tool_cls = _FILE_TOOLS_MAP[tool]
- tools.append(tool_cls(root_dir=self.root_dir)) # type: ignore[call-arg]
+ tools.append(tool_cls(root_dir=self.root_dir))
return tools
diff --git a/libs/community/langchain_community/agent_toolkits/nla/tool.py b/libs/community/langchain_community/agent_toolkits/nla/tool.py
index f097edaa118..c1206d94758 100644
--- a/libs/community/langchain_community/agent_toolkits/nla/tool.py
+++ b/libs/community/langchain_community/agent_toolkits/nla/tool.py
@@ -13,7 +13,7 @@ from langchain_community.tools.openapi.utils.openapi_utils import OpenAPISpec
from langchain_community.utilities.requests import Requests
-class NLATool(Tool): # type: ignore[override]
+class NLATool(Tool):
"""Natural Language API Tool."""
@classmethod
diff --git a/libs/community/langchain_community/agent_toolkits/openapi/planner.py b/libs/community/langchain_community/agent_toolkits/openapi/planner.py
index 3d49a225370..978d5d3ce3e 100644
--- a/libs/community/langchain_community/agent_toolkits/openapi/planner.py
+++ b/libs/community/langchain_community/agent_toolkits/openapi/planner.py
@@ -64,7 +64,7 @@ def _get_default_llm_chain_factory(
return partial(_get_default_llm_chain, prompt)
-class RequestsGetToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsGetToolWithParsing(BaseRequestsTool, BaseTool):
"""Requests GET tool with LLM-instructed extraction of truncated responses."""
name: str = "requests_get"
@@ -98,7 +98,7 @@ class RequestsGetToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[ov
raise NotImplementedError()
-class RequestsPostToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPostToolWithParsing(BaseRequestsTool, BaseTool):
"""Requests POST tool with LLM-instructed extraction of truncated responses."""
name: str = "requests_post"
@@ -129,7 +129,7 @@ class RequestsPostToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[o
raise NotImplementedError()
-class RequestsPatchToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPatchToolWithParsing(BaseRequestsTool, BaseTool):
"""Requests PATCH tool with LLM-instructed extraction of truncated responses."""
name: str = "requests_patch"
@@ -162,7 +162,7 @@ class RequestsPatchToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[
raise NotImplementedError()
-class RequestsPutToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPutToolWithParsing(BaseRequestsTool, BaseTool):
"""Requests PUT tool with LLM-instructed extraction of truncated responses."""
name: str = "requests_put"
@@ -193,7 +193,7 @@ class RequestsPutToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[ov
raise NotImplementedError()
-class RequestsDeleteToolWithParsing(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsDeleteToolWithParsing(BaseRequestsTool, BaseTool):
"""Tool that sends a DELETE request and parses the response."""
name: str = "requests_delete"
@@ -266,7 +266,7 @@ def _create_api_controller_agent(
if "GET" in allowed_operations:
get_llm_chain = LLMChain(llm=llm, prompt=PARSING_GET_PROMPT)
tools.append(
- RequestsGetToolWithParsing( # type: ignore[call-arg]
+ RequestsGetToolWithParsing(
requests_wrapper=requests_wrapper,
llm_chain=get_llm_chain,
allow_dangerous_requests=allow_dangerous_requests,
@@ -275,7 +275,7 @@ def _create_api_controller_agent(
if "POST" in allowed_operations:
post_llm_chain = LLMChain(llm=llm, prompt=PARSING_POST_PROMPT)
tools.append(
- RequestsPostToolWithParsing( # type: ignore[call-arg]
+ RequestsPostToolWithParsing(
requests_wrapper=requests_wrapper,
llm_chain=post_llm_chain,
allow_dangerous_requests=allow_dangerous_requests,
@@ -284,7 +284,7 @@ def _create_api_controller_agent(
if "PUT" in allowed_operations:
put_llm_chain = LLMChain(llm=llm, prompt=PARSING_PUT_PROMPT)
tools.append(
- RequestsPutToolWithParsing( # type: ignore[call-arg]
+ RequestsPutToolWithParsing(
requests_wrapper=requests_wrapper,
llm_chain=put_llm_chain,
allow_dangerous_requests=allow_dangerous_requests,
@@ -293,7 +293,7 @@ def _create_api_controller_agent(
if "DELETE" in allowed_operations:
delete_llm_chain = LLMChain(llm=llm, prompt=PARSING_DELETE_PROMPT)
tools.append(
- RequestsDeleteToolWithParsing( # type: ignore[call-arg]
+ RequestsDeleteToolWithParsing(
requests_wrapper=requests_wrapper,
llm_chain=delete_llm_chain,
allow_dangerous_requests=allow_dangerous_requests,
@@ -302,7 +302,7 @@ def _create_api_controller_agent(
if "PATCH" in allowed_operations:
patch_llm_chain = LLMChain(llm=llm, prompt=PARSING_PATCH_PROMPT)
tools.append(
- RequestsPatchToolWithParsing( # type: ignore[call-arg]
+ RequestsPatchToolWithParsing(
requests_wrapper=requests_wrapper,
llm_chain=patch_llm_chain,
allow_dangerous_requests=allow_dangerous_requests,
diff --git a/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py b/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py
index 113ff9be53c..1d702f54236 100644
--- a/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py
+++ b/libs/community/langchain_community/agent_toolkits/powerbi/toolkit.py
@@ -75,7 +75,7 @@ class PowerBIToolkit(BaseToolkit):
powerbi=self.powerbi,
examples=self.examples,
max_iterations=self.max_iterations,
- output_token_limit=self.output_token_limit, # type: ignore[arg-type]
+ output_token_limit=self.output_token_limit,
tiktoken_model_name=self.tiktoken_model_name,
),
InfoPowerBITool(powerbi=self.powerbi),
diff --git a/libs/community/langchain_community/agents/openai_assistant/base.py b/libs/community/langchain_community/agents/openai_assistant/base.py
index 25ad90f17fe..39559aabe9b 100644
--- a/libs/community/langchain_community/agents/openai_assistant/base.py
+++ b/libs/community/langchain_community/agents/openai_assistant/base.py
@@ -289,7 +289,7 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
name=name,
instructions=instructions,
tools=[_get_assistants_tool(tool) for tool in tools],
- tool_resources=tool_resources, # type: ignore[arg-type]
+ tool_resources=tool_resources,
model=model,
extra_body=extra_body,
**model_kwargs,
@@ -431,7 +431,7 @@ class OpenAIAssistantV2Runnable(OpenAIAssistantRunnable):
name=name,
instructions=instructions,
tools=openai_tools,
- tool_resources=tool_resources, # type: ignore[arg-type]
+ tool_resources=tool_resources,
model=model,
)
return cls(assistant_id=assistant.id, async_client=async_client, **kwargs)
diff --git a/libs/community/langchain_community/cache.py b/libs/community/langchain_community/cache.py
index f8b7f0323ef..4d38015d19c 100644
--- a/libs/community/langchain_community/cache.py
+++ b/libs/community/langchain_community/cache.py
@@ -579,7 +579,7 @@ class AsyncRedisCache(_RedisCacheBase):
try:
async with self.redis.pipeline() as pipe:
self._configure_pipeline_for_update(key, pipe, return_val, self.ttl)
- await pipe.execute() # type: ignore[attr-defined]
+ await pipe.execute()
except Exception as e:
logger.error(f"Redis async update failed: {e}")
diff --git a/libs/community/langchain_community/chains/ernie_functions/base.py b/libs/community/langchain_community/chains/ernie_functions/base.py
index e2a58548f30..efe9b9b3574 100644
--- a/libs/community/langchain_community/chains/ernie_functions/base.py
+++ b/libs/community/langchain_community/chains/ernie_functions/base.py
@@ -378,7 +378,7 @@ def create_ernie_fn_chain(
output_key: str = "function",
output_parser: Optional[BaseLLMOutputParser] = None,
**kwargs: Any,
-) -> LLMChain: # type: ignore[valid-type]
+) -> LLMChain:
"""[Legacy] Create an LLM chain that uses Ernie functions.
Args:
@@ -455,7 +455,7 @@ def create_ernie_fn_chain(
}
if len(ernie_functions) == 1:
llm_kwargs["function_call"] = {"name": ernie_functions[0]["name"]}
- llm_chain = LLMChain( # type: ignore[misc]
+ llm_chain = LLMChain(
llm=llm,
prompt=prompt,
output_parser=output_parser,
@@ -474,7 +474,7 @@ def create_structured_output_chain(
output_key: str = "function",
output_parser: Optional[BaseLLMOutputParser] = None,
**kwargs: Any,
-) -> LLMChain: # type: ignore[valid-type]
+) -> LLMChain:
"""[Legacy] Create an LLMChain that uses an Ernie function to get a structured output.
Args:
diff --git a/libs/community/langchain_community/chains/graph_qa/cypher.py b/libs/community/langchain_community/chains/graph_qa/cypher.py
index dbfde8d289b..719ff3aad09 100644
--- a/libs/community/langchain_community/chains/graph_qa/cypher.py
+++ b/libs/community/langchain_community/chains/graph_qa/cypher.py
@@ -324,7 +324,7 @@ class GraphCypherQAChain(Chain):
cypher_generation_chain = LLMChain(
llm=cypher_llm or llm, # type: ignore[arg-type]
- **use_cypher_llm_kwargs, # type: ignore[arg-type]
+ **use_cypher_llm_kwargs,
)
if exclude_types and include_types:
diff --git a/libs/community/langchain_community/chains/graph_qa/memgraph.py b/libs/community/langchain_community/chains/graph_qa/memgraph.py
index e82c0b7c5d5..ebbc220a8f4 100644
--- a/libs/community/langchain_community/chains/graph_qa/memgraph.py
+++ b/libs/community/langchain_community/chains/graph_qa/memgraph.py
@@ -235,7 +235,7 @@ class MemgraphQAChain(Chain):
llm_to_use = cypher_llm if cypher_llm is not None else llm
if prompt is not None and llm_to_use is not None:
- cypher_generation_chain = prompt | llm_to_use | StrOutputParser() # type: ignore[arg-type]
+ cypher_generation_chain = prompt | llm_to_use | StrOutputParser()
else:
raise ValueError(
"Missing required components for the cypher generation chain: "
diff --git a/libs/community/langchain_community/chains/graph_qa/neptune_sparql.py b/libs/community/langchain_community/chains/graph_qa/neptune_sparql.py
index 9155fae090e..efc57a5efd4 100644
--- a/libs/community/langchain_community/chains/graph_qa/neptune_sparql.py
+++ b/libs/community/langchain_community/chains/graph_qa/neptune_sparql.py
@@ -181,7 +181,7 @@ class NeptuneSparqlQAChain(Chain):
)
sparql_generation_chain = LLMChain(llm=llm, prompt=sparql_prompt)
- return cls( # type: ignore[call-arg]
+ return cls(
qa_chain=qa_chain,
sparql_generation_chain=sparql_generation_chain,
examples=examples,
diff --git a/libs/community/langchain_community/chains/llm_requests.py b/libs/community/langchain_community/chains/llm_requests.py
index 6fc23683d20..e781c20d2f1 100644
--- a/libs/community/langchain_community/chains/llm_requests.py
+++ b/libs/community/langchain_community/chains/llm_requests.py
@@ -28,7 +28,7 @@ class LLMRequestsChain(Chain):
See https://python.langchain.com/docs/security for more information.
"""
- llm_chain: LLMChain # type: ignore[valid-type]
+ llm_chain: LLMChain
requests_wrapper: TextRequestsWrapper = Field(
default_factory=lambda: TextRequestsWrapper(headers=DEFAULT_HEADERS),
exclude=True,
@@ -88,7 +88,7 @@ class LLMRequestsChain(Chain):
# extract the text from the html
soup = BeautifulSoup(res, "html.parser")
other_keys[self.requests_key] = soup.get_text()[: self.text_length]
- result = self.llm_chain.predict( # type: ignore[attr-defined]
+ result = self.llm_chain.predict(
callbacks=_run_manager.get_child(), **other_keys
)
return {self.output_key: result}
diff --git a/libs/community/langchain_community/chat_loaders/imessage.py b/libs/community/langchain_community/chat_loaders/imessage.py
index 41411113550..b6a1dd00d5f 100644
--- a/libs/community/langchain_community/chat_loaders/imessage.py
+++ b/libs/community/langchain_community/chat_loaders/imessage.py
@@ -158,7 +158,7 @@ class IMessageChatLoader(BaseChatLoader):
continue
results.append(
- HumanMessage( # type: ignore[call-arg]
+ HumanMessage(
role=sender,
content=content,
additional_kwargs={
diff --git a/libs/community/langchain_community/chat_loaders/slack.py b/libs/community/langchain_community/chat_loaders/slack.py
index 4a11e144454..7ce31f4e546 100644
--- a/libs/community/langchain_community/chat_loaders/slack.py
+++ b/libs/community/langchain_community/chat_loaders/slack.py
@@ -52,7 +52,7 @@ class SlackChatLoader(BaseChatLoader):
)
else:
results.append(
- HumanMessage( # type: ignore[call-arg]
+ HumanMessage(
role=sender,
content=text,
additional_kwargs={
diff --git a/libs/community/langchain_community/chat_loaders/utils.py b/libs/community/langchain_community/chat_loaders/utils.py
index c82e2e6cb59..f9d1310a1a7 100644
--- a/libs/community/langchain_community/chat_loaders/utils.py
+++ b/libs/community/langchain_community/chat_loaders/utils.py
@@ -78,7 +78,7 @@ def map_ai_messages_in_session(chat_sessions: ChatSession, sender: str) -> ChatS
message = AIMessage(
content=message.content,
additional_kwargs=message.additional_kwargs.copy(),
- example=getattr(message, "example", None), # type: ignore[arg-type]
+ example=getattr(message, "example", None),
)
num_converted += 1
messages.append(message)
diff --git a/libs/community/langchain_community/chat_loaders/whatsapp.py b/libs/community/langchain_community/chat_loaders/whatsapp.py
index 4856da0ead8..3e678b10632 100644
--- a/libs/community/langchain_community/chat_loaders/whatsapp.py
+++ b/libs/community/langchain_community/chat_loaders/whatsapp.py
@@ -73,7 +73,7 @@ class WhatsAppChatLoader(BaseChatLoader):
timestamp, sender, text = result.groups()
if not self._ignore_lines.match(text.strip()):
results.append(
- HumanMessage( # type: ignore[call-arg]
+ HumanMessage(
role=sender,
content=text,
additional_kwargs={
diff --git a/libs/community/langchain_community/chat_message_histories/sql.py b/libs/community/langchain_community/chat_message_histories/sql.py
index 08ba11d1fe9..d26804ec733 100644
--- a/libs/community/langchain_community/chat_message_histories/sql.py
+++ b/libs/community/langchain_community/chat_message_histories/sql.py
@@ -85,7 +85,7 @@ def create_message_model(table_name: str, DynamicBase: Any) -> Any:
"""
# Model declared inside a function to have a dynamic table name.
- class Message(DynamicBase): # type: ignore[valid-type, misc]
+ class Message(DynamicBase):
__tablename__ = table_name
id = Column(Integer, primary_key=True)
session_id = Column(Text)
diff --git a/libs/community/langchain_community/chat_models/anyscale.py b/libs/community/langchain_community/chat_models/anyscale.py
index b5db8bbeb0c..1e1a12e6d9e 100644
--- a/libs/community/langchain_community/chat_models/anyscale.py
+++ b/libs/community/langchain_community/chat_models/anyscale.py
@@ -167,7 +167,7 @@ class ChatAnyscale(ChatOpenAI):
else:
values["openai_api_base"] = values["anyscale_api_base"]
values["openai_api_key"] = values["anyscale_api_key"].get_secret_value()
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
except AttributeError as exc:
raise ValueError(
"`openai` has no `ChatCompletion` attribute, this is likely "
diff --git a/libs/community/langchain_community/chat_models/azure_openai.py b/libs/community/langchain_community/chat_models/azure_openai.py
index 6825b3d85e2..4f52d4e563b 100644
--- a/libs/community/langchain_community/chat_models/azure_openai.py
+++ b/libs/community/langchain_community/chat_models/azure_openai.py
@@ -227,7 +227,7 @@ class AzureChatOpenAI(ChatOpenAI):
**client_params
).chat.completions
else:
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
return values
@property
diff --git a/libs/community/langchain_community/chat_models/azureml_endpoint.py b/libs/community/langchain_community/chat_models/azureml_endpoint.py
index a02919d760a..ca7a50793e3 100644
--- a/libs/community/langchain_community/chat_models/azureml_endpoint.py
+++ b/libs/community/langchain_community/chat_models/azureml_endpoint.py
@@ -304,7 +304,7 @@ class AzureMLChatOnlineEndpoint(BaseChatModel, AzureMLBaseEndpoint):
"http_client": None,
}
- client = openai.OpenAI(**client_params) # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ client = openai.OpenAI(**client_params)
message_dicts = [
CustomOpenAIChatContentFormatter._convert_message_to_dict(m)
for m in messages
@@ -312,30 +312,30 @@ class AzureMLChatOnlineEndpoint(BaseChatModel, AzureMLBaseEndpoint):
params = {"stream": True, "stop": stop, "model": None, **kwargs}
default_chunk_class = AIMessageChunk
- for chunk in client.chat.completions.create(messages=message_dicts, **params): # type: ignore[arg-type]
+ for chunk in client.chat.completions.create(messages=message_dicts, **params):
if not isinstance(chunk, dict):
- chunk = chunk.dict() # type: ignore[attr-defined]
- if len(chunk["choices"]) == 0: # type: ignore[call-overload]
+ chunk = chunk.dict()
+ if len(chunk["choices"]) == 0:
continue
- choice = chunk["choices"][0] # type: ignore[call-overload]
- chunk = _convert_delta_to_message_chunk( # type: ignore[assignment]
- choice["delta"], # type: ignore[arg-type, index]
- default_chunk_class, # type: ignore[arg-type, index]
+ choice = chunk["choices"][0]
+ chunk = _convert_delta_to_message_chunk(
+ choice["delta"],
+ default_chunk_class,
)
generation_info = {}
- if finish_reason := choice.get("finish_reason"): # type: ignore[union-attr]
+ if finish_reason := choice.get("finish_reason"):
generation_info["finish_reason"] = finish_reason
- logprobs = choice.get("logprobs") # type: ignore[union-attr]
+ logprobs = choice.get("logprobs")
if logprobs:
generation_info["logprobs"] = logprobs
- default_chunk_class = chunk.__class__ # type: ignore[assignment]
- chunk = ChatGenerationChunk( # type: ignore[assignment]
- message=chunk, # type: ignore[arg-type]
- generation_info=generation_info or None, # type: ignore[arg-type]
+ default_chunk_class = chunk.__class__
+ chunk = ChatGenerationChunk(
+ message=chunk,
+ generation_info=generation_info or None,
)
if run_manager:
- run_manager.on_llm_new_token(chunk.text, chunk=chunk, logprobs=logprobs) # type: ignore[attr-defined, arg-type]
- yield chunk # type: ignore[misc]
+ run_manager.on_llm_new_token(chunk.text, chunk=chunk, logprobs=logprobs)
+ yield chunk
async def _astream(
self,
@@ -359,7 +359,7 @@ class AzureMLChatOnlineEndpoint(BaseChatModel, AzureMLBaseEndpoint):
"http_client": None,
}
- async_client = openai.AsyncOpenAI(**client_params) # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ async_client = openai.AsyncOpenAI(**client_params)
message_dicts = [
CustomOpenAIChatContentFormatter._convert_message_to_dict(m)
for m in messages
@@ -367,9 +367,9 @@ class AzureMLChatOnlineEndpoint(BaseChatModel, AzureMLBaseEndpoint):
params = {"stream": True, "stop": stop, "model": None, **kwargs}
default_chunk_class = AIMessageChunk
- async for chunk in await async_client.chat.completions.create( # type: ignore[attr-defined]
- messages=message_dicts, # type: ignore[arg-type]
- **params, # type: ignore[arg-type]
+ async for chunk in await async_client.chat.completions.create(
+ messages=message_dicts,
+ **params,
):
if not isinstance(chunk, dict):
chunk = chunk.dict()
diff --git a/libs/community/langchain_community/chat_models/baichuan.py b/libs/community/langchain_community/chat_models/baichuan.py
index 73f1a671fa3..66c7b27679b 100644
--- a/libs/community/langchain_community/chat_models/baichuan.py
+++ b/libs/community/langchain_community/chat_models/baichuan.py
@@ -128,7 +128,7 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
return AIMessage(
content=content,
additional_kwargs=additional_kwargs,
- tool_calls=tool_calls, # type: ignore[arg-type]
+ tool_calls=tool_calls,
invalid_tool_calls=invalid_tool_calls,
)
elif role == "tool":
@@ -137,7 +137,7 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
additional_kwargs["name"] = _dict["name"]
return ToolMessage(
content=content,
- tool_call_id=_dict.get("tool_call_id"), # type: ignore[arg-type]
+ tool_call_id=_dict.get("tool_call_id"),
additional_kwargs=additional_kwargs,
)
elif role == "system":
diff --git a/libs/community/langchain_community/chat_models/baidu_qianfan_endpoint.py b/libs/community/langchain_community/chat_models/baidu_qianfan_endpoint.py
index 243ac084d37..5020f6e728d 100644
--- a/libs/community/langchain_community/chat_models/baidu_qianfan_endpoint.py
+++ b/libs/community/langchain_community/chat_models/baidu_qianfan_endpoint.py
@@ -821,7 +821,7 @@ class QianfanChatEndpoint(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
key_name = convert_to_openai_tool(schema)["function"]["name"]
diff --git a/libs/community/langchain_community/chat_models/cloudflare_workersai.py b/libs/community/langchain_community/chat_models/cloudflare_workersai.py
index 4ea9d2d0bf2..6d3e0d67c7f 100644
--- a/libs/community/langchain_community/chat_models/cloudflare_workersai.py
+++ b/libs/community/langchain_community/chat_models/cloudflare_workersai.py
@@ -213,7 +213,7 @@ class ChatCloudflareWorkersAI(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
output_parser = JsonOutputKeyToolsParser(
@@ -222,7 +222,7 @@ class ChatCloudflareWorkersAI(BaseChatModel):
elif method == "json_mode":
llm = self.bind(response_format={"type": "json_object"})
output_parser = (
- PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
+ PydanticOutputParser(pydantic_object=schema) # type: ignore[arg-type]
if is_pydantic_schema
else JsonOutputParser()
)
diff --git a/libs/community/langchain_community/chat_models/everlyai.py b/libs/community/langchain_community/chat_models/everlyai.py
index 52dd4f6c599..b45b40a80e0 100644
--- a/libs/community/langchain_community/chat_models/everlyai.py
+++ b/libs/community/langchain_community/chat_models/everlyai.py
@@ -110,7 +110,7 @@ class ChatEverlyAI(ChatOpenAI):
"Please install it with `pip install openai`.",
) from e
try:
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
except AttributeError as exc:
raise ValueError(
"`openai` has no `ChatCompletion` attribute, this is likely "
diff --git a/libs/community/langchain_community/chat_models/jinachat.py b/libs/community/langchain_community/chat_models/jinachat.py
index 9a3c8f8c037..72c962d9354 100644
--- a/libs/community/langchain_community/chat_models/jinachat.py
+++ b/libs/community/langchain_community/chat_models/jinachat.py
@@ -70,11 +70,11 @@ def _create_retry_decorator(llm: JinaChat) -> Callable[[Any], Any]:
stop=stop_after_attempt(llm.max_retries),
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
@@ -234,7 +234,7 @@ class JinaChat(BaseChatModel):
"Please install it with `pip install openai`."
)
try:
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
except AttributeError:
raise ValueError(
"`openai` has no `ChatCompletion` attribute, this is likely "
@@ -266,11 +266,11 @@ class JinaChat(BaseChatModel):
stop=stop_after_attempt(self.max_retries),
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
diff --git a/libs/community/langchain_community/chat_models/konko.py b/libs/community/langchain_community/chat_models/konko.py
index a1164d6d178..af9738f12e3 100644
--- a/libs/community/langchain_community/chat_models/konko.py
+++ b/libs/community/langchain_community/chat_models/konko.py
@@ -42,7 +42,7 @@ DEFAULT_MODEL = "meta-llama/Llama-2-13b-chat-hf"
logger = logging.getLogger(__name__)
-class ChatKonko(ChatOpenAI): # type: ignore[override]
+class ChatKonko(ChatOpenAI):
"""`ChatKonko` Chat large language models API.
To use, you should have the ``konko`` python package installed, and the
diff --git a/libs/community/langchain_community/chat_models/llamacpp.py b/libs/community/langchain_community/chat_models/llamacpp.py
index 9714e766250..46caf5f58d7 100644
--- a/libs/community/langchain_community/chat_models/llamacpp.py
+++ b/libs/community/langchain_community/chat_models/llamacpp.py
@@ -664,7 +664,7 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
additional_kwargs=additional_kwargs,
name=name,
id=id_,
- tool_calls=tool_calls, # type: ignore[arg-type]
+ tool_calls=tool_calls,
invalid_tool_calls=invalid_tool_calls,
)
elif role == "system":
diff --git a/libs/community/langchain_community/chat_models/minimax.py b/libs/community/langchain_community/chat_models/minimax.py
index 8329a7d4651..8320c8fafcb 100644
--- a/libs/community/langchain_community/chat_models/minimax.py
+++ b/libs/community/langchain_community/chat_models/minimax.py
@@ -777,7 +777,7 @@ class MiniMaxChat(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
key_name = convert_to_openai_tool(schema)["function"]["name"]
diff --git a/libs/community/langchain_community/chat_models/moonshot.py b/libs/community/langchain_community/chat_models/moonshot.py
index 68f8fdc5a5a..6d31426fda7 100644
--- a/libs/community/langchain_community/chat_models/moonshot.py
+++ b/libs/community/langchain_community/chat_models/moonshot.py
@@ -12,7 +12,7 @@ from langchain_community.chat_models import ChatOpenAI
from langchain_community.llms.moonshot import MOONSHOT_SERVICE_URL_BASE, MoonshotCommon
-class MoonshotChat(MoonshotCommon, ChatOpenAI): # type: ignore[misc, override, override]
+class MoonshotChat(MoonshotCommon, ChatOpenAI): # type: ignore[misc]
"""Moonshot chat model integration.
Setup:
diff --git a/libs/community/langchain_community/chat_models/oci_data_science.py b/libs/community/langchain_community/chat_models/oci_data_science.py
index 8ac571adbd8..bc5f4c4a765 100644
--- a/libs/community/langchain_community/chat_models/oci_data_science.py
+++ b/libs/community/langchain_community/chat_models/oci_data_science.py
@@ -587,7 +587,7 @@ class ChatOCIModelDeployment(BaseChatModel, BaseOCIModelDeployment):
if method == "json_mode":
llm = self.bind(response_format={"type": "json_object"})
output_parser = (
- PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
+ PydanticOutputParser(pydantic_object=schema) # type: ignore[arg-type]
if is_pydantic_schema
else JsonOutputParser()
)
diff --git a/libs/community/langchain_community/chat_models/oci_generative_ai.py b/libs/community/langchain_community/chat_models/oci_generative_ai.py
index 71ccb600ce6..2be677d81f9 100644
--- a/libs/community/langchain_community/chat_models/oci_generative_ai.py
+++ b/libs/community/langchain_community/chat_models/oci_generative_ai.py
@@ -725,7 +725,7 @@ class ChatOCIGenAI(BaseChatModel, OCIGenAIBase):
elif method == "json_mode":
llm = self.bind(response_format={"type": "json_object"})
output_parser = (
- PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
+ PydanticOutputParser(pydantic_object=schema) # type: ignore[arg-type]
if is_pydantic_schema
else JsonOutputParser()
)
diff --git a/libs/community/langchain_community/chat_models/octoai.py b/libs/community/langchain_community/chat_models/octoai.py
index 70877487297..cf77bebd4c5 100644
--- a/libs/community/langchain_community/chat_models/octoai.py
+++ b/libs/community/langchain_community/chat_models/octoai.py
@@ -98,7 +98,7 @@ class ChatOctoAI(ChatOpenAI):
else:
values["openai_api_base"] = values["octoai_api_base"]
values["openai_api_key"] = values["octoai_api_token"].get_secret_value()
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
except ImportError:
raise ImportError(
"Could not import openai python package. "
diff --git a/libs/community/langchain_community/chat_models/openai.py b/libs/community/langchain_community/chat_models/openai.py
index 4d1666b6268..164ac03cd53 100644
--- a/libs/community/langchain_community/chat_models/openai.py
+++ b/libs/community/langchain_community/chat_models/openai.py
@@ -88,11 +88,11 @@ def _create_retry_decorator(
import openai
errors = [
- openai.error.Timeout, # type: ignore[attr-defined]
- openai.error.APIError, # type: ignore[attr-defined]
- openai.error.APIConnectionError, # type: ignore[attr-defined]
- openai.error.RateLimitError, # type: ignore[attr-defined]
- openai.error.ServiceUnavailableError, # type: ignore[attr-defined]
+ openai.error.Timeout,
+ openai.error.APIError,
+ openai.error.APIConnectionError,
+ openai.error.RateLimitError,
+ openai.error.ServiceUnavailableError,
]
return create_base_retry_decorator(
error_types=errors, max_retries=llm.max_retries, run_manager=run_manager
@@ -358,7 +358,7 @@ class ChatOpenAI(BaseChatModel):
**client_params
).chat.completions
elif not values.get("client"):
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
else:
pass
return values
@@ -595,7 +595,7 @@ class ChatOpenAI(BaseChatModel):
if self.openai_proxy:
import openai
- openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy} # type: ignore[attr-defined]
+ openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy}
return {**self._default_params, **openai_creds}
def _get_invocation_params(
diff --git a/libs/community/langchain_community/chat_models/perplexity.py b/libs/community/langchain_community/chat_models/perplexity.py
index 8f054e7b90b..e7d57ea04ea 100644
--- a/libs/community/langchain_community/chat_models/perplexity.py
+++ b/libs/community/langchain_community/chat_models/perplexity.py
@@ -486,7 +486,7 @@ class ChatPerplexity(BaseChatModel):
if is_pydantic_schema and hasattr(
schema, "model_json_schema"
): # accounting for pydantic v1 and v2
- response_format = schema.model_json_schema() # type: ignore[union-attr]
+ response_format = schema.model_json_schema()
elif is_pydantic_schema:
response_format = schema.schema() # type: ignore[union-attr]
elif isinstance(schema, dict):
diff --git a/libs/community/langchain_community/chat_models/sambanova.py b/libs/community/langchain_community/chat_models/sambanova.py
index 0e21395f4ff..7d58a530f3d 100644
--- a/libs/community/langchain_community/chat_models/sambanova.py
+++ b/libs/community/langchain_community/chat_models/sambanova.py
@@ -636,7 +636,7 @@ class ChatSambaNovaCloud(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike[Any] = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
output_parser = JsonOutputKeyToolsParser(
@@ -648,7 +648,7 @@ class ChatSambaNovaCloud(BaseChatModel):
# llm = self.bind(response_format={"type": "json_object"})
if is_pydantic_schema:
schema = cast(Type[BaseModel], schema)
- output_parser = PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
+ output_parser = PydanticOutputParser(pydantic_object=schema)
else:
output_parser = JsonOutputParser()
@@ -666,7 +666,7 @@ class ChatSambaNovaCloud(BaseChatModel):
# )
if is_pydantic_schema:
schema = cast(Type[BaseModel], schema)
- output_parser = PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
+ output_parser = PydanticOutputParser(pydantic_object=schema)
else:
output_parser = JsonOutputParser()
else:
diff --git a/libs/community/langchain_community/chat_models/solar.py b/libs/community/langchain_community/chat_models/solar.py
index 4bcdc0952aa..16f3c4d3eda 100644
--- a/libs/community/langchain_community/chat_models/solar.py
+++ b/libs/community/langchain_community/chat_models/solar.py
@@ -13,7 +13,7 @@ from langchain_community.llms.solar import SOLAR_SERVICE_URL_BASE, SolarCommon
@deprecated( # type: ignore[arg-type]
since="0.0.34", removal="1.0", alternative_import="langchain_upstage.ChatUpstage"
)
-class SolarChat(SolarCommon, ChatOpenAI): # type: ignore[override, override]
+class SolarChat(SolarCommon, ChatOpenAI):
"""Wrapper around Solar large language models.
To use, you should have the ``openai`` python package installed, and the
environment variable ``SOLAR_API_KEY`` set with your API key.
diff --git a/libs/community/langchain_community/chat_models/symblai_nebula.py b/libs/community/langchain_community/chat_models/symblai_nebula.py
index adacc508ca9..9eb9d5f08d8 100644
--- a/libs/community/langchain_community/chat_models/symblai_nebula.py
+++ b/libs/community/langchain_community/chat_models/symblai_nebula.py
@@ -176,7 +176,7 @@ class ChatNebula(BaseChatModel):
json_payload = json.dumps(payload)
async with ClientSession() as session:
- async with session.post( # type: ignore[call-arg]
+ async with session.post( # type: ignore[call-arg,unused-ignore]
url, data=json_payload, headers=headers, stream=True
) as response:
response.raise_for_status()
diff --git a/libs/community/langchain_community/chat_models/tongyi.py b/libs/community/langchain_community/chat_models/tongyi.py
index c28a727d8eb..fce974da69c 100644
--- a/libs/community/langchain_community/chat_models/tongyi.py
+++ b/libs/community/langchain_community/chat_models/tongyi.py
@@ -140,7 +140,7 @@ def convert_dict_to_message(
else AIMessage(
content=content,
additional_kwargs=additional_kwargs,
- tool_calls=tool_calls, # type: ignore[arg-type]
+ tool_calls=tool_calls,
invalid_tool_calls=invalid_tool_calls,
)
)
@@ -163,7 +163,7 @@ def convert_dict_to_message(
if is_chunk
else ToolMessage(
content=_dict.get("content", ""),
- tool_call_id=_dict.get("tool_call_id"), # type: ignore[arg-type]
+ tool_call_id=_dict.get("tool_call_id"),
additional_kwargs=additional_kwargs,
)
)
@@ -894,7 +894,7 @@ class ChatTongyi(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
key_name = convert_to_openai_tool(schema)["function"]["name"]
diff --git a/libs/community/langchain_community/chat_models/vertexai.py b/libs/community/langchain_community/chat_models/vertexai.py
index 6fae0513f94..eeb638e2dc0 100644
--- a/libs/community/langchain_community/chat_models/vertexai.py
+++ b/libs/community/langchain_community/chat_models/vertexai.py
@@ -209,7 +209,7 @@ def _get_question(messages: List[BaseMessage]) -> HumanMessage:
removal="1.0",
alternative_import="langchain_google_vertexai.ChatVertexAI",
)
-class ChatVertexAI(_VertexAICommon, BaseChatModel): # type: ignore[override]
+class ChatVertexAI(_VertexAICommon, BaseChatModel):
"""`Vertex AI` Chat large language models API."""
model_name: str = "chat-bison"
diff --git a/libs/community/langchain_community/chat_models/zhipuai.py b/libs/community/langchain_community/chat_models/zhipuai.py
index 18dc9dd1960..d3cd1e16d52 100644
--- a/libs/community/langchain_community/chat_models/zhipuai.py
+++ b/libs/community/langchain_community/chat_models/zhipuai.py
@@ -162,7 +162,7 @@ def _convert_dict_to_message(dct: Dict[str, Any]) -> BaseMessage:
additional_kwargs["name"] = dct["name"]
return ToolMessage(
content=content,
- tool_call_id=dct.get("tool_call_id"), # type: ignore[arg-type]
+ tool_call_id=dct.get("tool_call_id"),
additional_kwargs=additional_kwargs,
)
return ChatMessage(role=role, content=content) # type: ignore[arg-type]
@@ -861,7 +861,7 @@ class ChatZhipuAI(BaseChatModel):
if is_pydantic_schema:
output_parser: OutputParserLike = PydanticToolsParser(
tools=[schema], # type: ignore[list-item]
- first_tool_only=True, # type: ignore[list-item]
+ first_tool_only=True,
)
else:
output_parser = JsonOutputKeyToolsParser(
diff --git a/libs/community/langchain_community/document_loaders/async_html.py b/libs/community/langchain_community/document_loaders/async_html.py
index ddef7385f13..20b3c7ae1e5 100644
--- a/libs/community/langchain_community/document_loaders/async_html.py
+++ b/libs/community/langchain_community/document_loaders/async_html.py
@@ -226,8 +226,8 @@ class AsyncHtmlLoader(BaseLoader):
# in a separate loop, in a separate thread.
with ThreadPoolExecutor(max_workers=1) as executor:
future: Future[List[str]] = executor.submit(
- asyncio.run, # type: ignore[arg-type]
- self.fetch_all(self.web_paths), # type: ignore[arg-type]
+ asyncio.run,
+ self.fetch_all(self.web_paths),
)
results = future.result()
except RuntimeError:
diff --git a/libs/community/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py b/libs/community/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py
index 65621a67afe..8413c3108cc 100644
--- a/libs/community/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py
+++ b/libs/community/langchain_community/document_loaders/blob_loaders/cloud_blob_loader.py
@@ -224,7 +224,7 @@ class CloudBlobLoader(BlobLoader):
yield self.path
return
- paths = self.path.glob(self.glob) # type: ignore[attr-defined]
+ paths = self.path.glob(self.glob)
for path in paths:
if self.exclude:
if any(path.match(glob) for glob in self.exclude):
diff --git a/libs/community/langchain_community/document_loaders/concurrent.py b/libs/community/langchain_community/document_loaders/concurrent.py
index 8b40924b8e2..8a76ef49622 100644
--- a/libs/community/langchain_community/document_loaders/concurrent.py
+++ b/libs/community/langchain_community/document_loaders/concurrent.py
@@ -24,9 +24,9 @@ class ConcurrentLoader(GenericLoader):
def __init__(
self,
- blob_loader: BlobLoader, # type: ignore[valid-type]
+ blob_loader: BlobLoader,
blob_parser: BaseBlobParser,
- num_workers: int = 4, # type: ignore[valid-type]
+ num_workers: int = 4,
) -> None:
super().__init__(blob_loader, blob_parser)
self.num_workers = num_workers
@@ -40,7 +40,7 @@ class ConcurrentLoader(GenericLoader):
) as executor:
futures = {
executor.submit(self.blob_parser.lazy_parse, blob)
- for blob in self.blob_loader.yield_blobs() # type: ignore[attr-defined]
+ for blob in self.blob_loader.yield_blobs()
}
for future in concurrent.futures.as_completed(futures):
yield from future.result()
@@ -72,7 +72,7 @@ class ConcurrentLoader(GenericLoader):
num_workers: Max number of concurrent workers to use.
parser_kwargs: Keyword arguments to pass to the parser.
"""
- blob_loader = FileSystemBlobLoader( # type: ignore[attr-defined, misc]
+ blob_loader = FileSystemBlobLoader(
path,
glob=glob,
exclude=exclude,
diff --git a/libs/community/langchain_community/document_loaders/confluence.py b/libs/community/langchain_community/document_loaders/confluence.py
index 550da930755..ec1de225075 100644
--- a/libs/community/langchain_community/document_loaders/confluence.py
+++ b/libs/community/langchain_community/document_loaders/confluence.py
@@ -428,7 +428,7 @@ class ConfluenceLoader(BaseLoader):
self.number_of_retries # type: ignore[arg-type]
),
wait=wait_exponential(
- multiplier=1, # type: ignore[arg-type]
+ multiplier=1,
min=self.min_retry_seconds, # type: ignore[arg-type]
max=self.max_retry_seconds, # type: ignore[arg-type]
),
diff --git a/libs/community/langchain_community/document_loaders/csv_loader.py b/libs/community/langchain_community/document_loaders/csv_loader.py
index 59927920569..e6f3ab16aab 100644
--- a/libs/community/langchain_community/document_loaders/csv_loader.py
+++ b/libs/community/langchain_community/document_loaders/csv_loader.py
@@ -223,4 +223,4 @@ class UnstructuredCSVLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.csv import partition_csv
- return partition_csv(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_csv(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/doc_intelligence.py b/libs/community/langchain_community/document_loaders/doc_intelligence.py
index 4f01e32ff7e..10369e5d70e 100644
--- a/libs/community/langchain_community/document_loaders/doc_intelligence.py
+++ b/libs/community/langchain_community/document_loaders/doc_intelligence.py
@@ -101,7 +101,7 @@ class AzureAIDocumentIntelligenceLoader(BaseLoader):
self.url_path = url_path
self.bytes_source = bytes_source
- self.parser = AzureAIDocumentIntelligenceParser( # type: ignore[misc]
+ self.parser = AzureAIDocumentIntelligenceParser(
api_endpoint=api_endpoint,
api_key=api_key,
api_version=api_version,
@@ -116,10 +116,10 @@ class AzureAIDocumentIntelligenceLoader(BaseLoader):
) -> Iterator[Document]:
"""Lazy load the document as pages."""
if self.file_path is not None:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from self.parser.parse(blob)
elif self.url_path is not None:
- yield from self.parser.parse_url(self.url_path) # type: ignore[arg-type]
+ yield from self.parser.parse_url(self.url_path)
elif self.bytes_source is not None:
yield from self.parser.parse_bytes(self.bytes_source)
else:
diff --git a/libs/community/langchain_community/document_loaders/email.py b/libs/community/langchain_community/document_loaders/email.py
index c7e7cee54bb..24716c55a9f 100644
--- a/libs/community/langchain_community/document_loaders/email.py
+++ b/libs/community/langchain_community/document_loaders/email.py
@@ -60,16 +60,16 @@ class UnstructuredEmailLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.file_utils.filetype import FileType, detect_filetype
- filetype = detect_filetype(self.file_path) # type: ignore[arg-type]
+ filetype = detect_filetype(self.file_path)
if filetype == FileType.EML:
from unstructured.partition.email import partition_email
- return partition_email(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_email(filename=self.file_path, **self.unstructured_kwargs)
elif satisfies_min_unstructured_version("0.5.8") and filetype == FileType.MSG:
from unstructured.partition.msg import partition_msg
- return partition_msg(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_msg(filename=self.file_path, **self.unstructured_kwargs)
else:
raise ValueError(
f"Filetype {filetype} is not supported in UnstructuredEmailLoader."
diff --git a/libs/community/langchain_community/document_loaders/epub.py b/libs/community/langchain_community/document_loaders/epub.py
index d72fe0661e5..806737b62a5 100644
--- a/libs/community/langchain_community/document_loaders/epub.py
+++ b/libs/community/langchain_community/document_loaders/epub.py
@@ -52,4 +52,4 @@ class UnstructuredEPubLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.epub import partition_epub
- return partition_epub(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_epub(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/excel.py b/libs/community/langchain_community/document_loaders/excel.py
index aa28d891100..eeb08c1873f 100644
--- a/libs/community/langchain_community/document_loaders/excel.py
+++ b/libs/community/langchain_community/document_loaders/excel.py
@@ -49,4 +49,4 @@ class UnstructuredExcelLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.xlsx import partition_xlsx
- return partition_xlsx(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_xlsx(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/generic.py b/libs/community/langchain_community/document_loaders/generic.py
index 49b0c9eb2ea..191149618b1 100644
--- a/libs/community/langchain_community/document_loaders/generic.py
+++ b/libs/community/langchain_community/document_loaders/generic.py
@@ -96,7 +96,7 @@ class GenericLoader(BaseLoader):
def __init__(
self,
- blob_loader: BlobLoader, # type: ignore[valid-type]
+ blob_loader: BlobLoader,
blob_parser: BaseBlobParser,
) -> None:
"""A generic document loader.
@@ -112,7 +112,7 @@ class GenericLoader(BaseLoader):
self,
) -> Iterator[Document]:
"""Load documents lazily. Use this when working at a large scale."""
- for blob in self.blob_loader.yield_blobs(): # type: ignore[attr-defined]
+ for blob in self.blob_loader.yield_blobs():
yield from self.blob_parser.lazy_parse(blob)
def load_and_split(
@@ -159,7 +159,7 @@ class GenericLoader(BaseLoader):
Returns:
A generic document loader.
"""
- blob_loader = FileSystemBlobLoader( # type: ignore[attr-defined, misc]
+ blob_loader = FileSystemBlobLoader(
path,
glob=glob,
exclude=exclude,
diff --git a/libs/community/langchain_community/document_loaders/git.py b/libs/community/langchain_community/document_loaders/git.py
index 3b380b275f5..b37f575eacb 100644
--- a/libs/community/langchain_community/document_loaders/git.py
+++ b/libs/community/langchain_community/document_loaders/git.py
@@ -74,7 +74,7 @@ class GitLoader(BaseLoader):
file_path = os.path.join(self.repo_path, item.path)
- ignored_files = repo.ignored([file_path]) # type: ignore[arg-type]
+ ignored_files = repo.ignored([file_path])
if len(ignored_files):
continue
diff --git a/libs/community/langchain_community/document_loaders/html.py b/libs/community/langchain_community/document_loaders/html.py
index 9ea781a7e91..2ec3224e663 100644
--- a/libs/community/langchain_community/document_loaders/html.py
+++ b/libs/community/langchain_community/document_loaders/html.py
@@ -48,4 +48,4 @@ class UnstructuredHTMLLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.html import partition_html
- return partition_html(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_html(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/image.py b/libs/community/langchain_community/document_loaders/image.py
index 63a89e71ccb..acec0f360d0 100644
--- a/libs/community/langchain_community/document_loaders/image.py
+++ b/libs/community/langchain_community/document_loaders/image.py
@@ -48,4 +48,4 @@ class UnstructuredImageLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.image import partition_image
- return partition_image(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_image(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/image_captions.py b/libs/community/langchain_community/document_loaders/image_captions.py
index aeb1580cb39..568fa0a25aa 100644
--- a/libs/community/langchain_community/document_loaders/image_captions.py
+++ b/libs/community/langchain_community/document_loaders/image_captions.py
@@ -76,13 +76,13 @@ class ImageCaptionLoader(BaseLoader):
try:
if isinstance(image, bytes):
- image = Image.open(BytesIO(image)).convert("RGB") # type: ignore[assignment]
+ image = Image.open(BytesIO(image)).convert("RGB")
elif isinstance(image, str) and (
image.startswith("http://") or image.startswith("https://")
):
- image = Image.open(requests.get(image, stream=True).raw).convert("RGB") # type: ignore[assignment, arg-type]
+ image = Image.open(requests.get(image, stream=True).raw).convert("RGB")
else:
- image = Image.open(image).convert("RGB") # type: ignore[assignment]
+ image = Image.open(image).convert("RGB")
except Exception:
if isinstance(image_source, bytes):
msg = "Could not get image data from bytes"
diff --git a/libs/community/langchain_community/document_loaders/markdown.py b/libs/community/langchain_community/document_loaders/markdown.py
index 3c3196c2cb4..e940bff593d 100644
--- a/libs/community/langchain_community/document_loaders/markdown.py
+++ b/libs/community/langchain_community/document_loaders/markdown.py
@@ -93,4 +93,4 @@ class UnstructuredMarkdownLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.md import partition_md
- return partition_md(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_md(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/odt.py b/libs/community/langchain_community/document_loaders/odt.py
index 7d1236ff881..d1598d068d4 100644
--- a/libs/community/langchain_community/document_loaders/odt.py
+++ b/libs/community/langchain_community/document_loaders/odt.py
@@ -52,4 +52,4 @@ class UnstructuredODTLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.odt import partition_odt
- return partition_odt(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_odt(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/org_mode.py b/libs/community/langchain_community/document_loaders/org_mode.py
index b8ba1828433..614ad70b723 100644
--- a/libs/community/langchain_community/document_loaders/org_mode.py
+++ b/libs/community/langchain_community/document_loaders/org_mode.py
@@ -52,4 +52,4 @@ class UnstructuredOrgModeLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.org import partition_org
- return partition_org(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_org(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/parsers/audio.py b/libs/community/langchain_community/document_loaders/parsers/audio.py
index 4e1ac1bba62..5da288d473d 100644
--- a/libs/community/langchain_community/document_loaders/parsers/audio.py
+++ b/libs/community/langchain_community/document_loaders/parsers/audio.py
@@ -322,7 +322,7 @@ class OpenAIWhisperParser(BaseBlobParser):
model=self.model, file=file_obj, **self._create_params
)
else:
- transcript = openai.Audio.transcribe(self.model, file_obj) # type: ignore[attr-defined]
+ transcript = openai.Audio.transcribe(self.model, file_obj)
break
except Exception as e:
attempts += 1
diff --git a/libs/community/langchain_community/document_loaders/parsers/msword.py b/libs/community/langchain_community/document_loaders/parsers/msword.py
index c366a8ce1af..f2a03cc37da 100644
--- a/libs/community/langchain_community/document_loaders/parsers/msword.py
+++ b/libs/community/langchain_community/document_loaders/parsers/msword.py
@@ -9,7 +9,7 @@ from langchain_community.document_loaders.blob_loaders import Blob
class MsWordParser(BaseBlobParser):
"""Parse the Microsoft Word documents from a blob."""
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""Parse a Microsoft Word document into the Document iterator.
Args:
@@ -33,13 +33,13 @@ class MsWordParser(BaseBlobParser):
partition_docx
),
}
- if blob.mimetype not in ( # type: ignore[attr-defined]
+ if blob.mimetype not in (
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
):
raise ValueError("This blob type is not supported for this parser.")
- with blob.as_bytes_io() as word_document: # type: ignore[attr-defined]
- elements = mime_type_parser[blob.mimetype](file=word_document) # type: ignore[attr-defined] # type: ignore[operator] # type: ignore[operator] # type: ignore[operator] # type: ignore[operator] # type: ignore[operator] # type: ignore[operator]
+ with blob.as_bytes_io() as word_document:
+ elements = mime_type_parser[blob.mimetype](file=word_document)
text = "\n\n".join([str(el) for el in elements])
- metadata = {"source": blob.source} # type: ignore[attr-defined]
+ metadata = {"source": blob.source}
yield Document(page_content=text, metadata=metadata)
diff --git a/libs/community/langchain_community/document_loaders/parsers/pdf.py b/libs/community/langchain_community/document_loaders/parsers/pdf.py
index 46ad300be96..6b3a0a065a3 100644
--- a/libs/community/langchain_community/document_loaders/parsers/pdf.py
+++ b/libs/community/langchain_community/document_loaders/parsers/pdf.py
@@ -340,7 +340,7 @@ class PyPDFParser(BaseBlobParser):
self.extraction_mode = extraction_mode
self.extraction_kwargs = extraction_kwargs or {}
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""
Lazily parse the blob.
Insert image, if possible, between two paragraphs.
@@ -380,7 +380,7 @@ class PyPDFParser(BaseBlobParser):
**self.extraction_kwargs,
)
- with blob.as_bytes_io() as pdf_file_obj: # type: ignore[attr-defined]
+ with blob.as_bytes_io() as pdf_file_obj:
pdf_reader = pypdf.PdfReader(pdf_file_obj, password=self.password)
doc_metadata = _purge_metadata(
@@ -434,7 +434,7 @@ class PyPDFParser(BaseBlobParser):
if "/XObject" not in cast(dict, page["/Resources"]).keys():
return ""
- xObject = page["/Resources"]["/XObject"].get_object() # type: ignore[index]
+ xObject = page["/Resources"]["/XObject"].get_object()
images = []
for obj in xObject:
np_image: Any = None
@@ -677,7 +677,7 @@ class PDFMinerParser(BaseBlobParser):
return metadata
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""
Lazily parse the blob.
Insert image, if possible, between two paragraphs.
@@ -919,7 +919,7 @@ class PyMuPDFParser(BaseBlobParser):
self.extract_tables = extract_tables
self.extract_tables_settings = extract_tables_settings
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
return self._lazy_parse(
blob,
)
@@ -930,7 +930,7 @@ class PyMuPDFParser(BaseBlobParser):
# text-kwargs is present for backwards compatibility.
# Users should not use it directly.
text_kwargs: Optional[dict[str, Any]] = None,
- ) -> Iterator[Document]: # type: ignore[valid-type]
+ ) -> Iterator[Document]:
"""Lazily parse the blob.
Insert image, if possible, between two paragraphs.
In this way, a paragraph can be continued on the next page.
@@ -990,8 +990,8 @@ class PyMuPDFParser(BaseBlobParser):
)
with PyMuPDFParser._lock:
- with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
- if blob.data is None: # type: ignore[attr-defined]
+ with blob.as_bytes_io() as file_path:
+ if blob.data is None:
doc = pymupdf.open(file_path)
else:
doc = pymupdf.open(stream=file_path, filetype="pdf")
@@ -1066,8 +1066,8 @@ class PyMuPDFParser(BaseBlobParser):
"producer": "PyMuPDF",
"creator": "PyMuPDF",
"creationdate": "",
- "source": blob.source, # type: ignore[attr-defined]
- "file_path": blob.source, # type: ignore[attr-defined]
+ "source": blob.source,
+ "file_path": blob.source,
"total_pages": len(doc),
},
**{
@@ -1273,7 +1273,7 @@ class PyPDFium2Parser(BaseBlobParser):
self.mode = mode
self.pages_delimiter = pages_delimiter
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""
Lazily parse the blob.
Insert image, if possible, between two paragraphs.
@@ -1299,7 +1299,7 @@ class PyPDFium2Parser(BaseBlobParser):
# pypdfium2 is really finicky with respect to closing things,
# if done incorrectly creates seg faults.
with PyPDFium2Parser._lock:
- with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
+ with blob.as_bytes_io() as file_path:
pdf_reader = None
try:
pdf_reader = pypdfium2.PdfDocument(
@@ -1410,11 +1410,11 @@ class PDFPlumberParser(BaseBlobParser):
self.dedupe = dedupe
self.extract_images = extract_images
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""Lazily parse the blob."""
import pdfplumber
- with blob.as_bytes_io() as file_path: # type: ignore[attr-defined]
+ with blob.as_bytes_io() as file_path:
doc = pdfplumber.open(file_path) # open document
yield from [
@@ -1424,8 +1424,8 @@ class PDFPlumberParser(BaseBlobParser):
+ self._extract_images_from_page(page),
metadata=dict(
{
- "source": blob.source, # type: ignore[attr-defined]
- "file_path": blob.source, # type: ignore[attr-defined]
+ "source": blob.source,
+ "file_path": blob.source,
"page": page.page_number - 1,
"total_pages": len(doc.pages),
},
@@ -1593,14 +1593,14 @@ class AmazonTextractPDFParser(BaseBlobParser):
else:
self.boto3_textract_client = client
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""Iterates over the Blob pages and returns an Iterator with a Document
for each page, like the other parsers If multi-page document, blob.path
has to be set to the S3 URI and for single page docs
the blob.data is taken
"""
- url_parse_result = urlparse(str(blob.path)) if blob.path else None # type: ignore[attr-defined]
+ url_parse_result = urlparse(str(blob.path)) if blob.path else None
# Either call with S3 path (multi-page) or with bytes (single-page)
if (
url_parse_result
@@ -1608,13 +1608,13 @@ class AmazonTextractPDFParser(BaseBlobParser):
and url_parse_result.netloc
):
textract_response_json = self.tc.call_textract(
- input_document=str(blob.path), # type: ignore[attr-defined]
+ input_document=str(blob.path),
features=self.textract_features,
boto3_textract_client=self.boto3_textract_client,
)
else:
textract_response_json = self.tc.call_textract(
- input_document=blob.as_bytes(), # type: ignore[attr-defined]
+ input_document=blob.as_bytes(),
features=self.textract_features,
call_mode=self.tc.Textract_Call_Mode.FORCE_SYNC,
boto3_textract_client=self.boto3_textract_client,
@@ -1625,7 +1625,7 @@ class AmazonTextractPDFParser(BaseBlobParser):
for idx, page in enumerate(document.pages):
yield Document(
page_content=page.get_text(config=self.linearization_config),
- metadata={"source": blob.source, "page": idx + 1}, # type: ignore[attr-defined]
+ metadata={"source": blob.source, "page": idx + 1},
)
@@ -1645,23 +1645,23 @@ class DocumentIntelligenceParser(BaseBlobParser):
self.client = client
self.model = model
- def _generate_docs(self, blob: Blob, result: Any) -> Iterator[Document]: # type: ignore[valid-type]
+ def _generate_docs(self, blob: Blob, result: Any) -> Iterator[Document]:
for p in result.pages:
content = " ".join([line.content for line in p.lines])
d = Document(
page_content=content,
metadata={
- "source": blob.source, # type: ignore[attr-defined]
+ "source": blob.source,
"page": p.page_number,
},
)
yield d
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""Lazily parse the blob."""
- with blob.as_bytes_io() as file_obj: # type: ignore[attr-defined]
+ with blob.as_bytes_io() as file_obj:
poller = self.client.begin_analyze_document(self.model, file_obj)
result = poller.result()
diff --git a/libs/community/langchain_community/document_loaders/parsers/txt.py b/libs/community/langchain_community/document_loaders/parsers/txt.py
index ae46f68ab24..5b2da307431 100644
--- a/libs/community/langchain_community/document_loaders/parsers/txt.py
+++ b/libs/community/langchain_community/document_loaders/parsers/txt.py
@@ -11,6 +11,6 @@ from langchain_community.document_loaders.blob_loaders import Blob
class TextParser(BaseBlobParser):
"""Parser for text blobs."""
- def lazy_parse(self, blob: Blob) -> Iterator[Document]: # type: ignore[valid-type]
+ def lazy_parse(self, blob: Blob) -> Iterator[Document]:
"""Lazily parse the blob."""
- yield Document(page_content=blob.as_string(), metadata={"source": blob.source}) # type: ignore[attr-defined]
+ yield Document(page_content=blob.as_string(), metadata={"source": blob.source})
diff --git a/libs/community/langchain_community/document_loaders/pdf.py b/libs/community/langchain_community/document_loaders/pdf.py
index b9e57b19ff1..6b51e481eba 100644
--- a/libs/community/langchain_community/document_loaders/pdf.py
+++ b/libs/community/langchain_community/document_loaders/pdf.py
@@ -91,7 +91,7 @@ class UnstructuredPDFLoader(UnstructuredFileLoader):
def _get_elements(self) -> list:
from unstructured.partition.pdf import partition_pdf
- return partition_pdf(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_pdf(filename=self.file_path, **self.unstructured_kwargs)
class BasePDFLoader(BaseLoader, ABC):
@@ -299,11 +299,9 @@ class PyPDFLoader(BasePDFLoader):
In this way, a paragraph can be continued on the next page.
"""
if self.web_path:
- blob = Blob.from_data( # type: ignore[attr-defined]
- open(self.file_path, "rb").read(), path=self.web_path
- )
+ blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
else:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from self.parser.lazy_parse(blob)
@@ -415,11 +413,9 @@ class PyPDFium2Loader(BasePDFLoader):
In this way, a paragraph can be continued on the next page.
"""
if self.web_path:
- blob = Blob.from_data( # type: ignore[attr-defined]
- open(self.file_path, "rb").read(), path=self.web_path
- )
+ blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
else:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from self.parser.parse(blob)
@@ -674,11 +670,9 @@ class PDFMinerLoader(BasePDFLoader):
In this way, a paragraph can be continued on the next page.
"""
if self.web_path:
- blob = Blob.from_data( # type: ignore[attr-defined]
- open(self.file_path, "rb").read(), path=self.web_path
- )
+ blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
else:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from self.parser.lazy_parse(blob)
@@ -850,9 +844,9 @@ class PyMuPDFLoader(BasePDFLoader):
)
parser = self.parser
if self.web_path:
- blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
+ blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
else:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from parser._lazy_parse(blob, text_kwargs=kwargs)
def load(self, **kwargs: Any) -> list[Document]:
@@ -1046,9 +1040,9 @@ class PDFPlumberLoader(BasePDFLoader):
extract_images=self.extract_images,
)
if self.web_path:
- blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path) # type: ignore[attr-defined]
+ blob = Blob.from_data(open(self.file_path, "rb").read(), path=self.web_path)
else:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
return parser.parse(blob)
@@ -1163,7 +1157,7 @@ class AmazonTextractPDFLoader(BasePDFLoader):
# raises ValueError when multipage and not on S3"""
if self.web_path and self._is_s3_url(self.web_path):
- blob = Blob(path=self.web_path) # type: ignore[call-arg] # type: ignore[misc]
+ blob = Blob(path=self.web_path)
else:
blob = Blob.from_path(self.file_path)
if AmazonTextractPDFLoader._get_number_of_pages(blob) > 1:
@@ -1176,7 +1170,7 @@ class AmazonTextractPDFLoader(BasePDFLoader):
yield from self.parser.parse(blob)
@staticmethod
- def _get_number_of_pages(blob: Blob) -> int: # type: ignore[valid-type]
+ def _get_number_of_pages(blob: Blob) -> int:
try:
import pypdf
from PIL import Image, ImageSequence
@@ -1186,22 +1180,20 @@ class AmazonTextractPDFLoader(BasePDFLoader):
"Could not import pypdf or Pilloe python package. "
"Please install it with `pip install pypdf Pillow`."
)
- if blob.mimetype == "application/pdf": # type: ignore[attr-defined]
- with blob.as_bytes_io() as input_pdf_file: # type: ignore[attr-defined]
+ if blob.mimetype == "application/pdf":
+ with blob.as_bytes_io() as input_pdf_file:
pdf_reader = pypdf.PdfReader(input_pdf_file)
return len(pdf_reader.pages)
- elif blob.mimetype == "image/tiff": # type: ignore[attr-defined]
+ elif blob.mimetype == "image/tiff":
num_pages = 0
- img = Image.open(blob.as_bytes()) # type: ignore[attr-defined]
+ img = Image.open(blob.as_bytes())
for _, _ in enumerate(ImageSequence.Iterator(img)):
num_pages += 1
return num_pages
- elif blob.mimetype in ["image/png", "image/jpeg"]: # type: ignore[attr-defined]
+ elif blob.mimetype in ["image/png", "image/jpeg"]:
return 1
else:
- raise ValueError( # type: ignore[attr-defined]
- f"unsupported mime type: {blob.mimetype}"
- )
+ raise ValueError(f"unsupported mime type: {blob.mimetype}")
class DedocPDFLoader(DedocBaseLoader):
@@ -1348,7 +1340,7 @@ class DocumentIntelligenceLoader(BasePDFLoader):
self,
) -> Iterator[Document]:
"""Lazy load given path as pages."""
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
yield from self.parser.parse(blob)
diff --git a/libs/community/langchain_community/document_loaders/powerpoint.py b/libs/community/langchain_community/document_loaders/powerpoint.py
index 0fecbe4b678..d075402647c 100644
--- a/libs/community/langchain_community/document_loaders/powerpoint.py
+++ b/libs/community/langchain_community/document_loaders/powerpoint.py
@@ -59,7 +59,7 @@ class UnstructuredPowerPointLoader(UnstructuredFileLoader):
try:
import magic # noqa: F401
- is_ppt = detect_filetype(self.file_path) == FileType.PPT # type: ignore[arg-type]
+ is_ppt = detect_filetype(self.file_path) == FileType.PPT
except ImportError:
_, extension = os.path.splitext(str(self.file_path))
is_ppt = extension == ".ppt"
@@ -70,8 +70,8 @@ class UnstructuredPowerPointLoader(UnstructuredFileLoader):
if is_ppt:
from unstructured.partition.ppt import partition_ppt
- return partition_ppt(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_ppt(filename=self.file_path, **self.unstructured_kwargs)
else:
from unstructured.partition.pptx import partition_pptx
- return partition_pptx(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_pptx(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/rst.py b/libs/community/langchain_community/document_loaders/rst.py
index 77e4fc38b91..fa76979692d 100644
--- a/libs/community/langchain_community/document_loaders/rst.py
+++ b/libs/community/langchain_community/document_loaders/rst.py
@@ -56,4 +56,4 @@ class UnstructuredRSTLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.rst import partition_rst
- return partition_rst(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_rst(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/rtf.py b/libs/community/langchain_community/document_loaders/rtf.py
index bbecd7f455d..871da2b4823 100644
--- a/libs/community/langchain_community/document_loaders/rtf.py
+++ b/libs/community/langchain_community/document_loaders/rtf.py
@@ -56,4 +56,4 @@ class UnstructuredRTFLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.rtf import partition_rtf
- return partition_rtf(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_rtf(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/tsv.py b/libs/community/langchain_community/document_loaders/tsv.py
index a9455fd06f4..4cb3645b495 100644
--- a/libs/community/langchain_community/document_loaders/tsv.py
+++ b/libs/community/langchain_community/document_loaders/tsv.py
@@ -39,4 +39,4 @@ class UnstructuredTSVLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.tsv import partition_tsv
- return partition_tsv(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_tsv(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/vsdx.py b/libs/community/langchain_community/document_loaders/vsdx.py
index fd7d252032b..5546d5db4d6 100644
--- a/libs/community/langchain_community/document_loaders/vsdx.py
+++ b/libs/community/langchain_community/document_loaders/vsdx.py
@@ -37,7 +37,7 @@ class VsdxLoader(BaseLoader, ABC):
elif not os.path.isfile(self.file_path):
raise ValueError("File path %s is not a valid file or url" % self.file_path)
- self.parser = VsdxParser() # type: ignore[misc]
+ self.parser = VsdxParser()
def __del__(self) -> None:
if hasattr(self, "temp_file"):
@@ -50,5 +50,5 @@ class VsdxLoader(BaseLoader, ABC):
return bool(parsed.netloc) and bool(parsed.scheme)
def load(self) -> List[Document]:
- blob = Blob.from_path(self.file_path) # type: ignore[attr-defined]
+ blob = Blob.from_path(self.file_path)
return list(self.parser.parse(blob))
diff --git a/libs/community/langchain_community/document_loaders/weather.py b/libs/community/langchain_community/document_loaders/weather.py
index ff35956d109..a051f9ccf47 100644
--- a/libs/community/langchain_community/document_loaders/weather.py
+++ b/libs/community/langchain_community/document_loaders/weather.py
@@ -33,7 +33,7 @@ class WeatherDataLoader(BaseLoader):
def from_params(
cls, places: Sequence[str], *, openweathermap_api_key: Optional[str] = None
) -> WeatherDataLoader:
- client = OpenWeatherMapAPIWrapper(openweathermap_api_key=openweathermap_api_key) # type: ignore[call-arg]
+ client = OpenWeatherMapAPIWrapper(openweathermap_api_key=openweathermap_api_key)
return cls(client, places)
def lazy_load(
diff --git a/libs/community/langchain_community/document_loaders/word_document.py b/libs/community/langchain_community/document_loaders/word_document.py
index eac96eb5faa..957eefe7bcc 100644
--- a/libs/community/langchain_community/document_loaders/word_document.py
+++ b/libs/community/langchain_community/document_loaders/word_document.py
@@ -121,7 +121,7 @@ class UnstructuredWordDocumentLoader(UnstructuredFileLoader):
try:
import magic # noqa: F401
- is_doc = detect_filetype(self.file_path) == FileType.DOC # type: ignore[arg-type]
+ is_doc = detect_filetype(self.file_path) == FileType.DOC
except ImportError:
_, extension = os.path.splitext(str(self.file_path))
is_doc = extension == ".doc"
@@ -132,8 +132,8 @@ class UnstructuredWordDocumentLoader(UnstructuredFileLoader):
if is_doc:
from unstructured.partition.doc import partition_doc
- return partition_doc(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_doc(filename=self.file_path, **self.unstructured_kwargs)
else:
from unstructured.partition.docx import partition_docx
- return partition_docx(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_docx(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_loaders/xml.py b/libs/community/langchain_community/document_loaders/xml.py
index 1541e3b897e..a4757f222b8 100644
--- a/libs/community/langchain_community/document_loaders/xml.py
+++ b/libs/community/langchain_community/document_loaders/xml.py
@@ -46,4 +46,4 @@ class UnstructuredXMLLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
from unstructured.partition.xml import partition_xml
- return partition_xml(filename=self.file_path, **self.unstructured_kwargs) # type: ignore[arg-type]
+ return partition_xml(filename=self.file_path, **self.unstructured_kwargs)
diff --git a/libs/community/langchain_community/document_transformers/google_translate.py b/libs/community/langchain_community/document_transformers/google_translate.py
index f5a95ab8510..613ab0bdfc1 100644
--- a/libs/community/langchain_community/document_transformers/google_translate.py
+++ b/libs/community/langchain_community/document_transformers/google_translate.py
@@ -33,7 +33,7 @@ class GoogleTranslateTransformer(BaseDocumentTransformer):
"""
try:
from google.api_core.client_options import ClientOptions
- from google.cloud import translate # type: ignore[attr-defined]
+ from google.cloud import translate
except ImportError as exc:
raise ImportError(
"Install Google Cloud Translate to use this parser."
@@ -76,7 +76,7 @@ class GoogleTranslateTransformer(BaseDocumentTransformer):
Options: `text/plain`, `text/html`
"""
try:
- from google.cloud import translate # type: ignore[attr-defined]
+ from google.cloud import translate
except ImportError as exc:
raise ImportError(
"Install Google Cloud Translate to use this parser."
diff --git a/libs/community/langchain_community/document_transformers/openai_functions.py b/libs/community/langchain_community/document_transformers/openai_functions.py
index 7ba087a3e13..d95a48a64f1 100644
--- a/libs/community/langchain_community/document_transformers/openai_functions.py
+++ b/libs/community/langchain_community/document_transformers/openai_functions.py
@@ -58,7 +58,7 @@ class OpenAIMetadataTagger(BaseDocumentTransformer, BaseModel):
new_documents = []
for document in documents:
- extracted_metadata: Dict = self.tagging_chain.run(document.page_content) # type: ignore[assignment]
+ extracted_metadata: Dict = self.tagging_chain.run(document.page_content)
new_document = Document(
page_content=document.page_content,
metadata={**extracted_metadata, **document.metadata},
diff --git a/libs/community/langchain_community/embeddings/anyscale.py b/libs/community/langchain_community/embeddings/anyscale.py
index 7f35a729b48..ffa33fa497d 100644
--- a/libs/community/langchain_community/embeddings/anyscale.py
+++ b/libs/community/langchain_community/embeddings/anyscale.py
@@ -68,7 +68,7 @@ class AnyscaleEmbeddings(OpenAIEmbeddings):
else:
values["openai_api_base"] = values["anyscale_api_base"]
values["openai_api_key"] = values["anyscale_api_key"].get_secret_value()
- values["client"] = openai.Embedding # type: ignore[attr-defined]
+ values["client"] = openai.Embedding
return values
@property
diff --git a/libs/community/langchain_community/embeddings/azure_openai.py b/libs/community/langchain_community/embeddings/azure_openai.py
index 7687cb08ee3..00a2327d2cd 100644
--- a/libs/community/langchain_community/embeddings/azure_openai.py
+++ b/libs/community/langchain_community/embeddings/azure_openai.py
@@ -20,7 +20,7 @@ from langchain_community.utils.openai import is_openai_v1
removal="1.0",
alternative_import="langchain_openai.AzureOpenAIEmbeddings",
)
-class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override]
+class AzureOpenAIEmbeddings(OpenAIEmbeddings):
"""`Azure OpenAI` Embeddings API."""
azure_endpoint: Union[str, None] = None
@@ -170,16 +170,16 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override]
"default_query": self.default_query,
"http_client": self.http_client,
}
- self.client = openai.AzureOpenAI(**client_params).embeddings # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ self.client = openai.AzureOpenAI(**client_params).embeddings
if self.azure_ad_async_token_provider:
client_params["azure_ad_token_provider"] = (
self.azure_ad_async_token_provider
)
- self.async_client = openai.AsyncAzureOpenAI(**client_params).embeddings # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ self.async_client = openai.AsyncAzureOpenAI(**client_params).embeddings
else:
- self.client = openai.Embedding # type: ignore[attr-defined]
+ self.client = openai.Embedding
return self
@property
diff --git a/libs/community/langchain_community/embeddings/localai.py b/libs/community/langchain_community/embeddings/localai.py
index d163bb284fb..8c0457b3959 100644
--- a/libs/community/langchain_community/embeddings/localai.py
+++ b/libs/community/langchain_community/embeddings/localai.py
@@ -46,11 +46,11 @@ def _create_retry_decorator(embeddings: LocalAIEmbeddings) -> Callable[[Any], An
stop=stop_after_attempt(embeddings.max_retries),
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
@@ -68,11 +68,11 @@ def _async_retry_decorator(embeddings: LocalAIEmbeddings) -> Any:
stop=stop_after_attempt(embeddings.max_retries),
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
@@ -93,7 +93,7 @@ def _check_response(response: dict) -> dict:
if any(len(d["embedding"]) == 1 for d in response["data"]):
import openai
- raise openai.error.APIError("LocalAI API returned an empty embedding") # type: ignore[attr-defined]
+ raise openai.error.APIError("LocalAI API returned an empty embedding")
return response
@@ -230,7 +230,7 @@ class LocalAIEmbeddings(BaseModel, Embeddings):
try:
import openai
- values["client"] = openai.Embedding # type: ignore[attr-defined]
+ values["client"] = openai.Embedding
except ImportError:
raise ImportError(
"Could not import openai python package. "
@@ -253,10 +253,10 @@ class LocalAIEmbeddings(BaseModel, Embeddings):
if self.openai_proxy:
import openai
- openai.proxy = { # type: ignore[attr-defined]
+ openai.proxy = {
"http": self.openai_proxy,
"https": self.openai_proxy,
- } # type: ignore[assignment]
+ }
return openai_args
def _embedding_func(self, text: str, *, engine: str) -> List[float]:
diff --git a/libs/community/langchain_community/embeddings/mlflow.py b/libs/community/langchain_community/embeddings/mlflow.py
index 2dbff7c2eb8..09ceb3a229f 100644
--- a/libs/community/langchain_community/embeddings/mlflow.py
+++ b/libs/community/langchain_community/embeddings/mlflow.py
@@ -72,7 +72,7 @@ class MlflowEmbeddings(Embeddings, BaseModel):
for txt in _chunk(texts, 20):
resp = self._client.predict(
endpoint=self.endpoint,
- inputs={"input": txt, **params}, # type: ignore[arg-type]
+ inputs={"input": txt, **params},
)
embeddings.extend(r["embedding"] for r in resp["data"])
return embeddings
diff --git a/libs/community/langchain_community/embeddings/octoai_embeddings.py b/libs/community/langchain_community/embeddings/octoai_embeddings.py
index dc16288da94..cd10033e385 100644
--- a/libs/community/langchain_community/embeddings/octoai_embeddings.py
+++ b/libs/community/langchain_community/embeddings/octoai_embeddings.py
@@ -74,8 +74,8 @@ class OctoAIEmbeddings(OpenAIEmbeddings):
else:
values["openai_api_base"] = values["endpoint_url"]
values["openai_api_key"] = values["octoai_api_token"].get_secret_value()
- values["client"] = openai.Embedding # type: ignore[attr-defined]
- values["async_client"] = openai.Embedding # type: ignore[attr-defined]
+ values["client"] = openai.Embedding
+ values["async_client"] = openai.Embedding
except ImportError:
raise ImportError(
diff --git a/libs/community/langchain_community/embeddings/openai.py b/libs/community/langchain_community/embeddings/openai.py
index 5bedfc747ee..a695ab72ff3 100644
--- a/libs/community/langchain_community/embeddings/openai.py
+++ b/libs/community/langchain_community/embeddings/openai.py
@@ -58,11 +58,11 @@ def _create_retry_decorator(embeddings: OpenAIEmbeddings) -> Callable[[Any], Any
max=embeddings.retry_max_seconds,
),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
@@ -85,11 +85,11 @@ def _async_retry_decorator(embeddings: OpenAIEmbeddings) -> Any:
max=embeddings.retry_max_seconds,
),
retry=(
- retry_if_exception_type(openai.error.Timeout) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.APIConnectionError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.RateLimitError) # type: ignore[attr-defined]
- | retry_if_exception_type(openai.error.ServiceUnavailableError) # type: ignore[attr-defined]
+ retry_if_exception_type(openai.error.Timeout)
+ | retry_if_exception_type(openai.error.APIError)
+ | retry_if_exception_type(openai.error.APIConnectionError)
+ | retry_if_exception_type(openai.error.RateLimitError)
+ | retry_if_exception_type(openai.error.ServiceUnavailableError)
),
before_sleep=before_sleep_log(logger, logging.WARNING),
)
@@ -110,7 +110,7 @@ def _check_response(response: dict, skip_empty: bool = False) -> dict:
if any(len(d["embedding"]) == 1 for d in response["data"]) and not skip_empty:
import openai
- raise openai.error.APIError("OpenAI API returned an empty embedding") # type: ignore[attr-defined]
+ raise openai.error.APIError("OpenAI API returned an empty embedding")
return response
@@ -357,7 +357,7 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
**client_params
).embeddings
elif not values.get("client"):
- values["client"] = openai.Embedding # type: ignore[attr-defined]
+ values["client"] = openai.Embedding
else:
pass
return values
@@ -390,10 +390,10 @@ class OpenAIEmbeddings(BaseModel, Embeddings):
"Please install it with `pip install openai`."
)
- openai.proxy = { # type: ignore[attr-defined]
+ openai.proxy = {
"http": self.openai_proxy,
"https": self.openai_proxy,
- } # type: ignore[assignment]
+ }
return openai_args
# please refer to
diff --git a/libs/community/langchain_community/embeddings/spacy_embeddings.py b/libs/community/langchain_community/embeddings/spacy_embeddings.py
index cd862d3ba90..cbe9c06d571 100644
--- a/libs/community/langchain_community/embeddings/spacy_embeddings.py
+++ b/libs/community/langchain_community/embeddings/spacy_embeddings.py
@@ -54,7 +54,7 @@ class SpacyEmbeddings(BaseModel, Embeddings):
# Try to load the spaCy model
import spacy
- values["nlp"] = spacy.load(model_name) # type: ignore[arg-type]
+ values["nlp"] = spacy.load(model_name)
except OSError:
# If the model is not found, raise a ValueError
raise ValueError(
diff --git a/libs/community/langchain_community/embeddings/vertexai.py b/libs/community/langchain_community/embeddings/vertexai.py
index ea625c216b1..06637385e0d 100644
--- a/libs/community/langchain_community/embeddings/vertexai.py
+++ b/libs/community/langchain_community/embeddings/vertexai.py
@@ -25,7 +25,7 @@ _MIN_BATCH_SIZE = 5
removal="1.0",
alternative_import="langchain_google_vertexai.VertexAIEmbeddings",
)
-class VertexAIEmbeddings(_VertexAICommon, Embeddings): # type: ignore[override]
+class VertexAIEmbeddings(_VertexAICommon, Embeddings):
"""Google Cloud VertexAI embedding models."""
# Instance context
@@ -163,8 +163,8 @@ class VertexAIEmbeddings(_VertexAICommon, Embeddings): # type: ignore[override]
DeadlineExceeded,
]
retry_decorator = create_base_retry_decorator(
- error_types=errors, # type: ignore[arg-type]
- max_retries=self.max_retries, # type: ignore[arg-type]
+ error_types=errors,
+ max_retries=self.max_retries,
)
@retry_decorator
diff --git a/libs/community/langchain_community/embeddings/yandex.py b/libs/community/langchain_community/embeddings/yandex.py
index 59637bf1001..f7a6ac555cd 100644
--- a/libs/community/langchain_community/embeddings/yandex.py
+++ b/libs/community/langchain_community/embeddings/yandex.py
@@ -205,7 +205,7 @@ def _make_request(self: YandexGPTEmbeddings, texts: List[str], **kwargs): # typ
for text in texts:
request = TextEmbeddingRequest(model_uri=model_uri, text=text)
stub = EmbeddingsServiceStub(channel)
- res = stub.TextEmbedding(request, metadata=self.grpc_metadata) # type: ignore[attr-defined]
+ res = stub.TextEmbedding(request, metadata=self.grpc_metadata)
result.append(list(res.embedding))
time.sleep(self.sleep_interval)
diff --git a/libs/community/langchain_community/graphs/neo4j_graph.py b/libs/community/langchain_community/graphs/neo4j_graph.py
index f96cd276967..7ce5f2d7e2d 100644
--- a/libs/community/langchain_community/graphs/neo4j_graph.py
+++ b/libs/community/langchain_community/graphs/neo4j_graph.py
@@ -481,20 +481,20 @@ class Neo4jGraph(GraphStore):
or e.code
== "Neo.DatabaseError.Transaction.TransactionStartFailed"
)
- and "in an implicit transaction" in e.message # type: ignore[operator]
+ and "in an implicit transaction" in e.message
)
or ( # isPeriodicCommitError
e.code == "Neo.ClientError.Statement.SemanticError"
and (
- "in an open transaction is not possible" in e.message # type: ignore[operator]
- or "tried to execute in an explicit transaction" in e.message # type: ignore[operator]
+ "in an open transaction is not possible" in e.message
+ or "tried to execute in an explicit transaction" in e.message
)
)
):
raise
# fallback to allow implicit transactions
with self._driver.session(database=self._database) as session:
- data = session.run(Query(text=query, timeout=self.timeout), params) # type: ignore[assignment]
+ data = session.run(Query(text=query, timeout=self.timeout), params)
json_data = [r.data() for r in data]
if self.sanitize:
json_data = [value_sanitize(el) for el in json_data]
diff --git a/libs/community/langchain_community/indexes/_sql_record_manager.py b/libs/community/langchain_community/indexes/_sql_record_manager.py
index 4e7874d9c10..bf59530a06c 100644
--- a/libs/community/langchain_community/indexes/_sql_record_manager.py
+++ b/libs/community/langchain_community/indexes/_sql_record_manager.py
@@ -304,7 +304,7 @@ class SQLRecordManager(RecordManager):
# Note: uses SQLite insert to make on_conflict_do_update work.
# This code needs to be generalized a bit to work with more dialects.
insert_stmt = sqlite_insert(UpsertionRecord).values(records_to_upsert)
- stmt = insert_stmt.on_conflict_do_update( # type: ignore[attr-defined]
+ stmt = insert_stmt.on_conflict_do_update(
[UpsertionRecord.key, UpsertionRecord.namespace],
set_=dict(
# attr-defined type ignore
@@ -318,7 +318,7 @@ class SQLRecordManager(RecordManager):
# Note: uses SQLite insert to make on_conflict_do_update work.
# This code needs to be generalized a bit to work with more dialects.
insert_stmt = pg_insert(UpsertionRecord).values(records_to_upsert) # type: ignore[assignment]
- stmt = insert_stmt.on_conflict_do_update( # type: ignore[attr-defined]
+ stmt = insert_stmt.on_conflict_do_update(
"uix_key_namespace", # Name of constraint
set_=dict(
# attr-defined type ignore
@@ -379,7 +379,7 @@ class SQLRecordManager(RecordManager):
# Note: uses SQLite insert to make on_conflict_do_update work.
# This code needs to be generalized a bit to work with more dialects.
insert_stmt = sqlite_insert(UpsertionRecord).values(records_to_upsert)
- stmt = insert_stmt.on_conflict_do_update( # type: ignore[attr-defined]
+ stmt = insert_stmt.on_conflict_do_update(
[UpsertionRecord.key, UpsertionRecord.namespace],
set_=dict(
# attr-defined type ignore
@@ -393,7 +393,7 @@ class SQLRecordManager(RecordManager):
# Note: uses SQLite insert to make on_conflict_do_update work.
# This code needs to be generalized a bit to work with more dialects.
insert_stmt = pg_insert(UpsertionRecord).values(records_to_upsert) # type: ignore[assignment]
- stmt = insert_stmt.on_conflict_do_update( # type: ignore[attr-defined]
+ stmt = insert_stmt.on_conflict_do_update(
"uix_key_namespace", # Name of constraint
set_=dict(
# attr-defined type ignore
@@ -412,7 +412,7 @@ class SQLRecordManager(RecordManager):
with self._make_session() as session:
records = (
# mypy does not recognize .all()
- session.query(UpsertionRecord.key) # type: ignore[attr-defined]
+ session.query(UpsertionRecord.key)
.filter(
and_(
UpsertionRecord.key.in_(keys),
@@ -460,21 +460,15 @@ class SQLRecordManager(RecordManager):
# mypy does not recognize .all() or .filter()
if after:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.updated_at > after
- )
+ query = query.filter(UpsertionRecord.updated_at > after)
if before:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.updated_at < before
- )
+ query = query.filter(UpsertionRecord.updated_at < before)
if group_ids:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.group_id.in_(group_ids)
- )
+ query = query.filter(UpsertionRecord.group_id.in_(group_ids))
if limit:
- query = query.limit(limit) # type: ignore[attr-defined]
- records = query.all() # type: ignore[attr-defined]
+ query = query.limit(limit)
+ records = query.all()
return [r.key for r in records] # type: ignore[misc]
async def alist_keys(
@@ -493,20 +487,14 @@ class SQLRecordManager(RecordManager):
# mypy does not recognize .all() or .filter()
if after:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.updated_at > after
- )
+ query = query.filter(UpsertionRecord.updated_at > after)
if before:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.updated_at < before
- )
+ query = query.filter(UpsertionRecord.updated_at < before)
if group_ids:
- query = query.filter( # type: ignore[attr-defined]
- UpsertionRecord.group_id.in_(group_ids)
- )
+ query = query.filter(UpsertionRecord.group_id.in_(group_ids))
if limit:
- query = query.limit(limit) # type: ignore[attr-defined]
+ query = query.limit(limit)
records = (await session.execute(query)).scalars().all()
return list(records)
@@ -519,7 +507,7 @@ class SQLRecordManager(RecordManager):
UpsertionRecord.key.in_(keys),
UpsertionRecord.namespace == self.namespace,
)
- ).delete() # type: ignore[attr-defined]
+ ).delete()
session.commit()
async def adelete_keys(self, keys: Sequence[str]) -> None:
diff --git a/libs/community/langchain_community/llms/aleph_alpha.py b/libs/community/langchain_community/llms/aleph_alpha.py
index 73cf1f0dd85..d1cf2175eb0 100644
--- a/libs/community/langchain_community/llms/aleph_alpha.py
+++ b/libs/community/langchain_community/llms/aleph_alpha.py
@@ -281,6 +281,6 @@ class AlephAlpha(LLM):
if __name__ == "__main__":
- aa = AlephAlpha() # type: ignore[call-arg]
+ aa = AlephAlpha()
print(aa.invoke("How are you?")) # noqa: T201
diff --git a/libs/community/langchain_community/llms/anyscale.py b/libs/community/langchain_community/llms/anyscale.py
index e91607543e1..b55fb68ca80 100644
--- a/libs/community/langchain_community/llms/anyscale.py
+++ b/libs/community/langchain_community/llms/anyscale.py
@@ -62,7 +62,7 @@ def create_llm_result(
return LLMResult(generations=generations, llm_output=llm_output)
-class Anyscale(BaseOpenAI): # type: ignore[override]
+class Anyscale(BaseOpenAI):
"""Anyscale large language models.
To use, you should have the environment variable ``ANYSCALE_API_KEY``set with your
@@ -136,7 +136,7 @@ class Anyscale(BaseOpenAI): # type: ignore[override]
else:
values["openai_api_base"] = values["anyscale_api_base"]
values["openai_api_key"] = values["anyscale_api_key"].get_secret_value()
- values["client"] = openai.Completion # type: ignore[attr-defined]
+ values["client"] = openai.Completion
except ImportError:
raise ImportError(
"Could not import openai python package. "
diff --git a/libs/community/langchain_community/llms/azureml_endpoint.py b/libs/community/langchain_community/llms/azureml_endpoint.py
index 1ec03b9a527..184bf5f53e1 100644
--- a/libs/community/langchain_community/llms/azureml_endpoint.py
+++ b/libs/community/langchain_community/llms/azureml_endpoint.py
@@ -194,7 +194,7 @@ class GPT2ContentFormatter(ContentFormatterBase):
try:
choice = json.loads(output)[0]["0"]
except (KeyError, IndexError, TypeError) as e:
- raise ValueError(self.format_error_msg.format(api_type=api_type)) from e # type: ignore[union-attr]
+ raise ValueError(self.format_error_msg.format(api_type=api_type)) from e
return Generation(text=choice)
@@ -239,7 +239,7 @@ class HFContentFormatter(ContentFormatterBase):
try:
choice = json.loads(output)[0]["0"]["generated_text"]
except (KeyError, IndexError, TypeError) as e:
- raise ValueError(self.format_error_msg.format(api_type=api_type)) from e # type: ignore[union-attr]
+ raise ValueError(self.format_error_msg.format(api_type=api_type)) from e
return Generation(text=choice)
@@ -268,7 +268,7 @@ class DollyContentFormatter(ContentFormatterBase):
try:
choice = json.loads(output)[0]
except (KeyError, IndexError, TypeError) as e:
- raise ValueError(self.format_error_msg.format(api_type=api_type)) from e # type: ignore[union-attr]
+ raise ValueError(self.format_error_msg.format(api_type=api_type)) from e
return Generation(text=choice)
@@ -315,7 +315,7 @@ class CustomOpenAIContentFormatter(ContentFormatterBase):
try:
choice = json.loads(output)[0]["0"]
except (KeyError, IndexError, TypeError) as e:
- raise ValueError(self.format_error_msg.format(api_type=api_type)) from e # type: ignore[union-attr]
+ raise ValueError(self.format_error_msg.format(api_type=api_type)) from e
return Generation(text=choice)
if api_type == AzureMLEndpointApiType.serverless:
try:
@@ -327,7 +327,7 @@ class CustomOpenAIContentFormatter(ContentFormatterBase):
"received."
)
except (KeyError, IndexError, TypeError) as e:
- raise ValueError(self.format_error_msg.format(api_type=api_type)) from e # type: ignore[union-attr]
+ raise ValueError(self.format_error_msg.format(api_type=api_type)) from e
return Generation(
text=choice["text"].strip(),
generation_info=dict(
diff --git a/libs/community/langchain_community/llms/beam.py b/libs/community/langchain_community/llms/beam.py
index f5f95d1be62..7d3b6e65ec6 100644
--- a/libs/community/langchain_community/llms/beam.py
+++ b/libs/community/langchain_community/llms/beam.py
@@ -19,7 +19,7 @@ DEFAULT_NUM_TRIES = 10
DEFAULT_SLEEP_TIME = 4
-class Beam(LLM): # type: ignore[override, override, override, override]
+class Beam(LLM):
"""Beam API for gpt2 large language model.
To use, you should have the ``beam-sdk`` python package installed,
diff --git a/libs/community/langchain_community/llms/gooseai.py b/libs/community/langchain_community/llms/gooseai.py
index 61383e9b7db..282bd7d8f8f 100644
--- a/libs/community/langchain_community/llms/gooseai.py
+++ b/libs/community/langchain_community/llms/gooseai.py
@@ -97,8 +97,8 @@ class GooseAI(LLM):
import openai
openai.api_key = gooseai_api_key.get_secret_value()
- openai.api_base = "https://api.goose.ai/v1" # type: ignore[attr-defined]
- values["client"] = openai.Completion # type: ignore[attr-defined]
+ openai.api_base = "https://api.goose.ai/v1"
+ values["client"] = openai.Completion
except ImportError:
raise ImportError(
"Could not import openai python package. "
diff --git a/libs/community/langchain_community/llms/javelin_ai_gateway.py b/libs/community/langchain_community/llms/javelin_ai_gateway.py
index 156350308fa..3571ea4d8b8 100644
--- a/libs/community/langchain_community/llms/javelin_ai_gateway.py
+++ b/libs/community/langchain_community/llms/javelin_ai_gateway.py
@@ -12,7 +12,7 @@ from pydantic import BaseModel
# Ignoring type because below is valid pydantic code
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class Params(BaseModel, extra="allow"): # type: ignore[call-arg]
+class Params(BaseModel, extra="allow"):
"""Parameters for the Javelin AI Gateway LLM."""
temperature: float = 0.0
diff --git a/libs/community/langchain_community/llms/mlflow_ai_gateway.py b/libs/community/langchain_community/llms/mlflow_ai_gateway.py
index 95196838e94..8594aab8c55 100644
--- a/libs/community/langchain_community/llms/mlflow_ai_gateway.py
+++ b/libs/community/langchain_community/llms/mlflow_ai_gateway.py
@@ -10,7 +10,7 @@ from pydantic import BaseModel
# Ignoring type because below is valid pydantic code
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class Params(BaseModel, extra="allow"): # type: ignore[call-arg]
+class Params(BaseModel, extra="allow"):
"""Parameters for the MLflow AI Gateway LLM."""
temperature: float = 0.0
diff --git a/libs/community/langchain_community/llms/octoai_endpoint.py b/libs/community/langchain_community/llms/octoai_endpoint.py
index de56c11eb58..ef519735b71 100644
--- a/libs/community/langchain_community/llms/octoai_endpoint.py
+++ b/libs/community/langchain_community/llms/octoai_endpoint.py
@@ -10,7 +10,7 @@ DEFAULT_BASE_URL = "https://text.octoai.run/v1/"
DEFAULT_MODEL = "codellama-7b-instruct"
-class OctoAIEndpoint(BaseOpenAI): # type: ignore[override]
+class OctoAIEndpoint(BaseOpenAI):
"""OctoAI LLM Endpoints - OpenAI compatible.
OctoAIEndpoint is a class to interact with OctoAI Compute Service large
@@ -102,7 +102,7 @@ class OctoAIEndpoint(BaseOpenAI): # type: ignore[override]
else:
values["openai_api_base"] = values["octoai_api_base"]
values["openai_api_key"] = values["octoai_api_token"].get_secret_value()
- values["client"] = openai.Completion # type: ignore[attr-defined]
+ values["client"] = openai.Completion
except ImportError:
raise ImportError(
"Could not import openai python package. "
diff --git a/libs/community/langchain_community/llms/ollama.py b/libs/community/langchain_community/llms/ollama.py
index 72b6107967d..e6584ae218c 100644
--- a/libs/community/langchain_community/llms/ollama.py
+++ b/libs/community/langchain_community/llms/ollama.py
@@ -319,9 +319,9 @@ class _OllamaCommon(BaseLanguageModel):
"Content-Type": "application/json",
**(self.headers if isinstance(self.headers, dict) else {}),
},
- auth=self.auth, # type: ignore[arg-type]
+ auth=self.auth, # type: ignore[arg-type,unused-ignore]
json=request_payload,
- timeout=self.timeout, # type: ignore[arg-type]
+ timeout=self.timeout, # type: ignore[arg-type,unused-ignore]
) as response:
if response.status != 200:
if response.status == 404:
diff --git a/libs/community/langchain_community/llms/openai.py b/libs/community/langchain_community/llms/openai.py
index 9d640c2bd44..525599945fc 100644
--- a/libs/community/langchain_community/llms/openai.py
+++ b/libs/community/langchain_community/llms/openai.py
@@ -100,11 +100,11 @@ def _create_retry_decorator(
import openai
errors = [
- openai.error.Timeout, # type: ignore[attr-defined]
- openai.error.APIError, # type: ignore[attr-defined]
- openai.error.APIConnectionError, # type: ignore[attr-defined]
- openai.error.RateLimitError, # type: ignore[attr-defined]
- openai.error.ServiceUnavailableError, # type: ignore[attr-defined]
+ openai.error.Timeout,
+ openai.error.APIError,
+ openai.error.APIConnectionError,
+ openai.error.RateLimitError,
+ openai.error.ServiceUnavailableError,
]
return create_base_retry_decorator(
error_types=errors, max_retries=llm.max_retries, run_manager=run_manager
@@ -323,7 +323,7 @@ class BaseOpenAI(BaseLLM):
if not values.get("async_client"):
values["async_client"] = openai.AsyncOpenAI(**client_params).completions
elif not values.get("client"):
- values["client"] = openai.Completion # type: ignore[attr-defined]
+ values["client"] = openai.Completion
else:
pass
@@ -607,7 +607,7 @@ class BaseOpenAI(BaseLLM):
if self.openai_proxy:
import openai
- openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy} # type: ignore[assignment] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined]
+ openai.proxy = {"http": self.openai_proxy, "https": self.openai_proxy}
return {**openai_creds, **self._default_params}
@property
@@ -943,7 +943,7 @@ class AzureOpenAI(BaseOpenAI):
).completions
else:
- values["client"] = openai.Completion # type: ignore[attr-defined]
+ values["client"] = openai.Completion
return values
@@ -1068,18 +1068,18 @@ class OpenAIChat(BaseLLM):
openai.api_key = openai_api_key
if openai_api_base:
- openai.api_base = openai_api_base # type: ignore[attr-defined]
+ openai.api_base = openai_api_base
if openai_organization:
openai.organization = openai_organization
if openai_proxy:
- openai.proxy = {"http": openai_proxy, "https": openai_proxy} # type: ignore[assignment] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined] # type: ignore[attr-defined]
+ openai.proxy = {"http": openai_proxy, "https": openai_proxy}
except ImportError:
raise ImportError(
"Could not import openai python package. "
"Please install it with `pip install openai`."
)
try:
- values["client"] = openai.ChatCompletion # type: ignore[attr-defined]
+ values["client"] = openai.ChatCompletion
except AttributeError:
raise ValueError(
"`openai` has no `ChatCompletion` attribute, this is likely "
diff --git a/libs/community/langchain_community/llms/vertexai.py b/libs/community/langchain_community/llms/vertexai.py
index 22a1bca8e19..74ec9374ac5 100644
--- a/libs/community/langchain_community/llms/vertexai.py
+++ b/libs/community/langchain_community/llms/vertexai.py
@@ -49,7 +49,7 @@ def is_gemini_model(model_name: str) -> bool:
return model_name is not None and "gemini" in model_name
-def completion_with_retry( # type: ignore[no-redef]
+def completion_with_retry(
llm: VertexAI,
prompt: List[Union[str, "Image"]],
stream: bool = False,
@@ -124,7 +124,7 @@ class _VertexAIBase(BaseModel):
return cls.task_executor
-class _VertexAICommon(_VertexAIBase): # type: ignore[override]
+class _VertexAICommon(_VertexAIBase):
client: "_LanguageModel" = None #: :meta private:
client_preview: "_LanguageModel" = None #: :meta private:
model_name: str
@@ -208,7 +208,7 @@ class _VertexAICommon(_VertexAIBase): # type: ignore[override]
removal="1.0",
alternative_import="langchain_google_vertexai.VertexAI",
)
-class VertexAI(_VertexAICommon, BaseLLM): # type: ignore[override]
+class VertexAI(_VertexAICommon, BaseLLM):
"""Google Vertex AI large language models."""
model_name: str = "text-bison"
@@ -332,7 +332,7 @@ class VertexAI(_VertexAICommon, BaseLLM): # type: ignore[override]
generation += chunk
generations.append([generation])
else:
- res = completion_with_retry( # type: ignore[misc]
+ res = completion_with_retry(
self,
[prompt],
stream=should_stream,
@@ -375,7 +375,7 @@ class VertexAI(_VertexAICommon, BaseLLM): # type: ignore[override]
**kwargs: Any,
) -> Iterator[GenerationChunk]:
params = self._prepare_params(stop=stop, stream=True, **kwargs)
- for stream_resp in completion_with_retry( # type: ignore[misc]
+ for stream_resp in completion_with_retry(
self,
[prompt],
stream=True,
@@ -448,7 +448,7 @@ class VertexAIModelGarden(_VertexAIBase, BaseLLM):
@property
def endpoint_path(self) -> str:
return self.client.endpoint_path(
- project=self.project, # type: ignore[arg-type]
+ project=self.project,
location=self.location,
endpoint=self.endpoint_id,
)
diff --git a/libs/community/langchain_community/llms/yandex.py b/libs/community/langchain_community/llms/yandex.py
index cc615ac6d73..31b09bcdb25 100644
--- a/libs/community/langchain_community/llms/yandex.py
+++ b/libs/community/langchain_community/llms/yandex.py
@@ -235,7 +235,7 @@ def _make_request(
messages=[Message(role="user", text=prompt)],
)
stub = TextGenerationServiceStub(channel)
- res = stub.Completion(request, metadata=self.grpc_metadata) # type: ignore[attr-defined]
+ res = stub.Completion(request, metadata=self.grpc_metadata)
return list(res)[0].alternatives[0].message.text
@@ -291,7 +291,7 @@ async def _amake_request(self: YandexGPT, prompt: str) -> str:
messages=[Message(role="user", text=prompt)],
)
stub = TextGenerationAsyncServiceStub(channel)
- operation = await stub.Completion(request, metadata=self.grpc_metadata) # type: ignore[attr-defined]
+ operation = await stub.Completion(request, metadata=self.grpc_metadata)
async with grpc.aio.secure_channel(
operation_api_url, channel_credentials
) as operation_channel:
@@ -301,7 +301,7 @@ async def _amake_request(self: YandexGPT, prompt: str) -> str:
operation_request = GetOperationRequest(operation_id=operation.id)
operation = await operation_stub.Get(
operation_request,
- metadata=self.grpc_metadata, # type: ignore[attr-defined]
+ metadata=self.grpc_metadata,
)
completion_response = CompletionResponse()
diff --git a/libs/community/langchain_community/memory/zep_cloud_memory.py b/libs/community/langchain_community/memory/zep_cloud_memory.py
index 538fcb3b2c7..eacab5eb27a 100644
--- a/libs/community/langchain_community/memory/zep_cloud_memory.py
+++ b/libs/community/langchain_community/memory/zep_cloud_memory.py
@@ -8,7 +8,7 @@ try:
from langchain.memory import ConversationBufferMemory
from zep_cloud import MemoryGetRequestMemoryType
- class ZepCloudMemory(ConversationBufferMemory): # type: ignore[override]
+ class ZepCloudMemory(ConversationBufferMemory):
"""Persist your chain history to the Zep MemoryStore.
Documentation: https://help.getzep.com
diff --git a/libs/community/langchain_community/memory/zep_memory.py b/libs/community/langchain_community/memory/zep_memory.py
index e4cae448838..eda8042ecb5 100644
--- a/libs/community/langchain_community/memory/zep_memory.py
+++ b/libs/community/langchain_community/memory/zep_memory.py
@@ -7,7 +7,7 @@ from langchain_community.chat_message_histories import ZepChatMessageHistory
try:
from langchain.memory import ConversationBufferMemory
- class ZepMemory(ConversationBufferMemory): # type: ignore[override]
+ class ZepMemory(ConversationBufferMemory):
"""Persist your chain history to the Zep MemoryStore.
The number of messages returned by Zep and when the Zep server summarizes chat
diff --git a/libs/community/langchain_community/retrievers/bedrock.py b/libs/community/langchain_community/retrievers/bedrock.py
index d7fe03ad2c3..3dd33a045d7 100644
--- a/libs/community/langchain_community/retrievers/bedrock.py
+++ b/libs/community/langchain_community/retrievers/bedrock.py
@@ -7,13 +7,13 @@ from langchain_core.retrievers import BaseRetriever
from pydantic import BaseModel, model_validator
-class VectorSearchConfig(BaseModel, extra="allow"): # type: ignore[call-arg]
+class VectorSearchConfig(BaseModel, extra="allow"):
"""Configuration for vector search."""
numberOfResults: int = 4
-class RetrievalConfig(BaseModel, extra="allow"): # type: ignore[call-arg]
+class RetrievalConfig(BaseModel, extra="allow"):
"""Configuration for retrieval."""
vectorSearchConfiguration: VectorSearchConfig
diff --git a/libs/community/langchain_community/retrievers/kendra.py b/libs/community/langchain_community/retrievers/kendra.py
index 1b7cc5fbcd0..899a0052e31 100644
--- a/libs/community/langchain_community/retrievers/kendra.py
+++ b/libs/community/langchain_community/retrievers/kendra.py
@@ -68,7 +68,7 @@ Dates are also represented as str.
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class Highlight(BaseModel, extra="allow"): # type: ignore[call-arg]
+class Highlight(BaseModel, extra="allow"):
"""Information that highlights the keywords in the excerpt."""
BeginOffset: int
@@ -82,7 +82,7 @@ class Highlight(BaseModel, extra="allow"): # type: ignore[call-arg]
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class TextWithHighLights(BaseModel, extra="allow"): # type: ignore[call-arg]
+class TextWithHighLights(BaseModel, extra="allow"):
"""Text with highlights."""
Text: str
@@ -92,9 +92,7 @@ class TextWithHighLights(BaseModel, extra="allow"): # type: ignore[call-arg]
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class AdditionalResultAttributeValue( # type: ignore[call-arg]
- BaseModel, extra="allow"
-):
+class AdditionalResultAttributeValue(BaseModel, extra="allow"):
"""Value of an additional result attribute."""
TextWithHighlightsValue: TextWithHighLights
@@ -102,7 +100,7 @@ class AdditionalResultAttributeValue( # type: ignore[call-arg]
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class AdditionalResultAttribute(BaseModel, extra="allow"): # type: ignore[call-arg]
+class AdditionalResultAttribute(BaseModel, extra="allow"):
"""Additional result attribute."""
Key: str
@@ -117,7 +115,7 @@ class AdditionalResultAttribute(BaseModel, extra="allow"): # type: ignore[call-
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class DocumentAttributeValue(BaseModel, extra="allow"): # type: ignore[call-arg]
+class DocumentAttributeValue(BaseModel, extra="allow"):
"""Value of a document attribute."""
DateValue: Optional[str] = None
@@ -148,7 +146,7 @@ class DocumentAttributeValue(BaseModel, extra="allow"): # type: ignore[call-arg
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class DocumentAttribute(BaseModel, extra="allow"): # type: ignore[call-arg]
+class DocumentAttribute(BaseModel, extra="allow"):
"""Document attribute."""
Key: str
@@ -158,7 +156,7 @@ class DocumentAttribute(BaseModel, extra="allow"): # type: ignore[call-arg]
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class ResultItem(BaseModel, ABC, extra="allow"): # type: ignore[call-arg]
+class ResultItem(BaseModel, ABC, extra="allow"):
"""Base class of a result item."""
Id: Optional[str]
@@ -288,7 +286,7 @@ class RetrieveResultItem(ResultItem):
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class QueryResult(BaseModel, extra="allow"): # type: ignore[call-arg]
+class QueryResult(BaseModel, extra="allow"):
"""`Amazon Kendra Query API` search result.
It is composed of:
@@ -302,7 +300,7 @@ class QueryResult(BaseModel, extra="allow"): # type: ignore[call-arg]
# Unexpected keyword argument "extra" for "__init_subclass__" of "object"
-class RetrieveResult(BaseModel, extra="allow"): # type: ignore[call-arg]
+class RetrieveResult(BaseModel, extra="allow"):
"""`Amazon Kendra Retrieve API` search result.
It is composed of:
diff --git a/libs/community/langchain_community/tools/ainetwork/app.py b/libs/community/langchain_community/tools/ainetwork/app.py
index 98f83c5d366..8175a210b70 100644
--- a/libs/community/langchain_community/tools/ainetwork/app.py
+++ b/libs/community/langchain_community/tools/ainetwork/app.py
@@ -30,7 +30,7 @@ class AppSchema(BaseModel):
)
-class AINAppOps(AINBaseTool): # type: ignore[override, override]
+class AINAppOps(AINBaseTool):
"""Tool for app operations."""
name: str = "AINappOps"
diff --git a/libs/community/langchain_community/tools/ainetwork/base.py b/libs/community/langchain_community/tools/ainetwork/base.py
index a973412bd6f..00e4fc7f7a2 100644
--- a/libs/community/langchain_community/tools/ainetwork/base.py
+++ b/libs/community/langchain_community/tools/ainetwork/base.py
@@ -22,7 +22,7 @@ class OperationType(str, Enum):
GET = "GET"
-class AINBaseTool(BaseTool): # type: ignore[override]
+class AINBaseTool(BaseTool):
"""Base class for the AINetwork tools."""
interface: Ain = Field(default_factory=authenticate)
diff --git a/libs/community/langchain_community/tools/ainetwork/owner.py b/libs/community/langchain_community/tools/ainetwork/owner.py
index fdd15ed65a1..13d41d93273 100644
--- a/libs/community/langchain_community/tools/ainetwork/owner.py
+++ b/libs/community/langchain_community/tools/ainetwork/owner.py
@@ -30,7 +30,7 @@ class RuleSchema(BaseModel):
)
-class AINOwnerOps(AINBaseTool): # type: ignore[override, override]
+class AINOwnerOps(AINBaseTool):
"""Tool for owner operations."""
name: str = "AINownerOps"
diff --git a/libs/community/langchain_community/tools/ainetwork/rule.py b/libs/community/langchain_community/tools/ainetwork/rule.py
index 9a210501753..5a24c9e5aba 100644
--- a/libs/community/langchain_community/tools/ainetwork/rule.py
+++ b/libs/community/langchain_community/tools/ainetwork/rule.py
@@ -16,7 +16,7 @@ class RuleSchema(BaseModel):
eval: Optional[str] = Field(None, description="eval string to determine permission")
-class AINRuleOps(AINBaseTool): # type: ignore[override, override]
+class AINRuleOps(AINBaseTool):
"""Tool for owner operations."""
name: str = "AINruleOps"
diff --git a/libs/community/langchain_community/tools/ainetwork/transfer.py b/libs/community/langchain_community/tools/ainetwork/transfer.py
index ff8d307948b..81d630af2e3 100644
--- a/libs/community/langchain_community/tools/ainetwork/transfer.py
+++ b/libs/community/langchain_community/tools/ainetwork/transfer.py
@@ -14,7 +14,7 @@ class TransferSchema(BaseModel):
amount: int = Field(..., description="Amount of AIN to transfer")
-class AINTransfer(AINBaseTool): # type: ignore[override, override]
+class AINTransfer(AINBaseTool):
"""Tool for transfer operations."""
name: str = "AINtransfer"
diff --git a/libs/community/langchain_community/tools/ainetwork/value.py b/libs/community/langchain_community/tools/ainetwork/value.py
index cd521154318..be6414727f5 100644
--- a/libs/community/langchain_community/tools/ainetwork/value.py
+++ b/libs/community/langchain_community/tools/ainetwork/value.py
@@ -18,7 +18,7 @@ class ValueSchema(BaseModel):
)
-class AINValueOps(AINBaseTool): # type: ignore[override, override]
+class AINValueOps(AINBaseTool):
"""Tool for value operations."""
name: str = "AINvalueOps"
diff --git a/libs/community/langchain_community/tools/amadeus/base.py b/libs/community/langchain_community/tools/amadeus/base.py
index 9a8d5473ade..3fd3f377ce2 100644
--- a/libs/community/langchain_community/tools/amadeus/base.py
+++ b/libs/community/langchain_community/tools/amadeus/base.py
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from amadeus import Client
-class AmadeusBaseTool(BaseTool): # type: ignore[override]
+class AmadeusBaseTool(BaseTool):
"""Base Tool for Amadeus."""
client: Client = Field(default_factory=authenticate)
diff --git a/libs/community/langchain_community/tools/amadeus/closest_airport.py b/libs/community/langchain_community/tools/amadeus/closest_airport.py
index 71af3c2b08b..9523f73afbb 100644
--- a/libs/community/langchain_community/tools/amadeus/closest_airport.py
+++ b/libs/community/langchain_community/tools/amadeus/closest_airport.py
@@ -27,7 +27,7 @@ class ClosestAirportSchema(BaseModel):
)
-class AmadeusClosestAirport(AmadeusBaseTool): # type: ignore[override, override, override]
+class AmadeusClosestAirport(AmadeusBaseTool):
"""Tool for finding the closest airport to a particular location."""
name: str = "closest_airport"
diff --git a/libs/community/langchain_community/tools/amadeus/flight_search.py b/libs/community/langchain_community/tools/amadeus/flight_search.py
index 5dd32047c1d..c3cd8fe7bb9 100644
--- a/libs/community/langchain_community/tools/amadeus/flight_search.py
+++ b/libs/community/langchain_community/tools/amadeus/flight_search.py
@@ -51,7 +51,7 @@ class FlightSearchSchema(BaseModel):
)
-class AmadeusFlightSearch(AmadeusBaseTool): # type: ignore[override, override]
+class AmadeusFlightSearch(AmadeusBaseTool):
"""Tool for searching for a single flight between two airports."""
name: str = "single_flight_search"
diff --git a/libs/community/langchain_community/tools/arxiv/tool.py b/libs/community/langchain_community/tools/arxiv/tool.py
index 1d2fb5aa831..601022a1325 100644
--- a/libs/community/langchain_community/tools/arxiv/tool.py
+++ b/libs/community/langchain_community/tools/arxiv/tool.py
@@ -15,7 +15,7 @@ class ArxivInput(BaseModel):
query: str = Field(description="search query to look up")
-class ArxivQueryRun(BaseTool): # type: ignore[override, override]
+class ArxivQueryRun(BaseTool):
"""Tool that searches the Arxiv API."""
name: str = "arxiv"
diff --git a/libs/community/langchain_community/tools/asknews/tool.py b/libs/community/langchain_community/tools/asknews/tool.py
index 60cc7bf34c7..ca5de6970cd 100644
--- a/libs/community/langchain_community/tools/asknews/tool.py
+++ b/libs/community/langchain_community/tools/asknews/tool.py
@@ -34,7 +34,7 @@ class SearchInput(BaseModel):
)
-class AskNewsSearch(BaseTool): # type: ignore[override]
+class AskNewsSearch(BaseTool):
"""Tool that searches the AskNews API."""
name: str = "asknews_search"
@@ -43,7 +43,7 @@ class AskNewsSearch(BaseTool): # type: ignore[override]
"news. If you needs news from more than 48 hours ago, you can estimate the "
"number of hours back to search."
)
- api_wrapper: AskNewsAPIWrapper = Field(default_factory=AskNewsAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: AskNewsAPIWrapper = Field(default_factory=AskNewsAPIWrapper)
max_results: int = 10
args_schema: Optional[Type[BaseModel]] = SearchInput
diff --git a/libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py b/libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py
index bce7c841306..9e20870224b 100644
--- a/libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py
+++ b/libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py
@@ -12,7 +12,7 @@ from pydantic import SecretStr
logger = logging.getLogger(__name__)
-class HuggingFaceTextToSpeechModelInference(BaseTool): # type: ignore[override]
+class HuggingFaceTextToSpeechModelInference(BaseTool):
"""HuggingFace Text-to-Speech Model Inference.
Requirements:
@@ -74,7 +74,7 @@ class HuggingFaceTextToSpeechModelInference(BaseTool): # type: ignore[override]
f"Invalid value for 'file_naming_func': {file_naming_func}"
)
- super().__init__( # type: ignore[call-arg]
+ super().__init__(
model=model,
file_extension=file_extension,
api_url=f"{_HUGGINGFACE_API_URL_ROOT}/{model}",
diff --git a/libs/community/langchain_community/tools/azure_ai_services/document_intelligence.py b/libs/community/langchain_community/tools/azure_ai_services/document_intelligence.py
index 994fd13e646..cd0ac25018e 100644
--- a/libs/community/langchain_community/tools/azure_ai_services/document_intelligence.py
+++ b/libs/community/langchain_community/tools/azure_ai_services/document_intelligence.py
@@ -15,7 +15,7 @@ from langchain_community.tools.azure_ai_services.utils import (
logger = logging.getLogger(__name__)
-class AzureAiServicesDocumentIntelligenceTool(BaseTool): # type: ignore[override]
+class AzureAiServicesDocumentIntelligenceTool(BaseTool):
"""Tool that queries the Azure AI Services Document Intelligence API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_ai_services/image_analysis.py b/libs/community/langchain_community/tools/azure_ai_services/image_analysis.py
index ad6a7ca2393..c3292cff6b8 100644
--- a/libs/community/langchain_community/tools/azure_ai_services/image_analysis.py
+++ b/libs/community/langchain_community/tools/azure_ai_services/image_analysis.py
@@ -15,7 +15,7 @@ from langchain_community.tools.azure_ai_services.utils import (
logger = logging.getLogger(__name__)
-class AzureAiServicesImageAnalysisTool(BaseTool): # type: ignore[override]
+class AzureAiServicesImageAnalysisTool(BaseTool):
"""Tool that queries the Azure AI Services Image Analysis API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_ai_services/speech_to_text.py b/libs/community/langchain_community/tools/azure_ai_services/speech_to_text.py
index b10c0323427..15e08d27222 100644
--- a/libs/community/langchain_community/tools/azure_ai_services/speech_to_text.py
+++ b/libs/community/langchain_community/tools/azure_ai_services/speech_to_text.py
@@ -17,7 +17,7 @@ from langchain_community.tools.azure_ai_services.utils import (
logger = logging.getLogger(__name__)
-class AzureAiServicesSpeechToTextTool(BaseTool): # type: ignore[override]
+class AzureAiServicesSpeechToTextTool(BaseTool):
"""Tool that queries the Azure AI Services Speech to Text API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_ai_services/text_analytics_for_health.py b/libs/community/langchain_community/tools/azure_ai_services/text_analytics_for_health.py
index b7fcd310e9c..6df15788f5e 100644
--- a/libs/community/langchain_community/tools/azure_ai_services/text_analytics_for_health.py
+++ b/libs/community/langchain_community/tools/azure_ai_services/text_analytics_for_health.py
@@ -11,7 +11,7 @@ from pydantic import model_validator
logger = logging.getLogger(__name__)
-class AzureAiServicesTextAnalyticsForHealthTool(BaseTool): # type: ignore[override]
+class AzureAiServicesTextAnalyticsForHealthTool(BaseTool):
"""Tool that queries the Azure AI Services Text Analytics for Health API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_ai_services/text_to_speech.py b/libs/community/langchain_community/tools/azure_ai_services/text_to_speech.py
index 605a97998e3..1291e2dac56 100644
--- a/libs/community/langchain_community/tools/azure_ai_services/text_to_speech.py
+++ b/libs/community/langchain_community/tools/azure_ai_services/text_to_speech.py
@@ -12,7 +12,7 @@ from pydantic import model_validator
logger = logging.getLogger(__name__)
-class AzureAiServicesTextToSpeechTool(BaseTool): # type: ignore[override]
+class AzureAiServicesTextToSpeechTool(BaseTool):
"""Tool that queries the Azure AI Services Text to Speech API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py b/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py
index 6789787bcc9..937b1fc7930 100644
--- a/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py
+++ b/libs/community/langchain_community/tools/azure_cognitive_services/form_recognizer.py
@@ -15,7 +15,7 @@ from langchain_community.tools.azure_cognitive_services.utils import (
logger = logging.getLogger(__name__)
-class AzureCogsFormRecognizerTool(BaseTool): # type: ignore[override]
+class AzureCogsFormRecognizerTool(BaseTool):
"""Tool that queries the Azure Cognitive Services Form Recognizer API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_cognitive_services/image_analysis.py b/libs/community/langchain_community/tools/azure_cognitive_services/image_analysis.py
index c4223d24a7c..ce076243a7b 100644
--- a/libs/community/langchain_community/tools/azure_cognitive_services/image_analysis.py
+++ b/libs/community/langchain_community/tools/azure_cognitive_services/image_analysis.py
@@ -15,7 +15,7 @@ from langchain_community.tools.azure_cognitive_services.utils import (
logger = logging.getLogger(__name__)
-class AzureCogsImageAnalysisTool(BaseTool): # type: ignore[override]
+class AzureCogsImageAnalysisTool(BaseTool):
"""Tool that queries the Azure Cognitive Services Image Analysis API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_cognitive_services/speech2text.py b/libs/community/langchain_community/tools/azure_cognitive_services/speech2text.py
index 3a809550600..125c910df1b 100644
--- a/libs/community/langchain_community/tools/azure_cognitive_services/speech2text.py
+++ b/libs/community/langchain_community/tools/azure_cognitive_services/speech2text.py
@@ -17,7 +17,7 @@ from langchain_community.tools.azure_cognitive_services.utils import (
logger = logging.getLogger(__name__)
-class AzureCogsSpeech2TextTool(BaseTool): # type: ignore[override]
+class AzureCogsSpeech2TextTool(BaseTool):
"""Tool that queries the Azure Cognitive Services Speech2Text API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_cognitive_services/text2speech.py b/libs/community/langchain_community/tools/azure_cognitive_services/text2speech.py
index c6692561806..343653fe9c3 100644
--- a/libs/community/langchain_community/tools/azure_cognitive_services/text2speech.py
+++ b/libs/community/langchain_community/tools/azure_cognitive_services/text2speech.py
@@ -12,7 +12,7 @@ from pydantic import model_validator
logger = logging.getLogger(__name__)
-class AzureCogsText2SpeechTool(BaseTool): # type: ignore[override]
+class AzureCogsText2SpeechTool(BaseTool):
"""Tool that queries the Azure Cognitive Services Text2Speech API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/azure_cognitive_services/text_analytics_health.py b/libs/community/langchain_community/tools/azure_cognitive_services/text_analytics_health.py
index 53463f4d592..26864a83820 100644
--- a/libs/community/langchain_community/tools/azure_cognitive_services/text_analytics_health.py
+++ b/libs/community/langchain_community/tools/azure_cognitive_services/text_analytics_health.py
@@ -11,7 +11,7 @@ from pydantic import model_validator
logger = logging.getLogger(__name__)
-class AzureCogsTextAnalyticsHealthTool(BaseTool): # type: ignore[override]
+class AzureCogsTextAnalyticsHealthTool(BaseTool):
"""Tool that queries the Azure Cognitive Services Text Analytics for Health API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/bing_search/tool.py b/libs/community/langchain_community/tools/bing_search/tool.py
index 413b1f70cf8..9c05405f825 100644
--- a/libs/community/langchain_community/tools/bing_search/tool.py
+++ b/libs/community/langchain_community/tools/bing_search/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.bing_search import BingSearchAPIWrapper
-class BingSearchRun(BaseTool): # type: ignore[override]
+class BingSearchRun(BaseTool):
"""Tool that queries the Bing search API."""
name: str = "bing_search"
@@ -28,7 +28,7 @@ class BingSearchRun(BaseTool): # type: ignore[override]
return self.api_wrapper.run(query)
-class BingSearchResults(BaseTool): # type: ignore[override, override]
+class BingSearchResults(BaseTool):
"""Bing Search tool.
Setup:
diff --git a/libs/community/langchain_community/tools/brave_search/tool.py b/libs/community/langchain_community/tools/brave_search/tool.py
index 9d170494d6d..c9d62210c26 100644
--- a/libs/community/langchain_community/tools/brave_search/tool.py
+++ b/libs/community/langchain_community/tools/brave_search/tool.py
@@ -9,7 +9,7 @@ from pydantic import Field, SecretStr
from langchain_community.utilities.brave_search import BraveSearchWrapper
-class BraveSearch(BaseTool): # type: ignore[override]
+class BraveSearch(BaseTool):
"""Tool that queries the BraveSearch.
Api key can be provided as an environment variable BRAVE_SEARCH_API_KEY
diff --git a/libs/community/langchain_community/tools/cassandra_database/tool.py b/libs/community/langchain_community/tools/cassandra_database/tool.py
index b86e2a79bd3..ab6e502fb08 100644
--- a/libs/community/langchain_community/tools/cassandra_database/tool.py
+++ b/libs/community/langchain_community/tools/cassandra_database/tool.py
@@ -29,7 +29,7 @@ class _QueryCassandraDatabaseToolInput(BaseModel):
query: str = Field(..., description="A detailed and correct CQL query.")
-class QueryCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool): # type: ignore[override, override]
+class QueryCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool):
"""Tool for querying an Apache Cassandra database with provided CQL."""
name: str = "cassandra_db_query"
@@ -60,7 +60,7 @@ class _GetSchemaCassandraDatabaseToolInput(BaseModel):
)
-class GetSchemaCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool): # type: ignore[override, override]
+class GetSchemaCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool):
"""Tool for getting the schema of a keyspace in an Apache Cassandra database."""
name: str = "cassandra_db_schema"
@@ -107,7 +107,7 @@ class _GetTableDataCassandraDatabaseToolInput(BaseModel):
)
-class GetTableDataCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool): # type: ignore[override, override]
+class GetTableDataCassandraDatabaseTool(BaseCassandraDatabaseTool, BaseTool):
"""
Tool for getting data from a table in an Apache Cassandra database.
Use the WHERE clause to specify the predicate for the query that uses the
diff --git a/libs/community/langchain_community/tools/clickup/tool.py b/libs/community/langchain_community/tools/clickup/tool.py
index 7b0cac67ced..03b3fde586c 100644
--- a/libs/community/langchain_community/tools/clickup/tool.py
+++ b/libs/community/langchain_community/tools/clickup/tool.py
@@ -26,7 +26,7 @@ from pydantic import Field
from langchain_community.utilities.clickup import ClickupAPIWrapper
-class ClickupAction(BaseTool): # type: ignore[override]
+class ClickupAction(BaseTool):
"""Tool that queries the Clickup API."""
api_wrapper: ClickupAPIWrapper = Field(default_factory=ClickupAPIWrapper)
diff --git a/libs/community/langchain_community/tools/cogniswitch/tool.py b/libs/community/langchain_community/tools/cogniswitch/tool.py
index 1dc62b9e5c2..41c9663fb5e 100644
--- a/libs/community/langchain_community/tools/cogniswitch/tool.py
+++ b/libs/community/langchain_community/tools/cogniswitch/tool.py
@@ -7,7 +7,7 @@ from langchain_core.callbacks import CallbackManagerForToolRun
from langchain_core.tools import BaseTool
-class CogniswitchKnowledgeRequest(BaseTool): # type: ignore[override]
+class CogniswitchKnowledgeRequest(BaseTool):
"""Tool that uses the Cogniswitch service to answer questions.
name: str = "cogniswitch_knowledge_request"
@@ -80,7 +80,7 @@ class CogniswitchKnowledgeRequest(BaseTool): # type: ignore[override]
return response.json()
-class CogniswitchKnowledgeStatus(BaseTool): # type: ignore[override]
+class CogniswitchKnowledgeStatus(BaseTool):
"""Tool that uses the Cogniswitch services to get the
status of the document or url uploaded.
@@ -180,7 +180,7 @@ class CogniswitchKnowledgeStatus(BaseTool): # type: ignore[override]
}
-class CogniswitchKnowledgeSourceFile(BaseTool): # type: ignore[override]
+class CogniswitchKnowledgeSourceFile(BaseTool):
"""Tool that uses the Cogniswitch services to store data from file.
name: str = "cogniswitch_knowledge_source_file"
@@ -293,7 +293,7 @@ class CogniswitchKnowledgeSourceFile(BaseTool): # type: ignore[override]
return {"message": "Bad Request"}
-class CogniswitchKnowledgeSourceURL(BaseTool): # type: ignore[override]
+class CogniswitchKnowledgeSourceURL(BaseTool):
"""Tool that uses the Cogniswitch services to store data from a URL.
name: str = "cogniswitch_knowledge_source_url"
diff --git a/libs/community/langchain_community/tools/connery/tool.py b/libs/community/langchain_community/tools/connery/tool.py
index 2bb0713493b..d74bfc1743e 100644
--- a/libs/community/langchain_community/tools/connery/tool.py
+++ b/libs/community/langchain_community/tools/connery/tool.py
@@ -12,7 +12,7 @@ from pydantic import BaseModel, Field, create_model, model_validator
from langchain_community.tools.connery.models import Action, Parameter
-class ConneryAction(BaseTool): # type: ignore[override, override]
+class ConneryAction(BaseTool):
"""Connery Action tool."""
name: str
diff --git a/libs/community/langchain_community/tools/dataforseo_api_search/tool.py b/libs/community/langchain_community/tools/dataforseo_api_search/tool.py
index 8adc8b9ab86..65bf1ec22cd 100644
--- a/libs/community/langchain_community/tools/dataforseo_api_search/tool.py
+++ b/libs/community/langchain_community/tools/dataforseo_api_search/tool.py
@@ -12,7 +12,7 @@ from pydantic import Field
from langchain_community.utilities.dataforseo_api_search import DataForSeoAPIWrapper
-class DataForSeoAPISearchRun(BaseTool): # type: ignore[override]
+class DataForSeoAPISearchRun(BaseTool):
"""Tool that queries the DataForSeo Google search API."""
name: str = "dataforseo_api_search"
@@ -40,7 +40,7 @@ class DataForSeoAPISearchRun(BaseTool): # type: ignore[override]
return (await self.api_wrapper.arun(query)).__str__()
-class DataForSeoAPISearchResults(BaseTool): # type: ignore[override]
+class DataForSeoAPISearchResults(BaseTool):
"""Tool that queries the DataForSeo Google Search API
and get back json."""
diff --git a/libs/community/langchain_community/tools/dataherald/tool.py b/libs/community/langchain_community/tools/dataherald/tool.py
index 56b02e70186..2a2546a3283 100644
--- a/libs/community/langchain_community/tools/dataherald/tool.py
+++ b/libs/community/langchain_community/tools/dataherald/tool.py
@@ -15,7 +15,7 @@ class DataheraldTextToSQLInput(BaseModel):
)
-class DataheraldTextToSQL(BaseTool): # type: ignore[override, override]
+class DataheraldTextToSQL(BaseTool):
"""Tool that queries using the Dataherald SDK."""
name: str = "dataherald"
diff --git a/libs/community/langchain_community/tools/ddg_search/tool.py b/libs/community/langchain_community/tools/ddg_search/tool.py
index e5c28cb1f68..7db9b77da42 100644
--- a/libs/community/langchain_community/tools/ddg_search/tool.py
+++ b/libs/community/langchain_community/tools/ddg_search/tool.py
@@ -17,7 +17,7 @@ class DDGInput(BaseModel):
query: str = Field(description="search query to look up")
-class DuckDuckGoSearchRun(BaseTool): # type: ignore[override, override]
+class DuckDuckGoSearchRun(BaseTool):
"""DuckDuckGo tool.
Setup:
@@ -74,7 +74,7 @@ class DuckDuckGoSearchRun(BaseTool): # type: ignore[override, override]
return self.api_wrapper.run(query)
-class DuckDuckGoSearchResults(BaseTool): # type: ignore[override, override]
+class DuckDuckGoSearchResults(BaseTool):
"""Tool that queries the DuckDuckGo search API and
returns the results in `output_format`."""
diff --git a/libs/community/langchain_community/tools/e2b_data_analysis/tool.py b/libs/community/langchain_community/tools/e2b_data_analysis/tool.py
index 0078637d96c..3f952f6dc63 100644
--- a/libs/community/langchain_community/tools/e2b_data_analysis/tool.py
+++ b/libs/community/langchain_community/tools/e2b_data_analysis/tool.py
@@ -39,7 +39,7 @@ def _unparse(tree: ast.AST) -> str:
source_code = s.getvalue()
s.close()
else:
- source_code = ast.unparse(tree) # type: ignore[attr-defined]
+ source_code = ast.unparse(tree)
return source_code
@@ -93,7 +93,7 @@ class E2BDataAnalysisToolArguments(BaseModel):
)
-class E2BDataAnalysisTool(BaseTool): # type: ignore[override, override]
+class E2BDataAnalysisTool(BaseTool):
"""Tool for running python code in a sandboxed environment for data analysis."""
name: str = "e2b_data_analysis"
diff --git a/libs/community/langchain_community/tools/edenai/audio_speech_to_text.py b/libs/community/langchain_community/tools/edenai/audio_speech_to_text.py
index b3a70d4e642..ead38e7d19c 100644
--- a/libs/community/langchain_community/tools/edenai/audio_speech_to_text.py
+++ b/libs/community/langchain_community/tools/edenai/audio_speech_to_text.py
@@ -18,7 +18,7 @@ class SpeechToTextInput(BaseModel):
query: HttpUrl = Field(description="url of the audio to analyze")
-class EdenAiSpeechToTextTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiSpeechToTextTool(EdenaiTool):
"""Tool that queries the Eden AI Speech To Text API.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py b/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py
index 8c88060b75a..d17c0854f9e 100644
--- a/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py
+++ b/libs/community/langchain_community/tools/edenai/audio_text_to_speech.py
@@ -16,7 +16,7 @@ class TextToSpeechInput(BaseModel):
query: str = Field(description="text to generate audio from")
-class EdenAiTextToSpeechTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiTextToSpeechTool(EdenaiTool):
"""Tool that queries the Eden AI Text to speech API.
for api reference check edenai documentation:
https://docs.edenai.co/reference/audio_text_to_speech_create.
diff --git a/libs/community/langchain_community/tools/edenai/edenai_base_tool.py b/libs/community/langchain_community/tools/edenai/edenai_base_tool.py
index 5ce3b89dce3..edc5b582e25 100644
--- a/libs/community/langchain_community/tools/edenai/edenai_base_tool.py
+++ b/libs/community/langchain_community/tools/edenai/edenai_base_tool.py
@@ -13,7 +13,7 @@ from pydantic import Field, SecretStr
logger = logging.getLogger(__name__)
-class EdenaiTool(BaseTool): # type: ignore[override]
+class EdenaiTool(BaseTool):
"""
the base tool for all the EdenAI Tools .
you should have
diff --git a/libs/community/langchain_community/tools/edenai/image_explicitcontent.py b/libs/community/langchain_community/tools/edenai/image_explicitcontent.py
index 11dfa02df0e..50f9f24338a 100644
--- a/libs/community/langchain_community/tools/edenai/image_explicitcontent.py
+++ b/libs/community/langchain_community/tools/edenai/image_explicitcontent.py
@@ -15,7 +15,7 @@ class ExplicitImageInput(BaseModel):
query: HttpUrl = Field(description="url of the image to analyze")
-class EdenAiExplicitImageTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiExplicitImageTool(EdenaiTool):
"""Tool that queries the Eden AI Explicit image detection.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/edenai/image_objectdetection.py b/libs/community/langchain_community/tools/edenai/image_objectdetection.py
index ed4daac712d..491f6ec5b3a 100644
--- a/libs/community/langchain_community/tools/edenai/image_objectdetection.py
+++ b/libs/community/langchain_community/tools/edenai/image_objectdetection.py
@@ -15,7 +15,7 @@ class ObjectDetectionInput(BaseModel):
query: HttpUrl = Field(description="url of the image to analyze")
-class EdenAiObjectDetectionTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiObjectDetectionTool(EdenaiTool):
"""Tool that queries the Eden AI Object detection API.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/edenai/ocr_identityparser.py b/libs/community/langchain_community/tools/edenai/ocr_identityparser.py
index 74b0e9cefc2..f2270345917 100644
--- a/libs/community/langchain_community/tools/edenai/ocr_identityparser.py
+++ b/libs/community/langchain_community/tools/edenai/ocr_identityparser.py
@@ -15,7 +15,7 @@ class IDParsingInput(BaseModel):
query: HttpUrl = Field(description="url of the document to parse")
-class EdenAiParsingIDTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiParsingIDTool(EdenaiTool):
"""Tool that queries the Eden AI Identity parsing API.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py b/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py
index e84d514ccac..d5266476784 100644
--- a/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py
+++ b/libs/community/langchain_community/tools/edenai/ocr_invoiceparser.py
@@ -15,7 +15,7 @@ class InvoiceParsingInput(BaseModel):
query: HttpUrl = Field(description="url of the document to parse")
-class EdenAiParsingInvoiceTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiParsingInvoiceTool(EdenaiTool):
"""Tool that queries the Eden AI Invoice parsing API.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/edenai/text_moderation.py b/libs/community/langchain_community/tools/edenai/text_moderation.py
index 319f87702a6..f5f8497ff3c 100644
--- a/libs/community/langchain_community/tools/edenai/text_moderation.py
+++ b/libs/community/langchain_community/tools/edenai/text_moderation.py
@@ -15,7 +15,7 @@ class TextModerationInput(BaseModel):
query: str = Field(description="Text to moderate")
-class EdenAiTextModerationTool(EdenaiTool): # type: ignore[override, override, override]
+class EdenAiTextModerationTool(EdenaiTool):
"""Tool that queries the Eden AI Explicit text detection.
for api reference check edenai documentation:
diff --git a/libs/community/langchain_community/tools/eleven_labs/text2speech.py b/libs/community/langchain_community/tools/eleven_labs/text2speech.py
index b6e51061a71..91fd89b379a 100644
--- a/libs/community/langchain_community/tools/eleven_labs/text2speech.py
+++ b/libs/community/langchain_community/tools/eleven_labs/text2speech.py
@@ -26,7 +26,7 @@ class ElevenLabsModel(str, Enum):
MONO_LINGUAL = "eleven_flash_v2"
-class ElevenLabsText2SpeechTool(BaseTool): # type: ignore[override]
+class ElevenLabsText2SpeechTool(BaseTool):
"""Tool that queries the Eleven Labs Text2Speech API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/few_shot/tool.py b/libs/community/langchain_community/tools/few_shot/tool.py
index 2387ca4edb7..a61a24e1f58 100644
--- a/libs/community/langchain_community/tools/few_shot/tool.py
+++ b/libs/community/langchain_community/tools/few_shot/tool.py
@@ -13,7 +13,7 @@ class _FewShotToolInput(BaseModel):
)
-class FewShotSQLTool(BaseTool): # type: ignore[override]
+class FewShotSQLTool(BaseTool):
"""Tool to get example SQL queries related to an input question."""
name: str = "few_shot_sql"
diff --git a/libs/community/langchain_community/tools/file_management/copy.py b/libs/community/langchain_community/tools/file_management/copy.py
index 209f217b751..7679e3c43be 100644
--- a/libs/community/langchain_community/tools/file_management/copy.py
+++ b/libs/community/langchain_community/tools/file_management/copy.py
@@ -19,7 +19,7 @@ class FileCopyInput(BaseModel):
destination_path: str = Field(..., description="Path to save the copied file")
-class CopyFileTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class CopyFileTool(BaseFileToolMixin, BaseTool):
"""Tool that copies a file."""
name: str = "copy_file"
diff --git a/libs/community/langchain_community/tools/file_management/delete.py b/libs/community/langchain_community/tools/file_management/delete.py
index e840875807d..33f4b70b28d 100644
--- a/libs/community/langchain_community/tools/file_management/delete.py
+++ b/libs/community/langchain_community/tools/file_management/delete.py
@@ -18,7 +18,7 @@ class FileDeleteInput(BaseModel):
file_path: str = Field(..., description="Path of the file to delete")
-class DeleteFileTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class DeleteFileTool(BaseFileToolMixin, BaseTool):
"""Tool that deletes a file."""
name: str = "file_delete"
diff --git a/libs/community/langchain_community/tools/file_management/file_search.py b/libs/community/langchain_community/tools/file_management/file_search.py
index 02b2e1dd44b..a00aee40b4b 100644
--- a/libs/community/langchain_community/tools/file_management/file_search.py
+++ b/libs/community/langchain_community/tools/file_management/file_search.py
@@ -26,7 +26,7 @@ class FileSearchInput(BaseModel):
)
-class FileSearchTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class FileSearchTool(BaseFileToolMixin, BaseTool):
"""Tool that searches for files in a subdirectory that match a regex pattern."""
name: str = "file_search"
diff --git a/libs/community/langchain_community/tools/file_management/list_dir.py b/libs/community/langchain_community/tools/file_management/list_dir.py
index a2ffc6494f0..a8bfdc8e3ab 100644
--- a/libs/community/langchain_community/tools/file_management/list_dir.py
+++ b/libs/community/langchain_community/tools/file_management/list_dir.py
@@ -18,7 +18,7 @@ class DirectoryListingInput(BaseModel):
dir_path: str = Field(default=".", description="Subdirectory to list.")
-class ListDirectoryTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class ListDirectoryTool(BaseFileToolMixin, BaseTool):
"""Tool that lists files and directories in a specified folder."""
name: str = "list_directory"
diff --git a/libs/community/langchain_community/tools/file_management/move.py b/libs/community/langchain_community/tools/file_management/move.py
index 1d9bce338ea..935625172e9 100644
--- a/libs/community/langchain_community/tools/file_management/move.py
+++ b/libs/community/langchain_community/tools/file_management/move.py
@@ -19,7 +19,7 @@ class FileMoveInput(BaseModel):
destination_path: str = Field(..., description="New path for the moved file")
-class MoveFileTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class MoveFileTool(BaseFileToolMixin, BaseTool):
"""Tool that moves a file."""
name: str = "move_file"
diff --git a/libs/community/langchain_community/tools/file_management/read.py b/libs/community/langchain_community/tools/file_management/read.py
index 92572ee85ab..9f746ed16c1 100644
--- a/libs/community/langchain_community/tools/file_management/read.py
+++ b/libs/community/langchain_community/tools/file_management/read.py
@@ -17,7 +17,7 @@ class ReadFileInput(BaseModel):
file_path: str = Field(..., description="name of file")
-class ReadFileTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class ReadFileTool(BaseFileToolMixin, BaseTool):
"""Tool that reads a file."""
name: str = "read_file"
diff --git a/libs/community/langchain_community/tools/file_management/write.py b/libs/community/langchain_community/tools/file_management/write.py
index 647f845ecd1..1d62065bb74 100644
--- a/libs/community/langchain_community/tools/file_management/write.py
+++ b/libs/community/langchain_community/tools/file_management/write.py
@@ -21,7 +21,7 @@ class WriteFileInput(BaseModel):
)
-class WriteFileTool(BaseFileToolMixin, BaseTool): # type: ignore[override, override]
+class WriteFileTool(BaseFileToolMixin, BaseTool):
"""Tool that writes a file to disk."""
name: str = "write_file"
diff --git a/libs/community/langchain_community/tools/financial_datasets/balance_sheets.py b/libs/community/langchain_community/tools/financial_datasets/balance_sheets.py
index 4be8125cb5a..21508bc6f93 100644
--- a/libs/community/langchain_community/tools/financial_datasets/balance_sheets.py
+++ b/libs/community/langchain_community/tools/financial_datasets/balance_sheets.py
@@ -24,7 +24,7 @@ class BalanceSheetsSchema(BaseModel):
)
-class BalanceSheets(BaseTool): # type: ignore[override, override]
+class BalanceSheets(BaseTool):
"""
Tool that gets balance sheets for a given ticker over a given period.
"""
diff --git a/libs/community/langchain_community/tools/financial_datasets/cash_flow_statements.py b/libs/community/langchain_community/tools/financial_datasets/cash_flow_statements.py
index 5f621085a18..065c645420e 100644
--- a/libs/community/langchain_community/tools/financial_datasets/cash_flow_statements.py
+++ b/libs/community/langchain_community/tools/financial_datasets/cash_flow_statements.py
@@ -24,7 +24,7 @@ class CashFlowStatementsSchema(BaseModel):
)
-class CashFlowStatements(BaseTool): # type: ignore[override, override]
+class CashFlowStatements(BaseTool):
"""
Tool that gets cash flow statements for a given ticker over a given period.
"""
diff --git a/libs/community/langchain_community/tools/financial_datasets/income_statements.py b/libs/community/langchain_community/tools/financial_datasets/income_statements.py
index d181ef7a1c1..c4801f3d061 100644
--- a/libs/community/langchain_community/tools/financial_datasets/income_statements.py
+++ b/libs/community/langchain_community/tools/financial_datasets/income_statements.py
@@ -24,7 +24,7 @@ class IncomeStatementsSchema(BaseModel):
)
-class IncomeStatements(BaseTool): # type: ignore[override, override]
+class IncomeStatements(BaseTool):
"""
Tool that gets income statements for a given ticker over a given period.
"""
diff --git a/libs/community/langchain_community/tools/github/tool.py b/libs/community/langchain_community/tools/github/tool.py
index 1c605c95365..836ebc09138 100644
--- a/libs/community/langchain_community/tools/github/tool.py
+++ b/libs/community/langchain_community/tools/github/tool.py
@@ -17,10 +17,10 @@ from pydantic import BaseModel, Field
from langchain_community.utilities.github import GitHubAPIWrapper
-class GitHubAction(BaseTool): # type: ignore[override]
+class GitHubAction(BaseTool):
"""Tool for interacting with the GitHub API."""
- api_wrapper: GitHubAPIWrapper = Field(default_factory=GitHubAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: GitHubAPIWrapper = Field(default_factory=GitHubAPIWrapper)
mode: str
name: str = ""
description: str = ""
diff --git a/libs/community/langchain_community/tools/gitlab/tool.py b/libs/community/langchain_community/tools/gitlab/tool.py
index ac9d27b7dfd..338165ec846 100644
--- a/libs/community/langchain_community/tools/gitlab/tool.py
+++ b/libs/community/langchain_community/tools/gitlab/tool.py
@@ -17,10 +17,10 @@ from pydantic import Field
from langchain_community.utilities.gitlab import GitLabAPIWrapper
-class GitLabAction(BaseTool): # type: ignore[override]
+class GitLabAction(BaseTool):
"""Tool for interacting with the GitLab API."""
- api_wrapper: GitLabAPIWrapper = Field(default_factory=GitLabAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: GitLabAPIWrapper = Field(default_factory=GitLabAPIWrapper)
mode: str
name: str = ""
description: str = ""
diff --git a/libs/community/langchain_community/tools/gmail/base.py b/libs/community/langchain_community/tools/gmail/base.py
index 82e44fbc002..d55b0d30f8a 100644
--- a/libs/community/langchain_community/tools/gmail/base.py
+++ b/libs/community/langchain_community/tools/gmail/base.py
@@ -20,7 +20,7 @@ else:
pass
-class GmailBaseTool(BaseTool): # type: ignore[override]
+class GmailBaseTool(BaseTool):
"""Base class for Gmail tools."""
api_resource: Resource = Field(default_factory=build_resource_service)
diff --git a/libs/community/langchain_community/tools/gmail/create_draft.py b/libs/community/langchain_community/tools/gmail/create_draft.py
index a1cb44cd3cf..ec2495aaa4c 100644
--- a/libs/community/langchain_community/tools/gmail/create_draft.py
+++ b/libs/community/langchain_community/tools/gmail/create_draft.py
@@ -33,7 +33,7 @@ class CreateDraftSchema(BaseModel):
)
-class GmailCreateDraft(GmailBaseTool): # type: ignore[override, override]
+class GmailCreateDraft(GmailBaseTool):
"""Tool that creates a draft email for Gmail."""
name: str = "create_gmail_draft"
diff --git a/libs/community/langchain_community/tools/gmail/get_message.py b/libs/community/langchain_community/tools/gmail/get_message.py
index 0145d37b65f..6155cb499f4 100644
--- a/libs/community/langchain_community/tools/gmail/get_message.py
+++ b/libs/community/langchain_community/tools/gmail/get_message.py
@@ -18,7 +18,7 @@ class SearchArgsSchema(BaseModel):
)
-class GmailGetMessage(GmailBaseTool): # type: ignore[override, override]
+class GmailGetMessage(GmailBaseTool):
"""Tool that gets a message by ID from Gmail."""
name: str = "get_gmail_message"
diff --git a/libs/community/langchain_community/tools/gmail/get_thread.py b/libs/community/langchain_community/tools/gmail/get_thread.py
index 266b81115c2..5e61bd8bb98 100644
--- a/libs/community/langchain_community/tools/gmail/get_thread.py
+++ b/libs/community/langchain_community/tools/gmail/get_thread.py
@@ -16,7 +16,7 @@ class GetThreadSchema(BaseModel):
)
-class GmailGetThread(GmailBaseTool): # type: ignore[override, override]
+class GmailGetThread(GmailBaseTool):
"""Tool that gets a thread by ID from Gmail."""
name: str = "get_gmail_thread"
diff --git a/libs/community/langchain_community/tools/gmail/search.py b/libs/community/langchain_community/tools/gmail/search.py
index f0b4fe1df44..eb619684295 100644
--- a/libs/community/langchain_community/tools/gmail/search.py
+++ b/libs/community/langchain_community/tools/gmail/search.py
@@ -43,7 +43,7 @@ class SearchArgsSchema(BaseModel):
)
-class GmailSearch(GmailBaseTool): # type: ignore[override, override]
+class GmailSearch(GmailBaseTool):
"""Tool that searches for messages or threads in Gmail."""
name: str = "search_gmail"
diff --git a/libs/community/langchain_community/tools/gmail/send_message.py b/libs/community/langchain_community/tools/gmail/send_message.py
index fadab490144..0d9fbc66979 100644
--- a/libs/community/langchain_community/tools/gmail/send_message.py
+++ b/libs/community/langchain_community/tools/gmail/send_message.py
@@ -36,7 +36,7 @@ class SendMessageSchema(BaseModel):
)
-class GmailSendMessage(GmailBaseTool): # type: ignore[override, override]
+class GmailSendMessage(GmailBaseTool):
"""Tool that sends a message to Gmail."""
name: str = "send_gmail_message"
diff --git a/libs/community/langchain_community/tools/gmail/utils.py b/libs/community/langchain_community/tools/gmail/utils.py
index 01a6b774486..e53a4538365 100644
--- a/libs/community/langchain_community/tools/gmail/utils.py
+++ b/libs/community/langchain_community/tools/gmail/utils.py
@@ -83,7 +83,7 @@ def get_gmail_credentials(
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
- creds.refresh(Request()) # type: ignore[call-arg]
+ creds.refresh(Request())
else:
# https://developers.google.com/gmail/api/quickstart/python#authorize_credentials_for_a_desktop_application # noqa
flow = InstalledAppFlow.from_client_secrets_file(
diff --git a/libs/community/langchain_community/tools/golden_query/tool.py b/libs/community/langchain_community/tools/golden_query/tool.py
index 1f9664aa158..7cc5c72234c 100644
--- a/libs/community/langchain_community/tools/golden_query/tool.py
+++ b/libs/community/langchain_community/tools/golden_query/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.golden_query import GoldenQueryAPIWrapper
-class GoldenQueryRun(BaseTool): # type: ignore[override]
+class GoldenQueryRun(BaseTool):
"""Tool that adds the capability to query using the Golden API and get back JSON."""
name: str = "golden_query"
diff --git a/libs/community/langchain_community/tools/google_books.py b/libs/community/langchain_community/tools/google_books.py
index 390fce3fdf8..572dd2747a5 100644
--- a/libs/community/langchain_community/tools/google_books.py
+++ b/libs/community/langchain_community/tools/google_books.py
@@ -15,7 +15,7 @@ class GoogleBooksQueryInput(BaseModel):
query: str = Field(description="query to look up on google books")
-class GoogleBooksQueryRun(BaseTool): # type: ignore[override]
+class GoogleBooksQueryRun(BaseTool):
"""Tool that searches the Google Books API."""
name: str = "GoogleBooks"
diff --git a/libs/community/langchain_community/tools/google_cloud/texttospeech.py b/libs/community/langchain_community/tools/google_cloud/texttospeech.py
index 7984ae328f1..02a24e9cf1a 100644
--- a/libs/community/langchain_community/tools/google_cloud/texttospeech.py
+++ b/libs/community/langchain_community/tools/google_cloud/texttospeech.py
@@ -10,12 +10,12 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.vertexai import get_client_info
if TYPE_CHECKING:
- from google.cloud import texttospeech # type: ignore[attr-defined]
+ from google.cloud import texttospeech
def _import_google_cloud_texttospeech() -> Any:
try:
- from google.cloud import texttospeech # type: ignore[attr-defined]
+ from google.cloud import texttospeech
except ImportError as e:
raise ImportError(
"Cannot import google.cloud.texttospeech, please install "
@@ -42,7 +42,7 @@ def _encoding_file_extension_map(encoding: texttospeech.AudioEncoding) -> Option
removal="1.0",
alternative_import="langchain_google_community.TextToSpeechTool",
)
-class GoogleCloudTextToSpeechTool(BaseTool): # type: ignore[override]
+class GoogleCloudTextToSpeechTool(BaseTool):
"""Tool that queries the Google Cloud Text to Speech API.
In order to set this up, follow instructions at:
diff --git a/libs/community/langchain_community/tools/google_finance/tool.py b/libs/community/langchain_community/tools/google_finance/tool.py
index 15bbc1da2b4..82eb82de318 100644
--- a/libs/community/langchain_community/tools/google_finance/tool.py
+++ b/libs/community/langchain_community/tools/google_finance/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.google_finance import GoogleFinanceAPIWrapper
-class GoogleFinanceQueryRun(BaseTool): # type: ignore[override]
+class GoogleFinanceQueryRun(BaseTool):
"""Tool that queries the Google Finance API."""
name: str = "google_finance"
diff --git a/libs/community/langchain_community/tools/google_jobs/tool.py b/libs/community/langchain_community/tools/google_jobs/tool.py
index 98211d4351c..6a83b3043d9 100644
--- a/libs/community/langchain_community/tools/google_jobs/tool.py
+++ b/libs/community/langchain_community/tools/google_jobs/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.google_jobs import GoogleJobsAPIWrapper
-class GoogleJobsQueryRun(BaseTool): # type: ignore[override]
+class GoogleJobsQueryRun(BaseTool):
"""Tool that queries the Google Jobs API."""
name: str = "google_jobs"
diff --git a/libs/community/langchain_community/tools/google_lens/tool.py b/libs/community/langchain_community/tools/google_lens/tool.py
index 677e11babd3..38a4b847e21 100644
--- a/libs/community/langchain_community/tools/google_lens/tool.py
+++ b/libs/community/langchain_community/tools/google_lens/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.google_lens import GoogleLensAPIWrapper
-class GoogleLensQueryRun(BaseTool): # type: ignore[override]
+class GoogleLensQueryRun(BaseTool):
"""Tool that queries the Google Lens API."""
name: str = "google_lens"
diff --git a/libs/community/langchain_community/tools/google_places/tool.py b/libs/community/langchain_community/tools/google_places/tool.py
index 9328ec9050b..77a14690735 100644
--- a/libs/community/langchain_community/tools/google_places/tool.py
+++ b/libs/community/langchain_community/tools/google_places/tool.py
@@ -21,7 +21,7 @@ class GooglePlacesSchema(BaseModel):
removal="1.0",
alternative_import="langchain_google_community.GooglePlacesTool",
)
-class GooglePlacesTool(BaseTool): # type: ignore[override, override]
+class GooglePlacesTool(BaseTool):
"""Tool that queries the Google places API."""
name: str = "google_places"
@@ -31,7 +31,7 @@ class GooglePlacesTool(BaseTool): # type: ignore[override, override]
"discover addressed from ambiguous text. "
"Input should be a search query."
)
- api_wrapper: GooglePlacesAPIWrapper = Field(default_factory=GooglePlacesAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: GooglePlacesAPIWrapper = Field(default_factory=GooglePlacesAPIWrapper)
args_schema: Type[BaseModel] = GooglePlacesSchema
def _run(
diff --git a/libs/community/langchain_community/tools/google_scholar/tool.py b/libs/community/langchain_community/tools/google_scholar/tool.py
index 05bf590b9b8..49f8769696f 100644
--- a/libs/community/langchain_community/tools/google_scholar/tool.py
+++ b/libs/community/langchain_community/tools/google_scholar/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.google_scholar import GoogleScholarAPIWrapper
-class GoogleScholarQueryRun(BaseTool): # type: ignore[override]
+class GoogleScholarQueryRun(BaseTool):
"""Tool that queries the Google search API."""
name: str = "google_scholar"
diff --git a/libs/community/langchain_community/tools/google_search/tool.py b/libs/community/langchain_community/tools/google_search/tool.py
index fe9eac16be5..3ba05079df8 100644
--- a/libs/community/langchain_community/tools/google_search/tool.py
+++ b/libs/community/langchain_community/tools/google_search/tool.py
@@ -14,7 +14,7 @@ from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
removal="1.0",
alternative_import="langchain_google_community.GoogleSearchRun",
)
-class GoogleSearchRun(BaseTool): # type: ignore[override]
+class GoogleSearchRun(BaseTool):
"""Tool that queries the Google search API."""
name: str = "google_search"
@@ -39,7 +39,7 @@ class GoogleSearchRun(BaseTool): # type: ignore[override]
removal="1.0",
alternative_import="langchain_google_community.GoogleSearchResults",
)
-class GoogleSearchResults(BaseTool): # type: ignore[override]
+class GoogleSearchResults(BaseTool):
"""Tool that queries the Google Search API and gets back json."""
name: str = "google_search_results_json"
diff --git a/libs/community/langchain_community/tools/google_serper/tool.py b/libs/community/langchain_community/tools/google_serper/tool.py
index 2b277790fbd..562dd012a1a 100644
--- a/libs/community/langchain_community/tools/google_serper/tool.py
+++ b/libs/community/langchain_community/tools/google_serper/tool.py
@@ -12,7 +12,7 @@ from pydantic import Field
from langchain_community.utilities.google_serper import GoogleSerperAPIWrapper
-class GoogleSerperRun(BaseTool): # type: ignore[override]
+class GoogleSerperRun(BaseTool):
"""Tool that queries the Serper.dev Google search API."""
name: str = "google_serper"
@@ -40,7 +40,7 @@ class GoogleSerperRun(BaseTool): # type: ignore[override]
return (await self.api_wrapper.arun(query)).__str__()
-class GoogleSerperResults(BaseTool): # type: ignore[override]
+class GoogleSerperResults(BaseTool):
"""Tool that queries the Serper.dev Google Search API
and get back json."""
diff --git a/libs/community/langchain_community/tools/google_trends/tool.py b/libs/community/langchain_community/tools/google_trends/tool.py
index f830cf871ea..8b2b5dd8bfb 100644
--- a/libs/community/langchain_community/tools/google_trends/tool.py
+++ b/libs/community/langchain_community/tools/google_trends/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper
-class GoogleTrendsQueryRun(BaseTool): # type: ignore[override]
+class GoogleTrendsQueryRun(BaseTool):
"""Tool that queries the Google trends API."""
name: str = "google_trends"
diff --git a/libs/community/langchain_community/tools/graphql/tool.py b/libs/community/langchain_community/tools/graphql/tool.py
index 939c6a09c61..0530f8cae07 100644
--- a/libs/community/langchain_community/tools/graphql/tool.py
+++ b/libs/community/langchain_community/tools/graphql/tool.py
@@ -8,7 +8,7 @@ from pydantic import ConfigDict
from langchain_community.utilities.graphql import GraphQLAPIWrapper
-class BaseGraphQLTool(BaseTool): # type: ignore[override]
+class BaseGraphQLTool(BaseTool):
"""Base tool for querying a GraphQL API."""
graphql_wrapper: GraphQLAPIWrapper
diff --git a/libs/community/langchain_community/tools/human/tool.py b/libs/community/langchain_community/tools/human/tool.py
index 0262039dc92..d9e238b93c9 100644
--- a/libs/community/langchain_community/tools/human/tool.py
+++ b/libs/community/langchain_community/tools/human/tool.py
@@ -12,7 +12,7 @@ def _print_func(text: str) -> None:
print(text) # noqa: T201
-class HumanInputRun(BaseTool): # type: ignore[override]
+class HumanInputRun(BaseTool):
"""Tool that asks user for input."""
name: str = "human"
diff --git a/libs/community/langchain_community/tools/ifttt.py b/libs/community/langchain_community/tools/ifttt.py
index c28b0781488..40bbe76fdad 100644
--- a/libs/community/langchain_community/tools/ifttt.py
+++ b/libs/community/langchain_community/tools/ifttt.py
@@ -40,7 +40,7 @@ from langchain_core.callbacks import CallbackManagerForToolRun
from langchain_core.tools import BaseTool
-class IFTTTWebhook(BaseTool): # type: ignore[override]
+class IFTTTWebhook(BaseTool):
"""IFTTT Webhook.
Args:
diff --git a/libs/community/langchain_community/tools/jina_search/tool.py b/libs/community/langchain_community/tools/jina_search/tool.py
index dbb707f7f6a..4c4e7650b6c 100644
--- a/libs/community/langchain_community/tools/jina_search/tool.py
+++ b/libs/community/langchain_community/tools/jina_search/tool.py
@@ -15,7 +15,7 @@ class JinaInput(BaseModel):
query: str = Field(description="search query to look up")
-class JinaSearch(BaseTool): # type: ignore[override]
+class JinaSearch(BaseTool):
"""Tool that queries the JinaSearch.
..versionadded:: 0.2.16
diff --git a/libs/community/langchain_community/tools/jira/tool.py b/libs/community/langchain_community/tools/jira/tool.py
index caa1a34c8c9..93205920c57 100644
--- a/libs/community/langchain_community/tools/jira/tool.py
+++ b/libs/community/langchain_community/tools/jira/tool.py
@@ -29,10 +29,10 @@ from pydantic import Field
from langchain_community.utilities.jira import JiraAPIWrapper
-class JiraAction(BaseTool): # type: ignore[override]
+class JiraAction(BaseTool):
"""Tool that queries the Atlassian Jira API."""
- api_wrapper: JiraAPIWrapper = Field(default_factory=JiraAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: JiraAPIWrapper = Field(default_factory=JiraAPIWrapper)
mode: str
name: str = ""
description: str = ""
diff --git a/libs/community/langchain_community/tools/json/tool.py b/libs/community/langchain_community/tools/json/tool.py
index c9957ae33ab..6e7fddff6d7 100644
--- a/libs/community/langchain_community/tools/json/tool.py
+++ b/libs/community/langchain_community/tools/json/tool.py
@@ -82,7 +82,7 @@ class JsonSpec(BaseModel):
return repr(e)
-class JsonListKeysTool(BaseTool): # type: ignore[override]
+class JsonListKeysTool(BaseTool):
"""Tool for listing keys in a JSON spec."""
name: str = "json_spec_list_keys"
@@ -108,7 +108,7 @@ class JsonListKeysTool(BaseTool): # type: ignore[override]
return self._run(tool_input)
-class JsonGetValueTool(BaseTool): # type: ignore[override]
+class JsonGetValueTool(BaseTool):
"""Tool for getting a value in a JSON spec."""
name: str = "json_spec_get_value"
diff --git a/libs/community/langchain_community/tools/memorize/tool.py b/libs/community/langchain_community/tools/memorize/tool.py
index fe1ec52ac4a..87badf9ac31 100644
--- a/libs/community/langchain_community/tools/memorize/tool.py
+++ b/libs/community/langchain_community/tools/memorize/tool.py
@@ -30,7 +30,7 @@ class TrainableLLM(Protocol):
) -> TrainResult: ...
-class Memorize(BaseTool): # type: ignore[override]
+class Memorize(BaseTool):
"""Tool that trains a language model."""
name: str = "memorize"
diff --git a/libs/community/langchain_community/tools/merriam_webster/tool.py b/libs/community/langchain_community/tools/merriam_webster/tool.py
index b6f9209477f..9cf4e9f21ca 100644
--- a/libs/community/langchain_community/tools/merriam_webster/tool.py
+++ b/libs/community/langchain_community/tools/merriam_webster/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.merriam_webster import MerriamWebsterAPIWrapper
-class MerriamWebsterQueryRun(BaseTool): # type: ignore[override]
+class MerriamWebsterQueryRun(BaseTool):
"""Tool that searches the Merriam-Webster API."""
name: str = "merriam_webster"
diff --git a/libs/community/langchain_community/tools/metaphor_search/tool.py b/libs/community/langchain_community/tools/metaphor_search/tool.py
index 03af3636ba0..98e932e8d2f 100644
--- a/libs/community/langchain_community/tools/metaphor_search/tool.py
+++ b/libs/community/langchain_community/tools/metaphor_search/tool.py
@@ -17,7 +17,7 @@ from langchain_community.utilities.metaphor_search import MetaphorSearchAPIWrapp
removal="1.0",
alternative="langchain_exa.ExaSearchResults",
)
-class MetaphorSearchResults(BaseTool): # type: ignore[override]
+class MetaphorSearchResults(BaseTool):
"""Tool that queries the Metaphor Search API and gets back json."""
name: str = "metaphor_search_results_json"
diff --git a/libs/community/langchain_community/tools/mojeek_search/tool.py b/libs/community/langchain_community/tools/mojeek_search/tool.py
index 8172475cb38..9112e1afe65 100644
--- a/libs/community/langchain_community/tools/mojeek_search/tool.py
+++ b/libs/community/langchain_community/tools/mojeek_search/tool.py
@@ -11,7 +11,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.mojeek_search import MojeekSearchAPIWrapper
-class MojeekSearch(BaseTool): # type: ignore[override]
+class MojeekSearch(BaseTool):
name: str = "mojeek_search"
description: str = (
"A wrapper around Mojeek Search. "
diff --git a/libs/community/langchain_community/tools/multion/close_session.py b/libs/community/langchain_community/tools/multion/close_session.py
index 03a777f00c9..28f0abd013b 100644
--- a/libs/community/langchain_community/tools/multion/close_session.py
+++ b/libs/community/langchain_community/tools/multion/close_session.py
@@ -27,7 +27,7 @@ class CloseSessionSchema(BaseModel):
)
-class MultionCloseSession(BaseTool): # type: ignore[override, override]
+class MultionCloseSession(BaseTool):
"""Tool that closes an existing Multion Browser Window with provided fields.
Attributes:
diff --git a/libs/community/langchain_community/tools/multion/create_session.py b/libs/community/langchain_community/tools/multion/create_session.py
index 3feb83815da..53388a5a973 100644
--- a/libs/community/langchain_community/tools/multion/create_session.py
+++ b/libs/community/langchain_community/tools/multion/create_session.py
@@ -31,7 +31,7 @@ class CreateSessionSchema(BaseModel):
)
-class MultionCreateSession(BaseTool): # type: ignore[override]
+class MultionCreateSession(BaseTool):
"""Tool that creates a new Multion Browser Window with provided fields.
Attributes:
diff --git a/libs/community/langchain_community/tools/multion/update_session.py b/libs/community/langchain_community/tools/multion/update_session.py
index 4a2abddd35b..b535861e2ac 100644
--- a/libs/community/langchain_community/tools/multion/update_session.py
+++ b/libs/community/langchain_community/tools/multion/update_session.py
@@ -36,7 +36,7 @@ class UpdateSessionSchema(BaseModel):
)
-class MultionUpdateSession(BaseTool): # type: ignore[override, override]
+class MultionUpdateSession(BaseTool):
"""Tool that updates an existing Multion Browser Window with provided fields.
Attributes:
diff --git a/libs/community/langchain_community/tools/nasa/tool.py b/libs/community/langchain_community/tools/nasa/tool.py
index ee2c5f2a10d..b9f2caa4555 100644
--- a/libs/community/langchain_community/tools/nasa/tool.py
+++ b/libs/community/langchain_community/tools/nasa/tool.py
@@ -12,7 +12,7 @@ from pydantic import Field
from langchain_community.utilities.nasa import NasaAPIWrapper
-class NasaAction(BaseTool): # type: ignore[override]
+class NasaAction(BaseTool):
"""Tool that queries the Atlassian Jira API."""
api_wrapper: NasaAPIWrapper = Field(default_factory=NasaAPIWrapper)
diff --git a/libs/community/langchain_community/tools/nuclia/tool.py b/libs/community/langchain_community/tools/nuclia/tool.py
index e5d4e447527..8aeed0feb3b 100644
--- a/libs/community/langchain_community/tools/nuclia/tool.py
+++ b/libs/community/langchain_community/tools/nuclia/tool.py
@@ -54,7 +54,7 @@ class NUASchema(BaseModel):
)
-class NucliaUnderstandingAPI(BaseTool): # type: ignore[override, override]
+class NucliaUnderstandingAPI(BaseTool):
"""Tool to process files with the Nuclia Understanding API."""
name: str = "nuclia_understanding_api"
@@ -75,7 +75,7 @@ class NucliaUnderstandingAPI(BaseTool): # type: ignore[override, override]
else:
self._config["NUA_KEY"] = key
self._config["enable_ml"] = enable_ml
- super().__init__() # type: ignore[call-arg]
+ super().__init__()
def _run(
self,
diff --git a/libs/community/langchain_community/tools/office365/base.py b/libs/community/langchain_community/tools/office365/base.py
index a1d13cca38e..55160bd5e50 100644
--- a/libs/community/langchain_community/tools/office365/base.py
+++ b/libs/community/langchain_community/tools/office365/base.py
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from O365 import Account
-class O365BaseTool(BaseTool): # type: ignore[override]
+class O365BaseTool(BaseTool):
"""Base class for the Office 365 tools."""
account: Account = Field(default_factory=authenticate)
diff --git a/libs/community/langchain_community/tools/office365/create_draft_message.py b/libs/community/langchain_community/tools/office365/create_draft_message.py
index 0abac1ab298..02915ffedcf 100644
--- a/libs/community/langchain_community/tools/office365/create_draft_message.py
+++ b/libs/community/langchain_community/tools/office365/create_draft_message.py
@@ -31,7 +31,7 @@ class CreateDraftMessageSchema(BaseModel):
)
-class O365CreateDraftMessage(O365BaseTool): # type: ignore[override, override]
+class O365CreateDraftMessage(O365BaseTool):
"""Tool for creating a draft email in Office 365."""
name: str = "create_email_draft"
diff --git a/libs/community/langchain_community/tools/office365/events_search.py b/libs/community/langchain_community/tools/office365/events_search.py
index 9615b27e8bf..f23dd86b087 100644
--- a/libs/community/langchain_community/tools/office365/events_search.py
+++ b/libs/community/langchain_community/tools/office365/events_search.py
@@ -53,7 +53,7 @@ class SearchEventsInput(BaseModel):
)
-class O365SearchEvents(O365BaseTool): # type: ignore[override, override]
+class O365SearchEvents(O365BaseTool):
"""Search calendar events in Office 365.
Free, but setup is required
diff --git a/libs/community/langchain_community/tools/office365/messages_search.py b/libs/community/langchain_community/tools/office365/messages_search.py
index 07178c5f1e2..71fe2562bb4 100644
--- a/libs/community/langchain_community/tools/office365/messages_search.py
+++ b/libs/community/langchain_community/tools/office365/messages_search.py
@@ -52,7 +52,7 @@ class SearchEmailsInput(BaseModel):
)
-class O365SearchEmails(O365BaseTool): # type: ignore[override, override]
+class O365SearchEmails(O365BaseTool):
"""Search email messages in Office 365.
Free, but setup is required.
diff --git a/libs/community/langchain_community/tools/office365/send_event.py b/libs/community/langchain_community/tools/office365/send_event.py
index 052fc19c0e3..2ab140ca465 100644
--- a/libs/community/langchain_community/tools/office365/send_event.py
+++ b/libs/community/langchain_community/tools/office365/send_event.py
@@ -48,7 +48,7 @@ class SendEventSchema(BaseModel):
)
-class O365SendEvent(O365BaseTool): # type: ignore[override, override]
+class O365SendEvent(O365BaseTool):
"""Tool for sending calendar events in Office 365."""
name: str = "send_event"
diff --git a/libs/community/langchain_community/tools/office365/send_message.py b/libs/community/langchain_community/tools/office365/send_message.py
index c7e180e9b73..6ebc8883714 100644
--- a/libs/community/langchain_community/tools/office365/send_message.py
+++ b/libs/community/langchain_community/tools/office365/send_message.py
@@ -31,7 +31,7 @@ class SendMessageSchema(BaseModel):
)
-class O365SendMessage(O365BaseTool): # type: ignore[override, override]
+class O365SendMessage(O365BaseTool):
"""Send an email in Office 365."""
name: str = "send_email"
diff --git a/libs/community/langchain_community/tools/openai_dalle_image_generation/tool.py b/libs/community/langchain_community/tools/openai_dalle_image_generation/tool.py
index 6d0583b6f99..36374e887f7 100644
--- a/libs/community/langchain_community/tools/openai_dalle_image_generation/tool.py
+++ b/libs/community/langchain_community/tools/openai_dalle_image_generation/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.dalle_image_generator import DallEAPIWrapper
-class OpenAIDALLEImageGenerationTool(BaseTool): # type: ignore[override]
+class OpenAIDALLEImageGenerationTool(BaseTool):
"""Tool that generates an image using OpenAI DALLE."""
name: str = "openai_dalle"
diff --git a/libs/community/langchain_community/tools/openweathermap/tool.py b/libs/community/langchain_community/tools/openweathermap/tool.py
index cbeb552da2b..f88095d3ef6 100644
--- a/libs/community/langchain_community/tools/openweathermap/tool.py
+++ b/libs/community/langchain_community/tools/openweathermap/tool.py
@@ -9,11 +9,11 @@ from pydantic import Field
from langchain_community.utilities.openweathermap import OpenWeatherMapAPIWrapper
-class OpenWeatherMapQueryRun(BaseTool): # type: ignore[override]
+class OpenWeatherMapQueryRun(BaseTool):
"""Tool that queries the OpenWeatherMap API."""
api_wrapper: OpenWeatherMapAPIWrapper = Field(
- default_factory=OpenWeatherMapAPIWrapper # type: ignore[arg-type]
+ default_factory=OpenWeatherMapAPIWrapper
)
name: str = "open_weather_map"
diff --git a/libs/community/langchain_community/tools/passio_nutrition_ai/tool.py b/libs/community/langchain_community/tools/passio_nutrition_ai/tool.py
index 464caf6f9a2..939e1a41bc9 100644
--- a/libs/community/langchain_community/tools/passio_nutrition_ai/tool.py
+++ b/libs/community/langchain_community/tools/passio_nutrition_ai/tool.py
@@ -17,7 +17,7 @@ class NutritionAIInputs(BaseModel):
)
-class NutritionAI(BaseTool): # type: ignore[override, override]
+class NutritionAI(BaseTool):
"""Tool that queries the Passio Nutrition AI API."""
name: str = "nutritionai_advanced_search"
diff --git a/libs/community/langchain_community/tools/playwright/base.py b/libs/community/langchain_community/tools/playwright/base.py
index efed3bc8deb..e85cc847936 100644
--- a/libs/community/langchain_community/tools/playwright/base.py
+++ b/libs/community/langchain_community/tools/playwright/base.py
@@ -32,7 +32,7 @@ def lazy_import_playwright_browsers() -> Tuple[Type[AsyncBrowser], Type[SyncBrow
)
-class BaseBrowserTool(BaseTool): # type: ignore[override]
+class BaseBrowserTool(BaseTool):
"""Base class for browser tools."""
sync_browser: Optional["SyncBrowser"] = None
diff --git a/libs/community/langchain_community/tools/playwright/click.py b/libs/community/langchain_community/tools/playwright/click.py
index 07490e45fbf..22c6a23bf9c 100644
--- a/libs/community/langchain_community/tools/playwright/click.py
+++ b/libs/community/langchain_community/tools/playwright/click.py
@@ -21,7 +21,7 @@ class ClickToolInput(BaseModel):
selector: str = Field(..., description="CSS selector for the element to click")
-class ClickTool(BaseBrowserTool): # type: ignore[override, override, override]
+class ClickTool(BaseBrowserTool):
"""Tool for clicking on an element with the given CSS selector."""
name: str = "click_element"
diff --git a/libs/community/langchain_community/tools/playwright/current_page.py b/libs/community/langchain_community/tools/playwright/current_page.py
index 861b2eca53f..207cac4b702 100644
--- a/libs/community/langchain_community/tools/playwright/current_page.py
+++ b/libs/community/langchain_community/tools/playwright/current_page.py
@@ -19,7 +19,7 @@ class CurrentWebPageToolInput(BaseModel):
"""Explicit no-args input for CurrentWebPageTool."""
-class CurrentWebPageTool(BaseBrowserTool): # type: ignore[override, override]
+class CurrentWebPageTool(BaseBrowserTool):
"""Tool for getting the URL of the current webpage."""
name: str = "current_webpage"
diff --git a/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py b/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
index 18c2a1180bf..00a5e290274 100644
--- a/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
+++ b/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
@@ -28,7 +28,7 @@ class ExtractHyperlinksToolInput(BaseModel):
)
-class ExtractHyperlinksTool(BaseBrowserTool): # type: ignore[override, override]
+class ExtractHyperlinksTool(BaseBrowserTool):
"""Extract all hyperlinks on the page."""
name: str = "extract_hyperlinks"
diff --git a/libs/community/langchain_community/tools/playwright/extract_text.py b/libs/community/langchain_community/tools/playwright/extract_text.py
index 98774f73558..7c9ce7f8e17 100644
--- a/libs/community/langchain_community/tools/playwright/extract_text.py
+++ b/libs/community/langchain_community/tools/playwright/extract_text.py
@@ -19,7 +19,7 @@ class ExtractTextToolInput(BaseModel):
"""Explicit no-args input for ExtractTextTool."""
-class ExtractTextTool(BaseBrowserTool): # type: ignore[override, override]
+class ExtractTextTool(BaseBrowserTool):
"""Tool for extracting all the text on the current webpage."""
name: str = "extract_text"
diff --git a/libs/community/langchain_community/tools/playwright/get_elements.py b/libs/community/langchain_community/tools/playwright/get_elements.py
index 9708dcb3904..11e43c01696 100644
--- a/libs/community/langchain_community/tools/playwright/get_elements.py
+++ b/libs/community/langchain_community/tools/playwright/get_elements.py
@@ -73,7 +73,7 @@ def _get_elements(
return results
-class GetElementsTool(BaseBrowserTool): # type: ignore[override, override]
+class GetElementsTool(BaseBrowserTool):
"""Tool for getting elements in the current web page matching a CSS selector."""
name: str = "get_elements"
diff --git a/libs/community/langchain_community/tools/playwright/navigate.py b/libs/community/langchain_community/tools/playwright/navigate.py
index 0cd76585982..2bfe2be4fd7 100644
--- a/libs/community/langchain_community/tools/playwright/navigate.py
+++ b/libs/community/langchain_community/tools/playwright/navigate.py
@@ -32,7 +32,7 @@ class NavigateToolInput(BaseModel):
return values
-class NavigateTool(BaseBrowserTool): # type: ignore[override, override]
+class NavigateTool(BaseBrowserTool):
"""Tool for navigating a browser to a URL.
**Security Note**: This tool provides code to control web-browser navigation.
diff --git a/libs/community/langchain_community/tools/playwright/navigate_back.py b/libs/community/langchain_community/tools/playwright/navigate_back.py
index 2a2eff38906..45fa250cb44 100644
--- a/libs/community/langchain_community/tools/playwright/navigate_back.py
+++ b/libs/community/langchain_community/tools/playwright/navigate_back.py
@@ -19,7 +19,7 @@ class NavigateBackToolInput(BaseModel):
"""Explicit no-args input for NavigateBackTool."""
-class NavigateBackTool(BaseBrowserTool): # type: ignore[override, override]
+class NavigateBackTool(BaseBrowserTool):
"""Navigate back to the previous page in the browser history."""
name: str = "previous_webpage"
diff --git a/libs/community/langchain_community/tools/plugin.py b/libs/community/langchain_community/tools/plugin.py
index 440ea8d0ae6..102451e72da 100644
--- a/libs/community/langchain_community/tools/plugin.py
+++ b/libs/community/langchain_community/tools/plugin.py
@@ -63,7 +63,7 @@ class AIPluginToolSchema(BaseModel):
tool_input: Optional[str] = ""
-class AIPluginTool(BaseTool): # type: ignore[override, override]
+class AIPluginTool(BaseTool):
"""Tool for getting the OpenAPI spec for an AI Plugin."""
plugin: AIPlugin
diff --git a/libs/community/langchain_community/tools/polygon/aggregates.py b/libs/community/langchain_community/tools/polygon/aggregates.py
index 74f0b85f5f4..26cb62d4677 100644
--- a/libs/community/langchain_community/tools/polygon/aggregates.py
+++ b/libs/community/langchain_community/tools/polygon/aggregates.py
@@ -39,7 +39,7 @@ class PolygonAggregatesSchema(BaseModel):
)
-class PolygonAggregates(BaseTool): # type: ignore[override, override]
+class PolygonAggregates(BaseTool):
"""
Tool that gets aggregate bars (stock prices) over a
given date range for a given ticker from Polygon.
diff --git a/libs/community/langchain_community/tools/polygon/financials.py b/libs/community/langchain_community/tools/polygon/financials.py
index bf044a5f898..8400e7498b4 100644
--- a/libs/community/langchain_community/tools/polygon/financials.py
+++ b/libs/community/langchain_community/tools/polygon/financials.py
@@ -13,7 +13,7 @@ class Inputs(BaseModel):
query: str
-class PolygonFinancials(BaseTool): # type: ignore[override, override]
+class PolygonFinancials(BaseTool):
"""Tool that gets the financials of a ticker from Polygon"""
mode: str = "get_financials"
diff --git a/libs/community/langchain_community/tools/polygon/last_quote.py b/libs/community/langchain_community/tools/polygon/last_quote.py
index 2b9816683c6..76c768113b3 100644
--- a/libs/community/langchain_community/tools/polygon/last_quote.py
+++ b/libs/community/langchain_community/tools/polygon/last_quote.py
@@ -13,7 +13,7 @@ class Inputs(BaseModel):
query: str
-class PolygonLastQuote(BaseTool): # type: ignore[override, override]
+class PolygonLastQuote(BaseTool):
"""Tool that gets the last quote of a ticker from Polygon"""
mode: str = "get_last_quote"
diff --git a/libs/community/langchain_community/tools/polygon/ticker_news.py b/libs/community/langchain_community/tools/polygon/ticker_news.py
index 4a602d54acf..d4c4a2017ab 100644
--- a/libs/community/langchain_community/tools/polygon/ticker_news.py
+++ b/libs/community/langchain_community/tools/polygon/ticker_news.py
@@ -13,7 +13,7 @@ class Inputs(BaseModel):
query: str
-class PolygonTickerNews(BaseTool): # type: ignore[override, override]
+class PolygonTickerNews(BaseTool):
"""Tool that gets the latest news for a given ticker from Polygon"""
mode: str = "get_ticker_news"
diff --git a/libs/community/langchain_community/tools/powerbi/tool.py b/libs/community/langchain_community/tools/powerbi/tool.py
index cf930b3bafc..c5ec51e5b52 100644
--- a/libs/community/langchain_community/tools/powerbi/tool.py
+++ b/libs/community/langchain_community/tools/powerbi/tool.py
@@ -22,7 +22,7 @@ from langchain_community.utilities.powerbi import PowerBIDataset, json_to_md
logger = logging.getLogger(__name__)
-class QueryPowerBITool(BaseTool): # type: ignore[override]
+class QueryPowerBITool(BaseTool):
"""Tool for querying a Power BI Dataset."""
name: str = "query_powerbi"
@@ -216,7 +216,7 @@ class QueryPowerBITool(BaseTool): # type: ignore[override]
return False, 0
-class InfoPowerBITool(BaseTool): # type: ignore[override]
+class InfoPowerBITool(BaseTool):
"""Tool for getting metadata about a PowerBI Dataset."""
name: str = "schema_powerbi"
@@ -248,7 +248,7 @@ class InfoPowerBITool(BaseTool): # type: ignore[override]
return await self.powerbi.aget_table_info(tool_input.split(", "))
-class ListPowerBITool(BaseTool): # type: ignore[override]
+class ListPowerBITool(BaseTool):
"""Tool for getting tables names."""
name: str = "list_tables_powerbi"
diff --git a/libs/community/langchain_community/tools/pubmed/tool.py b/libs/community/langchain_community/tools/pubmed/tool.py
index 543c02a33bd..fe833863544 100644
--- a/libs/community/langchain_community/tools/pubmed/tool.py
+++ b/libs/community/langchain_community/tools/pubmed/tool.py
@@ -7,7 +7,7 @@ from pydantic import Field
from langchain_community.utilities.pubmed import PubMedAPIWrapper
-class PubmedQueryRun(BaseTool): # type: ignore[override]
+class PubmedQueryRun(BaseTool):
"""Tool that searches the PubMed API."""
name: str = "pub_med"
diff --git a/libs/community/langchain_community/tools/reddit_search/tool.py b/libs/community/langchain_community/tools/reddit_search/tool.py
index 9a9ce882bbc..fc823c2b23d 100644
--- a/libs/community/langchain_community/tools/reddit_search/tool.py
+++ b/libs/community/langchain_community/tools/reddit_search/tool.py
@@ -34,7 +34,7 @@ class RedditSearchSchema(BaseModel):
)
-class RedditSearchRun(BaseTool): # type: ignore[override, override]
+class RedditSearchRun(BaseTool):
"""Tool that queries for posts on a subreddit."""
name: str = "reddit_search"
diff --git a/libs/community/langchain_community/tools/requests/tool.py b/libs/community/langchain_community/tools/requests/tool.py
index bdfd63ddcc4..c91b348053f 100644
--- a/libs/community/langchain_community/tools/requests/tool.py
+++ b/libs/community/langchain_community/tools/requests/tool.py
@@ -47,7 +47,7 @@ class BaseRequestsTool(BaseModel):
super().__init__(**kwargs)
-class RequestsGetTool(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsGetTool(BaseRequestsTool, BaseTool):
"""Tool for making a GET request to an API endpoint."""
name: str = "requests_get"
@@ -71,7 +71,7 @@ class RequestsGetTool(BaseRequestsTool, BaseTool): # type: ignore[override]
return await self.requests_wrapper.aget(_clean_url(url))
-class RequestsPostTool(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPostTool(BaseRequestsTool, BaseTool):
"""Tool for making a POST request to an API endpoint."""
name: str = "requests_post"
@@ -108,7 +108,7 @@ class RequestsPostTool(BaseRequestsTool, BaseTool): # type: ignore[override]
return repr(e)
-class RequestsPatchTool(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPatchTool(BaseRequestsTool, BaseTool):
"""Tool for making a PATCH request to an API endpoint."""
name: str = "requests_patch"
@@ -145,7 +145,7 @@ class RequestsPatchTool(BaseRequestsTool, BaseTool): # type: ignore[override]
return repr(e)
-class RequestsPutTool(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsPutTool(BaseRequestsTool, BaseTool):
"""Tool for making a PUT request to an API endpoint."""
name: str = "requests_put"
@@ -182,7 +182,7 @@ class RequestsPutTool(BaseRequestsTool, BaseTool): # type: ignore[override]
return repr(e)
-class RequestsDeleteTool(BaseRequestsTool, BaseTool): # type: ignore[override]
+class RequestsDeleteTool(BaseRequestsTool, BaseTool):
"""Tool for making a DELETE request to an API endpoint."""
name: str = "requests_delete"
diff --git a/libs/community/langchain_community/tools/riza/command.py b/libs/community/langchain_community/tools/riza/command.py
index 0fb3498dd8c..37ef0446add 100644
--- a/libs/community/langchain_community/tools/riza/command.py
+++ b/libs/community/langchain_community/tools/riza/command.py
@@ -18,7 +18,7 @@ class ExecPythonInput(BaseModel):
code: str = Field(description="the Python code to execute")
-class ExecPython(BaseTool): # type: ignore[override, override]
+class ExecPython(BaseTool):
"""Riza Code tool.
Setup:
@@ -100,7 +100,7 @@ class ExecJavaScriptInput(BaseModel):
code: str = Field(description="the JavaScript code to execute")
-class ExecJavaScript(BaseTool): # type: ignore[override, override]
+class ExecJavaScript(BaseTool):
"""A tool implementation to execute JavaScript via Riza's Code Interpreter API."""
name: str = "riza_exec_javascript"
diff --git a/libs/community/langchain_community/tools/scenexplain/tool.py b/libs/community/langchain_community/tools/scenexplain/tool.py
index fb3914470da..2a7bb7c03e5 100644
--- a/libs/community/langchain_community/tools/scenexplain/tool.py
+++ b/libs/community/langchain_community/tools/scenexplain/tool.py
@@ -15,7 +15,7 @@ class SceneXplainInput(BaseModel):
query: str = Field(..., description="The link to the image to explain")
-class SceneXplainTool(BaseTool): # type: ignore[override]
+class SceneXplainTool(BaseTool):
"""Tool that explains images."""
name: str = "image_explainer"
@@ -24,7 +24,7 @@ class SceneXplainTool(BaseTool): # type: ignore[override]
"for an image. The input can be an image file of any format, and "
"the output will be a text description that covers every detail of the image."
)
- api_wrapper: SceneXplainAPIWrapper = Field(default_factory=SceneXplainAPIWrapper) # type: ignore[arg-type]
+ api_wrapper: SceneXplainAPIWrapper = Field(default_factory=SceneXplainAPIWrapper)
def _run(
self, query: str, run_manager: Optional[CallbackManagerForToolRun] = None
diff --git a/libs/community/langchain_community/tools/searchapi/tool.py b/libs/community/langchain_community/tools/searchapi/tool.py
index 8b92679bf6a..205d59880de 100644
--- a/libs/community/langchain_community/tools/searchapi/tool.py
+++ b/libs/community/langchain_community/tools/searchapi/tool.py
@@ -12,7 +12,7 @@ from pydantic import Field
from langchain_community.utilities.searchapi import SearchApiAPIWrapper
-class SearchAPIRun(BaseTool): # type: ignore[override]
+class SearchAPIRun(BaseTool):
"""Tool that queries the SearchApi.io search API."""
name: str = "searchapi"
@@ -40,7 +40,7 @@ class SearchAPIRun(BaseTool): # type: ignore[override]
return await self.api_wrapper.arun(query)
-class SearchAPIResults(BaseTool): # type: ignore[override]
+class SearchAPIResults(BaseTool):
"""Tool that queries the SearchApi.io search API and returns JSON."""
name: str = "searchapi_results_json"
diff --git a/libs/community/langchain_community/tools/searx_search/tool.py b/libs/community/langchain_community/tools/searx_search/tool.py
index 3f752785ae7..d16739e88f2 100644
--- a/libs/community/langchain_community/tools/searx_search/tool.py
+++ b/libs/community/langchain_community/tools/searx_search/tool.py
@@ -18,7 +18,7 @@ class SearxSearchQueryInput(BaseModel):
query: str = Field(description="query to look up on searx")
-class SearxSearchRun(BaseTool): # type: ignore[override, override]
+class SearxSearchRun(BaseTool):
"""Tool that queries a Searx instance."""
name: str = "searx_search"
@@ -48,7 +48,7 @@ class SearxSearchRun(BaseTool): # type: ignore[override, override]
return await self.wrapper.arun(query, **self.kwargs)
-class SearxSearchResults(BaseTool): # type: ignore[override, override]
+class SearxSearchResults(BaseTool):
"""Tool that queries a Searx instance and gets back json."""
name: str = "searx_search_results"
diff --git a/libs/community/langchain_community/tools/semanticscholar/tool.py b/libs/community/langchain_community/tools/semanticscholar/tool.py
index b5999eb22d7..ce53fa4bab5 100644
--- a/libs/community/langchain_community/tools/semanticscholar/tool.py
+++ b/libs/community/langchain_community/tools/semanticscholar/tool.py
@@ -15,7 +15,7 @@ class SemantscholarInput(BaseModel):
query: str = Field(description="search query to look up")
-class SemanticScholarQueryRun(BaseTool): # type: ignore[override, override]
+class SemanticScholarQueryRun(BaseTool):
"""Tool that searches the semanticscholar API."""
name: str = "semanticscholar"
diff --git a/libs/community/langchain_community/tools/shell/tool.py b/libs/community/langchain_community/tools/shell/tool.py
index 75481536df3..c4ff4d1b605 100644
--- a/libs/community/langchain_community/tools/shell/tool.py
+++ b/libs/community/langchain_community/tools/shell/tool.py
@@ -57,7 +57,7 @@ def _get_platform() -> str:
return system
-class ShellTool(BaseTool): # type: ignore[override, override]
+class ShellTool(BaseTool):
"""Tool to run shell commands."""
process: Any = Field(default_factory=_get_default_bash_process)
diff --git a/libs/community/langchain_community/tools/slack/base.py b/libs/community/langchain_community/tools/slack/base.py
index 38eb8f7d3f3..4d2fc5baca3 100644
--- a/libs/community/langchain_community/tools/slack/base.py
+++ b/libs/community/langchain_community/tools/slack/base.py
@@ -20,7 +20,7 @@ else:
pass
-class SlackBaseTool(BaseTool): # type: ignore[override]
+class SlackBaseTool(BaseTool):
"""Base class for Slack tools."""
client: WebClient = Field(default_factory=login)
diff --git a/libs/community/langchain_community/tools/slack/get_channel.py b/libs/community/langchain_community/tools/slack/get_channel.py
index 60419b66768..4cee16a9350 100644
--- a/libs/community/langchain_community/tools/slack/get_channel.py
+++ b/libs/community/langchain_community/tools/slack/get_channel.py
@@ -7,7 +7,7 @@ from langchain_core.callbacks import CallbackManagerForToolRun
from langchain_community.tools.slack.base import SlackBaseTool
-class SlackGetChannel(SlackBaseTool): # type: ignore[override]
+class SlackGetChannel(SlackBaseTool):
"""Tool that gets Slack channel information."""
name: str = "get_channelid_name_dict"
diff --git a/libs/community/langchain_community/tools/slack/get_message.py b/libs/community/langchain_community/tools/slack/get_message.py
index b756f3124c3..733f16979e4 100644
--- a/libs/community/langchain_community/tools/slack/get_message.py
+++ b/libs/community/langchain_community/tools/slack/get_message.py
@@ -17,7 +17,7 @@ class SlackGetMessageSchema(BaseModel):
)
-class SlackGetMessage(SlackBaseTool): # type: ignore[override, override]
+class SlackGetMessage(SlackBaseTool):
"""Tool that gets Slack messages."""
name: str = "get_messages"
diff --git a/libs/community/langchain_community/tools/slack/schedule_message.py b/libs/community/langchain_community/tools/slack/schedule_message.py
index 2e4e2c060e1..c4a561f5aae 100644
--- a/libs/community/langchain_community/tools/slack/schedule_message.py
+++ b/libs/community/langchain_community/tools/slack/schedule_message.py
@@ -33,7 +33,7 @@ class ScheduleMessageSchema(BaseModel):
)
-class SlackScheduleMessage(SlackBaseTool): # type: ignore[override, override]
+class SlackScheduleMessage(SlackBaseTool):
"""Tool for scheduling a message in Slack."""
name: str = "schedule_message"
diff --git a/libs/community/langchain_community/tools/slack/send_message.py b/libs/community/langchain_community/tools/slack/send_message.py
index d56de486047..87223830d43 100644
--- a/libs/community/langchain_community/tools/slack/send_message.py
+++ b/libs/community/langchain_community/tools/slack/send_message.py
@@ -19,7 +19,7 @@ class SendMessageSchema(BaseModel):
)
-class SlackSendMessage(SlackBaseTool): # type: ignore[override, override]
+class SlackSendMessage(SlackBaseTool):
"""Tool for sending a message in Slack."""
name: str = "send_message"
diff --git a/libs/community/langchain_community/tools/sleep/tool.py b/libs/community/langchain_community/tools/sleep/tool.py
index f3c7060a522..e39a272a79f 100644
--- a/libs/community/langchain_community/tools/sleep/tool.py
+++ b/libs/community/langchain_community/tools/sleep/tool.py
@@ -18,7 +18,7 @@ class SleepInput(BaseModel):
sleep_time: int = Field(..., description="Time to sleep in seconds")
-class SleepTool(BaseTool): # type: ignore[override]
+class SleepTool(BaseTool):
"""Tool that adds the capability to sleep."""
name: str = "sleep"
diff --git a/libs/community/langchain_community/tools/spark_sql/tool.py b/libs/community/langchain_community/tools/spark_sql/tool.py
index 421e507cd2e..91bbc87f295 100644
--- a/libs/community/langchain_community/tools/spark_sql/tool.py
+++ b/libs/community/langchain_community/tools/spark_sql/tool.py
@@ -26,7 +26,7 @@ class BaseSparkSQLTool(BaseModel):
)
-class QuerySparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
+class QuerySparkSQLTool(BaseSparkSQLTool, BaseTool):
"""Tool for querying a Spark SQL."""
name: str = "query_sql_db"
@@ -45,7 +45,7 @@ class QuerySparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
return self.db.run_no_throw(query)
-class InfoSparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
+class InfoSparkSQLTool(BaseSparkSQLTool, BaseTool):
"""Tool for getting metadata about a Spark SQL."""
name: str = "schema_sql_db"
@@ -65,7 +65,7 @@ class InfoSparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
return self.db.get_table_info_no_throw(table_names.split(", "))
-class ListSparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
+class ListSparkSQLTool(BaseSparkSQLTool, BaseTool):
"""Tool for getting tables names."""
name: str = "list_tables_sql_db"
@@ -80,7 +80,7 @@ class ListSparkSQLTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
return ", ".join(self.db.get_usable_table_names())
-class QueryCheckerTool(BaseSparkSQLTool, BaseTool): # type: ignore[override]
+class QueryCheckerTool(BaseSparkSQLTool, BaseTool):
"""Use an LLM to check if a query is correct.
Adapted from https://www.patterns.app/blog/2023/01/18/crunchbot-sql-analyst-gpt/"""
diff --git a/libs/community/langchain_community/tools/sql_database/tool.py b/libs/community/langchain_community/tools/sql_database/tool.py
index 8bbc595581f..cc235f4de88 100644
--- a/libs/community/langchain_community/tools/sql_database/tool.py
+++ b/libs/community/langchain_community/tools/sql_database/tool.py
@@ -33,7 +33,7 @@ class _QuerySQLDatabaseToolInput(BaseModel):
query: str = Field(..., description="A detailed and correct SQL query.")
-class QuerySQLDatabaseTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[override, override]
+class QuerySQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
"""Tool for querying a SQL database.
.. versionchanged:: 0.3.12
@@ -64,7 +64,7 @@ class QuerySQLDatabaseTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[overr
removal="1.0",
alternative_import="langchain_community.tools.QuerySQLDatabaseTool",
)
-class QuerySQLDataBaseTool(QuerySQLDatabaseTool): # type: ignore[override]
+class QuerySQLDataBaseTool(QuerySQLDatabaseTool):
"""
Equivalent stub to QuerySQLDatabaseTool for backwards compatibility.
:private:"""
@@ -82,7 +82,7 @@ class _InfoSQLDatabaseToolInput(BaseModel):
)
-class InfoSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[override, override]
+class InfoSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
"""Tool for getting metadata about a SQL database."""
name: str = "sql_db_schema"
@@ -104,7 +104,7 @@ class _ListSQLDatabaseToolInput(BaseModel):
tool_input: str = Field("", description="An empty string")
-class ListSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[override, override]
+class ListSQLDatabaseTool(BaseSQLDatabaseTool, BaseTool):
"""Tool for getting tables names."""
name: str = "sql_db_list_tables"
@@ -124,7 +124,7 @@ class _QuerySQLCheckerToolInput(BaseModel):
query: str = Field(..., description="A detailed and SQL query to be checked.")
-class QuerySQLCheckerTool(BaseSQLDatabaseTool, BaseTool): # type: ignore[override, override]
+class QuerySQLCheckerTool(BaseSQLDatabaseTool, BaseTool):
"""Use an LLM to check if a query is correct.
Adapted from https://www.patterns.app/blog/2023/01/18/crunchbot-sql-analyst-gpt/"""
diff --git a/libs/community/langchain_community/tools/stackexchange/tool.py b/libs/community/langchain_community/tools/stackexchange/tool.py
index fe4a48bd1e2..2060eada6e7 100644
--- a/libs/community/langchain_community/tools/stackexchange/tool.py
+++ b/libs/community/langchain_community/tools/stackexchange/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.stackexchange import StackExchangeAPIWrapper
-class StackExchangeTool(BaseTool): # type: ignore[override]
+class StackExchangeTool(BaseTool):
"""Tool that uses StackExchange"""
name: str = "stack_exchange"
diff --git a/libs/community/langchain_community/tools/steam/tool.py b/libs/community/langchain_community/tools/steam/tool.py
index f03f0c26fb9..3e71dddc0b4 100644
--- a/libs/community/langchain_community/tools/steam/tool.py
+++ b/libs/community/langchain_community/tools/steam/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.steam import SteamWebAPIWrapper
-class SteamWebAPIQueryRun(BaseTool): # type: ignore[override]
+class SteamWebAPIQueryRun(BaseTool):
"""Tool that searches the Steam Web API."""
mode: str
diff --git a/libs/community/langchain_community/tools/steamship_image_generation/tool.py b/libs/community/langchain_community/tools/steamship_image_generation/tool.py
index ce219236d52..ea1c4b6860d 100644
--- a/libs/community/langchain_community/tools/steamship_image_generation/tool.py
+++ b/libs/community/langchain_community/tools/steamship_image_generation/tool.py
@@ -41,7 +41,7 @@ SUPPORTED_IMAGE_SIZES = {
}
-class SteamshipImageGenerationTool(BaseTool): # type: ignore[override]
+class SteamshipImageGenerationTool(BaseTool):
"""Tool used to generate images from a text-prompt."""
model_name: ModelName
diff --git a/libs/community/langchain_community/tools/tavily_search/tool.py b/libs/community/langchain_community/tools/tavily_search/tool.py
index 32cd21d4197..2e258e22d53 100644
--- a/libs/community/langchain_community/tools/tavily_search/tool.py
+++ b/libs/community/langchain_community/tools/tavily_search/tool.py
@@ -18,7 +18,7 @@ class TavilyInput(BaseModel):
query: str = Field(description="search query to look up")
-class TavilySearchResults(BaseTool): # type: ignore[override, override]
+class TavilySearchResults(BaseTool):
"""Tool that queries the Tavily Search API and gets back json.
Setup:
@@ -202,7 +202,7 @@ class TavilySearchResults(BaseTool): # type: ignore[override, override]
return self.api_wrapper.clean_results(raw_results["results"]), raw_results
-class TavilyAnswer(BaseTool): # type: ignore[override, override]
+class TavilyAnswer(BaseTool):
"""Tool that queries the Tavily Search API and gets back an answer."""
name: str = "tavily_answer"
diff --git a/libs/community/langchain_community/tools/vectorstore/tool.py b/libs/community/langchain_community/tools/vectorstore/tool.py
index 269d00ac486..e2479929df6 100644
--- a/libs/community/langchain_community/tools/vectorstore/tool.py
+++ b/libs/community/langchain_community/tools/vectorstore/tool.py
@@ -31,7 +31,7 @@ def _create_description_from_template(values: Dict[str, Any]) -> Dict[str, Any]:
return values
-class VectorStoreQATool(BaseVectorStoreTool, BaseTool): # type: ignore[override]
+class VectorStoreQATool(BaseVectorStoreTool, BaseTool):
"""Tool for the VectorDBQA chain. To be initialized with name and chain."""
@staticmethod
@@ -79,7 +79,7 @@ class VectorStoreQATool(BaseVectorStoreTool, BaseTool): # type: ignore[override
)[chain.output_key]
-class VectorStoreQAWithSourcesTool(BaseVectorStoreTool, BaseTool): # type: ignore[override]
+class VectorStoreQAWithSourcesTool(BaseVectorStoreTool, BaseTool):
"""Tool for the VectorDBQAWithSources chain."""
@staticmethod
diff --git a/libs/community/langchain_community/tools/wikidata/tool.py b/libs/community/langchain_community/tools/wikidata/tool.py
index eb2ad9a06f1..c34096cf019 100644
--- a/libs/community/langchain_community/tools/wikidata/tool.py
+++ b/libs/community/langchain_community/tools/wikidata/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.wikidata import WikidataAPIWrapper
-class WikidataQueryRun(BaseTool): # type: ignore[override]
+class WikidataQueryRun(BaseTool):
"""Tool that searches the Wikidata API."""
name: str = "Wikidata"
diff --git a/libs/community/langchain_community/tools/wikipedia/tool.py b/libs/community/langchain_community/tools/wikipedia/tool.py
index 5d4f6e3540e..127117f89d6 100644
--- a/libs/community/langchain_community/tools/wikipedia/tool.py
+++ b/libs/community/langchain_community/tools/wikipedia/tool.py
@@ -15,7 +15,7 @@ class WikipediaQueryInput(BaseModel):
query: str = Field(description="query to look up on wikipedia")
-class WikipediaQueryRun(BaseTool): # type: ignore[override, override]
+class WikipediaQueryRun(BaseTool):
"""Tool that searches the Wikipedia API."""
name: str = "wikipedia"
diff --git a/libs/community/langchain_community/tools/wolfram_alpha/tool.py b/libs/community/langchain_community/tools/wolfram_alpha/tool.py
index cc5c8cf77d8..e4364e669a0 100644
--- a/libs/community/langchain_community/tools/wolfram_alpha/tool.py
+++ b/libs/community/langchain_community/tools/wolfram_alpha/tool.py
@@ -8,7 +8,7 @@ from langchain_core.tools import BaseTool
from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
-class WolframAlphaQueryRun(BaseTool): # type: ignore[override]
+class WolframAlphaQueryRun(BaseTool):
"""Tool that queries using the Wolfram Alpha SDK."""
name: str = "wolfram_alpha"
diff --git a/libs/community/langchain_community/tools/yahoo_finance_news.py b/libs/community/langchain_community/tools/yahoo_finance_news.py
index e8b8f648e09..7a9a49d2efc 100644
--- a/libs/community/langchain_community/tools/yahoo_finance_news.py
+++ b/libs/community/langchain_community/tools/yahoo_finance_news.py
@@ -16,7 +16,7 @@ class YahooFinanceNewsInput(BaseModel):
query: str = Field(description="company ticker query to look up")
-class YahooFinanceNewsTool(BaseTool): # type: ignore[override, override]
+class YahooFinanceNewsTool(BaseTool):
"""Tool that searches financial news on Yahoo Finance."""
name: str = "yahoo_finance_news"
diff --git a/libs/community/langchain_community/tools/you/tool.py b/libs/community/langchain_community/tools/you/tool.py
index 923ad41ebf3..59990e71ff5 100644
--- a/libs/community/langchain_community/tools/you/tool.py
+++ b/libs/community/langchain_community/tools/you/tool.py
@@ -17,7 +17,7 @@ class YouInput(BaseModel):
query: str = Field(description="should be a search query")
-class YouSearchTool(BaseTool): # type: ignore[override, override]
+class YouSearchTool(BaseTool):
"""Tool that searches the you.com API."""
name: str = "you_search"
diff --git a/libs/community/langchain_community/tools/youtube/search.py b/libs/community/langchain_community/tools/youtube/search.py
index cc68055b1b9..497fa542adf 100644
--- a/libs/community/langchain_community/tools/youtube/search.py
+++ b/libs/community/langchain_community/tools/youtube/search.py
@@ -16,7 +16,7 @@ from langchain_core.callbacks import CallbackManagerForToolRun
from langchain_core.tools import BaseTool
-class YouTubeSearchTool(BaseTool): # type: ignore[override]
+class YouTubeSearchTool(BaseTool):
"""Tool that queries YouTube."""
name: str = "youtube_search"
diff --git a/libs/community/langchain_community/tools/zapier/tool.py b/libs/community/langchain_community/tools/zapier/tool.py
index 3d00392e75e..8e2caa17422 100644
--- a/libs/community/langchain_community/tools/zapier/tool.py
+++ b/libs/community/langchain_community/tools/zapier/tool.py
@@ -83,7 +83,7 @@ from langchain_community.tools.zapier.prompt import BASE_ZAPIER_TOOL_PROMPT
from langchain_community.utilities.zapier import ZapierNLAWrapper
-class ZapierNLARunAction(BaseTool): # type: ignore[override]
+class ZapierNLARunAction(BaseTool):
"""Tool to run a specific action from the user's exposed actions.
Params:
@@ -167,7 +167,7 @@ ZapierNLARunAction.__doc__ = ZapierNLAWrapper.run.__doc__ + ZapierNLARunAction._
# other useful actions
-class ZapierNLAListActions(BaseTool): # type: ignore[override]
+class ZapierNLAListActions(BaseTool):
"""Tool to list all exposed actions for the user."""
name: str = "ZapierNLA_list_actions"
diff --git a/libs/community/langchain_community/tools/zenguard/tool.py b/libs/community/langchain_community/tools/zenguard/tool.py
index e54590079bd..f577b079847 100644
--- a/libs/community/langchain_community/tools/zenguard/tool.py
+++ b/libs/community/langchain_community/tools/zenguard/tool.py
@@ -44,7 +44,7 @@ class ZenGuardInput(BaseModel):
)
-class ZenGuardTool(BaseTool): # type: ignore[override, override]
+class ZenGuardTool(BaseTool):
name: str = "ZenGuard"
description: str = (
"ZenGuard AI integration package. ZenGuard AI - the fastest GenAI guardrails."
diff --git a/libs/community/langchain_community/utilities/astradb.py b/libs/community/langchain_community/utilities/astradb.py
index 72ba7ca9d41..20cc9556d92 100644
--- a/libs/community/langchain_community/utilities/astradb.py
+++ b/libs/community/langchain_community/utilities/astradb.py
@@ -151,7 +151,7 @@ class _AstraDBCollectionEnvironment(_AstraDBEnvironment):
)
self.astra_db.create_collection(
collection_name,
- dimension=embedding_dimension, # type: ignore[arg-type]
+ dimension=embedding_dimension,
metric=metric,
)
diff --git a/libs/community/langchain_community/utilities/dalle_image_generator.py b/libs/community/langchain_community/utilities/dalle_image_generator.py
index d95483bb4f6..71d9df762d2 100644
--- a/libs/community/langchain_community/utilities/dalle_image_generator.py
+++ b/libs/community/langchain_community/utilities/dalle_image_generator.py
@@ -129,11 +129,11 @@ class DallEAPIWrapper(BaseModel):
}
if not self.client:
- self.client = openai.OpenAI(**client_params).images # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ self.client = openai.OpenAI(**client_params).images
if not self.async_client:
- self.async_client = openai.AsyncOpenAI(**client_params).images # type: ignore[arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type, arg-type]
+ self.async_client = openai.AsyncOpenAI(**client_params).images
elif not self.client:
- self.client = openai.Image # type: ignore[attr-defined]
+ self.client = openai.Image
else:
pass
return self
diff --git a/libs/community/langchain_community/utilities/duckduckgo_search.py b/libs/community/langchain_community/utilities/duckduckgo_search.py
index f277e62bae0..ead6941aa97 100644
--- a/libs/community/langchain_community/utilities/duckduckgo_search.py
+++ b/libs/community/langchain_community/utilities/duckduckgo_search.py
@@ -63,7 +63,7 @@ class DuckDuckGoSearchAPIWrapper(BaseModel):
with DDGS() as ddgs:
ddgs_gen = ddgs.text(
query,
- region=self.region, # type: ignore[arg-type]
+ region=self.region,
safesearch=self.safesearch,
timelimit=self.time,
max_results=max_results or self.max_results,
@@ -82,7 +82,7 @@ class DuckDuckGoSearchAPIWrapper(BaseModel):
with DDGS() as ddgs:
ddgs_gen = ddgs.news(
query,
- region=self.region, # type: ignore[arg-type]
+ region=self.region,
safesearch=self.safesearch,
timelimit=self.time,
max_results=max_results or self.max_results,
@@ -100,7 +100,7 @@ class DuckDuckGoSearchAPIWrapper(BaseModel):
with DDGS() as ddgs:
ddgs_gen = ddgs.images(
query,
- region=self.region, # type: ignore[arg-type]
+ region=self.region,
safesearch=self.safesearch,
max_results=max_results or self.max_results,
)
diff --git a/libs/community/langchain_community/utilities/nvidia_riva.py b/libs/community/langchain_community/utilities/nvidia_riva.py
index 74afba23d2d..40a788a85f7 100644
--- a/libs/community/langchain_community/utilities/nvidia_riva.py
+++ b/libs/community/langchain_community/utilities/nvidia_riva.py
@@ -401,7 +401,7 @@ ASRInputType = AudioStream
ASROutputType = str
-class RivaASR( # type: ignore[override]
+class RivaASR(
RivaAuthMixin,
RivaCommonConfigMixin,
RunnableSerializable[ASRInputType, ASROutputType],
@@ -509,7 +509,7 @@ TTSInputType = Union[str, AnyMessage, PromptValue]
TTSOutputType = bytes
-class RivaTTS( # type: ignore[override]
+class RivaTTS(
RivaAuthMixin,
RivaCommonConfigMixin,
RunnableSerializable[TTSInputType, TTSOutputType],
diff --git a/libs/community/langchain_community/utilities/zapier.py b/libs/community/langchain_community/utilities/zapier.py
index 56e5dc5dda4..37d5aa83c90 100644
--- a/libs/community/langchain_community/utilities/zapier.py
+++ b/libs/community/langchain_community/utilities/zapier.py
@@ -285,13 +285,13 @@ class ZapierNLAWrapper(BaseModel):
data = await self.apreview(*args, **kwargs)
return json.dumps(data)
- def list_as_str(self) -> str: # type: ignore[no-untyped-def]
+ def list_as_str(self) -> str:
"""Same as list, but returns a stringified version of the JSON for
insertting back into an LLM."""
actions = self.list()
return json.dumps(actions)
- async def alist_as_str(self) -> str: # type: ignore[no-untyped-def]
+ async def alist_as_str(self) -> str:
"""Same as list, but returns a stringified version of the JSON for
insertting back into an LLM."""
actions = await self.alist()
diff --git a/libs/community/langchain_community/utils/math.py b/libs/community/langchain_community/utils/math.py
index 59b7440ddbc..bf110f22174 100644
--- a/libs/community/langchain_community/utils/math.py
+++ b/libs/community/langchain_community/utils/math.py
@@ -71,4 +71,4 @@ def cosine_similarity_top_k(
top_k_idxs = top_k_idxs[np.argsort(score_array.ravel()[top_k_idxs])][::-1]
ret_idxs = np.unravel_index(top_k_idxs, score_array.shape)
scores = score_array.ravel()[top_k_idxs].tolist()
- return list(zip(*ret_idxs)), scores # type: ignore[return-value]
+ return list(zip(*ret_idxs)), scores # type: ignore[return-value,unused-ignore]
diff --git a/libs/community/langchain_community/vectorstores/apache_doris.py b/libs/community/langchain_community/vectorstores/apache_doris.py
index 0e88fba5bdf..6b535726041 100644
--- a/libs/community/langchain_community/vectorstores/apache_doris.py
+++ b/libs/community/langchain_community/vectorstores/apache_doris.py
@@ -108,7 +108,7 @@ class ApacheDoris(VectorStore):
config (ApacheDorisSettings): Apache Doris client configuration information.
"""
try:
- import pymysql # type: ignore[import]
+ import pymysql # type: ignore[import-untyped]
except ImportError:
raise ImportError(
"Could not import pymysql python package. "
diff --git a/libs/community/langchain_community/vectorstores/astradb.py b/libs/community/langchain_community/vectorstores/astradb.py
index ad6f1d358af..06f3e51a9a9 100644
--- a/libs/community/langchain_community/vectorstores/astradb.py
+++ b/libs/community/langchain_community/vectorstores/astradb.py
@@ -245,7 +245,7 @@ class AstraDB(VectorStore):
async def aclear(self) -> None:
"""Empty the collection of all its stored entries."""
await self.astra_env.aensure_db_setup()
- await self.async_collection.delete_many({}) # type: ignore[union-attr]
+ await self.async_collection.delete_many({})
def delete_by_document_id(self, document_id: str) -> bool:
"""
@@ -258,7 +258,7 @@ class AstraDB(VectorStore):
True if a document has indeed been deleted, False if ID not found.
"""
self.astra_env.ensure_db_setup()
- deletion_response = self.collection.delete_one(document_id) # type: ignore[union-attr]
+ deletion_response = self.collection.delete_one(document_id)
return ((deletion_response or {}).get("status") or {}).get(
"deletedCount", 0
) == 1
diff --git a/libs/community/langchain_community/vectorstores/chroma.py b/libs/community/langchain_community/vectorstores/chroma.py
index ebf91f718af..e67b137bf4b 100644
--- a/libs/community/langchain_community/vectorstores/chroma.py
+++ b/libs/community/langchain_community/vectorstores/chroma.py
@@ -75,7 +75,7 @@ class Chroma(VectorStore):
persist_directory: Optional[str] = None,
client_settings: Optional[chromadb.config.Settings] = None,
collection_metadata: Optional[Dict] = None,
- client: Optional[chromadb.Client] = None, # type: ignore[valid-type]
+ client: Optional[chromadb.Client] = None,
relevance_score_fn: Optional[Callable[[float], float]] = None,
) -> None:
"""Initialize with a Chroma client."""
@@ -118,14 +118,14 @@ class Chroma(VectorStore):
_client_settings.persist_directory = persist_directory
else:
_client_settings = chromadb.config.Settings()
- self._client_settings = _client_settings # type: ignore[has-type]
- self._client = chromadb.Client(_client_settings) # type: ignore[has-type]
- self._persist_directory = ( # type: ignore[has-type]
+ self._client_settings = _client_settings
+ self._client = chromadb.Client(_client_settings)
+ self._persist_directory = (
_client_settings.persist_directory or persist_directory
)
self._embedding_function = embedding_function
- self._collection = self._client.get_or_create_collection( # type: ignore[has-type]
+ self._collection = self._client.get_or_create_collection(
name=collection_name,
embedding_function=None,
metadata=collection_metadata,
@@ -154,12 +154,12 @@ class Chroma(VectorStore):
"Could not import chromadb python package. "
"Please install it with `pip install chromadb`."
)
- return self._collection.query( # type: ignore[return-value]
+ return self._collection.query(
query_texts=query_texts,
- query_embeddings=query_embeddings, # type: ignore[arg-type]
+ query_embeddings=query_embeddings,
n_results=n_results,
- where=where, # type: ignore[arg-type]
- where_document=where_document, # type: ignore[arg-type]
+ where=where,
+ where_document=where_document,
**kwargs,
)
@@ -218,7 +218,7 @@ class Chroma(VectorStore):
ids_with_metadata = [ids[idx] for idx in non_empty_ids]
try:
self._collection.upsert(
- metadatas=metadatas, # type: ignore[arg-type]
+ metadatas=metadatas,
embeddings=embeddings_with_metadatas,
documents=images_with_metadatas,
ids=ids_with_metadata,
@@ -297,8 +297,8 @@ class Chroma(VectorStore):
ids_with_metadata = [ids[idx] for idx in non_empty_ids]
try:
self._collection.upsert(
- metadatas=metadatas, # type: ignore[arg-type]
- embeddings=embeddings_with_metadatas, # type: ignore[arg-type]
+ metadatas=metadatas,
+ embeddings=embeddings_with_metadatas,
documents=texts_with_metadatas,
ids=ids_with_metadata,
)
@@ -318,13 +318,13 @@ class Chroma(VectorStore):
)
ids_without_metadatas = [ids[j] for j in empty_ids]
self._collection.upsert(
- embeddings=embeddings_without_metadatas, # type: ignore[arg-type]
+ embeddings=embeddings_without_metadatas,
documents=texts_without_metadatas,
ids=ids_without_metadatas,
)
else:
self._collection.upsert(
- embeddings=embeddings, # type: ignore[arg-type]
+ embeddings=embeddings,
documents=texts,
ids=ids,
)
@@ -659,7 +659,7 @@ class Chroma(VectorStore):
def delete_collection(self) -> None:
"""Delete the collection."""
- self._client.delete_collection(self._collection.name) # type: ignore[has-type]
+ self._client.delete_collection(self._collection.name)
def get(
self,
@@ -697,7 +697,7 @@ class Chroma(VectorStore):
if include is not None:
kwargs["include"] = include
- return self._collection.get(**kwargs) # type: ignore[return-value, arg-type, arg-type, arg-type, arg-type, arg-type]
+ return self._collection.get(**kwargs)
@deprecated(
since="0.1.17",
@@ -716,7 +716,7 @@ class Chroma(VectorStore):
Since Chroma 0.4.x the manual persistence method is no longer
supported as docs are automatically persisted.
"""
- if self._persist_directory is None: # type: ignore[has-type]
+ if self._persist_directory is None:
raise ValueError(
"You must specify a persist_directory on"
"creation to persist the collection."
@@ -726,7 +726,7 @@ class Chroma(VectorStore):
# Maintain backwards compatibility with chromadb < 0.4.0
major, minor, _ = chromadb.__version__.split(".")
if int(major) == 0 and int(minor) < 4:
- self._client.persist() # type: ignore[has-type]
+ self._client.persist()
def update_document(self, document_id: str, document: Document) -> None:
"""Update a document in the collection.
@@ -763,9 +763,9 @@ class Chroma(VectorStore):
for batch in create_batches(
api=self._collection._client,
ids=ids,
- metadatas=metadata, # type: ignore[arg-type]
+ metadatas=metadata,
documents=text,
- embeddings=embeddings, # type: ignore[arg-type]
+ embeddings=embeddings,
):
self._collection.update(
ids=batch[0],
@@ -776,9 +776,9 @@ class Chroma(VectorStore):
else:
self._collection.update(
ids=ids,
- embeddings=embeddings, # type: ignore[arg-type]
+ embeddings=embeddings,
documents=text,
- metadatas=metadata, # type: ignore[arg-type]
+ metadatas=metadata,
)
@classmethod
@@ -791,7 +791,7 @@ class Chroma(VectorStore):
collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME,
persist_directory: Optional[str] = None,
client_settings: Optional[chromadb.config.Settings] = None,
- client: Optional[chromadb.Client] = None, # type: ignore[valid-type]
+ client: Optional[chromadb.Client] = None,
collection_metadata: Optional[Dict] = None,
**kwargs: Any,
) -> Chroma:
@@ -826,23 +826,23 @@ class Chroma(VectorStore):
if ids is None:
ids = [str(uuid.uuid4()) for _ in texts]
if hasattr(
- chroma_collection._client, # type: ignore[has-type]
+ chroma_collection._client,
"get_max_batch_size", # for Chroma 0.5.1 and above
) or hasattr(
- chroma_collection._client, # type: ignore[has-type]
+ chroma_collection._client,
"max_batch_size",
): # for Chroma 0.4.10 and above
from chromadb.utils.batch_utils import create_batches
for batch in create_batches(
- api=chroma_collection._client, # type: ignore[has-type]
+ api=chroma_collection._client,
ids=ids,
- metadatas=metadatas, # type: ignore[arg-type]
+ metadatas=metadatas,
documents=texts,
):
chroma_collection.add_texts(
texts=batch[3] if batch[3] else [],
- metadatas=batch[2] if batch[2] else None, # type: ignore[arg-type]
+ metadatas=batch[2] if batch[2] else None,
ids=batch[0],
)
else:
@@ -858,7 +858,7 @@ class Chroma(VectorStore):
collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME,
persist_directory: Optional[str] = None,
client_settings: Optional[chromadb.config.Settings] = None,
- client: Optional[ # type: ignore[valid-type]
+ client: Optional[
chromadb.Client
] = None, # Add this line # type: ignore[valid-type]
collection_metadata: Optional[Dict] = None,
diff --git a/libs/community/langchain_community/vectorstores/hanavector.py b/libs/community/langchain_community/vectorstores/hanavector.py
index 9c20656ac49..f9087fde01b 100644
--- a/libs/community/langchain_community/vectorstores/hanavector.py
+++ b/libs/community/langchain_community/vectorstores/hanavector.py
@@ -222,7 +222,7 @@ class HanaDB(VectorStore):
return self.embedding
@staticmethod
- def _sanitize_name(input_str: str) -> str: # type: ignore[misc]
+ def _sanitize_name(input_str: str) -> str:
# Remove characters that are not alphanumeric or underscores
return re.sub(r"[^a-zA-Z0-9_]", "", input_str)
@@ -356,7 +356,7 @@ class HanaDB(VectorStore):
finally:
cur.close()
- def add_texts( # type: ignore[override]
+ def add_texts(
self,
texts: Iterable[str],
metadatas: Optional[List[dict]] = None,
diff --git a/libs/community/langchain_community/vectorstores/llm_rails.py b/libs/community/langchain_community/vectorstores/llm_rails.py
index 2238d15fab0..16277161280 100644
--- a/libs/community/langchain_community/vectorstores/llm_rails.py
+++ b/libs/community/langchain_community/vectorstores/llm_rails.py
@@ -226,7 +226,7 @@ class LLMRails(VectorStore):
return LLMRailsRetriever(vectorstore=self, **kwargs)
-class LLMRailsRetriever(VectorStoreRetriever): # type: ignore[override]
+class LLMRailsRetriever(VectorStoreRetriever):
"""Retriever for LLMRails."""
vectorstore: LLMRails
diff --git a/libs/community/langchain_community/vectorstores/matching_engine.py b/libs/community/langchain_community/vectorstores/matching_engine.py
index 86f2ea27e05..d0f9c0b9a4e 100644
--- a/libs/community/langchain_community/vectorstores/matching_engine.py
+++ b/libs/community/langchain_community/vectorstores/matching_engine.py
@@ -284,7 +284,7 @@ class MatchingEngine(VectorStore):
page_content=page_content,
metadata=metadata,
)
- docs.append((document, result.distance)) # type: ignore[arg-type]
+ docs.append((document, result.distance))
logger.debug("Downloaded documents for query.")
@@ -426,16 +426,16 @@ class MatchingEngine(VectorStore):
"""
gcs_bucket_name = cls._validate_gcs_bucket(gcs_bucket_name)
credentials = cls._create_credentials_from_file(credentials_path)
- index = cls._create_index_by_id(index_id, project_id, region, credentials) # type: ignore[arg-type]
+ index = cls._create_index_by_id(index_id, project_id, region, credentials)
endpoint = cls._create_endpoint_by_id(
endpoint_id,
project_id,
region,
- credentials, # type: ignore[arg-type]
+ credentials,
)
- gcs_client = cls._get_gcs_client(credentials, project_id) # type: ignore[arg-type]
- cls._init_aiplatform(project_id, region, gcs_bucket_name, credentials) # type: ignore[arg-type]
+ gcs_client = cls._get_gcs_client(credentials, project_id)
+ cls._init_aiplatform(project_id, region, gcs_bucket_name, credentials)
return cls(
project_id=project_id,
diff --git a/libs/community/langchain_community/vectorstores/milvus.py b/libs/community/langchain_community/vectorstores/milvus.py
index 7dd40499968..f9e984d3509 100644
--- a/libs/community/langchain_community/vectorstores/milvus.py
+++ b/libs/community/langchain_community/vectorstores/milvus.py
@@ -1053,7 +1053,7 @@ class Milvus(VectorStore):
pks = [item.get(self._primary_field) for item in query_result]
return pks
- def upsert( # type: ignore[override]
+ def upsert(
self,
ids: Optional[List[str]] = None,
documents: List[Document] | None = None,
diff --git a/libs/community/langchain_community/vectorstores/mongodb_atlas.py b/libs/community/langchain_community/vectorstores/mongodb_atlas.py
index 2c23ae92c40..10fab4ec11d 100644
--- a/libs/community/langchain_community/vectorstores/mongodb_atlas.py
+++ b/libs/community/langchain_community/vectorstores/mongodb_atlas.py
@@ -210,7 +210,7 @@ class MongoDBAtlasVectorSearch(VectorStore):
]
if post_filter_pipeline is not None:
pipeline.extend(post_filter_pipeline)
- cursor = self._collection.aggregate(pipeline) # type: ignore[arg-type]
+ cursor = self._collection.aggregate(pipeline)
docs = []
for res in cursor:
text = res.pop(self._text_key)
diff --git a/libs/community/langchain_community/vectorstores/neo4j_vector.py b/libs/community/langchain_community/vectorstores/neo4j_vector.py
index b65f165abad..57c7202b331 100644
--- a/libs/community/langchain_community/vectorstores/neo4j_vector.py
+++ b/libs/community/langchain_community/vectorstores/neo4j_vector.py
@@ -692,20 +692,20 @@ class Neo4jVector(VectorStore):
or e.code
== "Neo.DatabaseError.Transaction.TransactionStartFailed"
)
- and "in an implicit transaction" in e.message # type: ignore[operator]
+ and "in an implicit transaction" in e.message
)
or ( # isPeriodicCommitError
e.code == "Neo.ClientError.Statement.SemanticError"
and (
- "in an open transaction is not possible" in e.message # type: ignore[operator]
- or "tried to execute in an explicit transaction" in e.message # type: ignore[operator]
+ "in an open transaction is not possible" in e.message
+ or "tried to execute in an explicit transaction" in e.message
)
)
):
raise
# Fallback to allow implicit transactions
with self._driver.session(database=self._database) as session:
- data = session.run(Query(text=query), params) # type: ignore[assignment]
+ data = session.run(Query(text=query), params)
return [r.data() for r in data]
def verify_version(self) -> None:
diff --git a/libs/community/langchain_community/vectorstores/pgvector.py b/libs/community/langchain_community/vectorstores/pgvector.py
index c2a9cd8b697..9497299f309 100644
--- a/libs/community/langchain_community/vectorstores/pgvector.py
+++ b/libs/community/langchain_community/vectorstores/pgvector.py
@@ -375,7 +375,7 @@ class PGVector(VectorStore):
def create_vector_extension(self) -> None:
try:
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
# The advisor lock fixes issue arising from concurrent
# creation of the vector extension.
# https://github.com/langchain-ai/langchain/issues/12933
@@ -393,24 +393,24 @@ class PGVector(VectorStore):
raise Exception(f"Failed to create vector extension: {e}") from e
def create_tables_if_not_exists(self) -> None:
- with Session(self._bind) as session, session.begin(): # type: ignore[arg-type]
+ with Session(self._bind) as session, session.begin():
Base.metadata.create_all(session.get_bind())
def drop_tables(self) -> None:
- with Session(self._bind) as session, session.begin(): # type: ignore[arg-type]
+ with Session(self._bind) as session, session.begin():
Base.metadata.drop_all(session.get_bind())
def create_collection(self) -> None:
if self.pre_delete_collection:
self.delete_collection()
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
self.CollectionStore.get_or_create(
session, self.collection_name, cmetadata=self.collection_metadata
)
def delete_collection(self) -> None:
self.logger.debug("Trying to delete collection")
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
collection = self.get_collection(session)
if not collection:
self.logger.warning("Collection not found")
@@ -421,7 +421,7 @@ class PGVector(VectorStore):
@contextlib.contextmanager
def _make_session(self) -> Generator[Session, None, None]:
"""Create a context manager for the session, bind to _conn string."""
- yield Session(self._bind) # type: ignore[arg-type]
+ yield Session(self._bind)
def delete(
self,
@@ -435,7 +435,7 @@ class PGVector(VectorStore):
ids: List of ids to delete.
collection_only: Only delete ids in the collection.
"""
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
if ids is not None:
self.logger.debug(
"Trying to delete vectors by ids (represented by the model "
@@ -523,7 +523,7 @@ class PGVector(VectorStore):
if not metadatas:
metadatas = [{} for _ in texts]
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
collection = self.get_collection(session)
if not collection:
raise ValueError("Collection not found")
@@ -935,7 +935,7 @@ class PGVector(VectorStore):
filter: Optional[Dict[str, str]] = None,
) -> List[Any]:
"""Query the collection."""
- with Session(self._bind) as session: # type: ignore[arg-type]
+ with Session(self._bind) as session:
collection = self.get_collection(session)
if not collection:
raise ValueError("Collection not found")
diff --git a/libs/community/langchain_community/vectorstores/qdrant.py b/libs/community/langchain_community/vectorstores/qdrant.py
index 9f402718e66..b4a9c60b2c0 100644
--- a/libs/community/langchain_community/vectorstores/qdrant.py
+++ b/libs/community/langchain_community/vectorstores/qdrant.py
@@ -1049,7 +1049,7 @@ class Qdrant(VectorStore):
**kwargs,
)
embeddings = [
- result.vector.get(self.vector_name) # type: ignore[index, union-attr]
+ result.vector.get(self.vector_name)
if self.vector_name is not None
else result.vector
for result in results
@@ -1124,7 +1124,7 @@ class Qdrant(VectorStore):
**kwargs,
)
embeddings = [
- result.vector.get(self.vector_name) # type: ignore[index, union-attr]
+ result.vector.get(self.vector_name)
if self.vector_name is not None
else result.vector
for result in results
@@ -1673,7 +1673,7 @@ class Qdrant(VectorStore):
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
- current_vector_config = current_vector_config.get(vector_name) # type: ignore[assignment]
+ current_vector_config = current_vector_config.get(vector_name)
elif isinstance(current_vector_config, dict) and vector_name is None:
raise QdrantException(
f"Existing Qdrant collection {collection_name} uses named vectors. "
@@ -1694,18 +1694,16 @@ class Qdrant(VectorStore):
)
# Check if the vector configuration has the same dimensionality.
- if current_vector_config.size != vector_size: # type: ignore[union-attr]
+ if current_vector_config.size != vector_size:
raise QdrantException(
f"Existing Qdrant collection is configured for vectors with "
- f"{current_vector_config.size} " # type: ignore[union-attr]
+ f"{current_vector_config.size} "
f"dimensions. Selected embeddings are {vector_size}-dimensional. "
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
- current_distance_func = (
- current_vector_config.distance.name.upper() # type: ignore[union-attr]
- )
+ current_distance_func = current_vector_config.distance.name.upper()
if current_distance_func != distance_func:
raise QdrantException(
f"Existing Qdrant collection is configured for "
@@ -1725,7 +1723,7 @@ class Qdrant(VectorStore):
# If vector name was provided, we're going to use the named vectors feature
# with just a single vector.
if vector_name is not None:
- vectors_config = { # type: ignore[assignment]
+ vectors_config = {
vector_name: vectors_config,
}
@@ -1741,7 +1739,7 @@ class Qdrant(VectorStore):
wal_config=wal_config,
quantization_config=quantization_config,
init_from=init_from,
- timeout=timeout, # type: ignore[arg-type]
+ timeout=timeout,
)
qdrant = cls(
client=client,
@@ -1838,7 +1836,7 @@ class Qdrant(VectorStore):
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
- current_vector_config = current_vector_config.get(vector_name) # type: ignore[assignment]
+ current_vector_config = current_vector_config.get(vector_name)
elif isinstance(current_vector_config, dict) and vector_name is None:
raise QdrantException(
f"Existing Qdrant collection {collection_name} uses named vectors. "
@@ -1859,22 +1857,20 @@ class Qdrant(VectorStore):
)
# Check if the vector configuration has the same dimensionality.
- if current_vector_config.size != vector_size: # type: ignore[union-attr]
+ if current_vector_config.size != vector_size:
raise QdrantException(
f"Existing Qdrant collection is configured for vectors with "
- f"{current_vector_config.size} " # type: ignore[union-attr]
+ f"{current_vector_config.size} "
f"dimensions. Selected embeddings are {vector_size}-dimensional. "
f"If you want to recreate the collection, set `force_recreate` "
f"parameter to `True`."
)
- current_distance_func = (
- current_vector_config.distance.name.upper() # type: ignore[union-attr]
- )
+ current_distance_func = current_vector_config.distance.name.upper()
if current_distance_func != distance_func:
raise QdrantException(
f"Existing Qdrant collection is configured for "
- f"{current_vector_config.distance} " # type: ignore[union-attr]
+ f"{current_vector_config.distance} "
f"similarity. Please set `distance_func` parameter to "
f"`{distance_func}` if you want to reuse it. If you want to "
f"recreate the collection, set `force_recreate` parameter to "
@@ -1890,7 +1886,7 @@ class Qdrant(VectorStore):
# If vector name was provided, we're going to use the named vectors feature
# with just a single vector.
if vector_name is not None:
- vectors_config = { # type: ignore[assignment]
+ vectors_config = {
vector_name: vectors_config,
}
@@ -1906,7 +1902,7 @@ class Qdrant(VectorStore):
wal_config=wal_config,
quantization_config=quantization_config,
init_from=init_from,
- timeout=timeout, # type: ignore[arg-type]
+ timeout=timeout,
)
qdrant = cls(
client=client,
diff --git a/libs/community/langchain_community/vectorstores/redis/base.py b/libs/community/langchain_community/vectorstores/redis/base.py
index a4efc12a7d9..36c9ebae359 100644
--- a/libs/community/langchain_community/vectorstores/redis/base.py
+++ b/libs/community/langchain_community/vectorstores/redis/base.py
@@ -1429,7 +1429,7 @@ def _prepare_metadata(metadata: Dict[str, Any]) -> Dict[str, Any]:
return clean_meta
-class RedisVectorStoreRetriever(VectorStoreRetriever): # type: ignore[override]
+class RedisVectorStoreRetriever(VectorStoreRetriever):
"""Retriever for Redis VectorStore."""
vectorstore: Redis
diff --git a/libs/community/langchain_community/vectorstores/redis/schema.py b/libs/community/langchain_community/vectorstores/redis/schema.py
index c613c9a7621..ac6b0cfc1d2 100644
--- a/libs/community/langchain_community/vectorstores/redis/schema.py
+++ b/libs/community/langchain_community/vectorstores/redis/schema.py
@@ -124,7 +124,7 @@ class RedisVectorField(RedisField):
return field_data
-class FlatVectorField(RedisVectorField): # type: ignore[override]
+class FlatVectorField(RedisVectorField):
"""Schema for flat vector fields in Redis."""
algorithm: Literal["FLAT"] = "FLAT"
@@ -139,7 +139,7 @@ class FlatVectorField(RedisVectorField): # type: ignore[override]
return VectorField(self.name, self.algorithm, field_data)
-class HNSWVectorField(RedisVectorField): # type: ignore[override]
+class HNSWVectorField(RedisVectorField):
"""Schema for HNSW vector fields in Redis."""
algorithm: Literal["HNSW"] = "HNSW"
diff --git a/libs/community/langchain_community/vectorstores/starrocks.py b/libs/community/langchain_community/vectorstores/starrocks.py
index d3ce2dcc9b5..8c24a794c44 100644
--- a/libs/community/langchain_community/vectorstores/starrocks.py
+++ b/libs/community/langchain_community/vectorstores/starrocks.py
@@ -162,7 +162,7 @@ class StarRocks(VectorStore):
config (StarRocksSettings): Configuration to StarRocks Client
"""
try:
- import pymysql # type: ignore[import]
+ import pymysql # type: ignore[import-untyped]
except ImportError:
raise ImportError(
"Could not import pymysql python package. "
diff --git a/libs/community/langchain_community/vectorstores/thirdai_neuraldb.py b/libs/community/langchain_community/vectorstores/thirdai_neuraldb.py
index 17d0d6318a3..45b15fafa8d 100644
--- a/libs/community/langchain_community/vectorstores/thirdai_neuraldb.py
+++ b/libs/community/langchain_community/vectorstores/thirdai_neuraldb.py
@@ -81,7 +81,7 @@ class NeuralDBVectorStore(VectorStore):
NeuralDBVectorStore._verify_thirdai_library(thirdai_key)
from thirdai import neural_db as ndb
- return cls(db=ndb.NeuralDB(**model_kwargs)) # type: ignore[call-arg]
+ return cls(db=ndb.NeuralDB(**model_kwargs))
@classmethod
def from_checkpoint( # type: ignore[no-untyped-def]
@@ -116,7 +116,7 @@ class NeuralDBVectorStore(VectorStore):
NeuralDBVectorStore._verify_thirdai_library(thirdai_key)
from thirdai import neural_db as ndb
- return cls(db=ndb.NeuralDB.from_checkpoint(checkpoint)) # type: ignore[call-arg]
+ return cls(db=ndb.NeuralDB.from_checkpoint(checkpoint))
@classmethod
def from_texts(
@@ -157,7 +157,7 @@ class NeuralDBVectorStore(VectorStore):
df = pd.DataFrame({"texts": texts})
if metadatas:
df = pd.concat([df, pd.DataFrame.from_records(metadatas)], axis=1)
- temp = tempfile.NamedTemporaryFile("w", delete=False, delete_on_close=False) # type: ignore[call-overload]
+ temp = tempfile.NamedTemporaryFile("w", delete=False, delete_on_close=False) # type: ignore[call-overload,unused-ignore]
df.to_csv(temp)
source_id = self.insert([ndb.CSV(temp.name)], **kwargs)[0]
offset = self.db._savable_state.documents.get_source_by_id(source_id)[1]
diff --git a/libs/community/langchain_community/vectorstores/vectara.py b/libs/community/langchain_community/vectorstores/vectara.py
index a5d80589525..7c48f184e4c 100644
--- a/libs/community/langchain_community/vectorstores/vectara.py
+++ b/libs/community/langchain_community/vectorstores/vectara.py
@@ -731,7 +731,7 @@ class Vectara(VectorStore):
)
-class VectaraRetriever(VectorStoreRetriever): # type: ignore[override]
+class VectaraRetriever(VectorStoreRetriever):
"""Vectara Retriever class."""
vectorstore: Vectara
diff --git a/libs/community/langchain_community/vectorstores/vikingdb.py b/libs/community/langchain_community/vectorstores/vikingdb.py
index 2e0a9b0c57f..485f4876a9c 100644
--- a/libs/community/langchain_community/vectorstores/vikingdb.py
+++ b/libs/community/langchain_community/vectorstores/vikingdb.py
@@ -222,7 +222,7 @@ class VikingDB(VectorStore):
end = min(i + batch_size, total_count)
insert_data = data[i:end]
# print(insert_data)
- self.collection.upsert_data(insert_data) # type: ignore[union-attr]
+ self.collection.upsert_data(insert_data)
return pks
def similarity_search( # type: ignore[override]
@@ -394,7 +394,7 @@ class VikingDB(VectorStore):
) -> None:
if self.collection is None:
logger.debug("No existing collection to search.")
- self.collection.delete_data(ids) # type: ignore[union-attr]
+ self.collection.delete_data(ids)
@classmethod
def from_texts( # type: ignore[no-untyped-def, override]
diff --git a/libs/community/pyproject.toml b/libs/community/pyproject.toml
index 3811b99d48d..1569d155c93 100644
--- a/libs/community/pyproject.toml
+++ b/libs/community/pyproject.toml
@@ -95,7 +95,7 @@ exclude = [
[tool.mypy]
ignore_missing_imports = "True"
disallow_untyped_defs = "True"
-exclude = ["notebooks", "examples", "example_data"]
+warn_unused_ignores = "True"
[tool.codespell]
skip = ".git,*.pdf,*.svg,*.pdf,*.yaml,*.ipynb,poetry.lock,*.min.js,*.css,package-lock.json,example_data,_dist,examples,*.trig"
diff --git a/libs/community/tests/integration_tests/adapters/test_openai.py b/libs/community/tests/integration_tests/adapters/test_openai.py
index 644f3cc7ffe..3f8f6c01c8d 100644
--- a/libs/community/tests/integration_tests/adapters/test_openai.py
+++ b/libs/community/tests/integration_tests/adapters/test_openai.py
@@ -6,7 +6,7 @@ from langchain_community.adapters import openai as lcopenai
def _test_no_stream(**kwargs: Any) -> None:
import openai
- result = openai.ChatCompletion.create(**kwargs) # type: ignore[attr-defined]
+ result = openai.ChatCompletion.create(**kwargs)
lc_result = lcopenai.ChatCompletion.create(**kwargs)
if isinstance(lc_result, dict):
if isinstance(result, dict):
@@ -20,7 +20,7 @@ def _test_stream(**kwargs: Any) -> None:
import openai
result = []
- for c in openai.ChatCompletion.create(**kwargs): # type: ignore[attr-defined]
+ for c in openai.ChatCompletion.create(**kwargs):
result.append(c["choices"][0]["delta"].to_dict_recursive())
lc_result = []
@@ -32,7 +32,7 @@ def _test_stream(**kwargs: Any) -> None:
async def _test_async(**kwargs: Any) -> None:
import openai
- result = await openai.ChatCompletion.acreate(**kwargs) # type: ignore[attr-defined]
+ result = await openai.ChatCompletion.acreate(**kwargs)
lc_result = await lcopenai.ChatCompletion.acreate(**kwargs)
if isinstance(lc_result, dict):
if isinstance(result, dict):
@@ -46,7 +46,7 @@ async def _test_astream(**kwargs: Any) -> None:
import openai
result = []
- async for c in await openai.ChatCompletion.acreate(**kwargs): # type: ignore[attr-defined]
+ async for c in await openai.ChatCompletion.acreate(**kwargs):
result.append(c["choices"][0]["delta"].to_dict_recursive())
lc_result = []
diff --git a/libs/community/tests/integration_tests/chains/test_ontotext_graphdb_qa.py b/libs/community/tests/integration_tests/chains/test_ontotext_graphdb_qa.py
index 85785f660b5..54486d7101a 100644
--- a/libs/community/tests/integration_tests/chains/test_ontotext_graphdb_qa.py
+++ b/libs/community/tests/integration_tests/chains/test_ontotext_graphdb_qa.py
@@ -375,9 +375,9 @@ def test_chain(model_name: str, question: str) -> None:
"FROM WHERE {?s ?p ?o}",
)
chain = OntotextGraphDBQAChain.from_llm(
- ChatOpenAI(temperature=0, model_name=model_name), # type: ignore[call-arg]
+ ChatOpenAI(temperature=0, model_name=model_name),
graph=graph,
- verbose=True, # type: ignore[call-arg]
+ verbose=True,
)
try:
chain.invoke({chain.input_key: question})
diff --git a/libs/community/tests/integration_tests/chat_models/test_bedrock.py b/libs/community/tests/integration_tests/chat_models/test_bedrock.py
index 5d7ea6dc91f..46a9293d30c 100644
--- a/libs/community/tests/integration_tests/chat_models/test_bedrock.py
+++ b/libs/community/tests/integration_tests/chat_models/test_bedrock.py
@@ -109,7 +109,7 @@ def test_bedrock_streaming(chat: BedrockChat) -> None:
full = None
for token in chat.stream("I'm Pickle Rick"):
- full = token if full is None else full + token # type: ignore[operator]
+ full = token if full is None else full + token
assert isinstance(token.content, str)
assert isinstance(cast(AIMessageChunk, full).content, str)
diff --git a/libs/community/tests/integration_tests/chat_models/test_jinachat.py b/libs/community/tests/integration_tests/chat_models/test_jinachat.py
index 50b641311cf..4188c4f5207 100644
--- a/libs/community/tests/integration_tests/chat_models/test_jinachat.py
+++ b/libs/community/tests/integration_tests/chat_models/test_jinachat.py
@@ -14,7 +14,7 @@ from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler
def test_jinachat_api_key_is_secret_string() -> None:
- llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type]
assert isinstance(llm.jinachat_api_key, SecretStr)
@@ -23,7 +23,7 @@ def test_jinachat_api_key_masked_when_passed_from_env(
) -> None:
"""Test initialization with an API key provided via an env variable"""
monkeypatch.setenv("JINACHAT_API_KEY", "secret-api-key")
- llm = JinaChat() # type: ignore[call-arg]
+ llm = JinaChat()
print(llm.jinachat_api_key, end="") # noqa: T201
captured = capsys.readouterr()
@@ -34,7 +34,7 @@ def test_jinachat_api_key_masked_when_passed_via_constructor(
capsys: CaptureFixture,
) -> None:
"""Test initialization with an API key provided via the initializer"""
- llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type]
print(llm.jinachat_api_key, end="") # noqa: T201
captured = capsys.readouterr()
@@ -43,13 +43,13 @@ def test_jinachat_api_key_masked_when_passed_via_constructor(
def test_uses_actual_secret_value_from_secretstr() -> None:
"""Test that actual secret is retrieved using `.get_secret_value()`."""
- llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = JinaChat(jinachat_api_key="secret-api-key") # type: ignore[arg-type]
assert cast(SecretStr, llm.jinachat_api_key).get_secret_value() == "secret-api-key"
def test_jinachat() -> None:
"""Test JinaChat wrapper."""
- chat = JinaChat(max_tokens=10) # type: ignore[call-arg]
+ chat = JinaChat(max_tokens=10)
message = HumanMessage(content="Hello")
response = chat.invoke([message])
assert isinstance(response, BaseMessage)
@@ -58,7 +58,7 @@ def test_jinachat() -> None:
def test_jinachat_system_message() -> None:
"""Test JinaChat wrapper with system message."""
- chat = JinaChat(max_tokens=10) # type: ignore[call-arg]
+ chat = JinaChat(max_tokens=10)
system_message = SystemMessage(content="You are to chat with the user.")
human_message = HumanMessage(content="Hello")
response = chat.invoke([system_message, human_message])
@@ -68,7 +68,7 @@ def test_jinachat_system_message() -> None:
def test_jinachat_generate() -> None:
"""Test JinaChat wrapper with generate."""
- chat = JinaChat(max_tokens=10) # type: ignore[call-arg]
+ chat = JinaChat(max_tokens=10)
message = HumanMessage(content="Hello")
response = chat.generate([[message], [message]])
assert isinstance(response, LLMResult)
@@ -85,7 +85,7 @@ def test_jinachat_streaming() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler()
callback_manager = CallbackManager([callback_handler])
- chat = JinaChat( # type: ignore[call-arg]
+ chat = JinaChat(
max_tokens=10,
streaming=True,
temperature=0,
@@ -100,7 +100,7 @@ def test_jinachat_streaming() -> None:
async def test_async_jinachat() -> None:
"""Test async generation."""
- chat = JinaChat(max_tokens=102) # type: ignore[call-arg]
+ chat = JinaChat(max_tokens=102)
message = HumanMessage(content="Hello")
response = await chat.agenerate([[message], [message]])
assert isinstance(response, LLMResult)
@@ -117,7 +117,7 @@ async def test_async_jinachat_streaming() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler()
callback_manager = CallbackManager([callback_handler])
- chat = JinaChat( # type: ignore[call-arg]
+ chat = JinaChat(
max_tokens=10,
streaming=True,
temperature=0,
@@ -154,4 +154,4 @@ def test_jinachat_extra_kwargs() -> None:
# Test that if explicit param is specified in kwargs it errors
with pytest.raises(ValueError):
- JinaChat(model_kwargs={"temperature": 0.2}) # type: ignore[call-arg]
+ JinaChat(model_kwargs={"temperature": 0.2})
diff --git a/libs/community/tests/integration_tests/chat_models/test_litellm.py b/libs/community/tests/integration_tests/chat_models/test_litellm.py
index 27be6e79312..6d1f9bce9d4 100644
--- a/libs/community/tests/integration_tests/chat_models/test_litellm.py
+++ b/libs/community/tests/integration_tests/chat_models/test_litellm.py
@@ -14,7 +14,7 @@ from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler
def test_litellm_call() -> None:
"""Test valid call to litellm."""
- chat = ChatLiteLLM( # type: ignore[call-arg]
+ chat = ChatLiteLLM(
model="test",
)
message = HumanMessage(content="Hello")
@@ -25,7 +25,7 @@ def test_litellm_call() -> None:
def test_litellm_generate() -> None:
"""Test generate method of anthropic."""
- chat = ChatLiteLLM(model="test") # type: ignore[call-arg]
+ chat = ChatLiteLLM(model="test")
chat_messages: List[List[BaseMessage]] = [
[HumanMessage(content="How many toes do dogs have?")]
]
@@ -41,7 +41,7 @@ def test_litellm_generate() -> None:
def test_litellm_streaming() -> None:
"""Test streaming tokens from anthropic."""
- chat = ChatLiteLLM(model="test", streaming=True) # type: ignore[call-arg]
+ chat = ChatLiteLLM(model="test", streaming=True)
message = HumanMessage(content="Hello")
response = chat.invoke([message])
assert isinstance(response, AIMessage)
@@ -52,7 +52,7 @@ def test_litellm_streaming_callback() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler()
callback_manager = CallbackManager([callback_handler])
- chat = ChatLiteLLM( # type: ignore[call-arg]
+ chat = ChatLiteLLM(
model="test",
streaming=True,
callback_manager=callback_manager,
diff --git a/libs/community/tests/integration_tests/chat_models/test_minimax.py b/libs/community/tests/integration_tests/chat_models/test_minimax.py
index 45127107f58..a41dcc0b60a 100644
--- a/libs/community/tests/integration_tests/chat_models/test_minimax.py
+++ b/libs/community/tests/integration_tests/chat_models/test_minimax.py
@@ -52,7 +52,7 @@ def test_chat_minimax_with_tool() -> None:
messages.append(ai_msg) # type: ignore[arg-type]
for tool_call in ai_msg.tool_calls:
selected_tool = {"add": add, "multiply": multiply}[tool_call["name"].lower()]
- tool_output = selected_tool.invoke(tool_call["args"]) # type: ignore[attr-defined]
+ tool_output = selected_tool.invoke(tool_call["args"])
messages.append(ToolMessage(tool_output, tool_call_id=tool_call["id"])) # type: ignore[arg-type]
response = chat_with_tools.invoke(messages)
assert isinstance(response, AIMessage)
diff --git a/libs/community/tests/integration_tests/chat_models/test_premai.py b/libs/community/tests/integration_tests/chat_models/test_premai.py
index 2f67b656545..cd297bd23a1 100644
--- a/libs/community/tests/integration_tests/chat_models/test_premai.py
+++ b/libs/community/tests/integration_tests/chat_models/test_premai.py
@@ -14,12 +14,12 @@ from langchain_community.chat_models import ChatPremAI
@pytest.fixture
def chat() -> ChatPremAI:
- return ChatPremAI(project_id=8) # type: ignore[call-arg]
+ return ChatPremAI(project_id=8)
def test_chat_premai() -> None:
"""Test ChatPremAI wrapper."""
- chat = ChatPremAI(project_id=8) # type: ignore[call-arg]
+ chat = ChatPremAI(project_id=8)
message = HumanMessage(content="Hello")
response = chat.invoke([message])
assert isinstance(response, BaseMessage)
@@ -28,7 +28,7 @@ def test_chat_premai() -> None:
def test_chat_prem_system_message() -> None:
"""Test ChatPremAI wrapper for system message"""
- chat = ChatPremAI(project_id=8) # type: ignore[call-arg]
+ chat = ChatPremAI(project_id=8)
system_message = SystemMessage(content="You are to chat with the user.")
human_message = HumanMessage(content="Hello")
response = chat.invoke([system_message, human_message])
@@ -44,7 +44,7 @@ def test_chat_prem_model() -> None:
def test_chat_prem_generate() -> None:
"""Test ChatPremAI wrapper with generate."""
- chat = ChatPremAI(project_id=8) # type: ignore[call-arg]
+ chat = ChatPremAI(project_id=8)
message = HumanMessage(content="Hello")
response = chat.generate([[message], [message]])
assert isinstance(response, LLMResult)
@@ -64,7 +64,7 @@ async def test_prem_invoke(chat: ChatPremAI) -> None:
def test_prem_streaming() -> None:
"""Test streaming tokens from Prem."""
- chat = ChatPremAI(project_id=8, streaming=True) # type: ignore[call-arg]
+ chat = ChatPremAI(project_id=8, streaming=True)
for token in chat.stream("I'm Pickle Rick"):
assert isinstance(token.content, str)
diff --git a/libs/community/tests/integration_tests/chat_models/test_qianfan_endpoint.py b/libs/community/tests/integration_tests/chat_models/test_qianfan_endpoint.py
index 6749090eb2c..f2e624daa48 100644
--- a/libs/community/tests/integration_tests/chat_models/test_qianfan_endpoint.py
+++ b/libs/community/tests/integration_tests/chat_models/test_qianfan_endpoint.py
@@ -89,7 +89,7 @@ def test_initialization() -> None:
"""Test chat model initialization."""
for model in [
- QianfanChatEndpoint(model="BLOOMZ-7B", timeout=40), # type: ignore[call-arg]
+ QianfanChatEndpoint(model="BLOOMZ-7B", timeout=40),
QianfanChatEndpoint(model="BLOOMZ-7B", request_timeout=40), # type: ignore[call-arg]
]:
assert model.model == "BLOOMZ-7B"
@@ -132,7 +132,7 @@ def test_endpoint_param() -> None:
"""Test user custom model deployments like some open source models."""
chat = QianfanChatEndpoint() # type: ignore[call-arg]
response = chat.invoke(
- [HumanMessage(endpoint="qianfan_bloomz_7b_compressed", content="Hello")] # type: ignore[call-arg]
+ [HumanMessage(endpoint="qianfan_bloomz_7b_compressed", content="Hello")]
)
assert isinstance(response, BaseMessage)
assert isinstance(response.content, str)
@@ -261,7 +261,7 @@ def test_functions_call_thoughts() -> None:
prompt_msgs = [
HumanMessagePromptTemplate.from_template(prompt_tmpl),
]
- prompt = ChatPromptTemplate(messages=prompt_msgs) # type: ignore[arg-type, call-arg]
+ prompt = ChatPromptTemplate(messages=prompt_msgs)
chain = prompt | chat.bind(functions=_FUNCTIONS)
@@ -274,7 +274,7 @@ def test_functions_call_thoughts() -> None:
def test_functions_call() -> None:
chat = QianfanChatEndpoint(model="ERNIE-Bot") # type: ignore[call-arg]
- prompt = ChatPromptTemplate( # type: ignore[call-arg]
+ prompt = ChatPromptTemplate(
messages=[
HumanMessage(content="What's the temperature in Shanghai today?"),
AIMessage(
@@ -340,8 +340,8 @@ def test_qianfan_key_masked_when_passed_via_constructor(
) -> None:
"""Test initialization with an API key provided via the initializer"""
chat = QianfanChatEndpoint( # type: ignore[call-arg]
- qianfan_ak="test-api-key", # type: ignore[arg-type]
- qianfan_sk="test-secret-key", # type: ignore[arg-type]
+ qianfan_ak="test-api-key",
+ qianfan_sk="test-secret-key",
)
print(chat.qianfan_ak, end="") # noqa: T201
captured = capsys.readouterr()
@@ -356,8 +356,8 @@ def test_qianfan_key_masked_when_passed_via_constructor(
def test_uses_actual_secret_value_from_secret_str() -> None:
"""Test that actual secret is retrieved using `.get_secret_value()`."""
chat = QianfanChatEndpoint( # type: ignore[call-arg]
- qianfan_ak="test-api-key", # type: ignore[arg-type]
- qianfan_sk="test-secret-key", # type: ignore[arg-type]
+ qianfan_ak="test-api-key",
+ qianfan_sk="test-secret-key",
)
assert cast(SecretStr, chat.qianfan_ak).get_secret_value() == "test-api-key"
assert cast(SecretStr, chat.qianfan_sk).get_secret_value() == "test-secret-key"
@@ -371,8 +371,8 @@ def test_init_api_key_param() -> None:
secret_key="test-secret-key", # type: ignore[arg-type]
),
QianfanChatEndpoint( # type: ignore[call-arg]
- qianfan_ak="test-api-key", # type: ignore[arg-type]
- qianfan_sk="test-secret-key", # type: ignore[arg-type]
+ qianfan_ak="test-api-key",
+ qianfan_sk="test-secret-key",
),
]:
assert cast(SecretStr, chat.qianfan_ak).get_secret_value() == "test-api-key"
diff --git a/libs/community/tests/integration_tests/chat_models/test_tongyi.py b/libs/community/tests/integration_tests/chat_models/test_tongyi.py
index 50d1d81c99d..0eee4d39b2a 100644
--- a/libs/community/tests/integration_tests/chat_models/test_tongyi.py
+++ b/libs/community/tests/integration_tests/chat_models/test_tongyi.py
@@ -103,7 +103,7 @@ def test_functions_call_thoughts() -> None:
prompt_msgs = [
HumanMessagePromptTemplate.from_template(prompt_tmpl),
]
- prompt = ChatPromptTemplate(messages=prompt_msgs) # type: ignore[arg-type, call-arg]
+ prompt = ChatPromptTemplate(messages=prompt_msgs)
chain = prompt | chat.bind(functions=_FUNCTIONS)
diff --git a/libs/community/tests/integration_tests/chat_models/test_volcengine_maas.py b/libs/community/tests/integration_tests/chat_models/test_volcengine_maas.py
index d236ae22511..24002ec617f 100644
--- a/libs/community/tests/integration_tests/chat_models/test_volcengine_maas.py
+++ b/libs/community/tests/integration_tests/chat_models/test_volcengine_maas.py
@@ -10,7 +10,7 @@ from tests.unit_tests.callbacks.fake_callback_handler import FakeCallbackHandler
def test_default_call() -> None:
"""Test valid chat call to volc engine."""
- chat = VolcEngineMaasChat() # type: ignore[call-arg]
+ chat = VolcEngineMaasChat()
response = chat.invoke([HumanMessage(content="Hello")])
assert isinstance(response, BaseMessage)
assert isinstance(response.content, str)
@@ -18,7 +18,7 @@ def test_default_call() -> None:
def test_multiple_history() -> None:
"""Tests multiple history works."""
- chat = VolcEngineMaasChat() # type: ignore[call-arg]
+ chat = VolcEngineMaasChat()
response = chat.invoke(
[
@@ -33,7 +33,7 @@ def test_multiple_history() -> None:
def test_stream() -> None:
"""Test that stream works."""
- chat = VolcEngineMaasChat(streaming=True) # type: ignore[call-arg]
+ chat = VolcEngineMaasChat(streaming=True)
callback_handler = FakeCallbackHandler()
callback_manager = CallbackManager([callback_handler])
response = chat.invoke(
@@ -51,7 +51,7 @@ def test_stream() -> None:
def test_stop() -> None:
"""Test that stop works."""
- chat = VolcEngineMaasChat( # type: ignore[call-arg]
+ chat = VolcEngineMaasChat(
model="skylark2-pro-4k", model_version="1.2", streaming=True
)
callback_handler = FakeCallbackHandler()
@@ -73,7 +73,7 @@ def test_stop() -> None:
def test_multiple_messages() -> None:
"""Tests multiple messages works."""
- chat = VolcEngineMaasChat() # type: ignore[call-arg]
+ chat = VolcEngineMaasChat()
message = HumanMessage(content="Hi, how are you?")
response = chat.generate([[message], [message]])
diff --git a/libs/community/tests/integration_tests/chat_models/test_zhipuai.py b/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
index 1f94712a259..3182947291f 100644
--- a/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
+++ b/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
@@ -88,7 +88,7 @@ def multiply(a: int, b: int) -> int:
def test_tool_call() -> None:
"""Test tool calling by ChatZhipuAI"""
- chat = ChatZhipuAI(model="glm-4-long") # type: ignore[call-arg]
+ chat = ChatZhipuAI(model="glm-4-long")
tools = [add, multiply]
chat_with_tools = chat.bind_tools(tools)
@@ -103,7 +103,7 @@ def test_tool_call() -> None:
messages.append(ai_msg) # type: ignore[arg-type]
for tool_call in ai_msg.tool_calls:
selected_tool = {"add": add, "multiply": multiply}[tool_call["name"].lower()]
- tool_output = selected_tool.invoke(tool_call["args"]) # type: ignore[attr-defined]
+ tool_output = selected_tool.invoke(tool_call["args"])
messages.append(ToolMessage(tool_output, tool_call_id=tool_call["id"])) # type: ignore[arg-type]
response = chat_with_tools.invoke(messages)
assert isinstance(response, AIMessage)
diff --git a/libs/community/tests/integration_tests/embeddings/test_azure_openai.py b/libs/community/tests/integration_tests/embeddings/test_azure_openai.py
index 5f304551b22..7f895055ea2 100644
--- a/libs/community/tests/integration_tests/embeddings/test_azure_openai.py
+++ b/libs/community/tests/integration_tests/embeddings/test_azure_openai.py
@@ -105,7 +105,7 @@ def test_azure_openai_embedding_with_empty_string() -> None:
output = embedding.embed_documents(document)
assert len(output) == 2
assert len(output[0]) == 1536
- expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[ # type: ignore[attr-defined]
+ expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[
"data"
][0]["embedding"]
assert np.allclose(output[0], expected_output)
diff --git a/libs/community/tests/integration_tests/embeddings/test_baichuan.py b/libs/community/tests/integration_tests/embeddings/test_baichuan.py
index 0c68d65c996..edfcf249510 100644
--- a/libs/community/tests/integration_tests/embeddings/test_baichuan.py
+++ b/libs/community/tests/integration_tests/embeddings/test_baichuan.py
@@ -6,7 +6,7 @@ from langchain_community.embeddings.baichuan import BaichuanTextEmbeddings
def test_baichuan_embedding_documents() -> None:
"""Test Baichuan Text Embedding for documents."""
documents = ["今天天气不错", "今天阳光灿烂"]
- embedding = BaichuanTextEmbeddings() # type: ignore[call-arg]
+ embedding = BaichuanTextEmbeddings()
output = embedding.embed_documents(documents)
assert len(output) == 2 # type: ignore[arg-type]
assert len(output[0]) == 1024 # type: ignore[index]
@@ -15,7 +15,7 @@ def test_baichuan_embedding_documents() -> None:
def test_baichuan_embedding_query() -> None:
"""Test Baichuan Text Embedding for query."""
document = "所有的小学生都会学过只因兔同笼问题。"
- embedding = BaichuanTextEmbeddings() # type: ignore[call-arg]
+ embedding = BaichuanTextEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 1024 # type: ignore[arg-type]
@@ -24,7 +24,7 @@ def test_baichuan_embeddings_multi_documents() -> None:
"""Test Baichuan Text Embedding for documents with multi texts."""
document = "午餐吃了螺蛳粉"
doc_amount = 35
- embeddings = BaichuanTextEmbeddings() # type: ignore[call-arg]
+ embeddings = BaichuanTextEmbeddings()
output = embeddings.embed_documents([document] * doc_amount)
assert len(output) == doc_amount # type: ignore[arg-type]
assert len(output[0]) == 1024 # type: ignore[index]
diff --git a/libs/community/tests/integration_tests/embeddings/test_cohere.py b/libs/community/tests/integration_tests/embeddings/test_cohere.py
index 6ca91681af0..a06db9c7f41 100644
--- a/libs/community/tests/integration_tests/embeddings/test_cohere.py
+++ b/libs/community/tests/integration_tests/embeddings/test_cohere.py
@@ -6,7 +6,7 @@ from langchain_community.embeddings.cohere import CohereEmbeddings
def test_cohere_embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
- embedding = CohereEmbeddings() # type: ignore[call-arg]
+ embedding = CohereEmbeddings()
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) == 2048
@@ -15,6 +15,6 @@ def test_cohere_embedding_documents() -> None:
def test_cohere_embedding_query() -> None:
"""Test cohere embeddings."""
document = "foo bar"
- embedding = CohereEmbeddings() # type: ignore[call-arg]
+ embedding = CohereEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 2048
diff --git a/libs/community/tests/integration_tests/embeddings/test_dashscope.py b/libs/community/tests/integration_tests/embeddings/test_dashscope.py
index b60b51cf517..33f654ce527 100644
--- a/libs/community/tests/integration_tests/embeddings/test_dashscope.py
+++ b/libs/community/tests/integration_tests/embeddings/test_dashscope.py
@@ -8,7 +8,7 @@ from langchain_community.embeddings.dashscope import DashScopeEmbeddings
def test_dashscope_embedding_documents() -> None:
"""Test dashscope embeddings."""
documents = ["foo bar"]
- embedding = DashScopeEmbeddings(model="text-embedding-v1") # type: ignore[call-arg]
+ embedding = DashScopeEmbeddings(model="text-embedding-v1")
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) == 1536
@@ -46,7 +46,7 @@ def test_dashscope_embedding_documents_multiple() -> None:
"foo23",
"foo24",
]
- embedding = DashScopeEmbeddings(model="text-embedding-v1") # type: ignore[call-arg]
+ embedding = DashScopeEmbeddings(model="text-embedding-v1")
output = embedding.embed_documents(documents)
assert len(output) == 28
assert len(output[0]) == 1536
@@ -57,7 +57,7 @@ def test_dashscope_embedding_documents_multiple() -> None:
def test_dashscope_embedding_query() -> None:
"""Test dashscope embeddings."""
document = "foo bar"
- embedding = DashScopeEmbeddings(model="text-embedding-v1") # type: ignore[call-arg]
+ embedding = DashScopeEmbeddings(model="text-embedding-v1")
output = embedding.embed_query(document)
assert len(output) == 1536
@@ -67,7 +67,7 @@ def test_dashscope_embedding_with_empty_string() -> None:
import dashscope
document = ["", "abc"]
- embedding = DashScopeEmbeddings(model="text-embedding-v1") # type: ignore[call-arg]
+ embedding = DashScopeEmbeddings(model="text-embedding-v1")
output = embedding.embed_documents(document)
assert len(output) == 2
assert len(output[0]) == 1536
diff --git a/libs/community/tests/integration_tests/embeddings/test_fastembed.py b/libs/community/tests/integration_tests/embeddings/test_fastembed.py
index f39c4cedfb4..36acee1db4e 100644
--- a/libs/community/tests/integration_tests/embeddings/test_fastembed.py
+++ b/libs/community/tests/integration_tests/embeddings/test_fastembed.py
@@ -17,7 +17,7 @@ def test_fastembed_embedding_documents(
) -> None:
"""Test fastembed embeddings for documents."""
documents = ["foo bar", "bar foo"]
- embedding = FastEmbedEmbeddings( # type: ignore[call-arg]
+ embedding = FastEmbedEmbeddings(
model_name=model_name,
max_length=max_length,
doc_embed_type=doc_embed_type, # type: ignore[arg-type]
@@ -41,7 +41,7 @@ def test_fastembed_embedding_query(
document = "foo bar"
embedding = FastEmbedEmbeddings(
model_name=model_name, max_length=max_length, batch_size=batch_size
- ) # type: ignore[call-arg]
+ )
output = embedding.embed_query(document)
assert len(output) == 384
@@ -57,7 +57,7 @@ async def test_fastembed_async_embedding_documents(
) -> None:
"""Test fastembed embeddings for documents."""
documents = ["foo bar", "bar foo"]
- embedding = FastEmbedEmbeddings( # type: ignore[call-arg]
+ embedding = FastEmbedEmbeddings(
model_name=model_name,
max_length=max_length,
doc_embed_type=doc_embed_type, # type: ignore[arg-type]
@@ -77,7 +77,7 @@ async def test_fastembed_async_embedding_query(
) -> None:
"""Test fastembed embeddings for query."""
document = "foo bar"
- embedding = FastEmbedEmbeddings(model_name=model_name, max_length=max_length) # type: ignore[call-arg]
+ embedding = FastEmbedEmbeddings(model_name=model_name, max_length=max_length)
output = await embedding.aembed_query(document)
assert len(output) == 384
@@ -85,6 +85,6 @@ async def test_fastembed_async_embedding_query(
def test_fastembed_embedding_query_with_default_params() -> None:
"""Test fastembed embeddings for query with default model params"""
document = "foo bar"
- embedding = FastEmbedEmbeddings() # type: ignore[call-arg]
+ embedding = FastEmbedEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 384
diff --git a/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py b/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py
index 8ac2e41b5a4..813b4834e64 100644
--- a/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py
+++ b/libs/community/tests/integration_tests/embeddings/test_huggingface_hub.py
@@ -8,7 +8,7 @@ from langchain_community.embeddings import HuggingFaceHubEmbeddings
def test_huggingfacehub_embedding_documents() -> None:
"""Test huggingfacehub embeddings."""
documents = ["foo bar"]
- embedding = HuggingFaceHubEmbeddings() # type: ignore[call-arg]
+ embedding = HuggingFaceHubEmbeddings()
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) == 768
@@ -17,7 +17,7 @@ def test_huggingfacehub_embedding_documents() -> None:
async def test_huggingfacehub_embedding_async_documents() -> None:
"""Test huggingfacehub embeddings."""
documents = ["foo bar"]
- embedding = HuggingFaceHubEmbeddings() # type: ignore[call-arg]
+ embedding = HuggingFaceHubEmbeddings()
output = await embedding.aembed_documents(documents)
assert len(output) == 1
assert len(output[0]) == 768
@@ -26,7 +26,7 @@ async def test_huggingfacehub_embedding_async_documents() -> None:
def test_huggingfacehub_embedding_query() -> None:
"""Test huggingfacehub embeddings."""
document = "foo bar"
- embedding = HuggingFaceHubEmbeddings() # type: ignore[call-arg]
+ embedding = HuggingFaceHubEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 768
@@ -34,7 +34,7 @@ def test_huggingfacehub_embedding_query() -> None:
async def test_huggingfacehub_embedding_async_query() -> None:
"""Test huggingfacehub embeddings."""
document = "foo bar"
- embedding = HuggingFaceHubEmbeddings() # type: ignore[call-arg]
+ embedding = HuggingFaceHubEmbeddings()
output = await embedding.aembed_query(document)
assert len(output) == 768
@@ -43,4 +43,4 @@ def test_huggingfacehub_embedding_invalid_repo() -> None:
"""Test huggingfacehub embedding repo id validation."""
# Only sentence-transformers models are currently supported.
with pytest.raises(ValueError):
- HuggingFaceHubEmbeddings(repo_id="allenai/specter") # type: ignore[call-arg]
+ HuggingFaceHubEmbeddings(repo_id="allenai/specter")
diff --git a/libs/community/tests/integration_tests/embeddings/test_laser.py b/libs/community/tests/integration_tests/embeddings/test_laser.py
index df8e83bdd21..d3331d3a303 100644
--- a/libs/community/tests/integration_tests/embeddings/test_laser.py
+++ b/libs/community/tests/integration_tests/embeddings/test_laser.py
@@ -12,10 +12,10 @@ def test_laser_embedding_documents(lang: str) -> None:
User warning is returned by LASER library implementation
so will ignore in testing."""
documents = ["hello", "world"]
- embedding = LaserEmbeddings(lang=lang) # type: ignore[call-arg]
+ embedding = LaserEmbeddings(lang=lang)
output = embedding.embed_documents(documents)
- assert len(output) == 2 # type: ignore[arg-type]
- assert len(output[0]) == 1024 # type: ignore[index]
+ assert len(output) == 2
+ assert len(output[0]) == 1024
@pytest.mark.filterwarnings("ignore::UserWarning:")
@@ -25,6 +25,6 @@ def test_laser_embedding_query(lang: str) -> None:
User warning is returned by LASER library implementation
so will ignore in testing."""
query = "hello world"
- embedding = LaserEmbeddings(lang=lang) # type: ignore[call-arg]
+ embedding = LaserEmbeddings(lang=lang)
output = embedding.embed_query(query)
assert len(output) == 1024
diff --git a/libs/community/tests/integration_tests/embeddings/test_minimax.py b/libs/community/tests/integration_tests/embeddings/test_minimax.py
index 3bb949d9535..c00ef608bea 100644
--- a/libs/community/tests/integration_tests/embeddings/test_minimax.py
+++ b/libs/community/tests/integration_tests/embeddings/test_minimax.py
@@ -10,9 +10,9 @@ def test_initialization_with_alias() -> None:
api_key = "your-api-key"
group_id = "your-group-id"
- embeddings = MiniMaxEmbeddings( # type: ignore[arg-type, call-arg]
+ embeddings = MiniMaxEmbeddings(
api_key=api_key, # type: ignore[arg-type]
- group_id=group_id, # type: ignore[arg-type]
+ group_id=group_id,
)
assert cast(SecretStr, embeddings.minimax_api_key).get_secret_value() == api_key
diff --git a/libs/community/tests/integration_tests/embeddings/test_openai.py b/libs/community/tests/integration_tests/embeddings/test_openai.py
index 739b12593f8..ac6c0a6f8ba 100644
--- a/libs/community/tests/integration_tests/embeddings/test_openai.py
+++ b/libs/community/tests/integration_tests/embeddings/test_openai.py
@@ -71,7 +71,7 @@ def test_openai_embedding_with_empty_string() -> None:
output = embedding.embed_documents(document)
assert len(output) == 2
assert len(output[0]) == 1536
- expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[ # type: ignore[attr-defined]
+ expected_output = openai.Embedding.create(input="", model="text-embedding-ada-002")[
"data"
][0]["embedding"]
assert np.allclose(output[0], expected_output)
diff --git a/libs/community/tests/integration_tests/embeddings/test_qianfan_endpoint.py b/libs/community/tests/integration_tests/embeddings/test_qianfan_endpoint.py
index 6be6ecc5f8f..ba2d86c8f7d 100644
--- a/libs/community/tests/integration_tests/embeddings/test_qianfan_endpoint.py
+++ b/libs/community/tests/integration_tests/embeddings/test_qianfan_endpoint.py
@@ -11,7 +11,7 @@ from langchain_community.embeddings.baidu_qianfan_endpoint import (
def test_embedding_multiple_documents() -> None:
documents = ["foo", "bar"]
- embedding = QianfanEmbeddingsEndpoint() # type: ignore[call-arg]
+ embedding = QianfanEmbeddingsEndpoint()
output = embedding.embed_documents(documents)
assert len(output) == 2
assert len(output[0]) == 384
@@ -20,20 +20,20 @@ def test_embedding_multiple_documents() -> None:
def test_embedding_query() -> None:
query = "foo"
- embedding = QianfanEmbeddingsEndpoint() # type: ignore[call-arg]
+ embedding = QianfanEmbeddingsEndpoint()
output = embedding.embed_query(query)
assert len(output) == 384
def test_model() -> None:
documents = ["hi", "qianfan"]
- embedding = QianfanEmbeddingsEndpoint(model="Embedding-V1") # type: ignore[call-arg]
+ embedding = QianfanEmbeddingsEndpoint(model="Embedding-V1")
output = embedding.embed_documents(documents)
assert len(output) == 2
def test_rate_limit() -> None:
- llm = QianfanEmbeddingsEndpoint( # type: ignore[call-arg]
+ llm = QianfanEmbeddingsEndpoint(
model="Embedding-V1", init_kwargs={"query_per_second": 2}
)
assert llm.client._client._rate_limiter._sync_limiter._query_per_second == 2
@@ -49,7 +49,7 @@ def test_initialization_with_alias() -> None:
api_key = "your-api-key"
secret_key = "your-secret-key"
- embeddings = QianfanEmbeddingsEndpoint( # type: ignore[arg-type, call-arg]
+ embeddings = QianfanEmbeddingsEndpoint(
api_key=api_key, # type: ignore[arg-type]
secret_key=secret_key, # type: ignore[arg-type]
)
diff --git a/libs/community/tests/integration_tests/embeddings/test_self_hosted.py b/libs/community/tests/integration_tests/embeddings/test_self_hosted.py
index 1bf681d2250..8cf67c4e92f 100644
--- a/libs/community/tests/integration_tests/embeddings/test_self_hosted.py
+++ b/libs/community/tests/integration_tests/embeddings/test_self_hosted.py
@@ -78,7 +78,7 @@ def test_self_hosted_embedding_documents() -> None:
"""Test self-hosted huggingface instruct embeddings."""
documents = ["foo bar"] * 2
gpu = get_remote_instance()
- embedding = SelfHostedEmbeddings( # type: ignore[call-arg]
+ embedding = SelfHostedEmbeddings(
model_load_fn=get_pipeline, hardware=gpu, inference_fn=inference_fn
)
output = embedding.embed_documents(documents)
@@ -90,7 +90,7 @@ def test_self_hosted_embedding_query() -> None:
"""Test self-hosted custom embeddings."""
query = "foo bar"
gpu = get_remote_instance()
- embedding = SelfHostedEmbeddings( # type: ignore[call-arg]
+ embedding = SelfHostedEmbeddings(
model_load_fn=get_pipeline, hardware=gpu, inference_fn=inference_fn
)
output = embedding.embed_query(query)
diff --git a/libs/community/tests/integration_tests/embeddings/test_sparkllm.py b/libs/community/tests/integration_tests/embeddings/test_sparkllm.py
index 6c6581ca789..06589b3fb01 100644
--- a/libs/community/tests/integration_tests/embeddings/test_sparkllm.py
+++ b/libs/community/tests/integration_tests/embeddings/test_sparkllm.py
@@ -18,7 +18,7 @@ def test_baichuan_embedding_documents() -> None:
"understand and think, "
"creating a better world with artificial intelligence."
]
- embedding = SparkLLMTextEmbeddings() # type: ignore[call-arg]
+ embedding = SparkLLMTextEmbeddings()
output = embedding.embed_documents(documents)
assert len(output) == 1 # type: ignore[arg-type]
assert len(output[0]) == 2560 # type: ignore[index]
@@ -31,6 +31,6 @@ def test_baichuan_embedding_query() -> None:
"first Artificial Intelligence open platform for Mobile Internet "
"and intelligent hardware developers"
)
- embedding = SparkLLMTextEmbeddings() # type: ignore[call-arg]
+ embedding = SparkLLMTextEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 2560 # type: ignore[arg-type]
diff --git a/libs/community/tests/integration_tests/embeddings/test_zhipuai.py b/libs/community/tests/integration_tests/embeddings/test_zhipuai.py
index 894088832a5..72dc5ec539f 100644
--- a/libs/community/tests/integration_tests/embeddings/test_zhipuai.py
+++ b/libs/community/tests/integration_tests/embeddings/test_zhipuai.py
@@ -8,8 +8,8 @@ def test_zhipuai_embedding_documents() -> None:
documents = ["This is a test query1.", "This is a test query2."]
embedding = ZhipuAIEmbeddings() # type: ignore[call-arg]
res = embedding.embed_documents(documents)
- assert len(res) == 2 # type: ignore[arg-type]
- assert len(res[0]) == 1024 # type: ignore[index]
+ assert len(res) == 2
+ assert len(res[0]) == 1024
def test_zhipuai_embedding_query() -> None:
@@ -17,7 +17,7 @@ def test_zhipuai_embedding_query() -> None:
document = "This is a test query."
embedding = ZhipuAIEmbeddings() # type: ignore[call-arg]
res = embedding.embed_query(document)
- assert len(res) == 1024 # type: ignore[arg-type]
+ assert len(res) == 1024
def test_zhipuai_embedding_dimensions() -> None:
@@ -28,4 +28,4 @@ def test_zhipuai_embedding_dimensions() -> None:
dimensions=2048,
) # type: ignore[call-arg]
res = embedding.embed_query(document)
- assert len(res) == 2048 # type: ignore[arg-type]
+ assert len(res) == 2048
diff --git a/libs/community/tests/integration_tests/llms/test_aleph_alpha.py b/libs/community/tests/integration_tests/llms/test_aleph_alpha.py
index 3ccafb99bb5..56d6aad2af2 100644
--- a/libs/community/tests/integration_tests/llms/test_aleph_alpha.py
+++ b/libs/community/tests/integration_tests/llms/test_aleph_alpha.py
@@ -5,6 +5,6 @@ from langchain_community.llms.aleph_alpha import AlephAlpha
def test_aleph_alpha_call() -> None:
"""Test valid call to cohere."""
- llm = AlephAlpha(maximum_tokens=10) # type: ignore[call-arg]
+ llm = AlephAlpha(maximum_tokens=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
diff --git a/libs/community/tests/integration_tests/llms/test_cohere.py b/libs/community/tests/integration_tests/llms/test_cohere.py
index 02404d20665..e5e2857c0de 100644
--- a/libs/community/tests/integration_tests/llms/test_cohere.py
+++ b/libs/community/tests/integration_tests/llms/test_cohere.py
@@ -12,7 +12,7 @@ from tests.integration_tests.llms.utils import assert_llm_equality
def test_cohere_call() -> None:
"""Test valid call to cohere."""
- llm = Cohere(max_tokens=10) # type: ignore[call-arg]
+ llm = Cohere(max_tokens=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
@@ -20,16 +20,16 @@ def test_cohere_call() -> None:
def test_cohere_api_key(monkeypatch: MonkeyPatch) -> None:
"""Test that cohere api key is a secret key."""
# test initialization from init
- assert isinstance(Cohere(cohere_api_key="1").cohere_api_key, SecretStr) # type: ignore[arg-type, call-arg]
+ assert isinstance(Cohere(cohere_api_key="1").cohere_api_key, SecretStr) # type: ignore[arg-type]
# test initialization from env variable
monkeypatch.setenv("COHERE_API_KEY", "secret-api-key")
- assert isinstance(Cohere().cohere_api_key, SecretStr) # type: ignore[call-arg]
+ assert isinstance(Cohere().cohere_api_key, SecretStr)
def test_saving_loading_llm(tmp_path: Path) -> None:
"""Test saving/loading an Cohere LLM."""
- llm = Cohere(max_tokens=10) # type: ignore[call-arg]
+ llm = Cohere(max_tokens=10)
llm.save(file_path=tmp_path / "cohere.yaml")
loaded_llm = load_llm(tmp_path / "cohere.yaml")
assert_llm_equality(llm, loaded_llm)
diff --git a/libs/community/tests/integration_tests/llms/test_gooseai.py b/libs/community/tests/integration_tests/llms/test_gooseai.py
index 13ee8b79d42..bbb14136793 100644
--- a/libs/community/tests/integration_tests/llms/test_gooseai.py
+++ b/libs/community/tests/integration_tests/llms/test_gooseai.py
@@ -5,14 +5,14 @@ from langchain_community.llms.gooseai import GooseAI
def test_gooseai_call() -> None:
"""Test valid call to gooseai."""
- llm = GooseAI(max_tokens=10) # type: ignore[call-arg]
+ llm = GooseAI(max_tokens=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
def test_gooseai_call_fairseq() -> None:
"""Test valid call to gooseai with fairseq model."""
- llm = GooseAI(model_name="fairseq-1-3b", max_tokens=10) # type: ignore[call-arg]
+ llm = GooseAI(model_name="fairseq-1-3b", max_tokens=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
@@ -22,7 +22,7 @@ def test_gooseai_stop_valid() -> None:
query = "write an ordered list of five items"
first_llm = GooseAI(stop="3", temperature=0) # type: ignore[call-arg]
first_output = first_llm.invoke(query)
- second_llm = GooseAI(temperature=0) # type: ignore[call-arg]
+ second_llm = GooseAI(temperature=0)
second_output = second_llm.invoke(query, stop=["3"])
# Because it stops on new lines, shouldn't return anything
assert first_output == second_output
diff --git a/libs/community/tests/integration_tests/llms/test_huggingface_hub.py b/libs/community/tests/integration_tests/llms/test_huggingface_hub.py
index 678c9c7a801..999f92ad414 100644
--- a/libs/community/tests/integration_tests/llms/test_huggingface_hub.py
+++ b/libs/community/tests/integration_tests/llms/test_huggingface_hub.py
@@ -11,35 +11,35 @@ from tests.integration_tests.llms.utils import assert_llm_equality
def test_huggingface_text_generation() -> None:
"""Test valid call to HuggingFace text generation model."""
- llm = HuggingFaceHub(repo_id="gpt2", model_kwargs={"max_new_tokens": 10}) # type: ignore[call-arg]
+ llm = HuggingFaceHub(repo_id="gpt2", model_kwargs={"max_new_tokens": 10})
output = llm.invoke("Say foo:")
assert isinstance(output, str)
def test_huggingface_text2text_generation() -> None:
"""Test valid call to HuggingFace text2text model."""
- llm = HuggingFaceHub(repo_id="google/flan-t5-xl") # type: ignore[call-arg]
+ llm = HuggingFaceHub(repo_id="google/flan-t5-xl")
output = llm.invoke("The capital of New York is")
assert output == "Albany"
def test_huggingface_summarization() -> None:
"""Test valid call to HuggingFace summarization model."""
- llm = HuggingFaceHub(repo_id="facebook/bart-large-cnn") # type: ignore[call-arg]
+ llm = HuggingFaceHub(repo_id="facebook/bart-large-cnn")
output = llm.invoke("Say foo:")
assert isinstance(output, str)
def test_huggingface_call_error() -> None:
"""Test valid call to HuggingFace that errors."""
- llm = HuggingFaceHub(model_kwargs={"max_new_tokens": -1}) # type: ignore[call-arg]
+ llm = HuggingFaceHub(model_kwargs={"max_new_tokens": -1})
with pytest.raises(ValueError):
llm.invoke("Say foo:")
def test_saving_loading_llm(tmp_path: Path) -> None:
"""Test saving/loading an HuggingFaceHub LLM."""
- llm = HuggingFaceHub(repo_id="gpt2", model_kwargs={"max_new_tokens": 10}) # type: ignore[call-arg]
+ llm = HuggingFaceHub(repo_id="gpt2", model_kwargs={"max_new_tokens": 10})
llm.save(file_path=tmp_path / "hf.yaml")
loaded_llm = load_llm(tmp_path / "hf.yaml")
assert_llm_equality(llm, loaded_llm)
diff --git a/libs/community/tests/integration_tests/llms/test_nlpcloud.py b/libs/community/tests/integration_tests/llms/test_nlpcloud.py
index 3645359e856..30083ec9686 100644
--- a/libs/community/tests/integration_tests/llms/test_nlpcloud.py
+++ b/libs/community/tests/integration_tests/llms/test_nlpcloud.py
@@ -13,14 +13,14 @@ from tests.integration_tests.llms.utils import assert_llm_equality
def test_nlpcloud_call() -> None:
"""Test valid call to nlpcloud."""
- llm = NLPCloud(max_length=10) # type: ignore[call-arg]
+ llm = NLPCloud(max_length=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
def test_saving_loading_llm(tmp_path: Path) -> None:
"""Test saving/loading an NLPCloud LLM."""
- llm = NLPCloud(max_length=10) # type: ignore[call-arg]
+ llm = NLPCloud(max_length=10)
llm.save(file_path=tmp_path / "nlpcloud.yaml")
loaded_llm = load_llm(tmp_path / "nlpcloud.yaml")
assert_llm_equality(llm, loaded_llm)
@@ -29,10 +29,10 @@ def test_saving_loading_llm(tmp_path: Path) -> None:
def test_nlpcloud_api_key(monkeypatch: MonkeyPatch, capsys: CaptureFixture) -> None:
"""Test that nlpcloud api key is a secret key."""
# test initialization from init
- assert isinstance(NLPCloud(nlpcloud_api_key="1").nlpcloud_api_key, SecretStr) # type: ignore[arg-type, call-arg]
+ assert isinstance(NLPCloud(nlpcloud_api_key="1").nlpcloud_api_key, SecretStr) # type: ignore[arg-type]
monkeypatch.setenv("NLPCLOUD_API_KEY", "secret-api-key")
- llm = NLPCloud() # type: ignore[call-arg]
+ llm = NLPCloud()
assert isinstance(llm.nlpcloud_api_key, SecretStr)
assert cast(SecretStr, llm.nlpcloud_api_key).get_secret_value() == "secret-api-key"
diff --git a/libs/community/tests/integration_tests/llms/test_petals.py b/libs/community/tests/integration_tests/llms/test_petals.py
index 1689efb26b3..91923060938 100644
--- a/libs/community/tests/integration_tests/llms/test_petals.py
+++ b/libs/community/tests/integration_tests/llms/test_petals.py
@@ -7,14 +7,14 @@ from langchain_community.llms.petals import Petals
def test_api_key_is_string() -> None:
- llm = Petals(huggingface_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = Petals(huggingface_api_key="secret-api-key") # type: ignore[arg-type]
assert isinstance(llm.huggingface_api_key, SecretStr)
def test_api_key_masked_when_passed_via_constructor(
capsys: CaptureFixture,
) -> None:
- llm = Petals(huggingface_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = Petals(huggingface_api_key="secret-api-key") # type: ignore[arg-type]
print(llm.huggingface_api_key, end="") # noqa: T201
captured = capsys.readouterr()
@@ -23,6 +23,6 @@ def test_api_key_masked_when_passed_via_constructor(
def test_gooseai_call() -> None:
"""Test valid call to gooseai."""
- llm = Petals(max_new_tokens=10) # type: ignore[call-arg]
+ llm = Petals(max_new_tokens=10)
output = llm.invoke("Say foo:")
assert isinstance(output, str)
diff --git a/libs/community/tests/integration_tests/llms/test_predictionguard.py b/libs/community/tests/integration_tests/llms/test_predictionguard.py
index 3907c1dd509..c49c1e0176f 100644
--- a/libs/community/tests/integration_tests/llms/test_predictionguard.py
+++ b/libs/community/tests/integration_tests/llms/test_predictionguard.py
@@ -7,7 +7,7 @@ from langchain_community.llms.predictionguard import PredictionGuard
def test_predictionguard_invoke() -> None:
"""Test valid call to prediction guard."""
- llm = PredictionGuard(model="Hermes-3-Llama-3.1-8B") # type: ignore[call-arg]
+ llm = PredictionGuard(model="Hermes-3-Llama-3.1-8B")
output = llm.invoke("Tell a joke.")
assert isinstance(output, str)
diff --git a/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py b/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py
index 35c63e8d878..38dc831cd89 100644
--- a/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py
+++ b/libs/community/tests/integration_tests/llms/test_qianfan_endpoint.py
@@ -10,14 +10,14 @@ from langchain_community.llms.baidu_qianfan_endpoint import QianfanLLMEndpoint
def test_call() -> None:
"""Test valid call to qianfan."""
- llm = QianfanLLMEndpoint() # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint()
output = llm.invoke("write a joke")
assert isinstance(output, str)
def test_generate() -> None:
"""Test valid call to qianfan."""
- llm = QianfanLLMEndpoint() # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint()
output = llm.generate(["write a joke"])
assert isinstance(output, LLMResult)
assert isinstance(output.generations, list)
@@ -25,20 +25,20 @@ def test_generate() -> None:
def test_generate_stream() -> None:
"""Test valid call to qianfan."""
- llm = QianfanLLMEndpoint() # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint()
output = llm.stream("write a joke")
assert isinstance(output, Generator)
async def test_qianfan_aio() -> None:
- llm = QianfanLLMEndpoint(streaming=True) # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint(streaming=True)
async for token in llm.astream("hi qianfan."):
assert isinstance(token, str)
def test_rate_limit() -> None:
- llm = QianfanLLMEndpoint(model="ERNIE-Bot", init_kwargs={"query_per_second": 2}) # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint(model="ERNIE-Bot", init_kwargs={"query_per_second": 2})
assert llm.client._client._rate_limiter._sync_limiter._query_per_second == 2
output = llm.generate(["write a joke"])
assert isinstance(output, LLMResult)
@@ -47,11 +47,11 @@ def test_rate_limit() -> None:
def test_qianfan_with_param_alias() -> None:
"""Test with qianfan llm parameter alias."""
- llm = QianfanLLMEndpoint( # type: ignore[call-arg]
+ llm = QianfanLLMEndpoint(
api_key="your-api-key", # type: ignore[arg-type]
secret_key="your-secret-key", # type: ignore[arg-type]
timeout=50,
- ) # type: ignore[call-arg]
+ )
assert cast(SecretStr, llm.qianfan_ak).get_secret_value() == "your-api-key"
assert cast(SecretStr, llm.qianfan_sk).get_secret_value() == "your-secret-key"
assert llm.request_timeout == 50
diff --git a/libs/community/tests/integration_tests/llms/test_sparkllm.py b/libs/community/tests/integration_tests/llms/test_sparkllm.py
index 8bcd28f4df2..2f9896f9466 100644
--- a/libs/community/tests/integration_tests/llms/test_sparkllm.py
+++ b/libs/community/tests/integration_tests/llms/test_sparkllm.py
@@ -22,7 +22,7 @@ def test_generate() -> None:
def test_spark_llm_with_param_alias() -> None:
"""Test SparkLLM with parameters alias."""
- llm = SparkLLM( # type: ignore[call-arg]
+ llm = SparkLLM(
app_id="your-app-id",
api_key="your-api-key",
api_secret="your-api-secret",
@@ -40,6 +40,6 @@ def test_spark_llm_with_param_alias() -> None:
def test_spark_llm_with_stream() -> None:
"""Test SparkLLM with stream."""
- llm = SparkLLM() # type: ignore[call-arg]
+ llm = SparkLLM()
for chunk in llm.stream("你好呀"):
assert isinstance(chunk, str)
diff --git a/libs/community/tests/integration_tests/llms/test_tongyi.py b/libs/community/tests/integration_tests/llms/test_tongyi.py
index 99e8c5f87ba..e7b6ec0e72d 100644
--- a/libs/community/tests/integration_tests/llms/test_tongyi.py
+++ b/libs/community/tests/integration_tests/llms/test_tongyi.py
@@ -7,14 +7,14 @@ from langchain_community.llms.tongyi import Tongyi
def test_tongyi_call() -> None:
"""Test valid call to tongyi."""
- llm = Tongyi() # type: ignore[call-arg]
+ llm = Tongyi()
output = llm.invoke("who are you")
assert isinstance(output, str)
def test_tongyi_generate() -> None:
"""Test valid call to tongyi."""
- llm = Tongyi() # type: ignore[call-arg]
+ llm = Tongyi()
output = llm.generate(["who are you"])
assert isinstance(output, LLMResult)
assert isinstance(output.generations, list)
@@ -22,7 +22,7 @@ def test_tongyi_generate() -> None:
def test_tongyi_generate_stream() -> None:
"""Test valid call to tongyi."""
- llm = Tongyi(streaming=True) # type: ignore[call-arg]
+ llm = Tongyi(streaming=True)
output = llm.generate(["who are you"])
print(output) # noqa: T201
assert isinstance(output, LLMResult)
@@ -31,6 +31,6 @@ def test_tongyi_generate_stream() -> None:
def test_tongyi_with_param_alias() -> None:
"""Test tongyi parameters alias"""
- llm = Tongyi(model="qwen-max", api_key="your-api_key") # type: ignore[call-arg]
+ llm = Tongyi(model="qwen-max", api_key="your-api_key")
assert llm.model_name == "qwen-max"
assert llm.dashscope_api_key == "your-api_key"
diff --git a/libs/community/tests/integration_tests/llms/test_volcengine_maas.py b/libs/community/tests/integration_tests/llms/test_volcengine_maas.py
index 321e830eeb4..4702a7a7038 100644
--- a/libs/community/tests/integration_tests/llms/test_volcengine_maas.py
+++ b/libs/community/tests/integration_tests/llms/test_volcengine_maas.py
@@ -13,7 +13,7 @@ from langchain_community.llms.volcengine_maas import (
def test_api_key_is_string() -> None:
- llm = VolcEngineMaasBase( # type: ignore[call-arg]
+ llm = VolcEngineMaasBase(
volc_engine_maas_ak="secret-volc-ak", # type: ignore[arg-type]
volc_engine_maas_sk="secret-volc-sk", # type: ignore[arg-type]
)
@@ -24,7 +24,7 @@ def test_api_key_is_string() -> None:
def test_api_key_masked_when_passed_via_constructor(
capsys: CaptureFixture,
) -> None:
- llm = VolcEngineMaasBase( # type: ignore[call-arg]
+ llm = VolcEngineMaasBase(
volc_engine_maas_ak="secret-volc-ak", # type: ignore[arg-type]
volc_engine_maas_sk="secret-volc-sk", # type: ignore[arg-type]
)
@@ -36,14 +36,14 @@ def test_api_key_masked_when_passed_via_constructor(
def test_default_call() -> None:
"""Test valid call to volc engine."""
- llm = VolcEngineMaasLLM() # type: ignore[call-arg]
+ llm = VolcEngineMaasLLM()
output = llm.invoke("tell me a joke")
assert isinstance(output, str)
def test_generate() -> None:
"""Test valid call to volc engine."""
- llm = VolcEngineMaasLLM() # type: ignore[call-arg]
+ llm = VolcEngineMaasLLM()
output = llm.generate(["tell me a joke"])
assert isinstance(output, LLMResult)
assert isinstance(output.generations, list)
@@ -51,6 +51,6 @@ def test_generate() -> None:
def test_generate_stream() -> None:
"""Test valid call to volc engine."""
- llm = VolcEngineMaasLLM(streaming=True) # type: ignore[call-arg]
+ llm = VolcEngineMaasLLM(streaming=True)
output = llm.stream("tell me a joke")
assert isinstance(output, Generator)
diff --git a/libs/community/tests/integration_tests/test_dalle.py b/libs/community/tests/integration_tests/test_dalle.py
index e5f1967785a..c2262f4e2d1 100644
--- a/libs/community/tests/integration_tests/test_dalle.py
+++ b/libs/community/tests/integration_tests/test_dalle.py
@@ -5,6 +5,6 @@ from langchain_community.utilities.dalle_image_generator import DallEAPIWrapper
def test_call() -> None:
"""Test that call returns a URL in the output."""
- search = DallEAPIWrapper() # type: ignore[call-arg]
+ search = DallEAPIWrapper()
output = search.run("volcano island")
assert "https://oaidalleapi" in output
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_audio_text_to_speech.py b/libs/community/tests/integration_tests/tools/edenai/test_audio_text_to_speech.py
index dd76ffda827..6411fed472c 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_audio_text_to_speech.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_audio_text_to_speech.py
@@ -16,7 +16,7 @@ from langchain_community.tools.edenai import EdenAiTextToSpeechTool
def test_edenai_call() -> None:
"""Test simple call to edenai's text to speech endpoint."""
- text2speech = EdenAiTextToSpeechTool( # type: ignore[call-arg]
+ text2speech = EdenAiTextToSpeechTool(
providers=["amazon"], language="en", voice="MALE"
)
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_image_explicitcontent.py b/libs/community/tests/integration_tests/tools/edenai/test_image_explicitcontent.py
index 2412286d6c8..a95fb99b134 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_image_explicitcontent.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_image_explicitcontent.py
@@ -14,7 +14,7 @@ from langchain_community.tools.edenai import EdenAiExplicitImageTool
def test_edenai_call() -> None:
"""Test simple call to edenai's image moderation endpoint."""
- image_moderation = EdenAiExplicitImageTool(providers=["amazon"]) # type: ignore[call-arg]
+ image_moderation = EdenAiExplicitImageTool(providers=["amazon"])
output = image_moderation.invoke("https://static.javatpoint.com/images/objects.jpg")
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_image_objectdetection.py b/libs/community/tests/integration_tests/tools/edenai/test_image_objectdetection.py
index a8253256abb..0d3e62b6c06 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_image_objectdetection.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_image_objectdetection.py
@@ -14,7 +14,7 @@ from langchain_community.tools.edenai import EdenAiObjectDetectionTool
def test_edenai_call() -> None:
"""Test simple call to edenai's object detection endpoint."""
- object_detection = EdenAiObjectDetectionTool(providers=["google"]) # type: ignore[call-arg]
+ object_detection = EdenAiObjectDetectionTool(providers=["google"])
output = object_detection.invoke("https://static.javatpoint.com/images/objects.jpg")
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py b/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py
index 104cc6efa63..91bd110f449 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_ocr_identityparser.py
@@ -14,7 +14,7 @@ from langchain_community.tools.edenai import EdenAiParsingIDTool
def test_edenai_call() -> None:
"""Test simple call to edenai's identity parser endpoint."""
- id_parser = EdenAiParsingIDTool(providers=["amazon"], language="en") # type: ignore[call-arg]
+ id_parser = EdenAiParsingIDTool(providers=["amazon"], language="en")
output = id_parser.invoke(
"https://www.citizencard.com/images/citizencard-uk-id-card-2023.jpg"
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_ocr_invoiceparser.py b/libs/community/tests/integration_tests/tools/edenai/test_ocr_invoiceparser.py
index 9dc989214c9..80b8d36b3ce 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_ocr_invoiceparser.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_ocr_invoiceparser.py
@@ -14,7 +14,7 @@ from langchain_community.tools.edenai import EdenAiParsingInvoiceTool
def test_edenai_call() -> None:
"""Test simple call to edenai's invoice parser endpoint."""
- invoice_parser = EdenAiParsingInvoiceTool(providers=["amazon"], language="en") # type: ignore[call-arg]
+ invoice_parser = EdenAiParsingInvoiceTool(providers=["amazon"], language="en")
output = invoice_parser.invoke(
"https://app.edenai.run/assets/img/data_1.72e3bdcc.png"
diff --git a/libs/community/tests/integration_tests/tools/edenai/test_text_moderation.py b/libs/community/tests/integration_tests/tools/edenai/test_text_moderation.py
index e903276d86a..97134576e93 100644
--- a/libs/community/tests/integration_tests/tools/edenai/test_text_moderation.py
+++ b/libs/community/tests/integration_tests/tools/edenai/test_text_moderation.py
@@ -15,7 +15,7 @@ from langchain_community.tools.edenai.text_moderation import EdenAiTextModeratio
def test_edenai_call() -> None:
"""Test simple call to edenai's text moderation endpoint."""
- text_moderation = EdenAiTextModerationTool(providers=["openai"], language="en") # type: ignore[call-arg]
+ text_moderation = EdenAiTextModerationTool(providers=["openai"], language="en")
output = text_moderation.invoke("i hate you")
diff --git a/libs/community/tests/integration_tests/utilities/test_dataherald_api.py b/libs/community/tests/integration_tests/utilities/test_dataherald_api.py
index 7ead67e9ccc..57a8107af99 100644
--- a/libs/community/tests/integration_tests/utilities/test_dataherald_api.py
+++ b/libs/community/tests/integration_tests/utilities/test_dataherald_api.py
@@ -5,6 +5,6 @@ from langchain_community.utilities.dataherald import DataheraldAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
- search = DataheraldAPIWrapper(db_connection_id="65fb766367dd22c99ce1a12d") # type: ignore[call-arg]
+ search = DataheraldAPIWrapper(db_connection_id="65fb766367dd22c99ce1a12d")
output = search.run("How many employees are in the company?")
assert "Answer: SELECT \n COUNT(*) FROM \n employees" in output
diff --git a/libs/community/tests/integration_tests/utilities/test_github.py b/libs/community/tests/integration_tests/utilities/test_github.py
index 538112fa0a8..cc59f47942a 100644
--- a/libs/community/tests/integration_tests/utilities/test_github.py
+++ b/libs/community/tests/integration_tests/utilities/test_github.py
@@ -13,7 +13,7 @@ from langchain_community.utilities.github import GitHubAPIWrapper
@pytest.fixture
def api_client() -> GitHubAPIWrapper:
- return GitHubAPIWrapper() # type: ignore[call-arg]
+ return GitHubAPIWrapper()
def test_get_open_issues(api_client: GitHubAPIWrapper) -> None:
diff --git a/libs/community/tests/integration_tests/utilities/test_googlesearch_api.py b/libs/community/tests/integration_tests/utilities/test_googlesearch_api.py
index 8868bfc6bcd..b32d05e76ba 100644
--- a/libs/community/tests/integration_tests/utilities/test_googlesearch_api.py
+++ b/libs/community/tests/integration_tests/utilities/test_googlesearch_api.py
@@ -5,14 +5,14 @@ from langchain_community.utilities.google_search import GoogleSearchAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
- search = GoogleSearchAPIWrapper() # type: ignore[call-arg]
+ search = GoogleSearchAPIWrapper()
output = search.run("What was Obama's first name?")
assert "Barack Hussein Obama II" in output
def test_no_result_call() -> None:
"""Test that call gives no result."""
- search = GoogleSearchAPIWrapper() # type: ignore[call-arg]
+ search = GoogleSearchAPIWrapper()
output = search.run(
"NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL_NORESULTCALL"
)
@@ -22,7 +22,7 @@ def test_no_result_call() -> None:
def test_result_with_params_call() -> None:
"""Test that call gives the correct answer with extra params."""
- search = GoogleSearchAPIWrapper() # type: ignore[call-arg]
+ search = GoogleSearchAPIWrapper()
output = search.results(
query="What was Obama's first name?",
num_results=5,
diff --git a/libs/community/tests/integration_tests/utilities/test_jira_api.py b/libs/community/tests/integration_tests/utilities/test_jira_api.py
index 557c639e1b4..e712afa57e7 100644
--- a/libs/community/tests/integration_tests/utilities/test_jira_api.py
+++ b/libs/community/tests/integration_tests/utilities/test_jira_api.py
@@ -6,14 +6,14 @@ from langchain_community.utilities.jira import JiraAPIWrapper
def test_search() -> None:
"""Test for Searching issues on JIRA"""
jql = "project = TP"
- jira = JiraAPIWrapper() # type: ignore[call-arg]
+ jira = JiraAPIWrapper()
output = jira.run("jql", jql)
assert "issues" in output
def test_getprojects() -> None:
"""Test for getting projects on JIRA"""
- jira = JiraAPIWrapper() # type: ignore[call-arg]
+ jira = JiraAPIWrapper()
output = jira.run("get_projects", "")
assert "projects" in output
@@ -24,7 +24,7 @@ def test_create_ticket() -> None:
'{"summary": "Test Summary", "description": "Test Description",'
' "issuetype": {"name": "Bug"}, "project": {"key": "TP"}}'
)
- jira = JiraAPIWrapper() # type: ignore[call-arg]
+ jira = JiraAPIWrapper()
output = jira.run("create_issue", issue_string)
assert "id" in output
assert "key" in output
@@ -32,7 +32,7 @@ def test_create_ticket() -> None:
def test_create_confluence_page() -> None:
"""Test for getting projects on JIRA"""
- jira = JiraAPIWrapper() # type: ignore[call-arg]
+ jira = JiraAPIWrapper()
create_page_dict = (
'{"space": "ROC", "title":"This is the title",'
'"body":"This is the body. You can use '
@@ -46,7 +46,7 @@ def test_create_confluence_page() -> None:
def test_other() -> None:
"""Non-exhaustive test for accessing other JIRA API methods"""
- jira = JiraAPIWrapper() # type: ignore[call-arg]
+ jira = JiraAPIWrapper()
issue_create_dict = """
{
"function":"issue_create",
diff --git a/libs/community/tests/integration_tests/utilities/test_openweathermap.py b/libs/community/tests/integration_tests/utilities/test_openweathermap.py
index 5a4415f8ff7..9f6e1f2c0fc 100644
--- a/libs/community/tests/integration_tests/utilities/test_openweathermap.py
+++ b/libs/community/tests/integration_tests/utilities/test_openweathermap.py
@@ -4,7 +4,7 @@ from langchain_community.utilities.openweathermap import OpenWeatherMapAPIWrappe
def test_openweathermap_api_wrapper() -> None:
"""Test that OpenWeatherMapAPIWrapper returns correct data for London, GB."""
- weather = OpenWeatherMapAPIWrapper() # type: ignore[call-arg]
+ weather = OpenWeatherMapAPIWrapper()
weather_data = weather.run("London,GB")
assert weather_data is not None
diff --git a/libs/community/tests/integration_tests/utilities/test_steam_api.py b/libs/community/tests/integration_tests/utilities/test_steam_api.py
index 96de47eeb47..be61f5f1ab2 100644
--- a/libs/community/tests/integration_tests/utilities/test_steam_api.py
+++ b/libs/community/tests/integration_tests/utilities/test_steam_api.py
@@ -5,7 +5,7 @@ from langchain_community.utilities.steam import SteamWebAPIWrapper
def test_get_game_details() -> None:
"""Test for getting game details on Steam"""
- steam = SteamWebAPIWrapper() # type: ignore[call-arg]
+ steam = SteamWebAPIWrapper()
output = steam.run("get_game_details", "Terraria")
assert "id" in output
assert "link" in output
@@ -16,7 +16,7 @@ def test_get_game_details() -> None:
def test_get_recommended_games() -> None:
"""Test for getting recommended games on Steam"""
- steam = SteamWebAPIWrapper() # type: ignore[call-arg]
+ steam = SteamWebAPIWrapper()
output = steam.run("get_recommended_games", "76561198362745711")
output = ast.literal_eval(output)
assert len(output) == 5
diff --git a/libs/community/tests/integration_tests/utilities/test_twilio.py b/libs/community/tests/integration_tests/utilities/test_twilio.py
index ba00f51d24e..fa6b3ed20e1 100644
--- a/libs/community/tests/integration_tests/utilities/test_twilio.py
+++ b/libs/community/tests/integration_tests/utilities/test_twilio.py
@@ -5,6 +5,6 @@ from langchain_community.utilities.twilio import TwilioAPIWrapper
def test_call() -> None:
"""Test that call runs."""
- twilio = TwilioAPIWrapper() # type: ignore[call-arg]
+ twilio = TwilioAPIWrapper()
output = twilio.run("Message", "+16162904619")
assert output
diff --git a/libs/community/tests/integration_tests/utilities/test_wolfram_alpha_api.py b/libs/community/tests/integration_tests/utilities/test_wolfram_alpha_api.py
index f6bc43f4620..54d7255725e 100644
--- a/libs/community/tests/integration_tests/utilities/test_wolfram_alpha_api.py
+++ b/libs/community/tests/integration_tests/utilities/test_wolfram_alpha_api.py
@@ -5,6 +5,6 @@ from langchain_community.utilities.wolfram_alpha import WolframAlphaAPIWrapper
def test_call() -> None:
"""Test that call gives the correct answer."""
- search = WolframAlphaAPIWrapper() # type: ignore[call-arg]
+ search = WolframAlphaAPIWrapper()
output = search.run("what is 2x+18=x+5?")
assert "x = -13" in output
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 ab7ecebd6dd..83ff601bc12 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
@@ -43,7 +43,7 @@ async def test_qdrant_aadd_texts_stores_duplicated_texts(
collection_name = uuid.uuid4().hex
vectors_config = rest.VectorParams(size=10, distance=rest.Distance.COSINE)
if vector_name is not None:
- vectors_config = {vector_name: vectors_config} # type: ignore[assignment]
+ vectors_config = {vector_name: vectors_config}
client.recreate_collection(collection_name, vectors_config=vectors_config)
vec_store = Qdrant(
@@ -119,6 +119,6 @@ async def test_qdrant_aadd_texts_stores_embeddings_as_named_vectors(
assert 5 == client.count(collection_name).count
assert all(
- vector_name in point.vector # type: ignore[operator]
+ vector_name in point.vector
for point in client.scroll(collection_name, with_vectors=True)[0]
)
diff --git a/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py b/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py
index 1ee99d40bdd..bb787a7a2b5 100644
--- a/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py
+++ b/libs/community/tests/integration_tests/vectorstores/qdrant/async_api/test_from_texts.py
@@ -82,7 +82,7 @@ async def test_qdrant_from_texts_stores_embeddings_as_named_vectors(
client = vec_store.client
assert 5 == client.count(collection_name).count
assert all(
- vector_name in point.vector # type: ignore[operator]
+ vector_name in point.vector
for point in client.scroll(collection_name, with_vectors=True)[0]
)
@@ -221,8 +221,8 @@ async def test_qdrant_from_texts_recreates_collection_on_force_recreate(
assert 2 == client.count(collection_name).count
vector_params = client.get_collection(collection_name).config.params.vectors
if vector_name is not None:
- vector_params = vector_params[vector_name] # type: ignore[index]
- assert 5 == vector_params.size # type: ignore[union-attr]
+ vector_params = vector_params[vector_name]
+ assert 5 == vector_params.size
@pytest.mark.parametrize("batch_size", [1, 64])
diff --git a/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py b/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py
index d3d73b3c6d5..bf579feb716 100644
--- a/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py
+++ b/libs/community/tests/integration_tests/vectorstores/qdrant/test_add_texts.py
@@ -62,7 +62,7 @@ def test_qdrant_add_texts_stores_duplicated_texts(vector_name: Optional[str]) ->
collection_name = uuid.uuid4().hex
vectors_config = rest.VectorParams(size=10, distance=rest.Distance.COSINE)
if vector_name is not None:
- vectors_config = {vector_name: vectors_config} # type: ignore[assignment]
+ vectors_config = {vector_name: vectors_config}
client.recreate_collection(collection_name, vectors_config=vectors_config)
vec_store = Qdrant(
@@ -130,6 +130,6 @@ def test_qdrant_add_texts_stores_embeddings_as_named_vectors(vector_name: str) -
assert 5 == client.count(collection_name).count
assert all(
- vector_name in point.vector # type: ignore[operator]
+ vector_name in point.vector
for point in client.scroll(collection_name, with_vectors=True)[0]
)
diff --git a/libs/community/tests/integration_tests/vectorstores/qdrant/test_from_texts.py b/libs/community/tests/integration_tests/vectorstores/qdrant/test_from_texts.py
index 27264c73568..dadc4ea0040 100644
--- a/libs/community/tests/integration_tests/vectorstores/qdrant/test_from_texts.py
+++ b/libs/community/tests/integration_tests/vectorstores/qdrant/test_from_texts.py
@@ -85,7 +85,7 @@ def test_qdrant_from_texts_stores_embeddings_as_named_vectors(vector_name: str)
client = QdrantClient(path=str(tmpdir))
assert 5 == client.count(collection_name).count
assert all(
- vector_name in point.vector # type: ignore[operator]
+ vector_name in point.vector
for point in client.scroll(collection_name, with_vectors=True)[0]
)
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 2c7614f9b24..727dfbc1de0 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
@@ -84,19 +84,19 @@ class TestAzureCosmosDBVectorSearch:
# ensure the test collection is empty
collection = prepare_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index]
+ assert collection.count_documents({}) == 0
@classmethod
def teardown_class(cls) -> None:
collection = prepare_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
@pytest.fixture(autouse=True)
def setup(self) -> None:
collection = prepare_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
@pytest.fixture(scope="class", autouse=True)
def cosmos_db_url(self) -> Union[str, Generator[str, None, None]]:
diff --git a/libs/community/tests/integration_tests/vectorstores/test_chroma.py b/libs/community/tests/integration_tests/vectorstores/test_chroma.py
index 1f93e11a11f..706771d8ce0 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_chroma.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_chroma.py
@@ -206,7 +206,7 @@ def test_chroma_update_document() -> None:
embedding=embedding,
ids=[document_id],
)
- old_embedding = docsearch._collection.peek()["embeddings"][ # type: ignore[index]
+ old_embedding = docsearch._collection.peek()["embeddings"][
docsearch._collection.peek()["ids"].index(document_id)
]
@@ -226,7 +226,7 @@ def test_chroma_update_document() -> None:
assert output == [Document(page_content=updated_content, metadata={"page": "0"})]
# Assert that the new embedding is correct
- new_embedding = docsearch._collection.peek()["embeddings"][ # type: ignore[index]
+ new_embedding = docsearch._collection.peek()["embeddings"][
docsearch._collection.peek()["ids"].index(document_id)
]
assert new_embedding == embedding.embed_documents([updated_content])[0]
@@ -344,7 +344,7 @@ def test_chroma_large_batch() -> None:
"my_collection",
embedding_function=embedding_function.embed_documents,
)
- docs = ["This is a test document"] * (client.max_batch_size + 100) # type: ignore[attr-defined]
+ docs = ["This is a test document"] * (client.max_batch_size + 100)
Chroma.from_texts(
client=client,
collection_name=col.name,
@@ -372,7 +372,7 @@ def test_chroma_large_batch_update() -> None:
"my_collection",
embedding_function=embedding_function.embed_documents,
)
- docs = ["This is a test document"] * (client.max_batch_size + 100) # type: ignore[attr-defined]
+ docs = ["This is a test document"] * (client.max_batch_size + 100)
ids = [str(uuid.uuid4()) for _ in range(len(docs))]
db = Chroma.from_texts(
client=client,
diff --git a/libs/community/tests/integration_tests/vectorstores/test_documentdb.py b/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
index acb2670d1b3..9227965e215 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_documentdb.py
@@ -71,20 +71,20 @@ class TestDocumentDBVectorSearch:
# ensure the test collection is empty
collection = prepare_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index]
+ assert collection.count_documents({}) == 0
@classmethod
def teardown_class(cls) -> None:
collection = prepare_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
collection.drop_indexes()
@pytest.fixture(autouse=True)
def setup(self) -> None:
collection = prepare_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
collection.drop_indexes()
def test_from_documents_cosine_distance(
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 a9c52d128ac..fdf7747e18b 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_mongodb_atlas.py
@@ -35,19 +35,19 @@ class TestMongoDBAtlasVectorSearch:
def setup_class(cls) -> None:
# ensure the test collection is empty
collection = get_collection()
- assert collection.count_documents({}) == 0 # type: ignore[index]
+ assert collection.count_documents({}) == 0
@classmethod
def teardown_class(cls) -> None:
collection = get_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
@pytest.fixture(autouse=True)
def setup(self) -> None:
collection = get_collection()
# delete all the documents in the collection
- collection.delete_many({}) # type: ignore[index]
+ collection.delete_many({})
def test_from_documents(
self, embedding_openai: Embeddings, collection: Any
diff --git a/libs/community/tests/integration_tests/vectorstores/test_singlestoredb.py b/libs/community/tests/integration_tests/vectorstores/test_singlestoredb.py
index 8308adaa760..b9e23123be6 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_singlestoredb.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_singlestoredb.py
@@ -557,7 +557,7 @@ def test_singestoredb_add_image2() -> None:
table_name = "test_singlestoredb_add_images"
drop(table_name)
docsearch = SingleStoreDB(
- OpenCLIPEmbeddings(), # type: ignore[call-arg, call-arg, call-arg]
+ OpenCLIPEmbeddings(),
table_name=table_name,
host=TEST_SINGLESTOREDB_URL,
)
diff --git a/libs/community/tests/integration_tests/vectorstores/test_tidb_vector.py b/libs/community/tests/integration_tests/vectorstores/test_tidb_vector.py
index 0451bc50a6c..d6803815c7b 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_tidb_vector.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_tidb_vector.py
@@ -324,7 +324,7 @@ def test_relevance_score() -> None:
except ValueError:
pass
- docsearch_l2.drop_vectorstore() # type: ignore[attr-defined]
+ docsearch_l2.drop_vectorstore()
def test_retriever_search_threshold() -> None:
diff --git a/libs/community/tests/integration_tests/vectorstores/test_vdms.py b/libs/community/tests/integration_tests/vectorstores/test_vdms.py
index a453a0fc20d..c389422ff76 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_vdms.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_vdms.py
@@ -40,7 +40,7 @@ def vdms_client() -> vdms.vdms:
@pytest.mark.requires("vdms")
@pytest.mark.enable_socket
def test_init_from_client(vdms_client: vdms.vdms) -> None:
- _ = VDMS( # type: ignore[call-arg]
+ _ = VDMS(
embedding=embedding_function,
client=vdms_client,
)
@@ -341,7 +341,7 @@ def test_with_relevance_score(vdms_client: vdms.vdms) -> None:
@pytest.mark.enable_socket
def test_add_documents_no_metadata(vdms_client: vdms.vdms) -> None:
collection_name = "test_add_documents_no_metadata"
- db = VDMS( # type: ignore[call-arg]
+ db = VDMS(
collection_name=collection_name,
embedding=embedding_function,
client=vdms_client,
@@ -353,7 +353,7 @@ def test_add_documents_no_metadata(vdms_client: vdms.vdms) -> None:
@pytest.mark.enable_socket
def test_add_documents_mixed_metadata(vdms_client: vdms.vdms) -> None:
collection_name = "test_add_documents_mixed_metadata"
- db = VDMS( # type: ignore[call-arg]
+ db = VDMS(
collection_name=collection_name,
embedding=embedding_function,
client=vdms_client,
diff --git a/libs/community/tests/integration_tests/vectorstores/test_vectara.py b/libs/community/tests/integration_tests/vectorstores/test_vectara.py
index a09a5b0b912..8c6ac53a6b8 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_vectara.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_vectara.py
@@ -268,7 +268,7 @@ def vectara3() -> Iterable[Vectara]:
vectara3.delete(doc_ids)
-def test_vectara_with_langchain_mmr(vectara3: Vectara) -> None: # type: ignore[no-untyped-def]
+def test_vectara_with_langchain_mmr(vectara3: Vectara) -> None:
# test max marginal relevance
output1 = vectara3.max_marginal_relevance_search(
"generative AI",
@@ -299,7 +299,7 @@ def test_vectara_with_langchain_mmr(vectara3: Vectara) -> None: # type: ignore[
)
-def test_vectara_rerankers(vectara3: Vectara) -> None: # type: ignore[no-untyped-def]
+def test_vectara_rerankers(vectara3: Vectara) -> None:
# test Vectara multi-lingual reranker
summary_config = SummaryConfig(is_enabled=True, max_results=7, response_lang="eng")
rerank_config = RerankConfig(reranker="rerank_multilingual_v1", rerank_k=50)
diff --git a/libs/community/tests/integration_tests/vectorstores/test_vlite.py b/libs/community/tests/integration_tests/vectorstores/test_vlite.py
index 7acd2e02df6..048807c1ab2 100644
--- a/libs/community/tests/integration_tests/vectorstores/test_vlite.py
+++ b/libs/community/tests/integration_tests/vectorstores/test_vlite.py
@@ -21,7 +21,7 @@ def test_vlite_with_metadatas() -> None:
docsearch = VLite.from_texts(
texts=texts,
embedding=FakeEmbeddings(), # type: ignore[call-arg]
- metadatas=metadatas, # type: ignore[call-arg]
+ metadatas=metadatas,
)
output = docsearch.similarity_search("foo", k=1)
assert output == [Document(page_content="foo", metadata={"page": "0"})]
@@ -34,7 +34,7 @@ def test_vlite_with_metadatas_with_scores() -> None:
docsearch = VLite.from_texts(
texts=texts,
embedding=FakeEmbeddings(), # type: ignore[call-arg]
- metadatas=metadatas, # type: ignore[call-arg]
+ metadatas=metadatas,
)
output = docsearch.similarity_search_with_score("foo", k=1)
assert output == [(Document(page_content="foo", metadata={"page": "0"}), 0.0)]
@@ -46,7 +46,7 @@ def test_vlite_update_document() -> None:
docsearch = VLite.from_texts(
texts=texts,
embedding=FakeEmbeddings(), # type: ignore[call-arg]
- ids=["1", "2", "3"], # type: ignore[call-arg]
+ ids=["1", "2", "3"],
)
docsearch.update_document("1", Document(page_content="updated_foo"))
output = docsearch.similarity_search("updated_foo", k=1)
@@ -59,7 +59,7 @@ def test_vlite_delete_document() -> None:
docsearch = VLite.from_texts(
texts=texts,
embedding=FakeEmbeddings(), # type: ignore[call-arg]
- ids=["1", "2", "3"], # type: ignore[call-arg]
+ ids=["1", "2", "3"],
)
docsearch.delete(["1"])
output = docsearch.similarity_search("foo", k=3)
@@ -89,7 +89,7 @@ def test_vlite_from_existing_index() -> None:
VLite.from_texts(
texts=texts,
embedding=FakeEmbeddings(), # type: ignore[call-arg]
- collection="test_collection", # type: ignore[call-arg]
+ collection="test_collection",
)
new_docsearch = VLite.from_existing_index(
collection="test_collection",
diff --git a/libs/community/tests/unit_tests/chat_models/test_baichuan.py b/libs/community/tests/unit_tests/chat_models/test_baichuan.py
index d869f0042bc..2688dedd3ee 100644
--- a/libs/community/tests/unit_tests/chat_models/test_baichuan.py
+++ b/libs/community/tests/unit_tests/chat_models/test_baichuan.py
@@ -25,7 +25,7 @@ def test_initialization() -> None:
"""Test chat model initialization."""
for model in [
- ChatBaichuan(model="Baichuan2-Turbo-192K", api_key="test-api-key", timeout=40), # type: ignore[arg-type, call-arg]
+ ChatBaichuan(model="Baichuan2-Turbo-192K", api_key="test-api-key", timeout=40), # type: ignore[arg-type]
ChatBaichuan( # type: ignore[call-arg]
model="Baichuan2-Turbo-192K",
baichuan_api_key="test-api-key",
@@ -149,8 +149,8 @@ def test_uses_actual_secret_value_from_secret_str() -> None:
def test_chat_baichuan_with_base_url() -> None:
- chat = ChatBaichuan( # type: ignore[call-arg]
+ chat = ChatBaichuan(
api_key="your-api-key", # type: ignore[arg-type]
- base_url="https://exmaple.com", # type: ignore[arg-type]
+ base_url="https://exmaple.com",
)
assert chat.baichuan_api_base == "https://exmaple.com"
diff --git a/libs/community/tests/unit_tests/chat_models/test_mlflow.py b/libs/community/tests/unit_tests/chat_models/test_mlflow.py
index af2efd5202d..6a05068e68f 100644
--- a/libs/community/tests/unit_tests/chat_models/test_mlflow.py
+++ b/libs/community/tests/unit_tests/chat_models/test_mlflow.py
@@ -238,7 +238,7 @@ def test_chat_mlflow_bind_tools(
)
]
agent = create_tool_calling_agent(llm, tools, prompt)
- agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True) # type: ignore[arg-type]
+ agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = agent_executor.invoke({"input": "36939 * 8922.4"})
assert result["output"] == "36939x8922.4 = 329,511,111.6"
diff --git a/libs/community/tests/unit_tests/chat_models/test_perplexity.py b/libs/community/tests/unit_tests/chat_models/test_perplexity.py
index 45cc4ec7cdf..ba44a4beff5 100644
--- a/libs/community/tests/unit_tests/chat_models/test_perplexity.py
+++ b/libs/community/tests/unit_tests/chat_models/test_perplexity.py
@@ -48,7 +48,7 @@ def test_perplexity_initialization() -> None:
# Verify that chat perplexity can be initialized using a secret key provided
# as a parameter rather than an environment variable.
for model in [
- ChatPerplexity( # type: ignore[call-arg]
+ ChatPerplexity(
model="test", timeout=1, api_key="test", temperature=0.7, verbose=True
),
ChatPerplexity( # type: ignore[call-arg]
diff --git a/libs/community/tests/unit_tests/chat_models/test_premai.py b/libs/community/tests/unit_tests/chat_models/test_premai.py
index 09118f48ea5..155cf1ae0ce 100644
--- a/libs/community/tests/unit_tests/chat_models/test_premai.py
+++ b/libs/community/tests/unit_tests/chat_models/test_premai.py
@@ -64,7 +64,7 @@ def test_messages_to_prompt_dict_with_valid_messages() -> None:
def test_premai_initialization() -> None:
for model in [
ChatPremAI(model="prem-ai-model", premai_api_key="xyz", project_id=8), # type: ignore[call-arg]
- ChatPremAI(model_name="prem-ai-model", api_key="xyz", project_id=8), # type: ignore[arg-type, call-arg]
+ ChatPremAI(model_name="prem-ai-model", api_key="xyz", project_id=8), # type: ignore[arg-type]
]:
assert model.model == "prem-ai-model"
assert model.temperature is None
diff --git a/libs/community/tests/unit_tests/chat_models/test_tongyi.py b/libs/community/tests/unit_tests/chat_models/test_tongyi.py
index afe151d4ed1..d3f468cc38e 100644
--- a/libs/community/tests/unit_tests/chat_models/test_tongyi.py
+++ b/libs/community/tests/unit_tests/chat_models/test_tongyi.py
@@ -59,7 +59,7 @@ def test__convert_dict_to_message_function_call() -> None:
expected_output = AIMessage(
content="foo",
additional_kwargs={"tool_calls": raw_function_calls},
- tool_calls=tool_calls, # type: ignore[arg-type]
+ tool_calls=tool_calls,
invalid_tool_calls=[],
)
assert result == expected_output
diff --git a/libs/community/tests/unit_tests/chat_models/test_yuan2.py b/libs/community/tests/unit_tests/chat_models/test_yuan2.py
index 683b2a013c7..dc1a298fc8e 100644
--- a/libs/community/tests/unit_tests/chat_models/test_yuan2.py
+++ b/libs/community/tests/unit_tests/chat_models/test_yuan2.py
@@ -16,7 +16,7 @@ from langchain_community.chat_models.yuan2 import (
@pytest.mark.requires("openai")
def test_yuan2_model_param() -> None:
- chat = ChatYuan2(model="foo") # type: ignore[call-arg]
+ chat = ChatYuan2(model="foo")
assert chat.model_name == "foo"
chat = ChatYuan2(model_name="foo") # type: ignore[call-arg]
assert chat.model_name == "foo"
@@ -26,7 +26,7 @@ def test_yuan2_model_param() -> None:
def test_yuan2_timeout_param() -> None:
chat = ChatYuan2(request_timeout=5) # type: ignore[call-arg]
assert chat.request_timeout == 5
- chat = ChatYuan2(timeout=10) # type: ignore[call-arg]
+ chat = ChatYuan2(timeout=10)
assert chat.request_timeout == 10
@@ -34,7 +34,7 @@ def test_yuan2_timeout_param() -> None:
def test_yuan2_stop_sequences_param() -> None:
chat = ChatYuan2(stop=[""]) # type: ignore[call-arg]
assert chat.stop == [""]
- chat = ChatYuan2(stop_sequences=[""]) # type: ignore[call-arg]
+ chat = ChatYuan2(stop_sequences=[""])
assert chat.stop == [""]
diff --git a/libs/community/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py b/libs/community/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py
index 7b107f32789..6b002222bd1 100644
--- a/libs/community/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py
+++ b/libs/community/tests/unit_tests/document_loaders/loaders/vendors/test_docugami.py
@@ -12,7 +12,7 @@ DOCUGAMI_XML_PATH = Path(__file__).parent / "test_data" / "docugami-example.xml"
@pytest.mark.requires("dgml_utils")
def test_docugami_loader_local() -> None:
"""Test DocugamiLoader."""
- loader = DocugamiLoader(file_paths=[DOCUGAMI_XML_PATH]) # type: ignore[call-arg]
+ loader = DocugamiLoader(file_paths=[DOCUGAMI_XML_PATH])
docs = loader.load()
assert len(docs) == 25
diff --git a/libs/community/tests/unit_tests/embeddings/test_gpt4all.py b/libs/community/tests/unit_tests/embeddings/test_gpt4all.py
index 19cfc134b5a..066b3c1fd9e 100644
--- a/libs/community/tests/unit_tests/embeddings/test_gpt4all.py
+++ b/libs/community/tests/unit_tests/embeddings/test_gpt4all.py
@@ -20,7 +20,7 @@ class MockEmbed4All(MagicMock):
n_threads: Optional[int] = None,
device: Optional[str] = None,
**kwargs: Any,
- ): # type: ignore[no-untyped-def]
+ ):
assert model_name == _GPT4ALL_MODEL_NAME
diff --git a/libs/community/tests/unit_tests/embeddings/test_oci_gen_ai_embedding.py b/libs/community/tests/unit_tests/embeddings/test_oci_gen_ai_embedding.py
index 9b12444cacc..32e63ba100e 100644
--- a/libs/community/tests/unit_tests/embeddings/test_oci_gen_ai_embedding.py
+++ b/libs/community/tests/unit_tests/embeddings/test_oci_gen_ai_embedding.py
@@ -20,7 +20,7 @@ class MockResponseDict(dict):
def test_embedding_call(monkeypatch: MonkeyPatch, test_model_id: str) -> None:
"""Test valid call to OCI Generative AI embedding service."""
oci_gen_ai_client = MagicMock()
- embeddings = OCIGenAIEmbeddings( # type: ignore[call-arg]
+ embeddings = OCIGenAIEmbeddings(
model_id=test_model_id,
service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
client=oci_gen_ai_client,
diff --git a/libs/community/tests/unit_tests/embeddings/test_premai.py b/libs/community/tests/unit_tests/embeddings/test_premai.py
index 8c75a67d20c..e9861ace6b4 100644
--- a/libs/community/tests/unit_tests/embeddings/test_premai.py
+++ b/libs/community/tests/unit_tests/embeddings/test_premai.py
@@ -12,7 +12,7 @@ def test_api_key_is_string() -> None:
llm = PremAIEmbeddings( # type: ignore[call-arg]
premai_api_key="secret-api-key", # type: ignore[arg-type]
project_id=8,
- model="fake-model", # type: ignore[arg-type]
+ model="fake-model",
)
assert isinstance(llm.premai_api_key, SecretStr)
@@ -24,7 +24,7 @@ def test_api_key_masked_when_passed_via_constructor(
llm = PremAIEmbeddings( # type: ignore[call-arg]
premai_api_key="secret-api-key", # type: ignore[arg-type]
project_id=8,
- model="fake-model", # type: ignore[arg-type]
+ model="fake-model",
)
print(llm.premai_api_key, end="") # noqa: T201
captured = capsys.readouterr()
diff --git a/libs/community/tests/unit_tests/indexes/test_sql_record_manager.py b/libs/community/tests/unit_tests/indexes/test_sql_record_manager.py
index 01e77c5e7a9..2de0f2676bb 100644
--- a/libs/community/tests/unit_tests/indexes/test_sql_record_manager.py
+++ b/libs/community/tests/unit_tests/indexes/test_sql_record_manager.py
@@ -73,7 +73,7 @@ def test_update_timestamp(manager: SQLRecordManager) -> None:
records = (
session.query(UpsertionRecord)
.filter(UpsertionRecord.namespace == manager.namespace)
- .all() # type: ignore[attr-defined]
+ .all()
)
assert [
@@ -102,7 +102,7 @@ def test_update_timestamp(manager: SQLRecordManager) -> None:
records = (
session.query(UpsertionRecord)
.filter(UpsertionRecord.namespace == manager.namespace)
- .all() # type: ignore[attr-defined]
+ .all()
)
assert [
@@ -131,7 +131,7 @@ def test_update_timestamp(manager: SQLRecordManager) -> None:
records = (
session.query(UpsertionRecord)
.filter(UpsertionRecord.namespace == manager.namespace)
- .all() # type: ignore[attr-defined]
+ .all()
)
assert [
diff --git a/libs/community/tests/unit_tests/llms/test_aleph_alpha.py b/libs/community/tests/unit_tests/llms/test_aleph_alpha.py
index 1b3979fd674..4fa7d1a1621 100644
--- a/libs/community/tests/unit_tests/llms/test_aleph_alpha.py
+++ b/libs/community/tests/unit_tests/llms/test_aleph_alpha.py
@@ -29,7 +29,7 @@ def test_api_key_masked_when_passed_from_env(
monkeypatch: MonkeyPatch, capsys: CaptureFixture
) -> None:
monkeypatch.setenv("ALEPH_ALPHA_API_KEY", "secret-api-key")
- llm = AlephAlpha() # type: ignore[call-arg]
+ llm = AlephAlpha()
print(llm.aleph_alpha_api_key, end="") # noqa: T201
captured = capsys.readouterr()
diff --git a/libs/community/tests/unit_tests/llms/test_gooseai.py b/libs/community/tests/unit_tests/llms/test_gooseai.py
index 6ec2f0aadc9..13f851a931d 100644
--- a/libs/community/tests/unit_tests/llms/test_gooseai.py
+++ b/libs/community/tests/unit_tests/llms/test_gooseai.py
@@ -17,7 +17,7 @@ def _openai_v1_installed() -> bool:
@pytest.mark.requires("openai")
def test_api_key_is_secret_string() -> None:
- llm = GooseAI(gooseai_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = GooseAI(gooseai_api_key="secret-api-key") # type: ignore[arg-type]
assert isinstance(llm.gooseai_api_key, SecretStr)
assert llm.gooseai_api_key.get_secret_value() == "secret-api-key"
@@ -27,7 +27,7 @@ def test_api_key_is_secret_string() -> None:
)
@pytest.mark.requires("openai")
def test_api_key_masked_when_passed_via_constructor() -> None:
- llm = GooseAI(gooseai_api_key="secret-api-key") # type: ignore[arg-type, call-arg]
+ llm = GooseAI(gooseai_api_key="secret-api-key") # type: ignore[arg-type]
assert str(llm.gooseai_api_key) == "**********"
assert "secret-api-key" not in repr(llm.gooseai_api_key)
assert "secret-api-key" not in repr(llm)
@@ -40,7 +40,7 @@ def test_api_key_masked_when_passed_via_constructor() -> None:
def test_api_key_masked_when_passed_from_env() -> None:
with MonkeyPatch.context() as mp:
mp.setenv("GOOSEAI_API_KEY", "secret-api-key")
- llm = GooseAI() # type: ignore[call-arg]
+ llm = GooseAI()
assert str(llm.gooseai_api_key) == "**********"
assert "secret-api-key" not in repr(llm.gooseai_api_key)
assert "secret-api-key" not in repr(llm)
diff --git a/libs/community/tests/unit_tests/load/test_dump.py b/libs/community/tests/unit_tests/load/test_dump.py
index ef86c654575..2786ebb20af 100644
--- a/libs/community/tests/unit_tests/load/test_dump.py
+++ b/libs/community/tests/unit_tests/load/test_dump.py
@@ -113,7 +113,7 @@ def test_serialize_llmchain_env() -> None:
if not has_env:
os.environ["OPENAI_API_KEY"] = "env_variable"
- llm_2 = OpenAI(model="davinci", temperature=0.5) # type: ignore[call-arg]
+ llm_2 = OpenAI(model="davinci", temperature=0.5)
prompt_2 = PromptTemplate.from_template("hello {name}!")
chain_2 = LLMChain(llm=llm_2, prompt=prompt_2)
@@ -140,7 +140,7 @@ def test_serialize_llmchain_chat(snapshot: Any) -> None:
if not has_env:
os.environ["OPENAI_API_KEY"] = "env_variable"
- llm_2 = ChatOpenAI(model="davinci", temperature=0.5) # type: ignore[call-arg]
+ llm_2 = ChatOpenAI(model="davinci", temperature=0.5)
prompt_2 = ChatPromptTemplate.from_messages(
[HumanMessagePromptTemplate.from_template("hello {name}!")]
)
@@ -237,7 +237,7 @@ def test_aliases_hidden() -> None:
dumped = json.loads(dumps(test_class, pretty=True))
# Check by alias
- test_class = TestClass(my_favorite_secret_alias="hello", my_other_secret="world") # type: ignore[call-arg]
+ test_class = TestClass(my_favorite_secret_alias="hello", my_other_secret="world")
dumped = json.loads(dumps(test_class, pretty=True))
expected_dump = {
"lc": 1,
diff --git a/libs/community/tests/unit_tests/retrievers/test_base.py b/libs/community/tests/unit_tests/retrievers/test_base.py
index e8665ff2028..a25f6debf52 100644
--- a/libs/community/tests/unit_tests/retrievers/test_base.py
+++ b/libs/community/tests/unit_tests/retrievers/test_base.py
@@ -178,12 +178,12 @@ class FakeRetrieverV2(BaseRetriever):
@pytest.fixture
def fake_retriever_v2() -> BaseRetriever:
- return FakeRetrieverV2() # type: ignore[abstract]
+ return FakeRetrieverV2()
@pytest.fixture
def fake_erroring_retriever_v2() -> BaseRetriever:
- return FakeRetrieverV2(throw_error=True) # type: ignore[abstract]
+ return FakeRetrieverV2(throw_error=True)
def test_fake_retriever_v2(
diff --git a/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py b/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py
index f32aec69552..117d3a0b8c2 100644
--- a/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py
+++ b/libs/community/tests/unit_tests/tools/eden_ai/test_tools.py
@@ -5,7 +5,7 @@ import pytest
from langchain_community.tools.edenai import EdenAiTextModerationTool
-tool = EdenAiTextModerationTool( # type: ignore[call-arg]
+tool = EdenAiTextModerationTool(
providers=["openai"],
language="en",
edenai_api_key="fake_key", # type: ignore[arg-type]
diff --git a/libs/community/tests/unit_tests/tools/test_you.py b/libs/community/tests/unit_tests/tools/test_you.py
index 4c383a98d52..165b4c69e53 100644
--- a/libs/community/tests/unit_tests/tools/test_you.py
+++ b/libs/community/tests/unit_tests/tools/test_you.py
@@ -22,7 +22,7 @@ class TestYouSearchTool:
responses.GET, f"{TEST_ENDPOINT}/search", json=MOCK_RESPONSE_RAW, status=200
)
query = "Test query text"
- you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test")) # type: ignore[call-arg]
+ you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test"))
results = you_tool.invoke(query)
expected_result = MOCK_PARSED_OUTPUT
assert results == expected_result
@@ -33,7 +33,7 @@ class TestYouSearchTool:
responses.GET, f"{TEST_ENDPOINT}/search", json=MOCK_RESPONSE_RAW, status=200
)
query = "Test query text"
- you_tool = YouSearchTool( # type: ignore[call-arg]
+ you_tool = YouSearchTool(
api_wrapper=YouSearchAPIWrapper(ydc_api_key="test", k=2)
)
results = you_tool.invoke(query)
@@ -46,7 +46,7 @@ class TestYouSearchTool:
responses.GET, f"{TEST_ENDPOINT}/search", json=MOCK_RESPONSE_RAW, status=200
)
query = "Test query text"
- you_tool = YouSearchTool( # type: ignore[call-arg]
+ you_tool = YouSearchTool(
api_wrapper=YouSearchAPIWrapper(ydc_api_key="test", n_snippets_per_hit=1)
)
results = you_tool.invoke(query)
@@ -60,7 +60,7 @@ class TestYouSearchTool:
)
query = "Test news text"
- you_tool = YouSearchTool( # type: ignore[call-arg]
+ you_tool = YouSearchTool(
api_wrapper=YouSearchAPIWrapper(ydc_api_key="test", endpoint_type="news")
)
results = you_tool.invoke(query)
@@ -68,7 +68,7 @@ class TestYouSearchTool:
assert results == expected_result
async def test_ainvoke(self) -> None:
- you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test")) # type: ignore[call-arg]
+ you_tool = YouSearchTool(api_wrapper=YouSearchAPIWrapper(ydc_api_key="test"))
# Mock response object to simulate aiohttp response
mock_response = AsyncMock()
diff --git a/libs/community/tests/unit_tests/utilities/test_brave_search.py b/libs/community/tests/unit_tests/utilities/test_brave_search.py
index e1c9bdc15a7..8107eaa3fb2 100644
--- a/libs/community/tests/unit_tests/utilities/test_brave_search.py
+++ b/libs/community/tests/unit_tests/utilities/test_brave_search.py
@@ -18,7 +18,7 @@ def test_api_key_from_env(monkeypatch: Any) -> None:
env_key = "env-api-key"
monkeypatch.setenv("BRAVE_SEARCH_API_KEY", env_key)
# Do not pass the api_key explicitly
- wrapper = BraveSearchWrapper() # type: ignore[call-arg]
+ wrapper = BraveSearchWrapper()
assert wrapper.api_key.get_secret_value() == env_key
@@ -29,4 +29,4 @@ def test_api_key_missing(monkeypatch: Any) -> None:
monkeypatch.delenv("BRAVE_SEARCH_API_KEY", raising=False)
with pytest.raises(ValueError):
# This should raise an error because no api_key is available.
- BraveSearchWrapper() # type: ignore[call-arg]
+ BraveSearchWrapper()
diff --git a/libs/community/tests/unit_tests/vectorstores/test_databricks_vector_search.py b/libs/community/tests/unit_tests/vectorstores/test_databricks_vector_search.py
index e2b987245db..57fd474116c 100644
--- a/libs/community/tests/unit_tests/vectorstores/test_databricks_vector_search.py
+++ b/libs/community/tests/unit_tests/vectorstores/test_databricks_vector_search.py
@@ -426,7 +426,7 @@ def test_add_texts_with_metadata() -> None:
DEFAULT_PRIMARY_KEY: id_,
DEFAULT_TEXT_COLUMN: text,
DEFAULT_VECTOR_COLUMN: vector,
- **metadata, # type: ignore[arg-type]
+ **metadata,
}
for text, vector, id_, metadata in zip(
fake_texts, vectors, added_ids, metadatas