HuggingFaceLLMο
- pydantic model llama_index.llms.huggingface.HuggingFaceLLMο
HuggingFace LLM.
Show JSON schema
{ "title": "HuggingFaceLLM", "description": "HuggingFace LLM.", "type": "object", "properties": { "callback_manager": { "title": "Callback Manager" }, "model_name": { "title": "Model Name", "description": "The model name to use from HuggingFace. Unused if `model` is passed in directly.", "type": "string" }, "context_window": { "title": "Context Window", "description": "The maximum number of tokens available for input.", "type": "integer" }, "max_new_tokens": { "title": "Max New Tokens", "description": "The maximum number of tokens to generate.", "type": "integer" }, "system_prompt": { "title": "System Prompt", "description": "The system prompt, containing any extra instructions or context. The model card on HuggingFace should specify if this is needed.", "type": "string" }, "query_wrapper_prompt": { "title": "Query Wrapper Prompt", "description": "The query wrapper prompt, containing the query placeholder. The model card on HuggingFace should specify if this is needed. Should contain a `{query_str}` placeholder.", "type": "string" }, "tokenizer_name": { "title": "Tokenizer Name", "description": "The name of the tokenizer to use from HuggingFace. Unused if `tokenizer` is passed in directly.", "type": "string" }, "device_map": { "title": "Device Map", "description": "The device_map to use. Defaults to 'auto'.", "type": "string" }, "stopping_ids": { "title": "Stopping Ids", "description": "The stopping ids to use. Generation stops when these token IDs are predicted.", "type": "array", "items": { "type": "integer" } }, "tokenizer_outputs_to_remove": { "title": "Tokenizer Outputs To Remove", "description": "The outputs to remove from the tokenizer. Sometimes huggingface tokenizers return extra inputs that cause errors.", "type": "array", "items": {} }, "tokenizer_kwargs": { "title": "Tokenizer Kwargs", "description": "The kwargs to pass to the tokenizer.", "type": "object" }, "model_kwargs": { "title": "Model Kwargs", "description": "The kwargs to pass to the model during initialization.", "type": "object" }, "generate_kwargs": { "title": "Generate Kwargs", "description": "The kwargs to pass to the model during generation.", "type": "object" } }, "required": [ "model_name", "context_window", "max_new_tokens", "system_prompt", "query_wrapper_prompt", "tokenizer_name", "device_map" ] }
- Config
arbitrary_types_allowed: bool = True
- Fields
- Validators
_validate_callback_manager
Β»callback_manager
- field context_window: int [Required]ο
The maximum number of tokens available for input.
- field device_map: str [Required]ο
The device_map to use. Defaults to βautoβ.
- field generate_kwargs: dict [Optional]ο
The kwargs to pass to the model during generation.
- field max_new_tokens: int [Required]ο
The maximum number of tokens to generate.
- field model_kwargs: dict [Optional]ο
The kwargs to pass to the model during initialization.
- field model_name: str [Required]ο
The model name to use from HuggingFace. Unused if model is passed in directly.
- field query_wrapper_prompt: str [Required]ο
The query wrapper prompt, containing the query placeholder. The model card on HuggingFace should specify if this is needed. Should contain a {query_str} placeholder.
- field stopping_ids: List[int] [Optional]ο
The stopping ids to use. Generation stops when these token IDs are predicted.
- field system_prompt: str [Required]ο
The system prompt, containing any extra instructions or context. The model card on HuggingFace should specify if this is needed.
- field tokenizer_kwargs: dict [Optional]ο
The kwargs to pass to the tokenizer.
- field tokenizer_name: str [Required]ο
The name of the tokenizer to use from HuggingFace. Unused if tokenizer is passed in directly.
- field tokenizer_outputs_to_remove: list [Optional]ο
The outputs to remove from the tokenizer. Sometimes huggingface tokenizers return extra inputs that cause errors.
- classmethod class_name() str ο
Get class name.
- complete(*args: Any, **kwargs: Any) Any ο
Completion endpoint for LLM.
- stream_complete(*args: Any, **kwargs: Any) Any ο
Streaming completion endpoint for LLM.
- property metadata: LLMMetadataο
LLM metadata.