Closed krassowski closed 2 months ago
The problem might be that we are overriding the HuggingFace provider which is missing updates from their official LLMs in LangChain. For example, we are not declaring the async_client
in the root_validator
here, which is causing this error.
https://github.com/jupyterlab/jupyter-ai/blob/main/packages/jupyter-ai-magics/jupyter_ai_magics/providers.py#L614
We should remove any custom code from here, and use the provider as-is from LangChain.
Excited for the new version, when will we get it? ollama completion models help me a lot!
We should remove any custom code from here, and use the provider as-is from LangChain.
This would remove the image generation capability as implemented by @JasonWeill in https://github.com/jupyterlab/jupyter-ai/pull/66, right?
To be fair, the image generator had limited support with HuggingFace models. If there's an alternate way to use the HF models to make images that is more widely supported, I'd love to adopt that.
I think the clean implementation in the langchain ecosystem would be one layer higher, using the Tools/function calling strategy. It is possible to force model to call a certain tool.
There are existing tools that generate images:
Presumably making a HuggingFace tool would not be too difficult.
The limitation is that only some models support function calling (AzureChatOpenAI, ChatAnthropic, ChatCohere, ChatFireworks, ChatGroq, ChatMistralAI, ChatOpenAI, ChatVertexAI) and ChatHuggingFace is not one of them (at least as of v0.1). The full list is in: https://python.langchain.com/v0.1/docs/integrations/chat/
An alternative is to extract the current HuggingFace implementation to a new provider which would be marked as providing no chat and no inline completion models, but only an image generation model. In either case changes would be breaking.
Having a tool integration though would be very nice, like imagine asking for something in the chat and also getting an illustration with an image.
We should remove any custom code from here, and use the provider as-is from LangChain.
Actually, on taking second look this function is not doing anything useful since https://github.com/jupyterlab/jupyter-ai/pull/784 because it no longer overrides the tasks list:
So it can be simply deleted :shrug:
Description
Reproduce
Set any model from from hugging face hub on, try to use chat or completion with streaming enabled
Expected behavior
Hugging face hub models work
Context
main
at 2019571. The issue with streaming in inline completer is pre-existing, but chat got broken only rececntly, since:This might be an upstream issue, or maybe we should have a way to detect when a model does not support streaming.