Skip to content

Commit

Permalink
Replace PaiEas LLM with LLI-integration and upgrade python to 3.11 (#148
Browse files Browse the repository at this point in the history
)

* Replace PaiEas LLM with LLI-integration and upgrade python version to 3.11

* Replace MyFCDashScope with OpenAILike class

* Fix pyproject dependency
  • Loading branch information
wwxxzz authored Aug 6, 2024
1 parent 5963850 commit abcf17b
Show file tree
Hide file tree
Showing 19 changed files with 750 additions and 2,465 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
# This is the version of the action for setting up Python, not the Python version.
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.10"
python-version: "3.11"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
# This is the version of the action for setting up Python, not the Python version.
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.10"
python-version: "3.11"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
# This is the version of the action for setting up Python, not the Python version.
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.10"
python-version: "3.11"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim AS builder
FROM python:3.11-slim AS builder

RUN pip3 install poetry

Expand All @@ -12,7 +12,7 @@ COPY . .

RUN poetry install && rm -rf $POETRY_CACHE_DIR

FROM python:3.10-slim AS prod
FROM python:3.11-slim AS prod

RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Harbin /etc/localtime

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile_gpu
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim AS builder
FROM python:3.11-slim AS builder

RUN pip3 install poetry

Expand All @@ -14,7 +14,7 @@ RUN mv pyproject_gpu.toml pyproject.toml \

RUN poetry install && rm -rf $POETRY_CACHE_DIR

FROM python:3.10-slim AS prod
FROM python:3.11-slim AS prod

RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Harbin /etc/localtime

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile_ui
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.10-slim AS builder
FROM python:3.11-slim AS builder

RUN pip3 install poetry

Expand All @@ -12,7 +12,7 @@ COPY . .

RUN poetry install && rm -rf $POETRY_CACHE_DIR

FROM python:3.10-slim AS prod
FROM python:3.11-slim AS prod

