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

Feature Request: Implement HuggingFace TGI API client #278

Open
michael-conrad opened this issue Jul 27, 2024 · 1 comment
Open

Feature Request: Implement HuggingFace TGI API client #278

michael-conrad opened this issue Jul 27, 2024 · 1 comment

Comments

@michael-conrad
Copy link

HuggingFace has a standard TGI/Docker type container for serving LLM requests.

It would be useful to take advantage of HuggingFace features for TGI generation.

@jackmpcollins
Copy link
Owner

jackmpcollins commented Jul 28, 2024

@michael-conrad

Text Generation Inference (TGI) now supports the Messages API, which is fully compatible with the OpenAI Chat Completion API. This feature is available starting from version 1.4.0. You can use OpenAI’s client libraries or third-party libraries expecting OpenAI schema to interact with TGI’s Messages API. Below are some examples of how to utilize this compatibility.

from https://huggingface.co/docs/text-generation-inference/messages_api

So you should be able to use magentic with HuggingFace TGI by setting the base_url param in OpenaiChatModel. See https://magentic.dev/configuration/

Please let me know here if this works for you or if there are any issues. If it works I'd be happy to accept a PR to add a section to the docs about it with useful links and any additional setup steps needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants