forked from Archives/langchain
Harrison/spell executor (#4914)
Co-authored-by: Jan Minar <rdancer@rdancer.org>
This commit is contained in:
parent
c06973261a
commit
5feb60f426
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cells": [
|
"cells": [
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "406483c4",
|
"id": "406483c4",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -15,6 +16,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "91192118",
|
"id": "91192118",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -38,6 +40,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "0b10d200",
|
"id": "0b10d200",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -70,6 +73,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "ce38ae84",
|
"id": "ce38ae84",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@ -114,10 +118,11 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"agent = PlanAndExecute(planner=planner, executer=executor, verbose=True)"
|
"agent = PlanAndExecute(planner=planner, executor=executor, verbose=True)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "8be9f1bd",
|
"id": "8be9f1bd",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
@ -14,7 +14,7 @@ from langchain.experimental.plan_and_execute.schema import (
|
|||||||
|
|
||||||
class PlanAndExecute(Chain):
|
class PlanAndExecute(Chain):
|
||||||
planner: BasePlanner
|
planner: BasePlanner
|
||||||
executer: BaseExecutor
|
executor: BaseExecutor
|
||||||
step_container: BaseStepContainer = Field(default_factory=ListStepContainer)
|
step_container: BaseStepContainer = Field(default_factory=ListStepContainer)
|
||||||
input_key: str = "input"
|
input_key: str = "input"
|
||||||
output_key: str = "output"
|
output_key: str = "output"
|
||||||
@ -41,7 +41,7 @@ class PlanAndExecute(Chain):
|
|||||||
for step in plan.steps:
|
for step in plan.steps:
|
||||||
_new_inputs = {"previous_steps": self.step_container, "current_step": step}
|
_new_inputs = {"previous_steps": self.step_container, "current_step": step}
|
||||||
new_inputs = {**_new_inputs, **inputs}
|
new_inputs = {**_new_inputs, **inputs}
|
||||||
response = self.executer.step(
|
response = self.executor.step(
|
||||||
new_inputs,
|
new_inputs,
|
||||||
callbacks=run_manager.get_child() if run_manager else None,
|
callbacks=run_manager.get_child() if run_manager else None,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user