8000 feat(cli): add fuzzy find provider capability to cli by Pouyanpi · Pull Request #1088 · NVIDIA/NeMo-Guardrails · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(cli): add fuzzy find provider capability to cli #1088

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

Easily search providers and add it to your config using:

nemoguardrails find-providers
cli-fuzzy-find.mov

Requires:

#1085

#Resolves:
#520

Documentation

#1089

@Pouyanpi Pouyanpi self-assigned this Apr 2, 2025
@Pouyanpi Pouyanpi added the enhancement New feature or request label Apr 2, 2025
@Pouyanpi Pouyanpi added this to the v0.14.0 milestone Apr 2, 2025
@Pouyanpi Pouyanpi marked this pull request as ready for review April 2, 2025 18:41
@Pouyanpi Pouyanpi marked this pull request as draft April 2, 2025 18:41
@Pouyanpi Pouyanpi force-pushed the feat/fuzzy-find-providers branch from 0cb20d1 to 7599587 Compare April 3, 2025 11:38
@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 14:17
@Pouyanpi Pouyanpi marked this pull request as draft April 11, 2025 14:21
@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.

This is a neat idea, approving. How about adding a validate option where we pass in a provider/model so we can check if it's supported by Guardrails?

@tgasser-nv
Copy link
Collaborator

Could you fix these warnings before merging:

➜  nemoguardrails git:(feat/fuzzy-find-providers) ✗ poetry run nemoguardrails providers --list
/Users/tgasser/projects/nemoguardrails/nemoguardrails/llm/providers/providers.py:101: UserWarning: Duplicate provider mapping for 'oci_data_sc
ience': existing class <class 'langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment'> vs new class <class 'langchain_commun
ity.chat_models.oci_data_science.ChatOCIModelDeploymentVLLM'>
  warnings.warn(
/Users/tgasser/projects/nemoguardrails/nemoguardrails/llm/providers/providers.py:101: UserWarning: Duplicate provider mapping for 'oci_data_sc
ience': existing class <class 'langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentVLLM'> vs new class <class 'langchain_co
mmunity.chat_models.oci_data_science.ChatOCIModelDeploymentTGI'>
  warnings.warn(
/Users/tgasser/projects/nemoguardrails/nemoguardrails/llm/providers/providers.py:101: UserWarning: Duplicate provider mapping for 'sambanova':
 existing class <class 'langchain_community.chat_models.sambanova.ChatSambaNovaCloud'> vs new class <class 'langchain_community.chat_models.sa
mbanova.ChatSambaStudio'>
  warnings.warn(

@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch 2 times, most recently from f97aa2b to bcf578f Compare April 16, 2025 17:34
@Pouyanpi
Copy link
Collaborator Author

This is a neat idea, approving. How about adding a validate option where we pass in a provider/model so we can check if it's supported by Guardrails?

This is a very good idea 👍🏻 I'll explore the possibility and get back to you.

@Pouyanpi Pouyanpi force-pushed the feat/lc-chat-providers branch from bcf578f to c925b04 Compare April 17, 2025 08:41
Base automatically changed from feat/lc-chat-providers to develop April 17, 2025 11:43
Introduced a new CLI module for interactive selection of LLM providers.
The module supports listing and selecting both text completion and chat
completion providers using fuzzy matching and a user-friendly interface.

Includes:
- `_list_providers` for listing available providers.
- `select_provider_type` and `select_provider` for interactive selection.
- `find_providers` as the main entry point for the CLI command.
Added a new `find_providers` command to the CLI for listing and
interactively selecting LLM providers. The command supports both text
and chat completion providers and includes a `--list` option for
displaying available providers without selection.
Added comprehensive unit tests for provider selection functionality,
including tests for listing providers, getting provider completions,
and interactive selection of provider types and providesr

Tests include:
- `_list_providers` output validation.
- `_get_provider_completions` return type and content checks.
- `find_providers` with `list_only` option.
- Mocked tests for `select_provider_type` and `select_provider_with_type`.
@Pouyanpi Pouyanpi force-pushed the feat/fuzzy-find-providers branch from 7599587 to 95edc71 Compare April 17, 2025 12:17
@Pouyanpi Pouyanpi marked this pull request as ready for review April 17, 2025 12:17
@Pouyanpi Pouyanpi merged commit 28abf68 into develop Apr 17, 2025
9 checks passed
@Pouyanpi Pouyanpi deleted the feat/fuzzy-find-providers branch April 17, 2025 12:29
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