Skip to content

Commit

Permalink
🐛 fix: http_request_kwargs in HFClientVLLM
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammedAlhajji committed Jul 8, 2024
1 parent 00ea7b6 commit 88388e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dsp/modules/hf_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -198,6 +199,7 @@ def _generate(self, prompt, **kwargs):
port=self.port,
json=payload,
headers=self.headers,
**self.http_request_kwargs,
)

try:
Expand Down Expand Up @@ -225,6 +227,7 @@ def _generate(self, prompt, **kwargs):
port=self.port,
json=payload,
headers=self.headers,
**self.http_request_kwargs,
)

try:
Expand Down

0 comments on commit 88388e4

Please sign in to comment.