Class: OpenAIAgentWorker
OpenAI agent worker. This class is responsible for running the agent.
Implements
Constructors
constructor
• new OpenAIAgentWorker(«destructured»
): OpenAIAgentWorker
Initialize.
Parameters
Name | Type |
---|---|
«destructured» | OpenAIAgentWorkerParams |
Returns
Defined in
packages/core/src/agent/openai/worker.ts:105
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:100
llm
• Private
llm: OpenAI
Defined in
packages/core/src/agent/openai/worker.ts:94
maxFunctionCalls
• Private
maxFunctionCalls: number
Defined in
packages/core/src/agent/openai/worker.ts:96
prefixMessages
• prefixMessages: ChatMessage
[]
Defined in
packages/core/src/agent/openai/worker.ts:98
verbose
• Private
verbose: boolean
Defined in
packages/core/src/agent/openai/worker.ts:95
Methods
_getAgentResponse
▸ _getAgentResponse(task
, mode
, llmChatKwargs
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Get agent response.
Parameters
Name | Type |
---|---|
task | Task |
mode | ChatResponseMode |
llmChatKwargs | any |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:232
_getLlmChatKwargs
▸ _getLlmChatKwargs(task
, openaiTools
, toolChoice?
): Object
Parameters
Name | Type | Default value |
---|---|---|
task | Task | undefined |
openaiTools | { [key: string] : any ; }[] | undefined |
toolChoice | string | { [key: string] : any ; } | "auto" |
Returns
Object
Defined in
packages/core/src/agent/openai/worker.ts:165
_getStreamAiResponse
▸ _getStreamAiResponse(task
, llmChatKwargs
): Promise
<StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
task | Task |
llmChatKwargs | any |
Returns
Promise
<StreamingAgentChatResponse
>
Defined in
packages/core/src/agent/openai/worker.ts:198
_processMessage
▸ _processMessage(task
, chatResponse
): AgentChatResponse
Process message.