Llama Stack 빠른 시작 — 서버 띄우고 SDK 호출하기
Llama Stack 빠른 시작
Llama Stack을 몇 개 명령으로 띄우는 방법을 볼게요. 로컬에서 RAG 애플리케이션을 만들 만큼 동작하는 흐름이에요.
서버 준비하기
Ollama로 모델을 준비하고 서버 의존성을 설치해요.
ollama run llama3.2:3b --keepalive 60m
uv run --with llama-stack llama stack list-deps starter | xargs -L1 uv pip install
이제 서버를 실행해요.
OLLAMA_URL=http://localhost:11434/v1 uv run --with llama-stack llama stack run starter
Python SDK로 호출하기
서버가 뜨면 Python SDK로 바로 호출할 수 있어요. base_url은 기본 로컬 포트를 쓰면 됩니다.
from llama_stack_client import LlamaStackClient
client = LlamaStackClient(base_url="http://localhost:8321")
response = client.chat.completions.create(
model="Llama3.2-3B-Instruct",
messages=[{"role": "user", "content": "What is machine learning?"}],
)
왜 이렇게 쓰나요
mHTMLSDK는 Python·Node.js·iOS·Android, 그리고 모든 언어를 위한 REST API까지 지원해요. 로컬에서 시작해 어디로든 배포할 수 있는 것이 Llama Stack의 설계 목표예요.