Skip to content

@toolcog/openai

Toolcog OpenAI plugin

References

default

Renames and re-exports openai

Interfaces

OpenAIEmbedderConfig

Options for configuring an Embedder function.

Note that embedder plugins may augment this type with additional options.

Extends

Properties

batchSize?

optional batchSize: number

Inherited from

EmbedderConfig.batchSize

Defined in

packages/plugins/openai/src/embedder.ts:23

dimensions?

optional dimensions: number

Inherited from

EmbedderConfig.dimensions

Defined in

packages/plugins/openai/src/embedder.ts:21

dispatcher?

optional dispatcher: Dispatcher<DispatcherEvents>

Defined in

packages/plugins/openai/src/embedder.ts:36

model?

optional model: EmbeddingModel

The default model the embedder should use.

Inherited from

EmbedderConfig.model

Defined in

packages/framework/core/src/embedding.ts:52

openai?

optional openai: OpenAI | ClientOptions

Defined in

packages/plugins/openai/src/embedder.ts:34


OpenAIEmbedderOptions

Options for controlling an Embedder call.

Note that embedder plugins may augment this type with additional options.

Extends

Properties

batchSize?

optional batchSize: number

Inherited from

EmbedderOptions.batchSize

Defined in

packages/plugins/openai/src/embedder.ts:29

dimensions?

optional dimensions: number

Inherited from

EmbedderOptions.dimensions

Defined in

packages/plugins/openai/src/embedder.ts:27

dispatcher?

optional dispatcher: Dispatcher<DispatcherEvents>

Defined in

packages/plugins/openai/src/embedder.ts:42

model?

optional model: EmbeddingModel

The model the embedder should use to generate embedding vectors.

Inherited from

EmbedderOptions.model

Defined in

packages/framework/core/src/embedding.ts:64

openai?

optional openai: OpenAI | ClientOptions

Defined in

packages/plugins/openai/src/embedder.ts:40

signal?

optional signal: AbortSignal

An abort signal that can be used to cancel the embedder call.

Inherited from

EmbedderOptions.signal

Defined in

packages/framework/core/src/embedding.ts:69


OpenAIGeneratorConfig

Options for configuring a Generator function.

Note that generator plugins may augment this type with additional options.

Extends

Properties

dispatcher?

optional dispatcher: Dispatcher<DispatcherEvents>

Defined in

packages/plugins/openai/src/generator.ts:107

frequency_penalty?

optional frequency_penalty: number

Inherited from

GeneratorConfig.frequency_penalty

Defined in

packages/plugins/openai/src/generator.ts:52

jsonMode?

optional jsonMode: boolean

Inherited from

GeneratorConfig.jsonMode

Defined in

packages/plugins/openai/src/generator.ts:50

logit_bias?

optional logit_bias: null | Record<string, number>

Inherited from

GeneratorConfig.logit_bias

Defined in

packages/plugins/openai/src/generator.ts:54

max_tokens?

optional max_tokens: number

Inherited from

GeneratorConfig.max_tokens

Defined in

packages/plugins/openai/src/generator.ts:56

model?

optional model: GenerativeModel

The default model the generator should use.

Inherited from

GeneratorConfig.model

Defined in

packages/framework/core/src/generative.ts:103

openai?

optional openai: OpenAI | ClientOptions

Inherited from

GeneratorConfig.openai

Defined in

packages/plugins/openai/src/generator.ts:48

parallel_tool_calls?

optional parallel_tool_calls: boolean

Inherited from

GeneratorConfig.parallel_tool_calls

Defined in

packages/plugins/openai/src/generator.ts:58

presence_penalty?

optional presence_penalty: number

Inherited from

GeneratorConfig.presence_penalty

Defined in

packages/plugins/openai/src/generator.ts:60

seed?

optional seed: number

Inherited from

GeneratorConfig.seed

Defined in

packages/plugins/openai/src/generator.ts:62

service_tier?

optional service_tier: "default" | "auto"

Inherited from

GeneratorConfig.service_tier

Defined in

packages/plugins/openai/src/generator.ts:64

stop?

optional stop: null | string | readonly string[]

Inherited from

GeneratorConfig.stop

Defined in

packages/plugins/openai/src/generator.ts:66

stream?

optional stream: boolean

Whether or not the generator should stream responses by default.

Inherited from

GeneratorConfig.stream

Defined in

packages/framework/core/src/generative.ts:114

system?

optional system: string

The default system prompt the generator should use when generating the response.

