Skip to main content

Class: HuggingFaceLLM

Unified language model interface

Extends

Constructors

new HuggingFaceLLM()

new HuggingFaceLLM(init?): HuggingFaceLLM

Parameters

init?: HFLLMConfig

Returns

HuggingFaceLLM

Overrides

BaseLLM.constructor

Defined in

packages/llamaindex/src/llm/huggingface.ts:206

Properties

contextWindow

contextWindow: number

Defined in

packages/llamaindex/src/llm/huggingface.ts:201


maxTokens?

optional maxTokens: number

Defined in

packages/llamaindex/src/llm/huggingface.ts:200


modelName

modelName: string

Defined in

packages/llamaindex/src/llm/huggingface.ts:196


temperature

temperature: number

Defined in

packages/llamaindex/src/llm/huggingface.ts:198


tokenizerName

tokenizerName: string

Defined in

packages/llamaindex/src/llm/huggingface.ts:197


topP

topP: number

Defined in

packages/llamaindex/src/llm/huggingface.ts:199

Accessors

metadata

get metadata(): LLMMetadata

Returns

LLMMetadata

Overrides

BaseLLM.metadata

Defined in

packages/llamaindex/src/llm/huggingface.ts:216

Methods

chat()

chat(params)

chat(params): Promise<AsyncIterable<ChatResponseChunk>>

Get a chat response from the LLM

Parameters

params: LLMChatParamsStreaming<object, object>

Returns

Promise<AsyncIterable<ChatResponseChunk>>

Overrides

BaseLLM.chat

Defined in

packages/llamaindex/src/llm/huggingface.ts:243

chat(params)

chat(params): Promise<ChatResponse<object>>

Get a chat response from the LLM

Parameters

params: LLMChatParamsNonStreaming<object, object>

Returns

Promise<ChatResponse<object>>

Overrides

BaseLLM.chat

Defined in

packages/llamaindex/src/llm/huggingface.ts:246


complete()

complete(params)

complete(params): Promise<AsyncIterable<CompletionResponse>>

Get a prompt completion from the LLM

Parameters

params: LLMCompletionParamsStreaming

Returns

Promise<AsyncIterable<CompletionResponse>>

Inherited from

BaseLLM.complete

Defined in

packages/core/dist/llms/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

BaseLLM.complete

Defined in

packages/core/dist/llms/index.d.ts:169


getModel()

getModel(): Promise<PreTrainedModel>

Returns

Promise<PreTrainedModel>

Defined in

packages/llamaindex/src/llm/huggingface.ts:235


getTokenizer()

getTokenizer(): Promise<PreTrainedTokenizer>

Returns

Promise<PreTrainedTokenizer>

Defined in

packages/llamaindex/src/llm/huggingface.ts:227


nonStreamChat()

protected nonStreamChat(params): Promise<ChatResponse<object>>

Parameters

params: LLMChatParamsNonStreaming<object, object>

Returns

Promise<ChatResponse<object>>

Defined in

packages/llamaindex/src/llm/huggingface.ts:255


streamChat()

protected streamChat(params): AsyncIterable<ChatResponseChunk>

Parameters

params: LLMChatParamsStreaming<object, object>

Returns

AsyncIterable<ChatResponseChunk>

Defined in

packages/llamaindex/src/llm/huggingface.ts:287