aisbreaker-api-js - v0.1.15 / services/connectors/AIsNetworkClient / AIsNetworkClientService
Class: AIsNetworkClientService
services/connectors/AIsNetworkClient.AIsNetworkClientService
Every service API must implement this interface.
Hierarchy
BaseAIsService
<AIsNetworkClientProps
,AIsNetworkClientDefaults
>↳
AIsNetworkClientService
Table of contents
Constructors
Properties
Methods
- checkRequest
- getContext
- getContextService
- getConversationState
- getHttpRequestHeaders
- getService
- getServiceUrl
- process
- processNonStreamingRequest
- processStreamingRequest
- processUnprotected
Constructors
constructor
• new AIsNetworkClientService(serviceProps
, serviceDefaults
, auth?
)
Parameters
Name | Type |
---|---|
serviceProps | AIsNetworkClientProps |
serviceDefaults | AIsNetworkClientDefaults |
auth? | Auth |
Overrides
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:43
Properties
auth
• Optional
auth: Auth
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:37
engine
• engine: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:43
engineOpt
• Optional
engineOpt: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:42
serviceDefaults
• serviceDefaults: AIsNetworkClientDefaults
Inherited from
BaseAIsService.serviceDefaults
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:36
serviceProps
• serviceProps: AIsNetworkClientProps
set in constructor
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:35
task
• task: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:40
url
• url: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:45
urlOpt
• Optional
urlOpt: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:44
vendor
• vendor: string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:41
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
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:264
getContext
▸ getContext(request?
): string
Optionally, provide additional context information/description for logging and error messages.
Parameters
Name | Type |
---|---|
request? | Request |
Returns
string
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:217
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
BaseAIsService.getContextService
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:181
getConversationState
▸ getConversationState(request
): DefaultConversationState
Parameters
Name | Type |
---|---|
request | Request |
Returns
Inherited from
BaseAIsService.getConversationState
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:277
getHttpRequestHeaders
▸ getHttpRequestHeaders(secret
): any
Parameters
Name | Type |
---|---|
secret | undefined | string |
Returns
any
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:187
getService
▸ getService(actualEngine?
): Service
Parameters
Name | Type |
---|---|
actualEngine? | string |
Returns
ResponseFinal.usage.service
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:200
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
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:249
process
▸ process(request
): Promise
<ResponseFinal
>
Let the service do its work.
Parameters
Name | Type |
---|---|
request | Request |
Returns
Promise
<ResponseFinal
>
Inherited from
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/base/BaseAIsService.ts:70
processNonStreamingRequest
▸ processNonStreamingRequest(url
, request
, aisNetworkRequest
, abortController
, context
): Promise
<AIsError
| ResponseFinal
>
process non-streaming
Parameters
Name | Type |
---|---|
url | string |
request | Request |
aisNetworkRequest | AIsNetworkRequest |
abortController | AbortController |
context | string |
Returns
Promise
<AIsError
| ResponseFinal
>
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:79
processStreamingRequest
▸ processStreamingRequest(url
, request
, aisNetworkRequest
, abortController
, context
): Promise
<undefined
| AIsError
| ResponseFinal
>
process streaming
Parameters
Name | Type |
---|---|
url | string |
request | Request |
aisNetworkRequest | AIsNetworkRequest |
abortController | AbortController |
context | string |
Returns
Promise
<undefined
| AIsError
| ResponseFinal
>
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:102
processUnprotected
▸ processUnprotected(request
, context
): Promise
<undefined
| AIsError
| ResponseFinal
>
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
| AIsError
| ResponseFinal
>
The final result. In the case of an error it returns an AIsError OR throws an AIError or general Error.
Overrides
BaseAIsService.processUnprotected
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/services/connectors/AIsNetworkClient.ts:57