Saltar al contenido principal

Class: ReActAgentWorker

ReAct agent worker.

Implements

Constructors

constructor

new ReActAgentWorker(«destructured»): ReActAgentWorker

Parameters

NameType
«destructured»ReActAgentWorkerParams

Returns

ReActAgentWorker

Defined in

packages/core/src/agent/react/worker.ts:70

Properties

_getTools

_getTools: (message: string) => Promise<BaseTool[]>

Type declaration

▸ (message): Promise<BaseTool[]>

Parameters
NameType
messagestring
Returns

Promise<BaseTool[]>

Defined in

packages/core/src/agent/react/worker.ts:68


llm

llm: LLM<Record<string, unknown>>

Defined in

packages/core/src/agent/react/worker.ts:62


maxInteractions

maxInteractions: number = 10

Defined in

packages/core/src/agent/react/worker.ts:64


outputParser

outputParser: ReActOutputParser

Defined in

packages/core/src/agent/react/worker.ts:66


reactChatFormatter

reactChatFormatter: ReActChatFormatter

Defined in

packages/core/src/agent/react/worker.ts:65

Methods

_getResponse

_getResponse(currentReasoning, sources): AgentChatResponse

Parameters

NameType
currentReasoningBaseReasoningStep[]
sourcesToolOutput[]

Returns

AgentChatResponse

Defined in

packages/core/src/agent/react/worker.ts:221


_getTaskStepResponse

_getTaskStepResponse(agentResponse, step, isDone): TaskStepOutput

Parameters

NameType
agentResponseAgentChatResponse
stepTaskStep
isDoneboolean

Returns

TaskStepOutput

Defined in

packages/core/src/agent/react/worker.ts:244


_processActions

_processActions(task, tools, output, isStreaming?): Promise<[BaseReasoningStep[], boolean]>

Parameters

NameTypeDefault value
taskTaskundefined
toolsBaseTool[]undefined
outputChatResponseundefined
isStreamingbooleanfalse

Returns

Promise<[BaseReasoningStep[], boolean]>

Defined in

packages/core/src/agent/react/worker.ts:164


_runStep

_runStep(step, task): Promise<TaskStepOutput>

Parameters

NameType
stepTaskStep
taskTask

Returns

Promise<TaskStepOutput>

Defined in

packages/core/src/agent/react/worker.ts:260


extractReasoningStep

extractReasoningStep(output, isStreaming): [string, BaseReasoningStep[], boolean]

Parameters

NameType
outputChatResponse
isStreamingboolean

Returns

[string, BaseReasoningStep[], boolean]

Defined in

packages/core/src/agent/react/worker.ts:119


finalizeTask

finalizeTask(task): void

Parameters

NameType
taskTask

Returns

void

Implementation of

AgentWorker.finalizeTask

Defined in

packages/core/src/agent/react/worker.ts:312


initializeStep

initializeStep(task): TaskStep

Parameters

NameType
taskTask

Returns

TaskStep

Implementation of

AgentWorker.initializeStep

Defined in

packages/core/src/agent/react/worker.ts:96


runStep

runStep(step, task): Promise<TaskStepOutput>

Parameters

NameType
stepTaskStep
taskTask

Returns

Promise<TaskStepOutput>

Implementation of

AgentWorker.runStep

Defined in

packages/core/src/agent/react/worker.ts:304


streamStep

streamStep(): Promise<TaskStepOutput>

Returns

Promise<TaskStepOutput>

Implementation of

AgentWorker.streamStep

Defined in

packages/core/src/agent/react/worker.ts:308