Skip to content

Commit

Permalink
community: fix lint from new mypy (#27474)
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis authored Oct 18, 2024
1 parent c397baa commit 97a819d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 49 deletions.
40 changes: 22 additions & 18 deletions libs/community/langchain_community/llms/gradient_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,23 @@ def _kwargs_post_fine_tune_request(
"content-type": "application/json",
},
json=dict(
samples=tuple(
{
"inputs": input,
}
for input in inputs
)
if multipliers is None
else tuple(
{
"inputs": input,
"fineTuningParameters": {
"multiplier": multiplier,
},
}
for input, multiplier in zip(inputs, multipliers)
samples=(
tuple(
{
"inputs": input,
}
for input in inputs
)
if multipliers is None
else tuple(
{
"inputs": input,
"fineTuningParameters": {
"multiplier": multiplier,
},
}
for input, multiplier in zip(inputs, multipliers)
)
),
),
)
Expand Down Expand Up @@ -338,9 +340,11 @@ async def _agenerate(
) -> LLMResult:
"""Run the LLM on the given prompt and input."""
generations = []
for generation in asyncio.gather(
[self._acall(prompt, stop=stop, run_manager=run_manager, **kwargs)]
for prompt in prompts
for generation in await asyncio.gather(
*[
self._acall(prompt, stop=stop, run_manager=run_manager, **kwargs)
for prompt in prompts
]
):
generations.append([Generation(text=generation)])
return LLMResult(generations=generations)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self, query: str) -> str:
"q": query,
}

total_results = []
total_results: Any = []
client = self.serp_search_engine(params)
client_dict = client.get_dict()
total_results = (
Expand Down
63 changes: 34 additions & 29 deletions libs/community/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/community/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jupyter = "^1.0.0"
setuptools = "^67.6.1"

[tool.poetry.group.typing.dependencies]
mypy = "^1.10"
mypy = "^1.12"
types-pyyaml = "^6.0.12.2"
types-requests = "^2.28.11.5"
types-toml = "^0.10.8.1"
Expand Down

0 comments on commit 97a819d

Please sign in to comment.