Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: RAG v2 PoC
on:
pull_request:
paths: ['v2/**', '.github/workflows/v2.yml']
push:
branches: [main]
paths: ['v2/**', '.github/workflows/v2.yml']
permissions:
contents: read
jobs:
focused:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.2
- run: bun install --frozen-lockfile --ignore-scripts
working-directory: v2
- run: bun run typecheck && bun run format:check && bun test test && bun run build
working-directory: v2
- run: bun run test:container
working-directory: v2
5 changes: 5 additions & 0 deletions v2/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
test
scripts
.qualification
3 changes: 3 additions & 0 deletions v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
.qualification/
16 changes: 16 additions & 0 deletions v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM oven/bun:1.4.2-debian AS build
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile --ignore-scripts
COPY tsconfig.json ./
COPY src ./src
RUN bun run typecheck && bun run build
FROM oven/bun:1.4.2-debian
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
COPY --chmod=0444 package.json ./
USER bun
ENV RAG_V2_HOST=0.0.0.0
EXPOSE 8001
CMD ["bun", "dist/main.js"]
81 changes: 81 additions & 0 deletions v2/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions v2/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
services:
clickhouse:
image: clickhouse/clickhouse-server:26.8
environment:
CLICKHOUSE_DB: rag_v2
CLICKHOUSE_USER: rag
CLICKHOUSE_PASSWORD: ${RAG_V2_CLICKHOUSE_PASSWORD:?Set a database password}
volumes:
- clickhouse-data:/var/lib/clickhouse
networks: [database]
healthcheck:
test: [CMD, clickhouse-client, --query, SELECT 1]
interval: 5s
timeout: 3s
retries: 20
rag:
build: .
init: true
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
ports: ["127.0.0.1:8001:8001"]
environment:
RAG_V2_JWKS_JSON: ${RAG_V2_JWKS_JSON:?Set public verification keys}
RAG_V2_JWT_ISSUER: ${RAG_V2_JWT_ISSUER:-librechat}
RAG_V2_CLICKHOUSE_URL: http://clickhouse:8123
RAG_V2_ALLOW_INSECURE_CLICKHOUSE: "true"
RAG_V2_CLICKHOUSE_USER: rag
RAG_V2_CLICKHOUSE_PASSWORD: ${RAG_V2_CLICKHOUSE_PASSWORD:?Set a database password}
RAG_V2_EMBEDDING_API_KEY: ${RAG_V2_EMBEDDING_API_KEY:?Set an embedding key}
RAG_V2_MODE: coordinator
RAG_V2_SINGLE_WRITER: "true"
command: [sh, -c, "bun dist/migrate.js && exec bun dist/main.js"]
depends_on:
clickhouse:
condition: service_healthy
networks: [database, outbound]
networks:
database:
internal: true
outbound: {}
volumes:
clickhouse-data: {}
30 changes: 30 additions & 0 deletions v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@librechat/rag-api-v2-poc",
"version": "0.1.0",
"private": true,
"type": "module",
"engines": {
"bun": "1.4.2"
},
"scripts": {
"start": "bun src/main.ts",
"migrate": "bun src/migrate.ts",
"test": "bun test test",
"typecheck": "tsc --noEmit",
"build": "bun build src/main.ts src/migrate.ts --target=bun --packages=external --outdir=dist",
"format:check": "prettier --check src test scripts package.json tsconfig.json compose.yaml",
"test:container": "bash scripts/qualify.sh",
"bench": "bun scripts/benchmark.ts"
},
"dependencies": {
"@clickhouse/client": "1.23.1",
"hono": "4.13.13",
"jose": "6.2.12",
"zod": "4.6.5"
},
"devDependencies": {
"@types/bun": "1.4.2",
"prettier": "3.9.9",
"typescript": "7.0.2"
}
}
Loading
Loading