Class: OpenAIAgentWorker
Implements
Constructors
constructor
• new OpenAIAgentWorker(«destructured»
): OpenAIAgentWorker
Parameters
Name | Type |
---|---|
«destructured» | OpenAIAgentWorkerParams |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:95
Properties
_getTools
• Private
_getTools: (input
: string
) => Promise
<BaseTool
[]>
Type declaration
▸ (input
): Promise
<BaseTool
[]>
Parameters
Name | Type |
---|---|
input | string |
Returns
Promise
<BaseTool
[]>
Defined in
packages/core/src/agent/openai/worker.ts:93
llm
• Private
llm: OpenAI
Defined in
packages/core/src/agent/openai/worker.ts:88
maxFunctionCalls
• Private
maxFunctionCalls: number
= 5
Defined in
packages/core/src/agent/openai/worker.ts:89
prefixMessages
• prefixMessages: ChatMessage
[]
Defined in
packages/core/src/agent/openai/worker.ts:91
Methods
_getAgentResponse
▸ _getAgentResponse(task
, mode
, llmChatParams
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
task | Task |
mode | ChatResponseMode |
llmChatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions > |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:219
_getLlmChatParams
▸ _getLlmChatParams(task
, openaiTools
, toolChoice?
): LLMChatParamsBase
<OpenAIAdditionalChatOptions
>
Parameters
Name | Type | Default value |
---|---|---|
task | Task | undefined |
openaiTools | BaseTool [] | undefined |
toolChoice | ChatCompletionToolChoiceOption | "auto" |
Returns
LLMChatParamsBase
<OpenAIAdditionalChatOptions
>
Defined in
packages/core/src/agent/openai/worker.ts:144
_getStreamAiResponse
▸ _getStreamAiResponse(task
, llmChatParams
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
task | Task |
llmChatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions > |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:175
_processMessage
▸ _processMessage(task
, aiMessage
): AgentChatResponse
Parameters
Name | Type |
---|---|
task | Task |
aiMessage | ChatMessage |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:163
_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:302
_shouldContinue
▸ _shouldContinue(toolCalls
, nFunctionCalls
): boolean
Parameters
Name | Type |
---|---|
toolCalls | null | ChatCompletionMessageToolCall [] |
nFunctionCalls | number |
Returns
boolean
Defined in
packages/core/src/agent/openai/worker.ts:283
callFunction
▸ callFunction(tools
, toolCall
): Promise
<CallFunctionOutput
>
Parameters
Name | Type |
---|---|
tools | BaseTool [] |
toolCall | ChatCompletionMessageToolCall |
Returns
Promise
<CallFunctionOutput
>
Defined in
packages/core/src/agent/openai/worker.ts:241
finalizeTask
▸ finalizeTask(task
): void
Parameters
Name | Type |
---|---|
task | Task |
Returns
void
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:370
getAllMessages
▸ getAllMessages(task
): ChatMessage
[]
Parameters
Name | Type |
---|---|
task | Task |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:126
getLatestToolCalls
▸ getLatestToolCalls(task
): null
| ChatCompletionMessageToolCall
[]
Parameters
Name | Type |
---|---|
task | Task |
Returns
null
| ChatCompletionMessageToolCall
[]
Defined in
packages/core/src/agent/openai/worker.ts:134
getTools
▸ getTools(input
): Promise
<BaseTool
[]>
Parameters
Name | Type |
---|---|
input | string |
Returns
Promise
<BaseTool
[]>
Defined in
packages/core/src/agent/openai/worker.ts:298
initializeStep
▸ initializeStep(task
): TaskStep
Parameters
Name | Type |
---|---|
task | Task |
Returns
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:262
runStep
▸ runStep(step
, task
, chatParams
): Promise
<TaskStepOutput
>
Parameters
Name | Type |
---|---|
step | TaskStep |
task | Task |
chatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions > |
Returns
Promise
<TaskStepOutput
>
Implementation of
Defined in
packages/core/src/agent/openai/worker.ts:352
streamStep
▸ streamStep(step
, task
, chatParams
): Promise
<TaskStepOutput
>
Parameters
Name | Type |
---|---|
step | TaskStep |
task | Task |
chatParams | LLMChatParamsBase <OpenAIAdditionalChatOptions > |
Returns
Promise
<TaskStepOutput
>