Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: http_request_kwargs in HFClientVLLM #1250

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
MohammedAlhajji marked this conversation as resolved.
Show resolved Hide resolved
)

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
Loading