Inherited from

GeneratorConfig.system

Defined in

packages/framework/core/src/generative.ts:109

temperature?

optional temperature: number

Inherited from

GeneratorConfig.temperature

Defined in

packages/plugins/openai/src/generator.ts:68

tools?

optional tools: null | readonly ToolSource[]

The default set of tools the generator should use.

Inherited from

GeneratorConfig.tools

Defined in

packages/framework/core/src/generative.ts:98

top_p?

optional top_p: number

Inherited from

GeneratorConfig.top_p

Defined in

packages/plugins/openai/src/generator.ts:70

user?

optional user: string

Inherited from

GeneratorConfig.user

Defined in

packages/plugins/openai/src/generator.ts:72


OpenAIGeneratorOptions

Options for controlling a Generator call.

Note that generator plugins may augment this type with additional options.

Extends

Properties

dispatcher?

optional dispatcher: Dispatcher<DispatcherEvents>

Defined in

packages/plugins/openai/src/generator.ts:111

frequency_penalty?

optional frequency_penalty: number

Inherited from

GeneratorOptions.frequency_penalty

Defined in

packages/plugins/openai/src/generator.ts:80

id?

optional id: string

Inherited from

GeneratorOptions.id

Defined in

packages/framework/core/src/generative.ts:123

instructions?

optional instructions: InstructionsSource

Instructions the generator should follow when generating the response.

Inherited from

GeneratorOptions.instructions

Defined in

packages/framework/core/src/generative.ts:138

jsonMode?

optional jsonMode: boolean

Inherited from

GeneratorOptions.jsonMode

Defined in

packages/plugins/openai/src/generator.ts:78

logit_bias?

optional logit_bias: null | Record<string, number>

Inherited from

GeneratorOptions.logit_bias

Defined in

packages/plugins/openai/src/generator.ts:82

max_tokens?

optional max_tokens: number

Inherited from

GeneratorOptions.max_tokens

Defined in

packages/plugins/openai/src/generator.ts:84

model?

optional model: GenerativeModel

The model the generator should use to generate the response.

Inherited from

GeneratorOptions.model

Defined in

packages/framework/core/src/generative.ts:148

openai?

optional openai: OpenAI | ClientOptions

Inherited from

GeneratorOptions.openai

Defined in

packages/plugins/openai/src/generator.ts:76

parallel_tool_calls?

optional parallel_tool_calls: boolean

Inherited from

GeneratorOptions.parallel_tool_calls

Defined in

packages/plugins/openai/src/generator.ts:86

parameters?

optional parameters: Schema

A schema that describes the arguments to the generator call.

Inherited from

GeneratorOptions.parameters

Defined in

packages/framework/core/src/generative.ts:128

presence_penalty?

optional presence_penalty: number

Inherited from

GeneratorOptions.presence_penalty

Defined in

packages/plugins/openai/src/generator.ts:88

returns?

optional returns: Schema

A schema that describes the value the generator must generate.

Inherited from

GeneratorOptions.returns

Defined in

packages/framework/core/src/generative.ts:133

seed?

optional seed: number

Inherited from

GeneratorOptions.seed

Defined in

packages/plugins/openai/src/generator.ts:90

service_tier?

optional service_tier: "default" | "auto"

Inherited from

GeneratorOptions.service_tier

Defined in

packages/plugins/openai/src/generator.ts:92

signal?

optional signal: null | AbortSignal

An abort signal that can be used to cancel the generator call.

Inherited from

GeneratorOptions.signal

Defined in

packages/framework/core/src/generative.ts:163

stop?

optional stop: null | string | readonly string[]

Inherited from

GeneratorOptions.stop

Defined in

packages/plugins/openai/src/generator.ts:94

stream?

optional stream: boolean

Whether or not the generator should stream responses.

Inherited from

GeneratorOptions.stream

Defined in

packages/framework/core/src/generative.ts:158

system?

optional system: string

The system prompt the generator should use when generating the response.

Inherited from

GeneratorOptions.system

Defined in

packages/framework/core/src/generative.ts:153

temperature?

optional temperature: number

Inherited from

GeneratorOptions.temperature

Defined in

packages/plugins/openai/src/generator.ts:96

tool_choice?

optional tool_choice: ChatCompletionToolChoiceOption

Inherited from

GeneratorOptions.tool_choice

Defined in

packages/plugins/openai/src/generator.ts:98

tools?

optional tools: null | readonly ToolSource[]

The tools the generator should use when generating the response.

Inherited from

GeneratorOptions.tools

Defined in

packages/framework/core/src/generative.ts:143

top_p?

optional top_p: number

Inherited from

GeneratorOptions.top_p

Defined in

packages/plugins/openai/src/generator.ts:100

user?

optional user: string

Inherited from

GeneratorOptions.user

Defined in

packages/plugins/openai/src/generator.ts:102


OpenAIPluginConfig

Extends

  • ClientOptions

Properties

apiKey?

optional apiKey: string

Defaults to process.env[‘OPENAI_API_KEY’].

Inherited from

ClientOptions.apiKey

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:11

baseURL?

optional baseURL: null | string

Override the default base URL for the API, e.g., “https://api.example.com/v2/

Defaults to process.env[‘OPENAI_BASE_URL’].

Inherited from

ClientOptions.baseURL

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:25

dangerouslyAllowBrowser?

optional dangerouslyAllowBrowser: boolean

By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. Only set this option to true if you understand the risks and have appropriate mitigations in place.

Inherited from

ClientOptions.dangerouslyAllowBrowser

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:73

defaultHeaders?

optional defaultHeaders: Headers

Default headers to include with every request to the API.

These can be removed in individual requests by explicitly setting the header to undefined or null in request options.

Inherited from

ClientOptions.defaultHeaders

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:61

defaultQuery?

optional defaultQuery: DefaultQuery

Default query parameters to include with every request to the API.

These can be removed in individual requests by explicitly setting the param to undefined in request options.

Inherited from

ClientOptions.defaultQuery

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:68

dispatcher?

optional dispatcher: Dispatcher<DispatcherEvents>

Defined in

packages/plugins/openai/src/plugin.ts:20

embedder?

optional embedder: OpenAIEmbedderConfig

Defined in

packages/plugins/openai/src/plugin.ts:16

fetch?

optional fetch: Fetch

Specify a custom fetch function implementation.

If not provided, we use node-fetch on Node.js and otherwise expect that fetch is defined globally.

Inherited from

ClientOptions.fetch

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:47

generator?

optional generator: OpenAIGeneratorConfig

Defined in

packages/plugins/openai/src/plugin.ts:18

httpAgent?

optional httpAgent: Agent

An HTTP agent used to manage HTTP(S) connections.

If not provided, an agent will be constructed by default in the Node.js environment, otherwise no agent is used.

Inherited from

ClientOptions.httpAgent

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:40

maxRetries?

optional maxRetries: number

The maximum number of times that the client will retry a request in case of a temporary failure, like a network error or a 5XX error from the server.

Default
2
Inherited from

ClientOptions.maxRetries

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:54

organization?

optional organization: null | string

Defaults to process.env[‘OPENAI_ORG_ID’].

Inherited from

ClientOptions.organization

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:15

project?

optional project: null | string

Defaults to process.env[‘OPENAI_PROJECT_ID’].

Inherited from

ClientOptions.project

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:19

timeout?

optional timeout: number

The maximum amount of time (in milliseconds) that the client should wait for a response from the server before timing out a single request.

Note that request timeouts are retried by default, so in a worst-case scenario you may wait much longer than this timeout before the promise succeeds or fails.

Inherited from

ClientOptions.timeout

Defined in

node_modules/.pnpm/[email protected]/node_modules/openai/index.d.mts:33

Functions

embed()

embed<T>(texts, options?): Promise<Embedded<T>>

Type Parameters

T extends string | readonly string[]

Parameters

texts: T

options?: OpenAIEmbedderOptions

Returns

Promise<Embedded<T>>

Defined in

packages/plugins/openai/src/embedder.ts:68


embedder()

embedder(options?): undefined | Embedder

Parameters

options?: OpenAIEmbedderOptions

Returns

undefined | Embedder

Defined in

packages/plugins/openai/src/embedder.ts:49


generate()

generate(args, options?): Promise<unknown>

Parameters

args: unknown

options?: OpenAIGeneratorOptions

Returns

Promise<unknown>

Defined in

packages/plugins/openai/src/generator.ts:130


generator()

generator(options?): undefined | Generator

Parameters

options?: OpenAIGeneratorOptions

Returns

undefined | Generator

Defined in

packages/plugins/openai/src/generator.ts:114


openai()

openai(config?): Plugin

Parameters

config?: OpenAIPluginConfig

Returns

Plugin

Defined in

packages/plugins/openai/src/plugin.ts:23