mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-23 11:30:37 +00:00
update experimental (#8402)
some changes were made to experimental, porting them over
This commit is contained in:
@@ -9,6 +9,8 @@ from langchain_experimental.plan_and_execute.schema import Plan, PlanOutputParse
|
||||
|
||||
|
||||
class BasePlanner(BaseModel):
|
||||
"""Base planner."""
|
||||
|
||||
@abstractmethod
|
||||
def plan(self, inputs: dict, callbacks: Callbacks = None, **kwargs: Any) -> Plan:
|
||||
"""Given input, decide what to do."""
|
||||
@@ -17,13 +19,18 @@ class BasePlanner(BaseModel):
|
||||
async def aplan(
|
||||
self, inputs: dict, callbacks: Callbacks = None, **kwargs: Any
|
||||
) -> Plan:
|
||||
"""Given input, decide what to do."""
|
||||
"""Given input, asynchronously decide what to do."""
|
||||
|
||||
|
||||
class LLMPlanner(BasePlanner):
|
||||
"""LLM planner."""
|
||||
|
||||
llm_chain: LLMChain
|
||||
"""The LLM chain to use."""
|
||||
output_parser: PlanOutputParser
|
||||
"""The output parser to use."""
|
||||
stop: Optional[List] = None
|
||||
"""The stop list to use."""
|
||||
|
||||
def plan(self, inputs: dict, callbacks: Callbacks = None, **kwargs: Any) -> Plan:
|
||||
"""Given input, decide what to do."""
|
||||
@@ -33,7 +40,7 @@ class LLMPlanner(BasePlanner):
|
||||
async def aplan(
|
||||
self, inputs: dict, callbacks: Callbacks = None, **kwargs: Any
|
||||
) -> Plan:
|
||||
"""Given input, decide what to do."""
|
||||
"""Given input, asynchronously decide what to do."""
|
||||
llm_response = await self.llm_chain.arun(
|
||||
**inputs, stop=self.stop, callbacks=callbacks
|
||||
)
|
||||
|
Reference in New Issue
Block a user