aisbreaker-core-nodejs - v0.1.15 / services/connectors/OpenaiComChat / OpenaiComChatService
Class: OpenaiComChatService
services/connectors/OpenaiComChat.OpenaiComChatService
Hierarchy
BaseAIsService
<OpenaiComChatProps
,OpenaiComChatDefaults
>↳
OpenaiComChatService
Table of contents
Constructors
Properties
- auth
- enableDebug
- enableTraceHttp
- engine
- engineOpt
- serviceDefaults
- serviceProps
- task
- timeoutMillis
- url
- urlOpt
- vendor
Methods
- checkRequest
- getContext
- getContextService
- getConversationState
- getService
- getServiceUrl
- process
- processNonStreamingRequest
- processStreamingRequest
- processUnprotected
Constructors
constructor
• new OpenaiComChatService(props
, serviceDefaults
, auth?
)
Parameters
Name | Type |
---|---|
props | OpenaiComChatProps |
serviceDefaults | OpenaiComChatDefaults |
auth? | Auth |
Overrides
base.BaseAIsService<OpenaiComChatProps, OpenaiComChatDefaults>.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
Name | Type | Description |
---|---|---|
request | Request | |
context | string | optional 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
Name | Type |
---|---|
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
Name | Type |
---|---|
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
Name | Type |
---|---|
request | Request |
Returns
DefaultConversationState
Inherited from
base.BaseAIsService.getConversationState
Defined in
aisbreaker-api-js/build/base/BaseAIsService.d.ts:63
getService
▸ getService(actualEngine?
): Service
Parameters
Name | Type |
---|---|
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
Name | Type | Description |
---|---|---|
url | undefined | string | The (base) URL specified in AIsServiceProps. |
engine | undefined | string | The engine derived form serviceId |
serviceDefaults | AIsServiceDefaults |
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
Name | Type |
---|---|
request | Request |
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
Name | Type |
---|---|
url | string |
request | Request |
openaiChatRequest | OpenaiChatRequest |
abortController | AbortController |
responseCollector | ResponseCollector |
conversationState | DefaultConversationState |
context | string |
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
Name | Type |
---|---|
url | string |
request | Request |
openaiChatRequest | OpenaiChatRequest |
abortController | AbortController |
responseCollector | ResponseCollector |
conversationState | DefaultConversationState |
context | string |
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
Name | Type | Description |
---|---|---|
request | Request | the request to process |
context | string | optional 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