pirag 0.2.0__py3-none-any.whl → 0.2.2__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 +27 -13
- app/rag/agent/services.py +11 -0
- app/rag/api.py +10 -20
- app/rag/cli.py +35 -14
- app/rag/config.py +20 -0
- app/rag/embedding/client.py +1 -1
- app/rag/embedding/{service.py → services.py} +1 -1
- app/rag/llm/client.py +64 -6
- app/rag/llm/{service.py → services.py} +1 -1
- app/rag/llm/utilities.py +40 -0
- app/rag/models.py +19 -0
- app/rag/routers.py +41 -0
- app/rag/{utils.py → utilities.py} +1 -1
- app/rag/vector_store/client.py +4 -1
- app/rag/vector_store/{service.py → services.py} +14 -1
- app/requirements.txt +2 -0
- {pirag-0.2.0.dist-info → pirag-0.2.2.dist-info}/METADATA +3 -1
- pirag-0.2.2.dist-info/RECORD +27 -0
- app/rag/v1/service.py +0 -0
- pirag-0.2.0.dist-info/RECORD +0 -24
- /app/rag/v1/{router.py → routers.py} +0 -0
- /app/rag/{agent/client.py → v1/services.py} +0 -0
- {pirag-0.2.0.dist-info → pirag-0.2.2.dist-info}/WHEEL +0 -0
- {pirag-0.2.0.dist-info → pirag-0.2.2.dist-info}/entry_points.txt +0 -0
- {pirag-0.2.0.dist-info → pirag-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {pirag-0.2.0.dist-info → pirag-0.2.2.dist-info}/top_level.txt +0 -0
app/main.py
CHANGED
@@ -5,15 +5,6 @@ import app.rag.config as cfn
|
|
5
5
|
import app.rag.api as api
|
6
6
|
import app.rag.cli as cli
|
7
7
|
|
8
|
-
# Command definitions
|
9
|
-
commands = {
|
10
|
-
"serve" : ("Start the RAG server", "Run a FastAPI-based RAG server", api.serve),
|
11
|
-
"chat" : ("Chat with the RAG system", "Run an interactive chat with the RAG system", cli.chat),
|
12
|
-
"train" : ("Train the RAG system", "Run a pipeline to train the RAG system", cli.train),
|
13
|
-
"test" : ("Test the RAG system", "Run a pipeline to test the RAG system", cli.test),
|
14
|
-
"doctor" : ("Diagnose the RAG system", "Run a pipeline to diagnose the RAG system", cli.doctor),
|
15
|
-
}
|
16
|
-
|
17
8
|
# Main parser
|
18
9
|
parser = ArgumentParser(
|
19
10
|
formatter_class = ArgumentDefaultsHelpFormatter,
|
@@ -24,14 +15,24 @@ parser = ArgumentParser(
|
|
24
15
|
add_help = False,
|
25
16
|
)
|
26
17
|
|
18
|
+
# Command definitions
|
19
|
+
commands = {
|
20
|
+
# name: help, description, function, extra_parsers
|
21
|
+
"serve" : ("Start the RAG server", "Run a FastAPI-based RAG server", api.serve, []),
|
22
|
+
"chat" : ("Chat with the RAG system", "Run an interactive chat with the RAG system", cli.chat, [cfn.chat_parser]),
|
23
|
+
"train" : ("Train the RAG system", "Run a pipeline to train the RAG system", cli.train, []),
|
24
|
+
"test" : ("Test the RAG system", "Run a pipeline to test the RAG system", cli.test, []),
|
25
|
+
"doctor" : ("Diagnose the RAG system", "Run a pipeline to diagnose the RAG system", cli.doctor, [cfn.doctor_parser]),
|
26
|
+
}
|
27
|
+
|
27
28
|
# Add command parsers
|
28
29
|
subparsers = parser.add_subparsers(title="commands", dest="command")
|
29
|
-
for name, (help, description, _) in commands.items():
|
30
|
+
for name, (help, description, _, extra_parsers) in commands.items():
|
30
31
|
subparsers.add_parser(
|
31
32
|
name = name,
|
32
33
|
help = help,
|
33
34
|
description = description,
|
34
|
-
parents = [cfn.common_parser],
|
35
|
+
parents = [cfn.common_parser] + extra_parsers,
|
35
36
|
add_help = False,
|
36
37
|
)
|
37
38
|
|
@@ -40,8 +41,21 @@ def main():
|
|
40
41
|
cfn.setup_logger(cfn.LOG_LEVEL, cfn.LOG_SAVE, cfn.LOG_DIR)
|
41
42
|
logger.debug(f"Parsed arguments: {args}")
|
42
43
|
|
43
|
-
if
|
44
|
-
func[
|
44
|
+
if command_info := commands.get(args.command):
|
45
|
+
func, extra_parsers = command_info[2], command_info[3]
|
46
|
+
|
47
|
+
# Create parser options dict from extra_parsers
|
48
|
+
extra_options = {}
|
49
|
+
if extra_parsers:
|
50
|
+
for parser_obj in extra_parsers:
|
51
|
+
for action in parser_obj._actions:
|
52
|
+
if action.dest == 'help':
|
53
|
+
continue
|
54
|
+
if hasattr(args, action.dest) and getattr(args, action.dest) != action.default:
|
55
|
+
extra_options[action.dest] = getattr(args, action.dest)
|
56
|
+
|
57
|
+
# Run the command with the extra parser options
|
58
|
+
func(extra_options)
|
45
59
|
else:
|
46
60
|
parser.print_help()
|
47
61
|
|
app/rag/api.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import uvicorn
|
2
|
-
from fastapi import FastAPI, Request, Depends, HTTPException, Query
|
2
|
+
from fastapi import FastAPI, APIRouter, Request, Depends, HTTPException, Query
|
3
3
|
from fastapi.middleware.cors import CORSMiddleware
|
4
4
|
|
5
5
|
from loguru import logger
|
6
6
|
import app.rag.config as cfn
|
7
|
-
|
7
|
+
|
8
|
+
from app.rag.routers import system_router
|
9
|
+
from app.rag.v1.routers import router as v1_router
|
8
10
|
|
9
11
|
# Initialize FastAPI app
|
10
12
|
api = FastAPI(
|
@@ -22,26 +24,14 @@ api.add_middleware(
|
|
22
24
|
allow_headers=["*"],
|
23
25
|
)
|
24
26
|
|
27
|
+
api.include_router(router=system_router, prefix="", tags=["System"])
|
28
|
+
api.include_router(router=v1_router, prefix="/v1")
|
25
29
|
|
26
|
-
|
27
|
-
async def _():
|
28
|
-
return {"message": "RAG API is running"}
|
29
|
-
|
30
|
-
|
31
|
-
@api.get("/livez")
|
32
|
-
async def _():
|
33
|
-
return {"status": "ok"}
|
34
|
-
|
35
|
-
|
36
|
-
@api.get("/readyz")
|
37
|
-
async def _():
|
38
|
-
return {"status": "ok"}
|
39
|
-
|
40
|
-
api.include_router(router=core_router, prefix="/v1")
|
41
|
-
|
42
|
-
def serve():
|
30
|
+
def serve(parser_options=None):
|
43
31
|
print("Serving the RAG API...")
|
44
|
-
|
32
|
+
if parser_options:
|
33
|
+
logger.debug(f"Serve parser options: {parser_options}")
|
34
|
+
|
45
35
|
uvicorn.run(
|
46
36
|
app = "app.rag.api:api",
|
47
37
|
host = cfn.API_HOST,
|
app/rag/cli.py
CHANGED
@@ -1,33 +1,54 @@
|
|
1
1
|
import app.rag.config as cfn
|
2
2
|
from loguru import logger
|
3
3
|
|
4
|
-
from app.rag.llm.
|
5
|
-
from app.rag.embedding.
|
6
|
-
from app.rag.vector_store.
|
4
|
+
from app.rag.llm.services import doctor as doctor_llm
|
5
|
+
from app.rag.embedding.services import doctor as doctor_embedding
|
6
|
+
from app.rag.vector_store.services import doctor as doctor_vector_store
|
7
|
+
from app.rag.agent.services import chat_only_llm, chat_with_rag
|
7
8
|
|
8
|
-
def chat():
|
9
|
-
|
9
|
+
def chat(options: dict):
|
10
|
+
logger.debug(f"Chat parser options: {options}")
|
11
|
+
no_rag = options.get('no_rag', False)
|
10
12
|
|
13
|
+
# -- Chat
|
14
|
+
if no_rag:
|
15
|
+
logger.info("💬 Chatting with the LLM system directly...")
|
16
|
+
chat_only_llm()
|
17
|
+
else:
|
18
|
+
logger.info("💬 Chatting with the RAG system...")
|
19
|
+
chat_with_rag()
|
11
20
|
|
12
|
-
|
21
|
+
|
22
|
+
def train(options: dict):
|
13
23
|
print("Training the RAG system...")
|
24
|
+
logger.debug(f"Train parser options: {options}")
|
14
25
|
|
15
26
|
|
16
|
-
def test():
|
27
|
+
def test(options: dict):
|
17
28
|
print("Testing the RAG system...")
|
29
|
+
logger.debug(f"Test parser options: {options}")
|
18
30
|
|
19
31
|
|
20
|
-
def doctor():
|
32
|
+
def doctor(options: dict):
|
21
33
|
logger.info("💚 Doctoring the RAG system...")
|
34
|
+
|
35
|
+
logger.debug(f"Doctor parser options: {options}")
|
36
|
+
# Check if resolve option is present
|
37
|
+
resolve = options.get('resolve', False)
|
38
|
+
if resolve:
|
39
|
+
logger.info("🔧 Resolving issues is enabled")
|
22
40
|
|
23
41
|
# -- LLM Server
|
24
|
-
logger.info("Checking the LLM server (OpenAI-compatible)...")
|
25
|
-
doctor_llm()
|
42
|
+
logger.info("🔍 Checking the LLM server (OpenAI-compatible)...")
|
43
|
+
doctor_llm(resolve)
|
26
44
|
|
27
45
|
# -- Embedding Server
|
28
|
-
logger.info("Checking the embedding server (OpenAI-compatible)...")
|
29
|
-
doctor_embedding()
|
46
|
+
logger.info("🔍 Checking the embedding server (OpenAI-compatible)...")
|
47
|
+
doctor_embedding(resolve)
|
30
48
|
|
31
49
|
# -- Vector Store
|
32
|
-
logger.info("Checking the vector store server (Milvus)...")
|
33
|
-
doctor_vector_store()
|
50
|
+
logger.info("🔍 Checking the vector store server (Milvus)...")
|
51
|
+
doctor_vector_store(resolve)
|
52
|
+
|
53
|
+
if resolve:
|
54
|
+
logger.info(f"🔧 Resolving issue completed. To make sure the issues are resolved, please try doctoring again.")
|
app/rag/config.py
CHANGED
@@ -40,12 +40,14 @@ API_RELOAD: bool = settings.get("API.RELOAD", True)
|
|
40
40
|
LLM_BASE_URL: str = settings.get("LLM.BASE_URL", "http://localhost:11434")
|
41
41
|
LLM_API_KEY: str = settings.get("LLM.API_KEY", "llm_api_key")
|
42
42
|
LLM_MODEL: str = settings.get("LLM.MODEL", "gemma3:4b")
|
43
|
+
LLM_SERVER_TYPE: str = settings.get("LLM.SERVER_TYPE", "openai")
|
43
44
|
|
44
45
|
|
45
46
|
# -- Embedding Server
|
46
47
|
EMBEDDING_BASE_URL: str = settings.get("EMBEDDING.BASE_URL", "http://localhost:11434")
|
47
48
|
EMBEDDING_API_KEY: str = settings.get("EMBEDDING.API_KEY", "embedding_api_key")
|
48
49
|
EMBEDDING_MODEL: str = settings.get("EMBEDDING.MODEL", "nomic-embed-text:latest")
|
50
|
+
EMBEDDING_SERVER_TYPE: str = settings.get("EMBEDDING.SERVER_TYPE", "openai")
|
49
51
|
EMBEDDING_DIMENSION: int = settings.get("EMBEDDING.DIMENSION", 768)
|
50
52
|
|
51
53
|
|
@@ -122,3 +124,21 @@ common_parser.add_argument(
|
|
122
124
|
default = argparse.SUPPRESS,
|
123
125
|
action = "help",
|
124
126
|
)
|
127
|
+
|
128
|
+
|
129
|
+
# Chat parser
|
130
|
+
chat_parser = argparse.ArgumentParser(add_help=False)
|
131
|
+
chat_parser.add_argument(
|
132
|
+
"-n", "--no-rag",
|
133
|
+
help = "Do not use RAG to answer the question. Just use the LLM to answer the question.",
|
134
|
+
action = "store_true",
|
135
|
+
)
|
136
|
+
|
137
|
+
|
138
|
+
# Doctor parser
|
139
|
+
doctor_parser = argparse.ArgumentParser(add_help=False)
|
140
|
+
doctor_parser.add_argument(
|
141
|
+
"-r", "--resolve",
|
142
|
+
help = "Resolve the issue",
|
143
|
+
action = "store_true",
|
144
|
+
)
|
app/rag/embedding/client.py
CHANGED
app/rag/llm/client.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
import requests
|
2
|
+
import time
|
2
3
|
from langchain_openai.llms import OpenAI
|
4
|
+
from typing import Dict, Tuple, Any, List, Optional
|
3
5
|
|
4
6
|
import app.rag.config as cfn
|
5
|
-
from app.rag.
|
6
|
-
|
7
|
+
from app.rag.utilities import connection_check
|
8
|
+
from .utilities import MetricCallbackHandler
|
7
9
|
|
8
10
|
class LLMClient:
|
9
11
|
def __init__(self, base_url: str, api_key: str, model: str):
|
@@ -34,11 +36,67 @@ class LLMClient:
|
|
34
36
|
return True
|
35
37
|
|
36
38
|
@connection_check
|
37
|
-
def generate(self, prompt: str) ->
|
38
|
-
"""Generate text from prompt
|
39
|
+
def generate(self, prompt: str) -> tuple:
|
40
|
+
"""Generate text from prompt and return usage information
|
41
|
+
|
42
|
+
Returns:
|
43
|
+
tuple: (generated_text, usage_info)
|
44
|
+
"""
|
45
|
+
if not self._is_connected or self._client is None:
|
46
|
+
return "", {}
|
47
|
+
|
48
|
+
response = self._client.generate([prompt])
|
49
|
+
return response.generations[0][0].text, response.llm_output
|
50
|
+
|
51
|
+
@connection_check
|
52
|
+
def generate_with_metrics(self, prompt: str) -> Tuple[str, Dict[str, Any]]:
|
53
|
+
"""Generate text with timing and usage metrics
|
54
|
+
|
55
|
+
Returns:
|
56
|
+
tuple: (generated_text, metrics_info)
|
57
|
+
"""
|
39
58
|
if not self._is_connected or self._client is None:
|
40
|
-
return ""
|
41
|
-
|
59
|
+
return "", {"error": "LLM client not connected"}
|
60
|
+
|
61
|
+
handler = MetricCallbackHandler()
|
62
|
+
|
63
|
+
# Create streaming client with callback
|
64
|
+
streaming_client = OpenAI(
|
65
|
+
base_url=self.base_url,
|
66
|
+
api_key=self.api_key,
|
67
|
+
model=self.model,
|
68
|
+
streaming=True,
|
69
|
+
callbacks=[handler]
|
70
|
+
)
|
71
|
+
|
72
|
+
# Make a single request
|
73
|
+
response = streaming_client.generate([prompt], callbacks=[handler])
|
74
|
+
|
75
|
+
# Get base metrics from response
|
76
|
+
metrics = {}
|
77
|
+
|
78
|
+
# Extract token usage from response
|
79
|
+
llm_output = response.llm_output if hasattr(response, 'llm_output') else {}
|
80
|
+
|
81
|
+
# Check if token_usage exists in the response
|
82
|
+
token_usage = llm_output.get('token_usage', {})
|
83
|
+
if token_usage:
|
84
|
+
# If token_usage is available, copy it to our metrics
|
85
|
+
metrics.update(token_usage)
|
86
|
+
|
87
|
+
# Add model name if available
|
88
|
+
if 'model_name' in llm_output:
|
89
|
+
metrics['model'] = llm_output['model_name']
|
90
|
+
else:
|
91
|
+
metrics['model'] = self.model
|
92
|
+
|
93
|
+
# Calculate and add timing metrics
|
94
|
+
metrics['ttft'] = handler.ttft or 0.0
|
95
|
+
metrics['total_time'] = (handler.end_time or time.time()) - handler.start_time
|
96
|
+
metrics['tokens_per_second'] = handler.calculate_tokens_per_second()
|
97
|
+
metrics['completion_tokens'] = handler.token_count
|
98
|
+
|
99
|
+
return handler.result, metrics
|
42
100
|
|
43
101
|
@connection_check
|
44
102
|
def list_models(self) -> list:
|
app/rag/llm/utilities.py
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
import time
|
2
|
+
from langchain.callbacks.base import BaseCallbackHandler
|
3
|
+
|
4
|
+
class MetricCallbackHandler(BaseCallbackHandler):
|
5
|
+
def __init__(self):
|
6
|
+
self.start_time = time.time()
|
7
|
+
self.ttft = None
|
8
|
+
self.first_token_time = None
|
9
|
+
self.result = ""
|
10
|
+
self.end_time = None
|
11
|
+
self.token_count = 0
|
12
|
+
self.token_timestamps = []
|
13
|
+
|
14
|
+
def on_llm_new_token(self, token: str, **kwargs):
|
15
|
+
current_time = time.time()
|
16
|
+
self.token_count += 1
|
17
|
+
self.token_timestamps.append(current_time)
|
18
|
+
|
19
|
+
if self.ttft is None:
|
20
|
+
self.ttft = current_time - self.start_time
|
21
|
+
self.first_token_time = current_time
|
22
|
+
|
23
|
+
self.result += token
|
24
|
+
|
25
|
+
def on_llm_end(self, *args, **kwargs):
|
26
|
+
self.end_time = time.time()
|
27
|
+
|
28
|
+
def calculate_tokens_per_second(self):
|
29
|
+
"""Calculate tokens per second after the first token"""
|
30
|
+
if self.token_count <= 1 or self.first_token_time is None or self.end_time is None:
|
31
|
+
return 0.0
|
32
|
+
|
33
|
+
# Calculate time from first token to completion (exclude TTFT)
|
34
|
+
generation_time = self.end_time - self.first_token_time
|
35
|
+
if generation_time <= 0:
|
36
|
+
return 0.0
|
37
|
+
|
38
|
+
# Exclude the first token from the count since we're measuring from after it arrived
|
39
|
+
tokens_after_first = self.token_count - 1
|
40
|
+
return tokens_after_first / generation_time
|
app/rag/models.py
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
from pydantic import BaseModel
|
2
|
+
|
3
|
+
class SystemStatusResponse(BaseModel):
|
4
|
+
"""
|
5
|
+
Response model for the system status endpoint.
|
6
|
+
"""
|
7
|
+
status: int
|
8
|
+
message: str
|
9
|
+
|
10
|
+
model_config = {
|
11
|
+
"json_schema_extra": {
|
12
|
+
"examples": [
|
13
|
+
{
|
14
|
+
"status": 200,
|
15
|
+
"message": "System is running normally"
|
16
|
+
}
|
17
|
+
]
|
18
|
+
}
|
19
|
+
}
|
app/rag/routers.py
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
from fastapi import APIRouter
|
2
|
+
|
3
|
+
from .models import SystemStatusResponse
|
4
|
+
|
5
|
+
system_router = APIRouter()
|
6
|
+
|
7
|
+
@system_router.get(
|
8
|
+
path = "/",
|
9
|
+
summary = "Root Endpoint",
|
10
|
+
description = "Root endpoint for the RAG API",
|
11
|
+
response_model = SystemStatusResponse,
|
12
|
+
)
|
13
|
+
async def root():
|
14
|
+
return SystemStatusResponse(
|
15
|
+
status = 200,
|
16
|
+
message = "RAG API is running. If you want to see API documentation, please visit /docs",
|
17
|
+
)
|
18
|
+
|
19
|
+
@system_router.get(
|
20
|
+
path = "/livez",
|
21
|
+
summary = "Liveness Probe",
|
22
|
+
description = "Check if the RAG API is running",
|
23
|
+
response_model = SystemStatusResponse,
|
24
|
+
)
|
25
|
+
async def livez():
|
26
|
+
return SystemStatusResponse(
|
27
|
+
status = 200,
|
28
|
+
message = "RAG API is live",
|
29
|
+
)
|
30
|
+
|
31
|
+
@system_router.get(
|
32
|
+
path = "/readyz",
|
33
|
+
summary = "Readiness Probe",
|
34
|
+
description = "Check if the RAG API is ready to serve requests",
|
35
|
+
response_model = SystemStatusResponse,
|
36
|
+
)
|
37
|
+
async def readyz():
|
38
|
+
return SystemStatusResponse(
|
39
|
+
status = 200,
|
40
|
+
message = "RAG API is ready to serve requests",
|
41
|
+
)
|
@@ -6,7 +6,7 @@ def connection_check(func):
|
|
6
6
|
@wraps(func)
|
7
7
|
def wrapper(self, *args, **kwargs):
|
8
8
|
try:
|
9
|
-
requests.head(url=self.base_url, timeout=
|
9
|
+
requests.head(url=self.base_url, timeout=1)
|
10
10
|
self._is_connected = True
|
11
11
|
return func(self, *args, **kwargs)
|
12
12
|
except requests.exceptions.ConnectionError:
|
app/rag/vector_store/client.py
CHANGED
@@ -3,7 +3,7 @@ from pymilvus import MilvusClient
|
|
3
3
|
from pymilvus.exceptions import MilvusException
|
4
4
|
|
5
5
|
import app.rag.config as cfn
|
6
|
-
from app.rag.
|
6
|
+
from app.rag.utilities import connection_check
|
7
7
|
|
8
8
|
|
9
9
|
class VectorStoreClient(MilvusClient):
|
@@ -40,6 +40,9 @@ class VectorStoreClient(MilvusClient):
|
|
40
40
|
except requests.exceptions.ConnectionError:
|
41
41
|
self._is_connected = False
|
42
42
|
return False
|
43
|
+
except requests.exceptions.ReadTimeout:
|
44
|
+
self._is_connected = False
|
45
|
+
return False
|
43
46
|
self._is_connected = True
|
44
47
|
return True
|
45
48
|
|
@@ -3,7 +3,7 @@ from loguru import logger
|
|
3
3
|
import app.rag.config as cfn
|
4
4
|
from .client import client
|
5
5
|
|
6
|
-
def doctor():
|
6
|
+
def doctor(resolve: bool):
|
7
7
|
# Check connection
|
8
8
|
is_connected = client.check_connection()
|
9
9
|
if not is_connected:
|
@@ -20,6 +20,9 @@ def doctor():
|
|
20
20
|
else:
|
21
21
|
if not client.has_database(cfn.MILVUS_DATABASE):
|
22
22
|
logger.error(f"- ❌ FAILED: Vector store databases (Database '{cfn.MILVUS_DATABASE}' not found)")
|
23
|
+
if resolve:
|
24
|
+
logger.info(f"- 🔧 Resolving issue: Creating database '{cfn.MILVUS_DATABASE}'")
|
25
|
+
client.create_database(cfn.MILVUS_DATABASE)
|
23
26
|
else:
|
24
27
|
logger.info(f"- ✅ PASSED: Vector store databases (Database '{cfn.MILVUS_DATABASE}' exists)")
|
25
28
|
except Exception as e:
|
@@ -34,9 +37,19 @@ def doctor():
|
|
34
37
|
logger.warning("- ⏭️ SKIPPED: Vector store collections (No database available)")
|
35
38
|
elif len(collections) == 0:
|
36
39
|
logger.error("- ❌ FAILED: Vector store collections (No collections available)")
|
40
|
+
if resolve:
|
41
|
+
logger.info(f"- 🔧 Resolving issue: Creating collection '{cfn.MILVUS_COLLECTION}'")
|
42
|
+
client.create_collection(cfn.MILVUS_COLLECTION)
|
37
43
|
else:
|
38
44
|
if not client.has_collection(cfn.MILVUS_COLLECTION):
|
39
45
|
logger.error(f"- ❌ FAILED: Vector store collections (Collection '{cfn.MILVUS_COLLECTION}' not found)")
|
46
|
+
if resolve:
|
47
|
+
logger.info(f"- 🔧 Resolving issue: Creating collection '{cfn.MILVUS_COLLECTION}'")
|
48
|
+
client.create_collection(
|
49
|
+
collection_name = cfn.MILVUS_COLLECTION,
|
50
|
+
dimension = cfn.EMBEDDING_DIMENSION,
|
51
|
+
metric_type = cfn.MILVUS_METRIC_TYPE
|
52
|
+
)
|
40
53
|
else:
|
41
54
|
logger.info(f"- ✅ PASSED: Vector store collections (Collection '{cfn.MILVUS_COLLECTION}' exists)")
|
42
55
|
except Exception as e:
|
app/requirements.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pirag
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.2
|
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
|
@@ -16,6 +16,8 @@ Requires-Dist: fastapi<0.116
|
|
16
16
|
Requires-Dist: uvicorn<0.35
|
17
17
|
Requires-Dist: ragas<0.3
|
18
18
|
Requires-Dist: pymilvus<2.6
|
19
|
+
Requires-Dist: langchain-openai<0.4
|
20
|
+
Requires-Dist: langchain-ollama<0.4
|
19
21
|
Dynamic: license-file
|
20
22
|
|
21
23
|
<div align="center">
|
@@ -0,0 +1,27 @@
|
|
1
|
+
app/main.py,sha256=H2M3jzG61MvEszebTdvrQc2PyHiKTwVoLFJo_W-T50s,2335
|
2
|
+
app/requirements.txt,sha256=SvJdCesmBDu3w8ANXuFkHUf08NsxIlI3PMmDCuPrUps,158
|
3
|
+
app/setup.py,sha256=nwUhqn3SLcm6L-WN0saHFisF-K9BpMR3qktszjBJcA4,736
|
4
|
+
app/rag/api.py,sha256=IdM296NbcyF4yzLRpTnsAiPRMntHBlTYJwW7rx-18qo,1077
|
5
|
+
app/rag/cli.py,sha256=IgzViBkIMIkdwYk4F3nrp-wMpBciza_yod6rt98HBZA,1703
|
6
|
+
app/rag/config.py,sha256=qenCAkJdgMWEMODuWWhtx6wJzsxDW7yUcY6nz37G33Q,4938
|
7
|
+
app/rag/models.py,sha256=VwkNFwzzTKeGUEkx4MPJR0Y2y1uaIMu37ja58Za70GY,415
|
8
|
+
app/rag/routers.py,sha256=Jv1rAmIl6-sRy5YLvEbRF2kpME_XYVC5Gm3Lxb6NAvw,1058
|
9
|
+
app/rag/utilities.py,sha256=AyKNakKmbNcAhjGUj9h2UUQGQV0A4759mJpTlCvMrCY,510
|
10
|
+
app/rag/agent/services.py,sha256=xi38u5cL1t5doVMnfOLIOb1aux1XCkqBf3yhKzQZBaw,199
|
11
|
+
app/rag/embedding/client.py,sha256=RKNKc1Tt0c_uLfNsd4ZWsBrEYmFEy59Xdromn-gKcg4,2163
|
12
|
+
app/rag/embedding/services.py,sha256=6LbbU5RetvO5DuB2AyLMw0r7Lnsi5u_mEoRusqDZu_E,1007
|
13
|
+
app/rag/llm/client.py,sha256=FdvbSq-_PMjYp3nD9iNzLiWnylFg8Zuc5cPnaPMLO-c,4231
|
14
|
+
app/rag/llm/services.py,sha256=5fQ_KdHpgt5PdHXQO54EnUSeQvyVtteXtRFbPb1Smwg,941
|
15
|
+
app/rag/llm/utilities.py,sha256=xLMxdwetxAetJP23uqygjy0zt_mCot4ToEZDl6zkGrA,1437
|
16
|
+
app/rag/test/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
+
app/rag/train/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
+
app/rag/v1/routers.py,sha256=mE-c-c_vNVN_V7M0-Z8OSGlzWTOa419sfxSV35Qs7DU,133
|
19
|
+
app/rag/v1/services.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
+
app/rag/vector_store/client.py,sha256=aj7xPOIua0c0Z_ZuVJ52NNQtrEpdbzyTxAM7-oNE2qM,2729
|
21
|
+
app/rag/vector_store/services.py,sha256=oslu4Yzubd7MYVhVEHDIV1pBh18VsrbvmW_1_5sMn-8,2705
|
22
|
+
pirag-0.2.2.dist-info/licenses/LICENSE,sha256=gBUmwRyDQYI4Q4Ju5S88urvB-B-nqsXN45n8oQ3DZ3Y,1079
|
23
|
+
pirag-0.2.2.dist-info/METADATA,sha256=VlARBEA9P4ZmyoEjVd2NXjHBTPWO0SuDI9hSZMjTf-o,5635
|
24
|
+
pirag-0.2.2.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
25
|
+
pirag-0.2.2.dist-info/entry_points.txt,sha256=1tHs5rP66AVq5SMEWRRIWRf_XqJo2Gb1TJl9-Kw_MSo,40
|
26
|
+
pirag-0.2.2.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
27
|
+
pirag-0.2.2.dist-info/RECORD,,
|
app/rag/v1/service.py
DELETED
File without changes
|
pirag-0.2.0.dist-info/RECORD
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
app/main.py,sha256=4yUp70bM0mn1AwL00-ttPO-wUn8nUgehRstFGQIytSc,1573
|
2
|
-
app/requirements.txt,sha256=SVy0-4AaepRwHLga-DaO_HiegjR1IUORWbGHMu3GanE,112
|
3
|
-
app/setup.py,sha256=nwUhqn3SLcm6L-WN0saHFisF-K9BpMR3qktszjBJcA4,736
|
4
|
-
app/rag/api.py,sha256=68HuxoYMkViFnr4iZKFLt6Y8fCkntrUXcnL3weSWEfw,1101
|
5
|
-
app/rag/cli.py,sha256=J4IBNOwi1B_qws3HP5OAHV82X1b56zPJcmR1w-Lkem8,822
|
6
|
-
app/rag/config.py,sha256=kHgsy4z8HGXq-zlwTYcgjcvxkly79mb8rTw6DY0zTB8,4369
|
7
|
-
app/rag/utils.py,sha256=svN1mEWf9mGrJ67PTwn8KNP2b6OuE08qkdslK4T11bM,510
|
8
|
-
app/rag/agent/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
app/rag/embedding/client.py,sha256=tu5LgZx1QuadYtViUQkLdFJAC99S2iB01jY0wOO5PCc,2159
|
10
|
-
app/rag/embedding/service.py,sha256=XC5SYIbwp8eTFu3zY5OYKlpELGpeRp-G2OPYmJWsko4,994
|
11
|
-
app/rag/llm/client.py,sha256=pFUsTgsBkPS0m5P0Btv9pgHHR9Os6NxEzM43GQSXwiA,2092
|
12
|
-
app/rag/llm/service.py,sha256=HBEnVyek-dz8pwv8wTHXG8d7oBT1uScMcr7omYVoSv0,928
|
13
|
-
app/rag/test/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
app/rag/train/client.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
app/rag/v1/router.py,sha256=mE-c-c_vNVN_V7M0-Z8OSGlzWTOa419sfxSV35Qs7DU,133
|
16
|
-
app/rag/v1/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
|
-
app/rag/vector_store/client.py,sha256=nFDS3ARTZhojXcFoo6AvCpK_qeTaEYt8WihllPD6ZSM,2613
|
18
|
-
app/rag/vector_store/service.py,sha256=xuamcVIHDgPC8XsbsPTRaE3L7hfLTmM1eS9ZOXLdw9c,1919
|
19
|
-
pirag-0.2.0.dist-info/licenses/LICENSE,sha256=gBUmwRyDQYI4Q4Ju5S88urvB-B-nqsXN45n8oQ3DZ3Y,1079
|
20
|
-
pirag-0.2.0.dist-info/METADATA,sha256=5rnLQ9cQMjNfeDwgxq-WDFoCpnfEiV_hJfYZwmcTBDQ,5563
|
21
|
-
pirag-0.2.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
22
|
-
pirag-0.2.0.dist-info/entry_points.txt,sha256=1tHs5rP66AVq5SMEWRRIWRf_XqJo2Gb1TJl9-Kw_MSo,40
|
23
|
-
pirag-0.2.0.dist-info/top_level.txt,sha256=io9g7LCbfmTG1SFKgEOGXmCFB9uMP2H5lerm0HiHWQE,4
|
24
|
-
pirag-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|