Huggingface LLM Provider

Created on 10 June 2024, 7 months ago
Updated 13 July 2024, 6 months ago

Problem/Motivation

Add an Huggingface abstraction layer into the core AI module as one of the important LLM's to handle out of the box.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇩🇪Germany marcus_johansson

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @marcus_johansson
  • 🇬🇧United Kingdom yautja_cetanu

    Would need to include

    • Functionality to choose with models you want to include into your site. This could be a "Find as you type" or you could go to hugging face and copy and paste the exact model name.
    • When a model is selected this will appear in the normal drop down
    • It's possible we just always allow all the models but this is complicated
    • Need to explore supporting all the models that arn't LLMs
  • Status changed to Needs review 6 months ago
  • 🇩🇪Germany marcus_johansson

    Done, can be tested with chat and embed. More operation types coming.

    The models that you setup on the config page are to show when using form selectors, when using calls you can still give any model.

  • 🇧🇪Belgium wouters_f Leuven

    Configuring the keys went fine,
    Finding the Huggingface models (i'm not a huggingface expert).
    I saw this on hugginface :
    <a href="https://huggingface.co/intfloat/multilingual-e5-small">https://huggingface.co/intfloat/multilingual-e5-small</a>
    So I enter this in the embedding autocomplete, but it automatically goes to
    hotchpotch/vespa-onnx-intfloat-multilingual-e5-small
    SO I'm not sure if this is to be expected.

    When I test this in the chat interface (model ReBatch/Reynaerde-7B-Instruct):
    I see this:

    POST https://api-inference.huggingface.co/models/ReBatch/Reynaerde-7B-Instruct` resulted in a `400 Bad Request` response: {"error":"Authorization header is correct, but the token seems invalid"}
    
    Of the following exception type:
    
    Drupal\ai\Exception\AiBadRequestException

    Apparently you should after configuring hugginface check these boxes.
    Find the settings user > Settings > Access tokens > Inference:

    Might be interesting to set a little instruction on the mistral config page (/admin/config/ai/providers/huggingface).
    Something of sorts: "Make sure your tokens have the permission to call the inference API, This is not enabled by default. (or similar).
    I'm no huggingface expert but can imagine other people bumbping into this.

  • 🇩🇪Germany marcus_johansson

    The autocomplete seems to have a bug when you fill in the actual full text. Will set it back to Needs Work. Also add some bolded information about the access token.

  • Status changed to Needs work 6 months ago
  • Status changed to Fixed 6 months ago
  • 🇩🇪Germany marcus_johansson

    Those things are fixed, so I think it mostly works now.

    The idea with default models is not bad. Its easy to add to the install config. It's just hard to decide what people wants there. Taking models that usually work for without failing on free tier would be preferred I think.

  • 🇧🇪Belgium wouters_f Leuven

    The danswer default models have a short description like.
    - if you're looking for multilingual content and search this is probably what you want.
    - if you want a really light fast model with only english content this is probably the right model for you.
    That really helped for choosing (at least for me)

    Also adding a small notification like
    "if you change embedding models it's best to do a re-index of the site. Otherwise your search might react in strange ways."

  • 🇬🇧United Kingdom yautja_cetanu

    If their things are opensource we could put a description in the module or maybe it's best to link to a documentation page because this might change a lot over time?

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024