Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

🐛 fix: http_request_kwargs in HFClientVLLM

Mohammed Alhajji88388e44c0c0
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 @@ class HFClientVLLM(HFModel):
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 @@ class HFClientVLLM(HFModel):
port=self.port,
json=payload,
headers=self.headers,
+ **self.http_request_kwargs,
)
try:
@@ -225,6 +227,7 @@ class HFClientVLLM(HFModel):
port=self.port,
json=payload,
headers=self.headers,
+ **self.http_request_kwargs,
)
try: