Class: HuggingFaceInferenceAPI
Wrapper on the Hugging Face's Inference API. API Docs: https://huggingface.co/docs/huggingface.js/inference/README List of tasks with models: huggingface.co/api/tasks
Note that Conversational API is not yet supported by the Inference API. They recommend using the text generation API instead. See: https://github.com/huggingface/huggingface.js/issues/586#issuecomment-2024059308
Extends
Constructors
new HuggingFaceInferenceAPI()
new HuggingFaceInferenceAPI(
init
):HuggingFaceInferenceAPI
Parameters
• init: any
Returns
Overrides
Defined in
packages/providers/huggingface/dist/index.d.ts:114
Properties
contextWindow
contextWindow:
number
Defined in
packages/providers/huggingface/dist/index.d.ts:112
hf
hf:
HfInference
Defined in
packages/providers/huggingface/dist/index.d.ts:113
maxTokens?
optional
maxTokens:number
Defined in
packages/providers/huggingface/dist/index.d.ts:111
model
model:
string
Defined in
packages/providers/huggingface/dist/index.d.ts:108
temperature
temperature:
number
Defined in
packages/providers/huggingface/dist/index.d.ts:109
topP
topP:
number
Defined in
packages/providers/huggingface/dist/index.d.ts:110
Accessors
metadata
get
metadata():LLMMetadata
Returns
Overrides
Defined in
packages/providers/huggingface/dist/index.d.ts:115
Methods
chat()
chat(params)
chat(
params
):Promise
<AsyncIterable
<ChatResponseChunk
,any
,any
>>
Get a chat response from the LLM
Parameters
• params: LLMChatParamsStreaming
<object
, object
>
Returns
Promise
<AsyncIterable
<ChatResponseChunk
, any
, any
>>
Overrides
Defined in
packages/providers/huggingface/dist/index.d.ts:116
chat(params)
chat(
params
):Promise
<ChatResponse
<object
>>
Get a chat response from the LLM
Parameters
• params: LLMChatParamsNonStreaming
<object
, object
>
Returns
Promise
<ChatResponse
<object
>>
Overrides
Defined in
packages/providers/huggingface/dist/index.d.ts:117
complete()
complete(params)
complete(
params
):Promise
<AsyncIterable
<CompletionResponse
,any
,any
>>
Get a prompt completion from the LLM
Parameters
• params: LLMCompletionParamsStreaming
Returns
Promise
<AsyncIterable
<CompletionResponse
, any
, any
>>
Inherited from
Defined in
packages/core/llms/dist/index.d.ts:168
complete(params)
complete(
params
):Promise
<CompletionResponse
>
Get a prompt completion from the LLM
Parameters
• params: LLMCompletionParamsNonStreaming
Returns
Promise
<CompletionResponse
>
Inherited from
Defined in
packages/core/llms/dist/index.d.ts:169
nonStreamChat()
protected
nonStreamChat(params
):Promise
<ChatResponse
<object
>>
Parameters
• params: LLMChatParamsNonStreaming
<object
, object
>
Returns
Promise
<ChatResponse
<object
>>
Defined in
packages/providers/huggingface/dist/index.d.ts:119
streamChat()
protected
streamChat(params
):AsyncIterable
<ChatResponseChunk
,any
,any
>
Parameters
• params: LLMChatParamsStreaming
<object
, object
>
Returns
AsyncIterable
<ChatResponseChunk
, any
, any
>
Defined in
packages/providers/huggingface/dist/index.d.ts:120