Open Chotom opened 1 month ago
Hi @Chotom!
Thanks for pointing out these inconsistencies/gaps in the documentation. We'll try to fix it for the next release. To answer your questions:
from nemoguardrails.llm.helpers import get_llm_instance_wrapper
from nemoguardrails.llm.providers import providers
from pprint import pprint
# List the names of supported LLM providers
pprint(providers.get_llm_provider_names())
# Detailed list with mapped classes
pprint(providers._providers)
Last, but not least, NeMo Guardrails has a mechanism for easily registering any LLM implementing the LangChain interface: https://docs.nvidia.com/nemo/guardrails/user_guides/configuration-guide.html?#custom-llm-models. This in combination with get_llm_instance_wrapper
can enable registering easily any LLM instance that you can instantiate in regular Python code. E.g.:
from nemoguardrails.llm.providers import register_llm_provider
def init(rails: LLMRails):
llm = ...
custom_llm_provider = get_llm_instance_wrapper(
llm=llm, llm_type="<some custom name>"
)
register_llm_provider("<some custom name>", custom_llm_provider)
Let me know if you have any additional questions.
Thanks! Especially this code clarifies any doubts in my case:
from pprint import pprint
from nemoguardrails.llm.providers import providers
pprint(providers._providers)
It would be great to have it in the Nemo docs somewhere in Supported LLM Models section.
In Supported LLM Models section there is info about supported engines:
The problem is that the documentation doesn't mention any particular page in the LangChain docs. I would guess that it references this page: Langchain > Components > LLMs. But there is also LangChain page dedicated to certain providers: Langchain > Providers.
And while some of the listed names seem to match the LangChain LLMs components (like e.g.
ai21
,aleph_alpha
,anthropic
), the other ones likeazure
orhuggingface_hub
, in my opinion, create inconsistency in name convention. The below image shows what I'm talking about (there is no particular provider called onlyazure
):So the questions are: