Skip to content

aisbreaker-core-nodejs - v0.1.15 / services/connectors/OpenaiComChat / OpenaiComChatService

Class: OpenaiComChatService

services/connectors/OpenaiComChat.OpenaiComChatService

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new OpenaiComChatService(props, serviceDefaults, auth?)

Parameters

NameType
propsOpenaiComChatProps
serviceDefaultsOpenaiComChatDefaults
auth?Auth

Overrides

base.BaseAIsService<OpenaiComChatProps, OpenaiComChatDefaults&gt;.constructor

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:37

Properties

auth

Optional auth: Auth

Inherited from

base.BaseAIsService.auth

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:7


enableDebug

enableDebug: boolean = false

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:34


enableTraceHttp

enableTraceHttp: boolean = false

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:35


engine

engine: string

Inherited from

base.BaseAIsService.engine

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:11


engineOpt

Optional engineOpt: string

Inherited from

base.BaseAIsService.engineOpt

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:10


serviceDefaults

serviceDefaults: OpenaiComChatDefaults

Inherited from

base.BaseAIsService.serviceDefaults

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:6


serviceProps

serviceProps: OpenaiComChatProps

Inherited from

base.BaseAIsService.serviceProps

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:5


task

task: string

Inherited from

base.BaseAIsService.task

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:8


timeoutMillis

timeoutMillis: number

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:33


url

url: string

Inherited from

base.BaseAIsService.url

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:13


urlOpt

Optional urlOpt: string

Inherited from

base.BaseAIsService.urlOpt

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:12


vendor

vendor: string

Inherited from

base.BaseAIsService.vendor

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:9

Methods

checkRequest

checkRequest(request, context): void

Check that all required fields are present

Parameters

NameTypeDescription
requestRequest
contextstringoptional context information/description/message prefix for logging and for error messages

Returns

void

Inherited from

base.BaseAIsService.checkRequest

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:62


getContext

getContext(request?): string

Optionally, provide additional context information/description for logging and error messages.

Parameters

NameType
request?Request

Returns

string

Inherited from

base.BaseAIsService.getContext

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:38


getContextService

getContextService(request?): undefined | string

Optionally, provide additional context information/description for logging and error messages.

Parameters

NameType
request?Request

Returns

undefined | string

Overrides

base.BaseAIsService.getContextService

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:308


getConversationState

getConversationState(request): DefaultConversationState

Parameters

NameType
requestRequest

Returns

DefaultConversationState

Inherited from

base.BaseAIsService.getConversationState

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:63


getService

getService(actualEngine?): Service

Parameters

NameType
actualEngine?string

Returns

Service

ResponseFinal.usage.service

Inherited from

base.BaseAIsService.getService

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:33


getServiceUrl

getServiceUrl(url, engine, serviceDefaults): undefined | string

Derive the service URL.

Implemented as method here to allow overriding.

Parameters

NameTypeDescription
urlundefined | stringThe (base) URL specified in AIsServiceProps.
engineundefined | stringThe engine derived form serviceId
serviceDefaultsAIsServiceDefaults

Returns

undefined | string

The URL to access the actual AI service.

Inherited from

base.BaseAIsService.getServiceUrl

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:54


process

process(request): Promise<ResponseFinal>

Let the service do its work.

Parameters

NameType
requestRequest

Returns

Promise<ResponseFinal>

Inherited from

base.BaseAIsService.process

Defined in

aisbreaker-api-js/build/base/BaseAIsService.d.ts:18


processNonStreamingRequest

processNonStreamingRequest(url, request, openaiChatRequest, abortController, responseCollector, conversationState, context): Promise<ResponseFinal | AIsError>

process non-streaming

Parameters

NameType
urlstring
requestRequest
openaiChatRequestOpenaiChatRequest
abortControllerAbortController
responseCollectorResponseCollector
conversationStateDefaultConversationState
contextstring

Returns

Promise<ResponseFinal | AIsError>

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:130


processStreamingRequest

processStreamingRequest(url, request, openaiChatRequest, abortController, responseCollector, conversationState, context): Promise<undefined | ResponseFinal | AIsError>

process streaming

Parameters

NameType
urlstring
requestRequest
openaiChatRequestOpenaiChatRequest
abortControllerAbortController
responseCollectorResponseCollector
conversationStateDefaultConversationState
contextstring

Returns

Promise<undefined | ResponseFinal | AIsError>

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:189


processUnprotected

processUnprotected(request, context): Promise<undefined | ResponseFinal | AIsError>

Do the work of process() without the need to care about all error handling.

Parameters

NameTypeDescription
requestRequestthe request to process
contextstringoptional context information/description/message prefix for logging and for error messages

Returns

Promise<undefined | ResponseFinal | AIsError>

The final result. In the case of an error it returns an AIsError OR throws an AIError or general Error.

Overrides

base.BaseAIsService.processUnprotected

Defined in

aisbreaker-core-nodejs/src/services/connectors/OpenaiComChat.ts:56

Released under the MIT License.