Skip to content

Add NvidiaChatGenerator component #1483

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

Open
julian-risch opened this issue Mar 7, 2025 · 1 comment · May be fixed by #1548
Open

Add NvidiaChatGenerator component #1483

julian-risch opened this issue Mar 7, 2025 · 1 comment · May be fixed by #1548
Assignees
Labels
feature request Ideas to improve an integration integration:nvidia P1

Comments

@julian-risch
Copy link
Member

julian-risch commented Mar 7, 2025

Is your feature request related to a problem? Please describe.
The current Nvidia integration comprises a NvidiaTextEmbedder, NvidiaDocumentEmbedder, NvidiaRanker andNvidiaGenerator but no NvidiaChatGenerator.
We should implement a NvidiaChatGenerator component and add a code example to https://haystack.deepset.ai/integrations/nvidia

Describe the solution you'd like
nvidia/src/haystack_integrations/utils/nvidia/nim_backend.py contains a generate method that uses the /chat/completions endpoint.
We should implement a chat_generate in nim_backend.py. After that generate can probably be refactored to call chat_generate with a list containing a single ChatMessage where the "role" is set to "user".

Note that we are implementing a run_async in all ChatGenerators too. An initial implementation of NvidiaChatGenerator without run_async would be okay but better if we add it too. #1379

Describe alternatives you've considered

Additional context
Adding this component was suggested on discord.

@lbux
Copy link
Contributor

lbux commented Mar 7, 2025

I wonder if this would even be necessary because my understanding is that Nvidia NIM can be hosted locally or used through their API, so this could all be accomplished through the OpenAIChatGenerator (they even recommend using OpenAI python library here). There doesn't seem to be anything "unique" to the Nvidia NIM API that would make it necessary to make a generator for those unique features alone. Since it is OpenAI API compliant, this would seem redundant. At least with Llama.cpp or Ollama chat generators that we have, they have some additional unique features/parameters that makes it a good idea to use their dedicated chat generators as opposed to OpenAIChatGenerator with an api_base_url

@julian-risch julian-risch added P1 and removed P2 labels Mar 12, 2025
@julian-risch julian-risch self-assigned this Mar 17, 2025
@julian-risch julian-risch removed the contributions wanted! Looking for external contributions label Mar 17, 2025
@julian-risch julian-risch linked a pull request Mar 18, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Ideas to improve an integration integration:nvidia P1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants