# 10. GPT4ALL

[GitHub:nomic-ai/gpt4all ](https://github.com/nomic-ai/gpt4all)It is an open source chatbot ecosystem learned with vast amounts of data, including conversations in silver code and chat format.

In this example, using LangChain `GPT4All` Describes how to interact with the model.

#### Method of installation <a href="#id-1" id="id-1"></a>

1. First, access the official homepage to download and install the installation file.
2. [Official homepage ](https://gpt4all.io/index.html)shortcut
3. Install Python package.
4. [Installation method using pip](https://github.com/nomic-ai/gpt4all/blob/main/gpt4all-bindings/python/README.md)

Copy

```
# !pip install -qU gpt4all
```

#### Model download <a href="#id-2" id="id-2"></a>

[gpt4all page ](https://gpt4all.io/index.html)in `Model Explorer` There is a section. (For more information, visit <https://github.com/nomic-ai/gpt4all>.)

1. [Official homepage ](https://gpt4all.io/index.html)Download the downloadable model from. We recommend choosing a driveable model from your PC specifications.
2. In this tutorial `EEVE-Korean-Instruct-10.8B-v1.0-Q8_0.gguf` (10.69GB) I will download the model and proceed.
3. Downloaded models `models` After creating a folder, it is downloaded to that folder.
4. `local_path` Assign a local file path ("./models/EEVE-Korean-Instruct-10.8B-v1.0-Q8\_0.gguf") to the variable.
5. This path can be replaced with the local file path you want.

Copy

```
local_path = "./models/EEVE-Korean-Instruct-10.8B-v1.0-Q8_0.gguf"  # Replace with your desired local file path.
```

#### Model information settings <a href="#id-3" id="id-3"></a>

Download a model in a compatible ggml format to run locally.

* Choose a model you are interested in.
* Download using UI `.bin` File `local_path` Move it to (see below).

**GPT4ALL model utilization**

`GPT4All` Silver is a large language model similar to GPT-3, which can be used for various natural language processing tasks.

This module allows you to easily load the GPT4All model and utilize it for reasoning.

Copy

```
from langchain.prompts import ChatPromptTemplate
from langchain_community.llms import GPT4All
from langchain_core.output_parsers import StrOutputParser
from langchain_core.callbacks import StreamingStdOutCallbackHandler

# Prompt
prompt = ChatPromptTemplate.from_template(
    """<s>A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.</s>
<s>Human: {question}</s>
<s>Assistant:
"""
)

# GPT4All 언어 모델 초기화
# model is GPT4All Initialize language model
llm = GPT4All(
    model=local_path,
    backend="gpu",  # GPU Settings
    streaming=True,  # Streaming Settings
    callbacks=[StreamingStdOutCallbackHandler()],  # Set callback
)

# create a chain
chain = prompt | llm | StrOutputParser()

# Execute query
response = chain.invoke({"question": "What is the capital of South Korea?"})
```

Copy

```
 The capital of South Korea is Seoul. 

Seoul is a large city with a population of about 10 million people, located in the northern part of the Korean Peninsula. It is considered one of the largest cities in the world and serves as a cultural, economic and political center. The city's history dates back to the Three Ages and has since developed into an important area in Baekje, Goryeo and Joseon. 

Seoul boasts a rich cultural heritage, including various museums, palaces and temples. The main attractions are Gyeongbokgung Palace, Changdeokgung Palace and Deoksugung Palace. 

Seoul also has a thriving economy and is home to many multinational companies. The city is famous for its technology industry and has major companies such as Samsung and LG. 

Overall, Seoul is a lively and exciting place to visit. You can find everything from historic sights to modern architecture, and the city's energy and diversity attracts travelers from all over the world. 
```
