Skip to content

Commit 55f2f50

Browse files
committed
Change prompt.py and corresponding file to make the LLM focus on emotion and personality
0 parents  commit 55f2f50

File tree

125 files changed

+38034
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+38034
-0
lines changed

.env.example

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Server Configuration
2+
HOST=0.0.0.0
3+
PORT=9621
4+
5+
# Directory Configuration
6+
WORKING_DIR=/app/data/rag_storage
7+
INPUT_DIR=/app/data/inputs
8+
9+
# LLM Configuration (Use valid host. For local services, you can use host.docker.internal)
10+
# Ollama example
11+
LLM_BINDING=ollama
12+
LLM_BINDING_HOST=http://host.docker.internal:11434
13+
LLM_MODEL=mistral-nemo:latest
14+
15+
# OpenAI alike example
16+
# LLM_BINDING=openai
17+
# LLM_MODEL=deepseek-chat
18+
# LLM_BINDING_HOST=https://api.deepseek.com
19+
# LLM_BINDING_API_KEY=your_api_key
20+
21+
# for OpenAI LLM (LLM_BINDING_API_KEY take priority)
22+
# OPENAI_API_KEY=your_api_key
23+
24+
# Lollms example
25+
# LLM_BINDING=lollms
26+
# LLM_BINDING_HOST=http://host.docker.internal:9600
27+
# LLM_MODEL=mistral-nemo:latest
28+
29+
30+
# Embedding Configuration (Use valid host. For local services, you can use host.docker.internal)
31+
# Ollama example
32+
EMBEDDING_BINDING=ollama
33+
EMBEDDING_BINDING_HOST=http://host.docker.internal:11434
34+
EMBEDDING_MODEL=bge-m3:latest
35+
36+
# Lollms example
37+
# EMBEDDING_BINDING=lollms
38+
# EMBEDDING_BINDING_HOST=http://host.docker.internal:9600
39+
# EMBEDDING_MODEL=bge-m3:latest
40+
41+
# RAG Configuration
42+
MAX_ASYNC=4
43+
MAX_TOKENS=32768
44+
EMBEDDING_DIM=1024
45+
MAX_EMBED_TOKENS=8192
46+
47+
# Security (empty for no key)
48+
LIGHTRAG_API_KEY=your-secure-api-key-here
49+
50+
# Logging
51+
LOG_LEVEL=INFO
52+
53+
# Optional SSL Configuration
54+
#SSL=true
55+
#SSL_CERTFILE=/path/to/cert.pem
56+
#SSL_KEYFILE=/path/to/key.pem
57+
58+
# Optional Timeout
59+
#TIMEOUT=30
60+
61+
# Optional for Azure (LLM_BINDING_HOST, LLM_BINDING_API_KEY take priority)
62+
# AZURE_OPENAI_API_VERSION=2024-08-01-preview
63+
# AZURE_OPENAI_DEPLOYMENT=gpt-4o
64+
# AZURE_OPENAI_API_KEY=myapikey
65+
# AZURE_OPENAI_ENDPOINT=https://myendpoint.openai.azure.com
66+
67+
# AZURE_EMBEDDING_DEPLOYMENT=text-embedding-3-large
68+
# AZURE_EMBEDDING_API_VERSION=2023-05-15
69+
70+
71+
# Ollama Emulating Model Tag
72+
# OLLAMA_EMULATING_MODEL_TAG=latest

.github/workflows/linting.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Linting and Formatting
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint-and-format:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pre-commit
28+
29+
- name: Run pre-commit
30+
run: pre-commit run --all-files

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
__pycache__
2+
*.egg-info
3+
dickens/
4+
book.txt
5+
lightrag-dev/
6+
.idea/
7+
dist/
8+
env/
9+
local_neo4jWorkDir/
10+
neo4jWorkDir/
11+
ignore_this.txt
12+
.venv/
13+
*.ignore.*
14+
.ruff_cache/
15+
gui/
16+
*.log
17+
.vscode
18+
inputs
19+
rag_storage
20+
.env
21+
venv/
22+
examples/input/
23+
examples/output/
24+
.DS_Store
25+
#Remove config.ini from repo
26+
*.ini

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: requirements-txt-fixer
8+
9+
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.6.4
12+
hooks:
13+
- id: ruff-format
14+
- id: ruff
15+
args: [--fix, --ignore=E402]
16+
17+
18+
- repo: https://github.com/mgedmin/check-manifest
19+
rev: "0.49"
20+
hooks:
21+
- id: check-manifest
22+
stages: [manual]

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Build stage
2+
FROM python:3.11-slim as builder
3+
4+
WORKDIR /app
5+
6+
# Install build dependencies
7+
RUN apt-get update && apt-get install -y --no-install-recommends \
8+
build-essential \
9+
curl \
10+
pkg-config \
11+
libssl-dev \
12+
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
13+
&& . "$HOME/.cargo/env" \
14+
&& rustup default stable \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
ENV PATH="/root/.cargo/bin:${PATH}"
18+
19+
# Copy only requirements files first to leverage Docker cache
20+
COPY requirements.txt .
21+
COPY lightrag/api/requirements.txt ./lightrag/api/
22+
23+
# Install dependencies
24+
RUN pip install --user --no-cache-dir -r requirements.txt
25+
RUN pip install --user --no-cache-dir -r lightrag/api/requirements.txt
26+
27+
# Final stage
28+
FROM python:3.11-slim
29+
30+
WORKDIR /app
31+
32+
# Copy only necessary files from builder
33+
COPY --from=builder /root/.local /root/.local
34+
COPY ./lightrag ./lightrag
35+
COPY setup.py .
36+
COPY .env .
37+
38+
RUN pip install .
39+
# Make sure scripts in .local are usable
40+
ENV PATH=/root/.local/bin:$PATH
41+
42+
# Create necessary directories
43+
RUN mkdir -p /app/data/rag_storage /app/data/inputs
44+
45+
# Expose the default port
46+
EXPOSE 9621
47+
48+
# Set entrypoint
49+
ENTRYPOINT ["python", "-m", "lightrag.api.lightrag_server"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 LarFii
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)