mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
perf(.github): set a timeout on get min versions HTTP calls (#35851)
During an automated code review of .github/scripts/get_min_versions.py, the following issue was identified. Set a timeout on get min versions HTTP calls. Network calls without a timeout can hang a worker indefinitely. I kept the patch small and re-ran syntax checks after applying it.
This commit is contained in:
@@ -718,7 +718,7 @@ def test_image_token_counting_jpeg() -> None:
|
||||
actual = model.get_num_tokens_from_messages([message])
|
||||
assert expected == actual
|
||||
|
||||
image_data = base64.b64encode(httpx.get(image_url).content).decode("utf-8")
|
||||
image_data = base64.b64encode(httpx.get(image_url, timeout=10.0).content).decode("utf-8")
|
||||
message = HumanMessage(
|
||||
content=[
|
||||
{"type": "text", "text": "describe the weather in this image"},
|
||||
@@ -750,7 +750,7 @@ def test_image_token_counting_png() -> None:
|
||||
actual = model.get_num_tokens_from_messages([message])
|
||||
assert expected == actual
|
||||
|
||||
image_data = base64.b64encode(httpx.get(image_url).content).decode("utf-8")
|
||||
image_data = base64.b64encode(httpx.get(image_url, timeout=10.0).content).decode("utf-8")
|
||||
message = HumanMessage(
|
||||
content=[
|
||||
{"type": "text", "text": "how many dice are in this image"},
|
||||
|
||||
@@ -92,7 +92,7 @@ class TestOpenAIStandard(ChatModelIntegrationTests):
|
||||
def test_openai_pdf_inputs(self, model: BaseChatModel) -> None:
|
||||
"""Test that the model can process PDF inputs."""
|
||||
url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
|
||||
pdf_data = base64.b64encode(httpx.get(url).content).decode("utf-8")
|
||||
pdf_data = base64.b64encode(httpx.get(url, timeout=10.0).content).decode("utf-8")
|
||||
|
||||
message = HumanMessage(
|
||||
[
|
||||
|
||||
@@ -87,7 +87,7 @@ class TestOpenAIResponses(TestOpenAIStandard):
|
||||
def test_openai_pdf_tool_messages(self, model: BaseChatModel) -> None:
|
||||
"""Test that the model can process PDF inputs in `ToolMessage` objects."""
|
||||
url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
|
||||
pdf_data = base64.b64encode(httpx.get(url).content).decode("utf-8")
|
||||
pdf_data = base64.b64encode(httpx.get(url, timeout=10.0).content).decode("utf-8")
|
||||
|
||||
tool_message = ToolMessage(
|
||||
content_blocks=[
|
||||
|
||||
Reference in New Issue
Block a user