community[patch]: Release 0.2.11 (#24989)

This commit is contained in:
Bagatur 2024-08-02 13:08:44 -07:00 committed by GitHub
parent c2538e7834
commit 8e2316b8c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 540 additions and 561 deletions

View File

@ -1794,7 +1794,7 @@ class _CachedAwaitable:
def __await__(self) -> Generator:
if self.result is _unset:
self.result = yield from self.awaitable.__await__()
return self.result
return self.result # type: ignore
def _reawaitable(func: Callable) -> Callable:

View File

@ -133,11 +133,16 @@ class AsyncHtmlLoader(BaseLoader):
async with aiohttp.ClientSession(trust_env=self.trust_env) as session:
for i in range(retries):
try:
kwargs: Dict = dict(
headers=self.session.headers,
cookies=self.session.cookies.get_dict(),
**self.requests_kwargs,
)
if not self.session.verify:
kwargs["ssl"] = False
async with session.get(
url,
headers=self.session.headers,
ssl=None if self.session.verify else False,
**self.requests_kwargs,
**kwargs,
) as response:
try:
text = await response.text()

View File

@ -134,12 +134,13 @@ class WebBaseLoader(BaseLoader):
async with aiohttp.ClientSession() as session:
for i in range(retries):
try:
async with session.get(
url,
kwargs: Dict = dict(
headers=self.session.headers,
ssl=None if self.session.verify else False,
cookies=self.session.cookies.get_dict(),
) as response:
)
if not self.session.verify:
kwargs["ssl"] = False
async with session.get(url, **kwargs) as response:
if self.raise_for_status:
response.raise_for_status()
return await response.text()

View File

@ -318,9 +318,9 @@ class _OllamaCommon(BaseLanguageModel):
"Content-Type": "application/json",
**(self.headers if isinstance(self.headers, dict) else {}),
},
auth=self.auth,
auth=self.auth, # type: ignore[arg-type]
json=request_payload,
timeout=self.timeout,
timeout=self.timeout, # type: ignore[arg-type]
) as response:
if response.status != 200:
if response.status == 404:

View File

@ -25,7 +25,7 @@ class ConneryAction(BaseTool):
def _run(
self,
run_manager: Optional[CallbackManagerForToolRun] = None,
**kwargs: Dict[str, str],
**kwargs: Any,
) -> Dict[str, str]:
"""
Runs the Connery Action with the provided input.
@ -40,7 +40,7 @@ class ConneryAction(BaseTool):
async def _arun(
self,
run_manager: Optional[AsyncCallbackManagerForToolRun] = None,
**kwargs: Dict[str, str],
**kwargs: Any,
) -> Dict[str, str]:
"""
Runs the Connery Action asynchronously with the provided input.

View File

@ -133,7 +133,7 @@ class _AstraDBCollectionEnvironment(_AstraDBEnvironment):
if pre_delete_collection:
await async_astra_db.delete_collection(collection_name)
if inspect.isawaitable(embedding_dimension):
dimension = await embedding_dimension
dimension: Optional[int] = await embedding_dimension
else:
dimension = embedding_dimension
await async_astra_db.create_collection(

View File

@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Union
import aiohttp
import requests
from aiohttp import ServerTimeoutError
from aiohttp import ClientTimeout, ServerTimeoutError
from langchain_core.pydantic_v1 import BaseModel, Field, root_validator, validator
from requests.exceptions import Timeout
@ -229,7 +229,7 @@ class PowerBIDataset(BaseModel):
self.request_url,
headers=self.headers,
json=self._create_json_content(command),
timeout=10,
timeout=ClientTimeout(total=10),
) as response:
if response.status == 403:
return "TokenError: Could not login to PowerBI, please check your credentials." # noqa: E501
@ -240,7 +240,7 @@ class PowerBIDataset(BaseModel):
self.request_url,
headers=self.headers,
json=self._create_json_content(command),
timeout=10,
timeout=ClientTimeout(total=10),
) as response:
if response.status == 403:
return "TokenError: Could not login to PowerBI, please check your credentials." # noqa: E501

View File

@ -281,12 +281,13 @@ class SearxSearchWrapper(BaseModel):
async def _asearx_api_query(self, params: dict) -> SearxResults:
if not self.aiosession:
async with aiohttp.ClientSession() as session:
async with session.get(
self.searx_host,
headers=self.headers,
params=params,
ssl=(lambda: False if self.unsecure else None)(),
) as response:
kwargs: Dict = {
"headers": self.headers,
"params": params,
}
if self.unsecure:
kwargs["ssl"] = False
async with session.get(self.searx_host, **kwargs) as response:
if not response.ok:
raise ValueError("Searx API returned an error: ", response.text)
result = SearxResults(await response.text())

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "langchain-community"
version = "0.2.10"
version = "0.2.11"
description = "Community contributed LangChain integrations."
authors = []
license = "MIT"
@ -30,8 +30,8 @@ ignore-words-list = "momento,collison,ned,foor,reworkd,parth,whats,aapply,mysogy
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
langchain-core = "^0.2.23"
langchain = "^0.2.9"
langchain-core = "^0.2.27"
langchain = "^0.2.12"
SQLAlchemy = ">=1.4,<3"
requests = "^2"
PyYAML = ">=5.3"

View File

@ -38,7 +38,7 @@ class Match(Enum):
return isinstance(value, float)
elif template is cls.ObjectWildcard:
return True
elif type(value) != type(template):
elif type(value) is not type(template):
return False
elif isinstance(value, dict):
if len(value) != len(template):

View File

@ -6,7 +6,7 @@ from langchain_core.language_models.llms import BaseLLM
def assert_llm_equality(llm: BaseLLM, loaded_llm: BaseLLM) -> None:
"""Assert LLM Equality for tests."""
# Check that they are the same type.
assert type(llm) == type(loaded_llm)
assert type(llm) is type(loaded_llm)
# Client field can be session based, so hash is different despite
# all other values being the same, so just assess all other fields
for field in llm.__fields__.keys():