Aller au contenu principal

Class: OpenAIAgent

Hierarchy

  • AgentRunner<OpenAI>

    OpenAIAgent

Constructors

constructor

new OpenAIAgent(params): OpenAIAgent

Parameters

NameType
paramsOpenAIAgentParams

Returns

OpenAIAgent

Overrides

AgentRunner&lt;OpenAI&gt;.constructor

Defined in

packages/core/src/agent/openai.ts:36

Properties

#chatHistory

Private #chatHistory: ChatMessage<ToolCallLLMMessageOptions>[]

Inherited from

AgentRunner.#chatHistory

Defined in

packages/core/src/agent/base.ts:227


#llm

Private Readonly #llm: OpenAI

Inherited from

AgentRunner.#llm

Defined in

packages/core/src/agent/base.ts:222


#runner

Private Readonly #runner: AgentWorker<OpenAI, {}, ToolCallLLMMessageOptions>

Inherited from

AgentRunner.#runner

Defined in

packages/core/src/agent/base.ts:228


#systemPrompt

Private Readonly #systemPrompt: null | MessageContent = null

Inherited from

AgentRunner.#systemPrompt

Defined in

packages/core/src/agent/base.ts:226


#tools

Private Readonly #tools: BaseToolWithCall[] | (query: MessageContent) => Promise<BaseToolWithCall[]>

Inherited from

AgentRunner.#tools

Defined in

packages/core/src/agent/base.ts:223


createStore

createStore: () => object = AgentRunner.defaultCreateStore

Type declaration

▸ (): object

Returns

object

Overrides

AgentRunner.createStore

Defined in

packages/core/src/agent/openai.ts:52


taskHandler

Static taskHandler: TaskHandler<OpenAI>

Defined in

packages/core/src/agent/openai.ts:54

Accessors

chatHistory

get chatHistory(): ChatMessage<AdditionalMessageOptions>[]

Returns

ChatMessage<AdditionalMessageOptions>[]

Inherited from

AgentRunner.chatHistory

Defined in

packages/core/src/agent/base.ts:254


llm

get llm(): AI

Returns

AI

Inherited from

AgentRunner.llm

Defined in

packages/core/src/agent/base.ts:250

Methods

chat

chat(params): Promise<AgentChatResponse<ToolCallLLMMessageOptions>>

Parameters

NameType
paramsChatEngineParamsNonStreaming

Returns

Promise<AgentChatResponse<ToolCallLLMMessageOptions>>

Inherited from

AgentRunner.chat

Defined in

packages/core/src/agent/base.ts:310

chat(params): Promise<ReadableStream<AgentStreamChatResponse<ToolCallLLMMessageOptions>>>

Parameters

NameType
paramsChatEngineParamsStreaming

Returns

Promise<ReadableStream<AgentStreamChatResponse<ToolCallLLMMessageOptions>>>

Inherited from

AgentRunner.chat

Defined in

packages/core/src/agent/base.ts:313


createTask

createTask(message, stream?): Promise<ReadableStream<TaskStepOutput<OpenAI, {}, ToolCallLLMMessageOptions>>>

Parameters

NameTypeDefault value
messageMessageContentundefined
streambooleanfalse

Returns

Promise<ReadableStream<TaskStepOutput<OpenAI, {}, ToolCallLLMMessageOptions>>>

Inherited from

AgentRunner.createTask

Defined in

packages/core/src/agent/base.ts:282


getTools

getTools(query): BaseToolWithCall[] | Promise<BaseToolWithCall[]>

Parameters

NameType
queryMessageContent

Returns

BaseToolWithCall[] | Promise<BaseToolWithCall[]>

Inherited from

AgentRunner.getTools

Defined in

packages/core/src/agent/base.ts:262


reset

reset(): void

Returns

void

Inherited from

AgentRunner.reset

Defined in

packages/core/src/agent/base.ts:258


defaultCreateStore

defaultCreateStore(): object

Returns

object

Inherited from

AgentRunner.defaultCreateStore

Defined in

packages/core/src/agent/base.ts:233


shouldContinue

shouldContinue<AI, Store, AdditionalMessageOptions>(task): boolean

Type parameters

NameType
AIextends LLM<object, object>
Storeextends object = {}
AdditionalMessageOptionsextends object = AI extends LLM<object, AdditionalMessageOptions> ? AdditionalMessageOptions : never

Parameters

NameType
taskReadonly<TaskStep<AI, Store, AdditionalMessageOptions>>

Returns

boolean

Inherited from

AgentRunner.shouldContinue

Defined in

packages/core/src/agent/base.ts:268