mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
14e8c74736
## Description This PR adds support for [lm-format-enforcer](https://github.com/noamgat/lm-format-enforcer) to LangChain. ![image](https://raw.githubusercontent.com/noamgat/lm-format-enforcer/main/docs/Intro.webp) The library is similar to jsonformer / RELLM which are supported in Langchain, but has several advantages such as - Batching and Beam search support - More complete JSON Schema support - LLM has control over whitespace, improving quality - Better runtime performance due to only calling the LLM's generate() function once per generate() call. The integration is loosely based on the jsonformer integration in terms of project structure. ## Dependencies No compile-time dependency was added, but if `lm-format-enforcer` is not installed, a runtime error will occur if it is trying to be used. ## Tests Due to the integration modifying the internal parameters of the underlying huggingface transformer LLM, it is not possible to test without building a real LM, which requires internet access. So, similar to the jsonformer and RELLM integrations, the testing is via the notebook. ## Twitter Handle [@noamgat](https://twitter.com/noamgat) Looking forward to hearing feedback! --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
9 lines
379 B
Python
9 lines
379 B
Python
"""Experimental LLM wrappers."""
|
|
|
|
from langchain_experimental.llms.jsonformer_decoder import JsonFormer
|
|
from langchain_experimental.llms.llamaapi import ChatLlamaAPI
|
|
from langchain_experimental.llms.lmformatenforcer_decoder import LMFormatEnforcer
|
|
from langchain_experimental.llms.rellm_decoder import RELLM
|
|
|
|
__all__ = ["RELLM", "JsonFormer", "ChatLlamaAPI", "LMFormatEnforcer"]
|