Skip to content

Commit ba9892f

Browse files
authored
minor bug fix for EC-RAG (#1378)
Signed-off-by: Zhu, Yongbo <[email protected]>
1 parent ff1310b commit ba9892f

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

EdgeCraftRAG/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ quality and performance.
88
## What's New in this release?
99

1010
- Support image/url data retrieval and display in EC-RAG
11-
- Support display of LLM-used context sources in UI
11+
- Support display of document source used by LLM in UI
1212
- Support pipeline remove operation in RESTful API and UI
1313
- Support RAG pipeline performance benchmark and display in UI
1414
- Fixed known issues in EC-RAG UI and server
@@ -77,7 +77,7 @@ export RENDERGROUPID=$(getent group render | cut -d: -f3)
7777
pip install --upgrade --upgrade-strategy eager "optimum[openvino]"
7878

7979
optimum-cli export openvino -m BAAI/bge-small-en-v1.5 ${MODEL_PATH}/BAAI/bge-small-en-v1.5 --task sentence-similarity
80-
optimum-cli export openvino -m BAAI/bge-reranker-large ${MODEL_PATH}/BAAI/bge-reranker-large --task sentence-similarity
80+
optimum-cli export openvino -m BAAI/bge-reranker-large ${MODEL_PATH}/BAAI/bge-reranker-large --task text-classification
8181
optimum-cli export openvino -m Qwen/Qwen2-7B-Instruct ${MODEL_PATH}/Qwen/Qwen2-7B-Instruct/INT4_compressed_weights --weight-format int4
8282

8383
```

EdgeCraftRAG/docker_compose/intel/gpu/arc/compose_vllm.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ services:
6767
ports:
6868
- ${VLLM_SERVICE_PORT:-8008}:80
6969
environment:
70-
HTTPS_PROXY: ${https_proxy}
71-
HTTP_PROXY: ${https_proxy}
70+
no_proxy: ${no_proxy}
71+
http_proxy: ${http_proxy}
72+
https_proxy: ${https_proxy}
7273
VLLM_OPENVINO_DEVICE: GPU
7374
HF_ENDPOINT: ${HF_ENDPOINT}
7475
HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
7576
volumes:
76-
- /dev/dri/by-path:/dev/dri/by-path
77-
- $HOME/.cache/huggingface:/root/.cache/huggingface
77+
- ${HF_CACHE:-${HOME}/.cache}:/root/.cache
7878
devices:
7979
- /dev/dri
8080
group_add:

EdgeCraftRAG/edgecraftrag/api/v1/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ async def get_files():
5353

5454

5555
# GET a file
56-
@data_app.get(path="/v1/data/files")
56+
@data_app.get(path="/v1/data/files/{name}")
5757
async def get_file_docs(name):
58-
return ctx.get_file_mgr().get_docs_by_file(name)
58+
return ctx.get_file_mgr().get_file_by_name_or_id(name)
5959

6060

6161
# DELETE a file

EdgeCraftRAG/edgecraftrag/api/v1/pipeline.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ async def add_pipeline(request: PipelineCreateIn):
5454
pass
5555
else:
5656
return "Unable to patch an active pipeline..."
57-
update_pipeline_handler(pl, request)
57+
try:
58+
update_pipeline_handler(pl, request)
59+
except ValueError as e:
60+
ctx.get_pipeline_mgr().remove_pipeline_by_name_or_id(request.name)
61+
return str(e)
5862
return pl
5963

6064

@@ -71,7 +75,10 @@ async def update_pipeline(name, request: PipelineCreateIn):
7175
else:
7276
return "Unable to patch an active pipeline..."
7377
async with ctx.get_pipeline_mgr()._lock:
74-
update_pipeline_handler(pl, request)
78+
try:
79+
update_pipeline_handler(pl, request)
80+
except ValueError as e:
81+
return str(e)
7582
return pl
7683

7784

EdgeCraftRAG/edgecraftrag/api_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NodeParserIn(BaseModel):
1919
chunk_overlap: Optional[int] = None
2020
chunk_sizes: Optional[list] = None
2121
parser_type: str
22-
window_size: Optional[int] = None
22+
window_size: Optional[int] = 3
2323

2424

2525
class IndexerIn(BaseModel):

EdgeCraftRAG/edgecraftrag/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class FileType(str, Enum):
4040

4141
class NodeParserType(str, Enum):
4242

43-
DEFAULT = "default"
4443
SIMPLE = "simple"
4544
HIERARCHY = "hierarchical"
4645
SENTENCEWINDOW = "sentencewindow"
@@ -49,14 +48,12 @@ class NodeParserType(str, Enum):
4948

5049
class IndexerType(str, Enum):
5150

52-
DEFAULT = "default"
5351
FAISS_VECTOR = "faiss_vector"
5452
DEFAULT_VECTOR = "vector"
5553

5654

5755
class RetrieverType(str, Enum):
5856

59-
DEFAULT = "default"
6057
VECTORSIMILARITY = "vectorsimilarity"
6158
AUTOMERGE = "auto_merge"
6259
BM25 = "bm25"

EdgeCraftRAG/edgecraftrag/components/retriever.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ def run(self, **kwargs) -> Any:
9898
for k, v in kwargs.items():
9999
if k == "query":
100100
nodes = cast(List[BaseNode], list(self._docstore.docs.values()))
101-
bm25_retr = BM25Retriever.from_defaults(nodes=nodes, similarity_top_k=self.topk)
101+
similarity_top_k = min(len(nodes), self.topk)
102+
bm25_retr = BM25Retriever.from_defaults(nodes=nodes, similarity_top_k=similarity_top_k)
102103
return bm25_retr.retrieve(v)
103104

104105
return None

EdgeCraftRAG/edgecraftrag/controllers/nodemgr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ def del_nodes(self, nodes):
2525
pass
2626

2727
def del_nodes_by_np_idx(self, np_idx):
28-
del self.nodes[np_idx]
28+
if np_idx in self.nodes:
29+
del self.nodes[np_idx]
2930

3031
def get_nodes(self, np_idx) -> List[BaseNode]:
3132
if np_idx in self.nodes:

0 commit comments

Comments
 (0)