Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llama-stack #40

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions examples/llama-stack/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
GEMINI_API_KEY=

# Restack

RESTACK_ENGINE_ID=
RESTACK_ENGINE_ADDRESS=
RESTACK_ENGINE_API_KEY=

RESTACK_CLOUD_TOKEN=
44 changes: 44 additions & 0 deletions examples/llama-stack/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ------- Image ----------

FROM node:20-bullseye-slim AS installer

RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*

COPY ./package.json ./app/package.json
COPY ./tsconfig.json ./app/tsconfig.json


WORKDIR /app

RUN npm install

# ------- Builder ----------

FROM node:20-bullseye-slim AS builder
WORKDIR /app
COPY --from=installer /app .
COPY ./src ./src

RUN npm run build

# ------- Runner ----------

FROM node:20-bullseye-slim AS runner

RUN apt-get update \
&& apt-get install -y ca-certificates \
&& rm -rf /var/lib/apt/lists/*

RUN addgroup --system --gid 1001 service
RUN adduser --system --uid 1001 service
USER service

WORKDIR /app

COPY --from=builder /app .

ENV NODE_OPTIONS=”--max-old-space-size=4096″

CMD ["node", "dist/services"]
30 changes: 30 additions & 0 deletions examples/llama-stack/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.8'
services:
ollama:
image: ollama/ollama
container_name: ollama
volumes:
- ollama:/root/.ollama
ports:
- "11434:11434"
entrypoint: ["ollama"]
command: ["serve"]

llamastack:
image: llamastack/distribution-ollama
platform: linux/amd64
container_name: llamastack
ports:
- "5001:5000"
volumes:
- ~/.llama:/root/.llama
- type: bind
source: ./llamastack-run.yaml
target: /app/llamastack-run.yaml
depends_on:
- ollama
environment:
- OLLAMA_HOST=http://ollama:11434

volumes:
ollama:
9 changes: 9 additions & 0 deletions examples/llama-stack/llamastack-run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
built_at: "2024-11-10T00:00:00Z"
image_name: "llamastack/distribution-ollama"
model: "llama3.1:8b-instruct-fp16"
host: "http://ollama:11434"
inference:
- provider_id: "ollama0"
provider_type: "remote::ollama"
config:
url: "http://ollama:11434"
36 changes: 36 additions & 0 deletions examples/llama-stack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "restack-examples-ts-llama-stack",
"version": "1.0.0",
"description": "Basic Llama-stack example",
"scripts": {
"start": "ts-node src/services.ts",
"start.watch": "nodemon src/services.ts",
"dev": "pnpm start.watch",
"build": "tsc --build",
"clean": "rm -rf node_modules",
"schedule": "ts-node ./scheduleWorkflow.ts",
"restack-up": "node restack_up.mjs"
},
"nodemonConfig": {
"execMap": {
"ts": "ts-node"
},
"ext": "ts",
"watch": [
"src"
]
},
"dependencies": {
"@restackio/ai": "^0.0.82",
"@temporalio/workflow": "^1.11.2",
"dotenv": "^16.4.5",
"llama-stack-client": "^0.0.35"
},
"devDependencies": {
"@restackio/cloud": "^1.0.17",
"@types/node": "^20.16.9",
"nodemon": "^2.0.22",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
}
}
Loading