Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Update hf_client.py to support custom headers

arnavsinghvi11bdf52ca21175
diff --git a/dsp/modules/hf_client.py b/dsp/modules/hf_client.py
index dac3a16d3..4b91e7e30 100644
--- a/dsp/modules/hf_client.py
+++ b/dsp/modules/hf_client.py
@@ -33,7 +33,7 @@ class HFClientTGI(HFModel):
self.ports = port if isinstance(port, list) else [port]
self.http_request_kwargs = http_request_kwargs or {}
- self.headers = {"Content-Type": "application/json"}
+ self.headers = self.http_request_kwargs.pop('headers', {"Content-Type": "application/json"})
self.kwargs = {
"model": model,