Aller au contenu 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:71

Properties

_getTools

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

Type declaration

▸ (message): Promise<BaseTool<any>[]>

Parameters
NameType
messagestring
Returns

Promise<BaseTool<any>[]>

Defined in

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


llm

llm: LLM<object, object>

Defined in

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


maxInteractions

maxInteractions: number = 10

Defined in

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


outputParser

outputParser: ReActOutputParser

Defined in

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


reactChatFormatter

reactChatFormatter: ReActChatFormatter

Defined in

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

Methods

_getResponse

_getResponse(currentReasoning, sources): AgentChatResponse

Parameters

NameType
currentReasoningBaseReasoningStep[]
sourcesToolOutput[]

Returns

AgentChatResponse

Defined in

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


_getTaskStepResponse

_getTaskStepResponse(agentResponse, step, isDone): TaskStepOutput

Parameters

NameType
agentResponseAgentChatResponse
stepTaskStep
isDoneboolean

Returns

TaskStepOutput

Defined in

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


_processActions

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

Parameters

NameTypeDefault value
taskTaskundefined
toolsBaseTool<any>[]undefined
outputChatResponse<object>undefined
isStreamingbooleanfalse

Returns

Promise<[BaseReasoningStep[], boolean]>

Defined in

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


_runStep

_runStep(step, task): Promise<TaskStepOutput>

Parameters

NameType
stepTaskStep
taskTask

Returns

Promise<TaskStepOutput>

Defined in

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


extractReasoningStep

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

Parameters

NameType
outputChatResponse<object>
isStreamingboolean

Returns

[string, BaseReasoningStep[], boolean]

Defined in

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


finalizeTask

finalizeTask(task): void

Parameters

NameType
taskTask

Returns

void

Implementation of

AgentWorker.finalizeTask

Defined in

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


initializeStep

initializeStep(task): TaskStep

Parameters

NameType
taskTask

Returns

TaskStep

Implementation of

AgentWorker.initializeStep

Defined in

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


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:313


streamStep

streamStep(): Promise<TaskStepOutput>

Returns

Promise<TaskStepOutput>

Implementation of

AgentWorker.streamStep

Defined in

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