KevinHuSh
commited on
Commit
·
0e1a16c
1
Parent(s):
3fb07ee
refine README (#169)
Browse files- README.md +14 -0
- api/apps/llm_app.py +2 -1
- api/db/services/common_service.py +1 -1
- rag/nlp/query.py +2 -1
README.md
CHANGED
|
@@ -47,6 +47,20 @@
|
|
| 47 |
|
| 48 |
## 🤺RagFlow vs. other RAG applications
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
## 🔎 System Architecture
|
| 51 |
|
| 52 |
<div align="center" style="margin-top:20px;margin-bottom:20px;">
|
|
|
|
| 47 |
|
| 48 |
## 🤺RagFlow vs. other RAG applications
|
| 49 |
|
| 50 |
+
| Feature | RagFlow | Langchain-Chatchat | Dify.AI | Assistants API | QAnythig | LangChain |
|
| 51 |
+
|---------|:---------:|:----------------:|:-----------:|:-----------:|:-----------:|:-----------:|
|
| 52 |
+
| **Well-Founded Answer** | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
|
| 53 |
+
| **Trackable Chunking** | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
|
| 54 |
+
| **Chunking Method** | Rich Variety | Naive | Naive | Naive | Naive | Naive |
|
| 55 |
+
| **Table Structure Recognition** | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
|
| 56 |
+
| **Structured Data Lookup** | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
|
| 57 |
+
| **Programming Approach** | API-oriented | API-oriented | API-oriented | API-oriented | API-oriented | Python Code-oriented |
|
| 58 |
+
| **RAG Engine** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |
|
| 59 |
+
| **Prompt IDE** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: |
|
| 60 |
+
| **Supported LLMs** | Rich Variety | Rich Variety | Rich Variety | OpenAI-only | QwenLLM | Rich Variety |
|
| 61 |
+
| **Local Deployment** | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: |
|
| 62 |
+
| **Ecosystem Strategy** | Open Source | Open Source | Open Source | Close Source | Open Source | Open Source |
|
| 63 |
+
|
| 64 |
## 🔎 System Architecture
|
| 65 |
|
| 66 |
<div align="center" style="margin-top:20px;margin-bottom:20px;">
|
api/apps/llm_app.py
CHANGED
|
@@ -69,7 +69,8 @@ def set_api_key():
|
|
| 69 |
return get_data_error_result(retmsg=msg)
|
| 70 |
|
| 71 |
llm = {
|
| 72 |
-
"api_key": req["api_key"]
|
|
|
|
| 73 |
}
|
| 74 |
for n in ["model_type", "llm_name"]:
|
| 75 |
if n in req:
|
|
|
|
| 69 |
return get_data_error_result(retmsg=msg)
|
| 70 |
|
| 71 |
llm = {
|
| 72 |
+
"api_key": req["api_key"],
|
| 73 |
+
"api_base": req.get("base_url", "")
|
| 74 |
}
|
| 75 |
for n in ["model_type", "llm_name"]:
|
| 76 |
if n in req:
|
api/db/services/common_service.py
CHANGED
|
@@ -143,7 +143,7 @@ class CommonService:
|
|
| 143 |
@DB.connection_context()
|
| 144 |
def filter_update(cls, filters, update_data):
|
| 145 |
with DB.atomic():
|
| 146 |
-
cls.model.update(update_data).where(*filters).execute()
|
| 147 |
|
| 148 |
@staticmethod
|
| 149 |
def cut_list(tar_list, n):
|
|
|
|
| 143 |
@DB.connection_context()
|
| 144 |
def filter_update(cls, filters, update_data):
|
| 145 |
with DB.atomic():
|
| 146 |
+
return cls.model.update(update_data).where(*filters).execute()
|
| 147 |
|
| 148 |
@staticmethod
|
| 149 |
def cut_list(tar_list, n):
|
rag/nlp/query.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
|
| 3 |
import json
|
|
|
|
| 4 |
import re
|
| 5 |
import logging
|
| 6 |
import copy
|
|
@@ -167,4 +168,4 @@ class EsQueryer:
|
|
| 167 |
#d = 1e-9
|
| 168 |
# for k, v in dtwt.items():
|
| 169 |
# d += v * v
|
| 170 |
-
return s / q
|
|
|
|
| 1 |
# -*- coding: utf-8 -*-
|
| 2 |
|
| 3 |
import json
|
| 4 |
+
import math
|
| 5 |
import re
|
| 6 |
import logging
|
| 7 |
import copy
|
|
|
|
| 168 |
#d = 1e-9
|
| 169 |
# for k, v in dtwt.items():
|
| 170 |
# d += v * v
|
| 171 |
+
return s / q / max(1, math.sqrt(math.log10(max(len(qtwt.keys()), len(dtwt.keys())))))# math.sqrt(q) / math.sqrt(d)
|