File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
mineru_vl_utils/vlm_client Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 22import json
33import os
44import re
5+ from enum import Enum
56from typing import AsyncIterable , Iterable , Sequence
67
78import httpx
@@ -35,6 +36,16 @@ def _get_env(key: str, default: str | None = None) -> str:
3536 raise ValueError (f"Environment variable { key } is not set." )
3637
3738
39+ class HTTPMethod (str , Enum ):
40+ HEAD = "HEAD"
41+ GET = "GET"
42+ PUT = "PUT"
43+ DELETE = "DELETE"
44+ OPTIONS = "OPTIONS"
45+ TRACE = "TRACE"
46+ POST = "POST"
47+
48+
3849class HttpVlmClient (VlmClient ):
3950 def __init__ (
4051 self ,
@@ -120,6 +131,7 @@ def _new_client(self) -> httpx.Client:
120131 retry = Retry (
121132 total = self .max_retries ,
122133 backoff_factor = self .retry_backoff_factor ,
134+ allowed_methods = list (HTTPMethod ),
123135 ),
124136 transport = httpx .HTTPTransport (
125137 limits = httpx .Limits (
@@ -144,6 +156,7 @@ async def _new_aio_client(self) -> httpx.AsyncClient:
144156 retry = Retry (
145157 total = self .max_retries ,
146158 backoff_factor = self .retry_backoff_factor ,
159+ allowed_methods = list (HTTPMethod ),
147160 ),
148161 transport = httpx .AsyncHTTPTransport (
149162 limits = httpx .Limits (
You can’t perform that action at this time.
0 commit comments