aisbreaker-core-nodejs - v0.1.15 / services/connectors/HuggingfaceCoChat / HuggingfaceCoChatService
Class: HuggingfaceCoChatService
services/connectors/HuggingfaceCoChat.HuggingfaceCoChatService
Hierarchy
BaseAIsService
<HuggingfaceCoChatProps
,HuggingfaceCoChatDefaults
>↳
HuggingfaceCoChatService
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
- processUnprotected
Constructors
constructor
• new HuggingfaceCoChatService(props
, serviceDefaults
, auth?
)
Parameters
Name | Type |
---|---|
props | HuggingfaceCoChatProps |
serviceDefaults | HuggingfaceCoChatDefaults |
auth? | Auth |
Overrides
base.BaseAIsService<HuggingfaceCoChatProps, HuggingfaceCoChatDefaults>.constructor
Defined in
aisbreaker-core-nodejs/src/services/connectors/HuggingfaceCoChat.ts:49
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/HuggingfaceCoChat.ts:46
enableTraceHttp
• enableTraceHttp: boolean
= false
Defined in
aisbreaker-core-nodejs/src/services/connectors/HuggingfaceCoChat.ts:47
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: HuggingfaceCoChatDefaults
Inherited from
base.BaseAIsService.serviceDefaults
Defined in
aisbreaker-api-js/build/base/BaseAIsService.d.ts:6
serviceProps
• serviceProps: HuggingfaceCoChatProps
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/HuggingfaceCoChat.ts:45
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/HuggingfaceCoChat.ts:204
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
, huggingfaceChatRequest
, abortController
, responseCollector
, conversationState
, context
): Promise
<ResponseFinal
| AIsError
>
process non-streaming
Parameters
Name | Type |
---|---|
url | string |
request | Request |
huggingfaceChatRequest | HuggingfaceChatRequest |
abortController | AbortController |
responseCollector | ResponseCollector |
conversationState | DefaultConversationState |
context | string |
Returns
Promise
<ResponseFinal
| AIsError
>
Defined in
aisbreaker-core-nodejs/src/services/connectors/HuggingfaceCoChat.ts:145
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/HuggingfaceCoChat.ts:71