garak.generators.langchain
LangChain generator support
- class LangChainLLMGenerator(name='', config_root=<module 'garak._config' from '/home/docs/checkouts/readthedocs.org/user_builds/garak/checkouts/stable/garak/_config.py'>)Source
Bases:
GeneratorClass supporting LangChain LLM interfaces
- See LangChain’s supported models here,
Calls invoke with the prompt and relays the response. No per-LLM specific checking, so make sure the right environment variables are set.
Set –target_name to the LLM type required.
Explicitly, garak delegates the majority of responsibility here:
the generator calls invoke() on the LLM, which seems to be the most widely supported method
langchain-relevant environment vars need to be set up there
There’s no support for chains, just the langchain LLM interface.
Configurable parameters:
DEFAULT_PARAMScontents:max_tokens=150temperature=0.75top_k=Nonecontext_len=Noneskip_seq_start=Noneskip_seq_end=Nonek=0p=0.75preset=Nonefrequency_penalty=0.0presence_penalty=0.0stop=[]model_provider=Noneconfigurable_fields=None
Default values are listed
See also Configuring garak for how to set these values.
Other attributes:
- extra_dependency_names = ['langchain.chat_models']
- generator_family_name = 'LangChain'