跳到主要内容

Class: OpenAIAgent

Extends

Constructors

new OpenAIAgent()

new OpenAIAgent(params): OpenAIAgent

Parameters

params: OpenAIAgentParams

Returns

OpenAIAgent

Overrides

AgentRunner<OpenAI>.constructor

Source

packages/llamaindex/src/agent/openai.ts:22

Properties

#chatHistory

private #chatHistory: ChatMessage <ToolCallLLMMessageOptions>[]

Inherited from

AgentRunner.#chatHistory

Source

packages/llamaindex/src/agent/base.ts:216


#llm

private readonly #llm: OpenAI

Inherited from

AgentRunner.#llm

Source

packages/llamaindex/src/agent/base.ts:211


#runner

private readonly #runner: AgentWorker <OpenAI, object, ToolCallLLMMessageOptions>

Inherited from

AgentRunner.#runner

Source

packages/llamaindex/src/agent/base.ts:217


#systemPrompt

private readonly #systemPrompt: null | MessageContent = null

Inherited from

AgentRunner.#systemPrompt

Source

packages/llamaindex/src/agent/base.ts:215


#tools

private readonly #tools: BaseToolWithCall[] | (query) => Promise <BaseToolWithCall[]>

Inherited from

AgentRunner.#tools

Source

packages/llamaindex/src/agent/base.ts:212


#verbose

private readonly #verbose: boolean

Inherited from

AgentRunner.#verbose

Source

packages/llamaindex/src/agent/base.ts:218


createStore()

createStore: () => object = AgentRunner.defaultCreateStore

Returns

object

Overrides

AgentRunner.createStore

Source

packages/llamaindex/src/agent/openai.ts:41


taskHandler

static taskHandler: TaskHandler <OpenAI>

Source

packages/llamaindex/src/agent/openai.ts:43

Accessors

chatHistory

get chatHistory(): ChatMessage<AdditionalMessageOptions>[]

Returns

ChatMessage<AdditionalMessageOptions>[]

Source

packages/llamaindex/src/agent/base.ts:245


llm

get llm(): AI

Returns

AI

Source

packages/llamaindex/src/agent/base.ts:241


verbose

get verbose(): boolean

Returns

boolean

Source

packages/llamaindex/src/agent/base.ts:249

Methods

chat()

chat(params)

chat(params): Promise <EngineResponse>

Parameters

params: ChatEngineParamsNonStreaming

Returns

Promise <EngineResponse>

Inherited from

AgentRunner.chat

Source

packages/llamaindex/src/agent/base.ts:316

chat(params)

chat(params): Promise<ReadableStream <EngineResponse>>

Parameters

params: ChatEngineParamsStreaming

Returns

Promise<ReadableStream <EngineResponse>>

Inherited from

AgentRunner.chat

Source

packages/llamaindex/src/agent/base.ts:317


createTask()

createTask(message, stream, verbose, chatHistory?): ReadableStream<TaskStepOutput <OpenAI, object, ToolCallLLMMessageOptions>>

Parameters

message: MessageContent

stream: boolean= false

verbose: undefined | boolean= undefined

chatHistory?: ChatMessage <ToolCallLLMMessageOptions>[]

Returns

ReadableStream<TaskStepOutput <OpenAI, object, ToolCallLLMMessageOptions>>

Inherited from

AgentRunner.createTask

Source

packages/llamaindex/src/agent/base.ts:276


getTools()

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

Parameters

query: MessageContent

Returns

BaseToolWithCall[] | Promise <BaseToolWithCall[]>

Inherited from

AgentRunner.getTools

Source

packages/llamaindex/src/agent/base.ts:257


reset()

reset(): void

Returns

void

Inherited from

AgentRunner.reset

Source

packages/llamaindex/src/agent/base.ts:253


defaultCreateStore()

static defaultCreateStore(): object

Returns

object

Inherited from

AgentRunner.defaultCreateStore

Source

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


shouldContinue()

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

Type parameters

AI extends LLM<object, object>

Store extends object = object

AdditionalMessageOptions extends object = AI extends LLM<object, AdditionalMessageOptions> ? AdditionalMessageOptions : never

Parameters

task: Readonly<TaskStep<AI, Store, AdditionalMessageOptions>>

Returns

boolean

Inherited from

AgentRunner.shouldContinue

Source

packages/llamaindex/src/agent/base.ts:263