Class: OpenAIAgent
An agent that uses OpenAI's API to generate text.
Hierarchy
-
AgentRunner
↳
OpenAIAgent
Constructors
constructor
• new OpenAIAgent(«destructured»
): OpenAIAgent
Parameters
Name | Type |
---|---|
«destructured» | OpenAIAgentParams |
Returns
Overrides
AgentRunner.constructor
Defined in
packages/core/src/agent/openai/base.ts:26
Properties
agentWorker
• agentWorker: AgentWorker
<object
>
Inherited from
AgentRunner.agentWorker
Defined in
packages/core/src/agent/runner/base.ts:43
defaultToolChoice
• defaultToolChoice: string
Inherited from
AgentRunner.defaultToolChoice
Defined in
packages/core/src/agent/runner/base.ts:48
deleteTaskOnFinish
• deleteTaskOnFinish: boolean
Inherited from
AgentRunner.deleteTaskOnFinish
Defined in
packages/core/src/agent/runner/base.ts:47
initTaskStateKwargs
• initTaskStateKwargs: Record
<string
, any
>
Inherited from
AgentRunner.initTaskStateKwargs
Defined in
packages/core/src/agent/runner/base.ts:46
memory
• memory: BaseMemory
Inherited from
AgentRunner.memory
Defined in
packages/core/src/agent/runner/base.ts:45
state
• state: AgentState
Inherited from
AgentRunner.state
Defined in
packages/core/src/agent/runner/base.ts:44
Methods
_chat
▸ _chat(«destructured»
): Promise
<AgentChatResponse
>
Parameters
Name | Type |
---|---|
«destructured» | ChatEngineAgentParams |
Returns
Promise
<AgentChatResponse
>
Inherited from
AgentRunner._chat
Defined in
packages/core/src/agent/runner/base.ts:262
▸ _chat(«destructured»
): Promise
<StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
«destructured» | ChatEngineAgentParams & { stream : true } |
Returns
Promise
<StreamingAgentChatResponse
>
Inherited from
AgentRunner._chat
Defined in
packages/core/src/agent/runner/base.ts:267
_getPromptModules
▸ _getPromptModules(): string
[]
Returns
string
[]
Inherited from
AgentRunner._getPromptModules
Defined in
packages/core/src/agent/runner/base.ts:348
_getPrompts
▸ _getPrompts(): string
[]
Returns
string
[]
Inherited from
AgentRunner._getPrompts
Defined in
packages/core/src/agent/runner/base.ts:352
chat
▸ chat(«destructured»
): Promise
<AgentChatResponse
>
Sends a message to the LLM and returns the response.
Parameters
Name | Type |
---|---|
«destructured» | ChatEngineAgentParams & { stream? : false } |
Returns
Promise
<AgentChatResponse
>
Inherited from
AgentRunner.chat
Defined in
packages/core/src/agent/runner/base.ts:310
▸ chat(«destructured»
): Promise
<StreamingAgentChatResponse
>
Parameters
Name | Type |
---|---|
«destructured» | ChatEngineAgentParams & { stream : true } |
Returns
Promise
<StreamingAgentChatResponse
>
Inherited from
AgentRunner.chat
Defined in
packages/core/src/agent/runner/base.ts:318
createTask
▸ createTask(input
, kwargs?
): Task
Creates a task.
Parameters
Name | Type |
---|---|
input | string |
kwargs? | any |
Returns
Inherited from
AgentRunner.createTask
Defined in
packages/core/src/agent/runner/base.ts:74
deleteTask
▸ deleteTask(taskId
): void
Deletes the task.
Parameters
Name | Type |
---|---|
taskId | string |
Returns
void
Inherited from
AgentRunner.deleteTask
Defined in
packages/core/src/agent/runner/base.ts:117
finalizeResponse
▸ finalizeResponse(taskId
, stepOutput
, kwargs?
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Finalizes the response and returns it.
Parameters
Name | Type |
---|---|
taskId | string |
stepOutput | TaskStepOutput |
kwargs? | any |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Inherited from
AgentRunner.finalizeResponse
Defined in
packages/core/src/agent/runner/base.ts:227
getCompletedStep
▸ getCompletedStep(taskId
, stepId
, kwargs
): TaskStepOutput
Parameters
Name | Type |
---|---|
taskId | string |
stepId | string |
kwargs | any |
Returns
Inherited from
AgentRunner.getCompletedStep
Defined in
packages/core/src/agent/runner/base.ts:363
getCompletedSteps
▸ getCompletedSteps(taskId
): TaskStepOutput
[]
Returns the completed steps in the task.
Parameters
Name | Type |
---|---|
taskId | string |
Returns
Inherited from
AgentRunner.getCompletedSteps
Defined in
packages/core/src/agent/runner/base.ts:142
getTask
▸ getTask(taskId
): Task
Returns the task.
Parameters
Name | Type |
---|---|
taskId | string |
Returns
Inherited from
AgentRunner.getTask
Defined in
packages/core/src/agent/runner/base.ts:133
getUpcomingSteps
▸ getUpcomingSteps(taskId
, kwargs
): TaskStep
[]
Returns the next steps in the task.
Parameters
Name | Type |
---|---|
taskId | string |
kwargs | any |
Returns
TaskStep
[]
Inherited from
AgentRunner.getUpcomingSteps
Defined in
packages/core/src/agent/runner/base.ts:151
listTasks
▸ listTasks(): Task
[]
Returns the list of tasks.
Returns
Task
[]
Inherited from
AgentRunner.listTasks
Defined in
packages/core/src/agent/runner/base.ts:124
query
▸ query(params
): Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
query is the main entrypoint for the agent. It takes a query and returns a response.
Parameters
Name | Type |
---|---|
params | QueryEngineParamsNonStreaming |
Returns
Promise
<AgentChatResponse
| StreamingAgentChatResponse
>
Inherited from
AgentRunner.query
Defined in
packages/core/src/agent/types.ts:60
reset
▸ reset(): void
Resets the agent.
Returns
void
Inherited from
AgentRunner.reset
Defined in
packages/core/src/agent/runner/base.ts:359
runStep
▸ runStep(taskId
, input?
, step?
, kwargs?
): Promise
<TaskStepOutput
>
Runs the next step in the task.
Parameters
Name | Type |
---|---|
taskId | string |
input? | null | string |
step? | TaskStep |
kwargs | any |
Returns
Promise
<TaskStepOutput
>
Inherited from
AgentRunner.runStep
Defined in
packages/core/src/agent/runner/base.ts:193
streamStep
▸ streamStep(taskId
, input
, step?
, kwargs?
): Promise
<TaskStepOutput
>
Runs the step and returns the response.
Parameters
Name | Type |
---|---|
taskId | string |
input | string |
step? | TaskStep |
kwargs? | any |
Returns
Promise
<TaskStepOutput
>
Inherited from
AgentRunner.streamStep
Defined in
packages/core/src/agent/runner/base.ts:210
undoStep
▸ undoStep(taskId
): void
Undoes the step.
Parameters
Name | Type |
---|---|
taskId | string |
Returns
void
Inherited from
AgentRunner.undoStep