8000 feat(llm): add support for langchain partner and community chat models by Pouyanpi · Pull Request #1085 · NVIDIA/NeMo-Guardrails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(llm): add support for langchain partner and community chat models #1085

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

Merged
merged 5 commits into from
Apr 17, 2025

Conversation

Pouyanpi
Copy link
Collaborator
@Pouyanpi Pouyanpi commented Apr 2, 2025

Description

Introduces a new abstraction layer for initializing LLM models with:

  • refactor providers module
  • implement model initialization logic
  • clear separation between text completion and chat models
  • proper error handling with dedicated ModelInitializationError
  • consistent provider name handling and discovery
  • type safety improvements for LangChain models

Added tests, increase number of providers related tests from 2 to 69.

Requires:

Following PRs must get merged first (those are cherry-picked to this PR)
#1084
#1083

Resolves

#1055
#1044
#1070
#124
#902
#753
#520
#865
might resolve #933
need to check #992

  • which discussions?
  • which issues?

TODO:

@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch from 69e3889 to 1c72e4a Compare April 2, 2025 10:29
@Pouyanpi Pouyanpi self-assigned this Apr 2, 2025
@Pouyanpi Pouyanpi added this to the v0.14.0 milestone Apr 2, 2025
@Pouyanpi Pouyanpi added the enhancement New feature or request label Apr 2, 2025
@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch 2 times, most recently from 12de6bb to 5a7bdb0 Compare April 10, 2025 14:41
@Pouyanpi Pouyanpi marked this pull request as ready for review April 11, 2025 12:34
@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch from c88c5ff to 9cec72e Compare April 14, 2025 11:40
Copy link
Collaborator
@tgasser-nv tgasser-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, approving. We need to define a subset of models for each of the initializer types and add them to integration tests. Then we can add documentation saying that we support every Langchain model out there, and list the models we actively test against. Also we need to add integration tests calling into these providers (could you create a follow-on task for that?)

@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch 3 times, most recently from f97aa2b to bcf578f Compare April 16, 2025 17:34
Introduces a new abstraction layer for initializing LLM models with:
- refactor providers module
- implement model initialization logic
- clear separation between text completion and chat models
- proper error handling with dedicated ModelInitializationError
- consistent provider name handling and discovery
- type safety improvements for LangChain models

fix: remove configurable

fix: remove lru_cache

feat(config): add mode field to Model

feat(llmrails): integrate mode field from Model

feat(initializer): integrate mode field from Model

feat(initializer): add mode support to LangChain model initialization

- introduced `ModelInitStrategy` class to encapsulate initialization
  strategies with supported modes.
- updated `try_strategy` to skip strategies that do not support the
  requested mode.
- enhanced logging
- adjusted strategies to include supported modes for better control
  over initialization logic.

fix(providers): change to log.debug

refactor: move deprecated llm providers to a list

fix: remove Langchain warnings

refactor: improve langchain initialization logic and names

add validation and improve model initialization

add custom_chat_model registeration test

add tests

skip failing test as it should be run in LIVE mode

Update nemoguardrails/rails/llm/config.py

Signed-off-by: Pouyan <13303554+Pouyanpi@users.noreply.github.com>
@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch from bcf578f to c925b04 Compare April 17, 2025 08:41
correct regex pattern in test for model initialization
@Pouyanpi Pouyanpi mentioned this pull request Apr 17, 2025
@Pouyanpi Pouyanpi merged commit aaf0124 into develop Apr 17, 2025
9 checks passed
@Pouyanpi Pouyanpi deleted the feat/lc-chat-providers branch April 17, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0