mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-31 10:23:18 +00:00
langchain-openai[patch]: Add ruff bandit rules to linter (#31788)
This commit is contained in:
@@ -23,7 +23,7 @@ class _SyncHttpxClientWrapper(openai.DefaultHttpxClient):
|
||||
|
||||
try:
|
||||
self.close()
|
||||
except Exception:
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class _AsyncHttpxClientWrapper(openai.DefaultAsyncHttpxClient):
|
||||
try:
|
||||
# TODO(someday): support non asyncio runtimes here
|
||||
asyncio.get_running_loop().create_task(self.aclose())
|
||||
except Exception:
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
|
||||
|
||||
|
@@ -310,7 +310,8 @@ class BaseOpenAI(BaseLLM):
|
||||
generation = chunk
|
||||
else:
|
||||
generation += chunk
|
||||
assert generation is not None
|
||||
if generation is None:
|
||||
raise ValueError("Generation is empty after streaming.")
|
||||
choices.append(
|
||||
{
|
||||
"text": generation.text,
|
||||
@@ -378,7 +379,8 @@ class BaseOpenAI(BaseLLM):
|
||||
generation = chunk
|
||||
else:
|
||||
generation += chunk
|
||||
assert generation is not None
|
||||
if generation is None:
|
||||
raise ValueError("Generation is empty after streaming.")
|
||||
choices.append(
|
||||
{
|
||||
"text": generation.text,
|
||||
|
Reference in New Issue
Block a user