stanfordnlp / dspy

DSPy: The framework for programming—not prompting—language models
https://dspy.ai
MIT License
18.84k stars 1.44k forks source link

Missing headers as http_request setting simple quick fix needed #1513

Closed dgonier closed 1 month ago

dgonier commented 1 month ago

You need to modify your hf_client.py because there are cases where uses need to pass in special headers in their request. You can easily do this by making the following changes

    self.http_request_kwargs = http_request_kwargs or {}
    self.model_type = model_type
    self.headers = self.http_request_kwargs.get('headers', {"Content-Type": "application/json"})
    self.http_request_kwargs.pop('headers')
arnavsinghvi11 commented 1 month ago

Thanks @dgonier ! updated on the latest commit