RUN rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Harbin /etc/localtime

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ PAI-RAG is an easy-to-use opensource framework for modular RAG (Retrieval-Augmen

2. Development Environment Settings

This project uses poetry for management. To ensure environmental consistency and avoid problems caused by Python version differences, we specify Python version 3.10.
This project uses poetry for management. To ensure environmental consistency and avoid problems caused by Python version differences, we specify Python version 3.11.

```bash
conda create -n rag_env python==3.10
conda create -n rag_env python==3.11
conda activate rag_env
```

Expand Down
4 changes: 2 additions & 2 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ PAI-RAG 是一个易于使用的模块化 RAG(检索增强生成)开源框

2. 配置开发环境

本项目使用poetry进行管理,若在本地环境下使用,建议在安装环境之前先创建一个空环境。为了确保环境一致性并避免因Python版本差异造成的问题,我们指定Python版本为3.10
本项目使用poetry进行管理,若在本地环境下使用,建议在安装环境之前先创建一个空环境。为了确保环境一致性并避免因Python版本差异造成的问题,我们指定Python版本为3.11

```bash
conda create -n rag_env python==3.10
conda create -n rag_env python==3.11
conda activate rag_env
```

Expand Down
1,311 changes: 658 additions & 653 deletions poetry.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ authors = []
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10.0,<3.12"
python = ">=3.11.0,<3.12"
fastapi = "^0.110.1"
uvicorn = "^0.29.0"
llama-index-core = ">=0.10.29,<=0.10.39"
llama-index-core = "0.10.57"
llama-index-embeddings-openai = "^0.1.7"
llama-index-embeddings-azure-openai = "^0.1.7"
llama-index-embeddings-dashscope = "^0.1.3"
llama-index-llms-openai = "^0.1.15"
llama-index-llms-openai = "^0.1.27"
llama-index-llms-azure-openai = "^0.1.6"
llama-index-llms-dashscope = "^0.1.2"
llama-index-readers-database = "^0.1.3"
Expand All @@ -42,7 +42,7 @@ flagembedding = "^1.2.10"
sentencepiece = "^0.2.0"
oss2 = "^2.18.5"
asgi-correlation-id = "^4.3.1"
openinference-instrumentation-llama-index = "1.3.0"
openinference-instrumentation-llama-index = "^1.3.0"
torch = [
{version = "2.3.0+cpu", source = "pytorch_cpu", platform = "linux"},
{version = "2.3.0+cpu", source = "pytorch_cpu", platform = "win32"},
Expand All @@ -63,10 +63,10 @@ llama-parse = "0.4.2"
pypdf2 = "^3.0.1"
pdfplumber = "^0.11.0"
pdfminer-six = "^20231228"
openinference-semantic-conventions = "0.1.6"
openinference-semantic-conventions = "^0.1.9"
llama-index-tools-google = "^0.1.5"
llama-index-tools-duckduckgo = "^0.1.1"
openinference-instrumentation = "^0.1.7"
openinference-instrumentation = "^0.1.12"
llama-index-llms-huggingface = "^0.2.0"
pytest-asyncio = "^0.23.7"
pytest-cov = "^5.0.0"
Expand All @@ -83,6 +83,7 @@ llama-index-vector-stores-alibabacloud-opensearch = "^0.1.0"
asyncpg = "^0.29.0"
pgvector = "^0.3.2"
pre-commit = "^3.8.0"
llama-index-llms-paieas = "^0.1.0"

[tool.poetry.scripts]
pai_rag = "pai_rag.main:main"
Expand Down
13 changes: 7 additions & 6 deletions pyproject_gpu.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ authors = []
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10.0,<3.12"
python = ">=3.11.0,<3.12"
fastapi = "^0.110.1"
uvicorn = "^0.29.0"
llama-index-core = ">=0.10.29,<=0.10.39"
llama-index-core = "0.10.57"
llama-index-embeddings-openai = "^0.1.7"
llama-index-embeddings-azure-openai = "^0.1.7"
llama-index-embeddings-dashscope = "^0.1.3"
llama-index-llms-openai = "^0.1.15"
llama-index-llms-openai = "^0.1.27"
llama-index-llms-azure-openai = "^0.1.6"
llama-index-llms-dashscope = "^0.1.2"
llama-index-readers-database = "^0.1.3"
Expand All @@ -42,7 +42,7 @@ flagembedding = "^1.2.10"
sentencepiece = "^0.2.0"
oss2 = "^2.18.5"
asgi-correlation-id = "^4.3.1"
openinference-instrumentation-llama-index = "1.3.0"
openinference-instrumentation-llama-index = "^1.3.0"
torch = "2.2.2"
torchvision = "0.17.2"
openpyxl = "^3.1.2"
Expand All @@ -55,10 +55,10 @@ llama-parse = "0.4.2"
pypdf2 = "^3.0.1"
pdfplumber = "^0.11.0"
pdfminer-six = "^20231228"
openinference-semantic-conventions = "0.1.6"
openinference-semantic-conventions = "^0.1.9"
llama-index-tools-google = "^0.1.5"
llama-index-tools-duckduckgo = "^0.1.1"
openinference-instrumentation = "0.1.7"
openinference-instrumentation = "^0.1.12"
llama-index-llms-huggingface = "^0.2.0"
pytest-asyncio = "^0.23.7"
pytest-cov = "^5.0.0"
Expand All @@ -75,6 +75,7 @@ llama-index-vector-stores-alibabacloud-opensearch = "^0.1.0"
asyncpg = "^0.29.0"
pgvector = "^0.3.2"
pre-commit = "^3.8.0"
llama-index-llms-paieas = "^0.1.0"

[tool.poetry.scripts]
pai_rag = "pai_rag.main:main"
Expand Down
5 changes: 5 additions & 0 deletions src/pai_rag/config/settings_fc_demo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ type = "SimpleChatEngine"
[rag.multi_modal_llm]
source = ""

[rag.node_enhancement]
tree_depth = 3
max_clusters = 52
proba_threshold = 0.10

[rag.node_parser]
type = "Sentence"
chunk_size = 500
Expand Down
Loading

0 comments on commit abcf17b

Please sign in to comment.