pirag 0.1.1__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app/main.py CHANGED
@@ -62,7 +62,10 @@ def main():
62
62
  command_message = f"with command: {args.command}" if args.command else ""
63
63
  logger.info(f"RAG Started {command_message}")
64
64
 
65
- setup_logger(args.log_level)
65
+ setup_logger(
66
+ log_level = args.log_level,
67
+ log_dir = args.log_dir,
68
+ )
66
69
  logger.debug(f"Parsed arguments: {args}")
67
70
 
68
71
  if args.command == 'doctor':
app/rag/config.py CHANGED
@@ -3,34 +3,35 @@ from pathlib import Path
3
3
  from loguru import logger
4
4
 
5
5
  # Logger format constants
6
- TIME_FORMAT = "{time:YYYY-MM-DD HH:mm:ss.SSS!UTC}Z"
7
- FILE_FORMAT = f"{TIME_FORMAT} | {{level: <8}} | {{name}}:{{function}}:{{line}} - {{message}}"
8
- CONSOLE_FORMAT_FULL = f"<green>{TIME_FORMAT}</green> | <level>{{level: <8}}</level> | <cyan>{{name}}</cyan>:<cyan>{{function}}</cyan>:<cyan>{{line}}</cyan> - <level>{{message}}</level>\n"
9
- CONSOLE_FORMAT_SIMPLE = f"<green>{TIME_FORMAT}</green> | <level>{{level: <8}}</level> | <level>{{message}}</level>\n"
6
+ LOG_TIME_FORMAT = "{time:YYYY-MM-DD HH:mm:ss.SSS!UTC}Z"
7
+ LOG_FILE_FORMAT = f"{LOG_TIME_FORMAT} | {{level: <8}} | {{name}}:{{function}}:{{line}} - {{message}}"
8
+ LOG_CONSOLE_FORMAT_FULL = f"<green>{LOG_TIME_FORMAT}</green> | <level>{{level: <8}}</level> | <cyan>{{name}}</cyan>:<cyan>{{function}}</cyan>:<cyan>{{line}}</cyan> - <level>{{message}}</level>\n"
9
+ LOG_CONSOLE_FORMAT_SIMPLE = f"<green>{LOG_TIME_FORMAT}</green> | <level>{{level: <8}}</level> | <level>{{message}}</level>\n"
10
10
 
11
11
  # Initial logger setup before setup_logger()
12
12
  logger.remove()
13
13
  logger.add(
14
14
  sink = sys.stderr,
15
15
  level = "INFO",
16
- format = lambda record: CONSOLE_FORMAT_SIMPLE if record["level"].name == "INFO" else CONSOLE_FORMAT_FULL,
16
+ format = lambda record: LOG_CONSOLE_FORMAT_SIMPLE if record["level"].name == "INFO" else LOG_CONSOLE_FORMAT_FULL,
17
17
  colorize = True
18
18
  )
19
19
 
20
- def setup_logger(log_level: str):
20
+ def setup_logger(log_level: str, log_dir: str):
21
21
  """Configure logger with specified level and outputs"""
22
22
 
23
- logger.remove()
24
-
25
- log_dir = Path("app/logs")
23
+ log_dir = Path(log_dir)
26
24
  log_dir.mkdir(exist_ok=True, parents=True)
27
25
 
26
+ logger.remove()
27
+
28
28
  # File handler
