From 88388e44c0c08afab7886dd5b960a273dc33e0b3 Mon Sep 17 00:00:00 2001 From: Mohammed Alhajji Date: Mon, 8 Jul 2024 09:17:00 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20http=5Frequest=5Fkwargs?= =?UTF-8?q?=20in=20HFClientVLLM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dsp/modules/hf_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dsp/modules/hf_client.py b/dsp/modules/hf_client.py index 71cc22666..6a49e69db 100644 --- a/dsp/modules/hf_client.py +++ b/dsp/modules/hf_client.py @@ -118,7 +118,7 @@ def send_hftgi_request_v00(arg, **kwargs): class HFClientVLLM(HFModel): - def __init__(self, model, port, model_type: Literal['chat', 'text'] = 'text', url="http://localhost", **kwargs): + def __init__(self, model, port, model_type: Literal['chat', 'text'] = 'text', url="http://localhost", http_request_kwargs=None, **kwargs): super().__init__(model=model, is_client=True) if isinstance(url, list): @@ -132,6 +132,7 @@ def __init__(self, model, port, model_type: Literal['chat', 'text'] = 'text', ur self.urls_const = tuple(self.urls) self.port = port + self.http_request_kwargs = http_request_kwargs or {} self.model_type = model_type self.headers = {"Content-Type": "application/json"} self.kwargs |= kwargs @@ -198,6 +199,7 @@ def _generate(self, prompt, **kwargs): port=self.port, json=payload, headers=self.headers, + **self.http_request_kwargs, ) try: @@ -225,6 +227,7 @@ def _generate(self, prompt, **kwargs): port=self.port, json=payload, headers=self.headers, + **self.http_request_kwargs, ) try: