# Hugging Face

## How to configure & use it?

#### Supported parameters

* `model` (Optional\[str]): The name or identifier of the Hugging Face model to use. This parameter is optional, and its default value is `"nomic-ai/gpt4all-j"`.
* `model_kwargs` (Optional\[Dict]): Keyword arguments passed to the Hugging Face model (optional).
* `pipeline_kwargs` (Optional\[dict]): Keyword arguments passed to the Hugging Face pipeline (optional).
* `task` (str): The task associated with the model. Valid options include `'text2text-generation'`, `'text-generation'`, and `'summarization'`.
* `pipeline` (pipeline): Pass pipeline directly to the component. If pipeline is passed, all other configs are ignored. **Running in a Colab/Kaggle/Python scripts(s)**\`\`\`python

```python
from genai_stack.model import HuggingFaceModel
from genai_stack.stack.stack import Stack

llm = HuggingFaceModel.from_kwargs()
Stack(model=llm)  # Initialize stack
model_response = llm.predict("How many countries are there in the world?")
print(model_response["output"])
```

* Import the model from `genai_stack.model`
* Instantiate the class with parameters you want to customize


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genaistack.aiplanet.com/components/llms/hugging-face.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
