easyllm icon indicating copy to clipboard operation
easyllm copied to clipboard

Need to provide additional args to InferenceClient

Open dylan-stark opened this issue 2 years ago • 2 comments

I'm using huggingface.chatCompletion and need to be able to provide some cookies to the InferenceClient. I don't see a way to pass that in via create(), which is where the client is instantiated. I also looked at the huggingface_hub implementation, but didn't see a way to set it via module member or environment variable.

The approach I landed on was adding a module-level client_args dictionary, similar to huggingface.api_key and .prompt_builder, and passing anything defined in there when the client is instantiated. If that makes sense and you want to support this, I'm happy to open a PR. Or if you see issues or have suggestions to improve, let me know.

dylan-stark avatar Nov 02 '23 10:11 dylan-stark

Hello @dylan-stark,

Currently there is no way to customize the InferenceClient. If you want to can create a PR with a recommendation on how to add those.

philschmid avatar Nov 06 '23 07:11 philschmid

Hi @philschmid. I opened PR #45. It's working well for me in practice. If there are some changes you'd recommend, I'm happy to make them.

dylan-stark avatar Nov 19 '23 00:11 dylan-stark