29
29
  logger.add(
30
- sink = log_dir / "app.log",
30
+ sink = log_dir / "{time:YYYYMMDD-HHmmss!UTC}Z.log",
31
31
  level = log_level,
32
- rotation = "500 MB",
33
- format = FILE_FORMAT,
32
+ rotation = "100 MB",
33
+ retention = 0,
34
+ format = LOG_FILE_FORMAT,
34
35
  serialize = False,
35
36
  enqueue = True,
36
37
  backtrace = True,
@@ -42,7 +43,7 @@ def setup_logger(log_level: str):
42
43
  logger.add(
43
44
  sink = sys.stderr,
44
45
  level = log_level,
45
- format = lambda record: CONSOLE_FORMAT_SIMPLE if record["level"].name == "INFO" else CONSOLE_FORMAT_FULL,
46
+ format = lambda record: LOG_CONSOLE_FORMAT_SIMPLE if record["level"].name == "INFO" else LOG_CONSOLE_FORMAT_FULL,
46
47
  colorize = True
47
48
  )
48
49
 
@@ -133,10 +134,10 @@ top_parser.add_argument(
133
134
  )
134
135
 
135
136
  top_parser.add_argument(
136
- '--log-path',
137
- envvar = 'LOG_PATH',
138
- help = 'Path to log file',
139
- default = '.logs',
137
+ '--log-dir',
138
+ envvar = 'LOG_DIR',
139
+ help = 'Path to log directory',
140
+ default = '.pirag/logs',
140
141
  type = str,
141
142
  required = False,
142
143
  action = EnvDefault,
app/rag/doctor/config.py CHANGED
@@ -1,5 +1,7 @@
1
1
  import argparse
2
2
 
3
+ from app.rag.config import top_parser, common_parser
4
+
3
5
  help = "Diagnose the RAG system."
4
6
 
5
7
  parser = argparse.ArgumentParser(
@@ -17,4 +19,6 @@ subparsers.add_parser(
17
19
  "check",
18
20
  help = "Check RAG System. Scan all components of the system and diagnose status",
19
21
  description = "Check RAG System. Scan all components of the system and diagnose status",
22
+ parents = [top_parser, common_parser],
23
+ add_help = False,
20
24
  )
app/rag/test/router.py CHANGED
@@ -1,15 +1,4 @@
1
1
  from argparse import Namespace
2
- from ragas import evaluate
3
- from ragas.metrics import (
4
- answer_relevancy,
5
- faithfulness,
6
- context_precision,
7
- context_recall,
8
- )
9
2
 
10
3
  def route(args: Namespace):
11
-
12
- result = evaluate(
13
-
14
- )
15
4
  print(args)
app/rag/test/service.py CHANGED
@@ -1,9 +0,0 @@
1
- # https://milvus.io/docs/integrate_with_ragas.md
2
- from ragas.metrics import (
3
- answer_relevancy,
4
- faithfulness,
5
- context_precision,
6
- context_recall,
7
- )
8
-
9
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pirag
3
- Version: 0.1.1
3
+ Version: 0.1.5
4
4
  Summary: CLI Projects of On-Premise RAG. You can use your own LLM and vector DB. Or just add remote LLM servers and vector DB.
5
5
  Author-email: semir4in <semir4in@gmail.com>, jyje <jyjeon@outlook.com>
6
6
  Project-URL: Homepage, https://github.com/jyje/pilot-onpremise-rag
@@ -31,6 +31,7 @@ Dynamic: license-file
31
31
  [![LangChain](https://img.shields.io/badge/LangChain-blue?style=flat&logo=Langchain&logoColor=white)](https://langchain.com)
32
32
  [![Milvus](https://img.shields.io/badge/Milvus-red?style=flat&logo=Milvus&logoColor=white)](https://milvus.io/)
33
33
  [![MinIO](https://img.shields.io/badge/MinIO-red?style=flat&logo=MinIO&logoColor=white)](https://min.io/)
34
+ [![Build Status](https://github.com/jyje/pilot-onpremise-rag/actions/workflows/build-and-publish.yml/badge.svg)](https://github.com/jyje/pilot-onpremise-rag/actions/workflows/build-and-publish.yml)
34
35
  <!-- [![Docker](https://img.shields.io/badge/Docker-blue?style=flat&logo=Docker&logoColor=white)](https://docker.com) -->
35
36
 
36
37
  </div>
@@ -46,15 +47,20 @@ Dynamic: license-file
46
47
  git clone https://github.com/jyje/pilot-onpremise-rag
47
48
  cd pilot-onpremise-rag
48
49
 
49
- docker compose -f docker/compose.yaml up -d
50
+ docker compose -f docker/compose.yaml up
50
51
  ```
51
52
 
52
- ### Install pirag
53
+ ### Install pirag from source
53
54
  ```bash
54
55
  git clone https://github.com/jyje/pilot-onpremise-rag
55
56
  cd pilot-onpremise-rag
56
57
 
57
- pip install --upgrade -e ./app
58
+ pip install --upgrade -e .
59
+ ```
60
+
61
+ ### Install pirag from PyPI
62
+ ```bash
63
+ pip install --upgrade pirag
58
64
  ```
59
65
 
60
66
  ## 📚 Usage
@@ -1,27 +1,27 @@
1
- app/main.py,sha256=CRpnMBACO2446xoGbgN6mz9QH2_EM-Ibi017x3WoJiE,2182
1
+ app/main.py,sha256=Zl9yGtnZqTH8-0ljdvsvvQ_7Nksv8_1wo-oZntmhbos,2241
2
2
  app/requirements.txt,sha256=JFEWoQHN7hwDg0bDrWlN0vxZVR3oe8dYgv7mkHrQg1g,128
3
3
  app/setup.py,sha256=j9qcfapv_jOW3jORYGfHzKDAcxNRItHcHA34_mMDGj4,744
4
4
  app/rag/agent.py,sha256=u1ovyqALsmOMHDCW-hdlkMU72XdlTMiFJ-WRbLHHrYQ,2190
5
- app/rag/config.py,sha256=SNVJF7zEuClG818W9Ot_ecOqVdy2390hzxe73hD0jzg,5057
5
+ app/rag/config.py,sha256=KVDuJ8wVwgb9akMSxEl8cTJ3p7UHECZHlXKiyRopj10,5172
6
6
  app/rag/ask/__init__.py,sha256=41lK4nmvWT2ZZ3G_FMtOiG-0JFJdDVT4zoxkoes8TaE,59
7
7
  app/rag/ask/config.py,sha256=tRHOBrEAmTMBaBmYPKPsRJmSaVyKT8-TBSDJQXEndxc,386
8
8
  app/rag/ask/router.py,sha256=5nuaaHzWVr2ltYqOuQ30ujmZ-GFyx-22OLVODILd5iE,76
9
9
  app/rag/ask/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  app/rag/doctor/__init__.py,sha256=41lK4nmvWT2ZZ3G_FMtOiG-0JFJdDVT4zoxkoes8TaE,59
11
- app/rag/doctor/config.py,sha256=dpDwEGb7Aa5solTov8GsIWKPuAlQIo9_49wddbyZh0Q,646
11
+ app/rag/doctor/config.py,sha256=CW0scwLkRykKLp15szu6Q9i3sG7n70ZJ0eYOtkjuS9Q,765
12
12
  app/rag/doctor/router.py,sha256=5nuaaHzWVr2ltYqOuQ30ujmZ-GFyx-22OLVODILd5iE,76
13
13
  app/rag/doctor/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  app/rag/test/__init__.py,sha256=41lK4nmvWT2ZZ3G_FMtOiG-0JFJdDVT4zoxkoes8TaE,59
15
15
  app/rag/test/config.py,sha256=tk-IM1VspaUPgwWKSwYWagkdYXfOjIAjU3-c0rxMBoc,361
16
- app/rag/test/router.py,sha256=zfqLhfYwP3nvoZEJWtxGwKuYdEk7NmM83EYlL5wVy8w,259
17
- app/rag/test/service.py,sha256=Znb-qEM5eM6-Y-tmSoBklsLGR6gEKeYqc1EW_yzYts0,164
16
+ app/rag/test/router.py,sha256=5nuaaHzWVr2ltYqOuQ30ujmZ-GFyx-22OLVODILd5iE,76
17
+ app/rag/test/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  app/rag/train/__init__.py,sha256=41lK4nmvWT2ZZ3G_FMtOiG-0JFJdDVT4zoxkoes8TaE,59
19
19
  app/rag/train/config.py,sha256=PO4iRMmZXViFHOMBbOOhnFHqBu8hRfbI61zGCuksKhI,668
20
20
  app/rag/train/router.py,sha256=5nuaaHzWVr2ltYqOuQ30ujmZ-GFyx-22OLVODILd5iE,76
21
21
  app/rag/train/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- pirag-0.1.1.dist-info/licenses/LICENSE,sha256=gBUmwRyDQYI4Q4Ju5S88urvB-B-nqsXN45n8oQ3DZ3Y,1079
23
- pirag-0.1.1.dist-info/METADATA,sha256=8A9yNPYmYQLCillOhA1Luy4mw4JAluDQxhLtemNcIsE,5158
24
- pirag-0.1.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
- pirag-0.1.1.dist-info/entry_points.txt,sha256=1tHs5rP66AVq5SMEWRRIWRf_XqJo2Gb1TJl9-Kw_MSo,40
26
- pirag-0.1.1.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
27
- pirag-0.1.1.dist-info/RECORD,,
22
+ pirag-0.1.5.dist-info/licenses/LICENSE,sha256=gBUmwRyDQYI4Q4Ju5S88urvB-B-nqsXN45n8oQ3DZ3Y,1079
23
+ pirag-0.1.5.dist-info/METADATA,sha256=SXdyCa3Og7nEhHDl_AZNcN-j7FT7GY6zanku4Swlfuo,5430
24
+ pirag-0.1.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
25
+ pirag-0.1.5.dist-info/entry_points.txt,sha256=1tHs5rP66AVq5SMEWRRIWRf_XqJo2Gb1TJl9-Kw_MSo,40
26
+ pirag-0.1.5.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
27
+ pirag-0.1.5.dist-info/RECORD,,
File without changes