Modelfile 구성을 통해 원하는 응답 받기

Modelfile 구성을 통해 원하는 응답 받기
Huggingface 모델을 Ollama로 구동해보자
모델 준비 테스트 모델 MLP-KTLim/llama-3-Korean-Bllossom-8B at mainWe’re on a journey to advance and democratize artificial intelligence through open source and open science. Huggingface 모델 다운로드 GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/MLP-KTLim/llama-3-Korean-Bllossom-8B git lfs install git lfs pull Satetensors To gguf How to

목표

기존 사이드 프로젝트 (ex. Flashour, Mirobaek) 에 LLM을 통해 자동으로 글을 작성하고 올릴수 있도록 해보자

사용한 모델

Bllossom/llama-3.2-Korean-Bllossom-3B at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.
MLP-KTLim/llama-3-Korean-Bllossom-8B at main
We’re on a journey to advance and democratize artificial intelligence through open source and open science.

모델 1 : 미로 생성

Bllossom/llama-3.2-Korean-Bllossom-3B

FROM model.gguf

TEMPLATE """{{- if .System }}
<s>{{ .System }}</s>
{{- end }}
<s>Human:
{{ .Prompt }}</s>
<s>Assistant:
"miroData": 
"""

SYSTEM """당신은 사용자 요청에 따라 미로 관련 JSON 데이터를 생성하는 AI입니다. 사용자가 미로와 관련된 요청을 하면 다음 정보를 생성하세요:
1. **miroData**: 다음 규칙에 따라 구성된 2차원 리스트 형태의 복잡한 미로 데이터를 생성하세요:
   - 상하좌우로 이동할 수 있으며 출발점(2)에서 도착점(3)으로 가는 유효한 경로가 반드시 포함되도록 생성하세요.
   - 0: 길 (path)
   - 1: 벽 (wall)
   - 2: 출발점 (starting point)
   - 3: 도착점 (ending point)

**예제 응답:**
{
  "miroData": [
                [2,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0],
                [0,1,1,1,0,1,0,1,0,1,1,0,1,1,1,1,0,1,0,1,0],
                [0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1],
                [0,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0],
                [0,1,1,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0],
                [0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0],
                [1,0,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0],
                [0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0],
                [0,1,1,1,0,0,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0],
                [0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0],
                [1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0],
                [1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0],
                [1,0,1,0,1,1,0,0,0,1,1,1,0,1,0,1,1,1,1,1,1],
                [0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0],
                [0,1,1,1,1,0,1,1,0,1,0,1,1,1,1,1,0,1,0,1,0],
                [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0],
                [1,1,0,1,0,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,1],
                [0,0,0,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,1,0],
                [1,1,1,1,1,1,0,0,1,0,1,1,1,0,0,1,0,1,1,1,0],
                [0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0],
                [1,0,1,1,1,1,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0],
                [3,0,0,1,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0]
        ]
}

**예제 사용자 요청:**
- "문제 해결을 위한 복잡한 미로를 생성해줘."
- "탐험할 수 있는 랜덤한 미로를 원해."

"""

PARAMETER stop <s>
PARAMETER stop </s>

적용

질문

복잡한 미로 만들어줘

응답

[
  [2,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0],
  [0,1,1,1,0,1,0,1,0,1,1,0,1,1,1,1,0,1,0,1,0],
  [0,1,0,1,0,0,0,0,0,0,1,1,0,0,0,1,0,1,0,1,1],
  [0,0,0,1,0,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,0],
  [0,1,1,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0],
  [0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0],
  [1,0,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,0,0,0],
  [0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0],
  [0,1,1,1,0,0,0,1,0,0,0,1,0,1,0,0,1,1,1,1,0],
  [0,0,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0],
  [1,1,1,0,1,1,0,1,0,1,0,1,1,1,0,1,0,0,1,1,0],
  [1,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0],
  [1,0,1,0,1,1,0,0,0,1,1,1,0,1,0,1,1,1,1,1,1],
  [0,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0],
  [0,1,1,1,1,0,1,1,0,1,0,1,1,1,1,1,0,1,0,1,0],
  [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0],
  [1,1,0,1,0,1,0,1,0,0,0,1,1,0,1,1,0,1,0,1,1],
  [0,0,0,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,1,0],
  [1,1,1,1,1,1,0,0,1,0,1,0,0,1,0,1,1,0,1,1,0],
  [0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,0,1,0,0],
  [1,0,1,1,1,1,1,0,1,0,1,0,0,1,0,1,1,0,1,1,0],
  [3,0,0,1,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0]
]

모델 2 : 제목, 내용 생성

MLP-KTLim/llama-3-Korean-Bllossom-8B

FROM model.gguf

TEMPLATE """{{- if .System }}
<s>{{ .System }}</s>
{{- end }}
<s>Human:
{{ .Prompt }}</s>
<s>Assistant:

"""

SYSTEM """당신은 사용자 요청에 따라 미로 관련 JSON 데이터를 생성하는 AI입니다. 사용자가 미로와 관련된 요청을 하면 다음 정보를 생성하세요:
1. **title**: 미로의 세계관을 함축하는 제목
2. **content**: 세계관에대한 상세내용

**예제 사용자 요청:**
- "간단한 미로를 만들어줘."
- "문제 해결을 위한 복잡한 미로를 생성해줘."
- "탐험할 수 있는 랜덤한 미로를 원해."

**예제 응답:**
{
  "title": {미로의 세계관을 함축하는 제목},
  "content": {미로의 세계관을 함축하는 제목}
}

"""

PARAMETER stop <s>
PARAMETER stop </s>

적용

질문

미로 게시물 하나 생성해줘

응답

{
  "title": "신비로운 유적 미로",
  "content": "이 미로는 고대의 신비한 유적에 숨겨진 비밀을 찾기 위한 대담한 모험입니다. 많은 보물과 적들이 기다
리고 있어, 용감한 탐험자가 필요합니다."
}

n8n 워크플로우 자동화
n8n.io - a powerful workflow automation tooln8n is a free and source-available workflow automation toolgitguadian-logoDocker | n8n DocsDocumentation for n8n, a workflow automation platform.logo version: “3.7” services: n8n: image: docker.n8n.io/n8nio/n8n restart: always ports: - 86:80 labels: - traefik.enable=true - traefik.http.