mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Expose kwargs in LLMChainExtractor.from_llm
(#3748)
Re: https://github.com/hwchase17/langchain/issues/3747
This commit is contained in:
parent
512c24fc9c
commit
57e028549a
@ -69,9 +69,10 @@ class LLMChainExtractor(BaseDocumentCompressor):
|
|||||||
llm: BaseLanguageModel,
|
llm: BaseLanguageModel,
|
||||||
prompt: Optional[PromptTemplate] = None,
|
prompt: Optional[PromptTemplate] = None,
|
||||||
get_input: Optional[Callable[[str, Document], str]] = None,
|
get_input: Optional[Callable[[str, Document], str]] = None,
|
||||||
|
llm_chain_kwargs: Optional[dict] = None,
|
||||||
) -> "LLMChainExtractor":
|
) -> "LLMChainExtractor":
|
||||||
"""Initialize from LLM."""
|
"""Initialize from LLM."""
|
||||||
_prompt = prompt if prompt is not None else _get_default_chain_prompt()
|
_prompt = prompt if prompt is not None else _get_default_chain_prompt()
|
||||||
_get_input = get_input if get_input is not None else default_get_input
|
_get_input = get_input if get_input is not None else default_get_input
|
||||||
llm_chain = LLMChain(llm=llm, prompt=_prompt)
|
llm_chain = LLMChain(llm=llm, prompt=_prompt, **(llm_chain_kwargs or {}))
|
||||||
return cls(llm_chain=llm_chain, get_input=_get_input)
|
return cls(llm_chain=llm_chain, get_input=_get_input)
|
||||||
|
Loading…
Reference in New Issue
Block a user