Class: OpenAIAgentWorker
Implements
Constructors
constructor
• new OpenAIAgentWorker(«destructured»
): OpenAIAgentWorker
Parameters
Name | Type |
---|---|
«destructured» | OpenAIAgentWorkerParams |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:92
Properties
_getTools
• Private
_getTools: (input
: string
) => Promise
<BaseTool
<any
>[]>
Type declaration
▸ (input
): Promise
<BaseTool
<any
>[]>
Parameters
Name | Type |
---|---|
input | string |
Returns
Promise
<BaseTool
<any
>[]>
Defined in
packages/core/src/agent/openai/worker.ts:90
llm
• Private
llm: OpenAI
Defined in
packages/core/src/agent/openai/worker.ts:85
maxFunctionCalls
• Private
maxFunctionCalls: number
= 5
Defined in
packages/core/src/agent/openai/worker.ts:86
prefixMessages
• prefixMessages: ChatMessage
[]
Defined in
packages/core/src/agent/openai/worker.ts:88
Methods
_getAgentResponse
▸ _getAgentResponse(task
, mode
, llmChatParams
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
task | Task |
mode | ChatResponseMode |
llmChatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions , ToolCallLLMMessageOptions > |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:253
_getLlmChatParams
▸ _getLlmChatParams(task
, tools
, toolChoice?
): LLMChatParamsBase
<OpenAIAdditionalChatOptions
, ToolCallLLMMessageOptions
>
Parameters
Name | Type | Default value |
---|---|---|
task | Task | undefined |
tools | BaseTool <any >[] | undefined |
toolChoice | ChatCompletionToolChoiceOption | "auto" |
Returns
LLMChatParamsBase
<OpenAIAdditionalChatOptions
, ToolCallLLMMessageOptions
>
Defined in
packages/core/src/agent/openai/worker.ts:142
_getStreamAiResponse
▸ _getStreamAiResponse(task
, llmChatParams
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
task | Task |
llmChatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions , ToolCallLLMMessageOptions > |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:176
_processMessage
▸ _processMessage(task
, aiMessage
): AgentChatResponse
Parameters
Name | Type |
---|---|
task | Task |
aiMessage | ChatMessage |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:164
_runStep
▸ _runStep(step
, task
, mode?
, toolChoice?
): Promise
<TaskStepOutput
>
Parameters
Name | Type | Default value |
---|---|---|
step | TaskStep | undefined |
task | Task | undefined |
mode | ChatResponseMode | ChatResponseMode.WAIT |
toolChoice | ChatCompletionToolChoiceOption | "auto" |
Returns
Promise
<TaskStepOutput
>
Defined in
packages/core/src/agent/openai/worker.ts:329
_shouldContinue
▸ _shouldContinue(toolCall
, nFunctionCalls
): toolCall is ToolCall
Parameters
Name | Type |
---|---|
toolCall | null | ToolCall |
nFunctionCalls | number |
Returns
toolCall is ToolCall
Defined in
packages/core/src/agent/openai/worker.ts:314
callFunction
▸ callFunction(tools
, toolCall
): Promise
<CallFunctionOutput
>
Parameters
Name | Type |
---|---|
tools | BaseTool <any >[] |
toolCall | ToolCall |
Returns
Promise
<CallFunctionOutput
>
Defined in
packages/core/src/agent/openai/worker.ts:278
finalizeTask
▸ finalizeTask(task
): void
Parameters
Name | Type |
---|---|
task | Task |
Returns
void
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:393
getAllMessages
▸ getAllMessages(task
): ChatMessage
<ToolCallLLMMessageOptions
>[]
Parameters
Name | Type |
---|---|
task | Task |
Returns
ChatMessage
<ToolCallLLMMessageOptions
>[]
Defined in
packages/core/src/agent/openai/worker.ts:123
getLatestToolCall
▸ getLatestToolCall(task
): null
| ToolCall
Parameters
Name | Type |
---|---|
task | Task |
Returns
null
| ToolCall
Defined in
packages/core/src/agent/openai/worker.ts:131
getTools
▸ getTools(input
): Promise
<BaseTool
<any
>[]>
Parameters
Name | Type |
---|---|
input | string |
Returns
Promise
<BaseTool
<any
>[]>
Defined in
packages/core/src/agent/openai/worker.ts:325
initializeStep
▸ initializeStep(task
): TaskStep
Parameters
Name | Type |
---|---|
task | Task |
Returns
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:293
runStep
▸ runStep(step
, task
, chatParams
): Promise
<TaskStepOutput
>
Parameters
Name | Type |
---|---|
step | TaskStep |
task | Task |
chatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions , object > |
Returns
Promise
<TaskStepOutput
>
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:375
streamStep
▸ streamStep(step
, task
, chatParams
): Promise
<TaskStepOutput
>
Parameters
Name | Type |
---|---|
step | TaskStep |
task | Task |
chatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions , object > |
Returns
Promise
<TaskStepOutput
>