Delete ZeroShotAgent and CombineDocsChain components
This commit is contained in:
parent
5cf56ca7a8
commit
53844a5963
2 changed files with 0 additions and 56 deletions
|
|
@ -1,28 +0,0 @@
|
|||
from typing import List, Optional
|
||||
|
||||
from langchain.agents.mrkl.base import ZeroShotAgent
|
||||
from langchain_core.tools import BaseTool
|
||||
from langflow import CustomComponent
|
||||
from langflow.components.chains.LLMChain import LLMChain
|
||||
|
||||
|
||||
class ZeroShotAgentComponent(CustomComponent):
|
||||
display_name = "ZeroShotAgent"
|
||||
description = "Construct an agent from an LLM and tools."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"llm": {"display_name": "LLM Chain"},
|
||||
"tools": {"display_name": "Tools"},
|
||||
"prefix": {"display_name": "Prefix", "multiline": True},
|
||||
"suffix": {"display_name": "Suffix", "multiline": True},
|
||||
}
|
||||
|
||||
def build(
|
||||
self,
|
||||
llm: LLMChain,
|
||||
tools: Optional[List[BaseTool]] = None,
|
||||
prefix: str = "Answer the following questions as best you can. You have access to the following tools:",
|
||||
suffix: str = "Begin!\n\nQuestion: {input}\nThought:{agent_scratchpad}",
|
||||
) -> ZeroShotAgent:
|
||||
return ZeroShotAgent(llm_chain=llm, allowed_tools=tools, prefix=prefix, suffix=suffix)
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
from langflow import CustomComponent
|
||||
from langflow.field_typing import BaseLanguageModel, Chain
|
||||
from typing import Union, Callable
|
||||
from langchain.chains.combine_documents.base import BaseCombineDocumentsChain
|
||||
|
||||
|
||||
class CombineDocsChainComponent(CustomComponent):
|
||||
display_name = "CombineDocsChain"
|
||||
description = "Load question answering chain."
|
||||
|
||||
def build_config(self):
|
||||
return {
|
||||
"llm": {"display_name": "LLM"},
|
||||
"chain_type": {
|
||||
"display_name": "Chain Type",
|
||||
"options": ["stuff", "map_reduce", "map_rerank", "refine"],
|
||||
},
|
||||
}
|
||||
|
||||
def build(
|
||||
self,
|
||||
llm: BaseLanguageModel,
|
||||
chain_type: str,
|
||||
) -> Union[Chain, Callable]:
|
||||
if chain_type not in ["stuff", "map_reduce", "map_rerank", "refine"]:
|
||||
raise ValueError(f"Invalid chain_type: {chain_type}")
|
||||
|
||||
return BaseCombineDocumentsChain()
|
||||
Loading…
Add table
Add a link
Reference in a new issue