logdetective 0.5.9__py3-none-any.whl → 0.5.10__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.
- logdetective/logdetective.py +5 -1
- logdetective/prompts.yml +5 -0
- logdetective/server/server.py +5 -2
- logdetective/server/utils.py +13 -1
- logdetective/utils.py +0 -13
- {logdetective-0.5.9.dist-info → logdetective-0.5.10.dist-info}/METADATA +1 -1
- {logdetective-0.5.9.dist-info → logdetective-0.5.10.dist-info}/RECORD +10 -10
- {logdetective-0.5.9.dist-info → logdetective-0.5.10.dist-info}/LICENSE +0 -0
- {logdetective-0.5.9.dist-info → logdetective-0.5.10.dist-info}/WHEEL +0 -0
- {logdetective-0.5.9.dist-info → logdetective-0.5.10.dist-info}/entry_points.txt +0 -0
logdetective/logdetective.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import logging
|
|
3
3
|
import sys
|
|
4
|
+
import os
|
|
4
5
|
|
|
5
6
|
from logdetective.constants import DEFAULT_ADVISOR
|
|
6
7
|
from logdetective.utils import (
|
|
@@ -67,7 +68,10 @@ def setup_args():
|
|
|
67
68
|
parser.add_argument("-v", "--verbose", action="count", default=0)
|
|
68
69
|
parser.add_argument("-q", "--quiet", action="store_true")
|
|
69
70
|
parser.add_argument(
|
|
70
|
-
"--prompts",
|
|
71
|
+
"--prompts",
|
|
72
|
+
type=str,
|
|
73
|
+
default=f"{os.path.dirname(__file__)}/prompts.yml",
|
|
74
|
+
help="Path to prompt configuration file."
|
|
71
75
|
)
|
|
72
76
|
return parser.parse_args()
|
|
73
77
|
|
logdetective/prompts.yml
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
# This file is intended for customization of prompts
|
|
2
|
+
# It is used only in server mode.
|
|
3
|
+
# On command line you have to load it using --prompts
|
|
4
|
+
# The defaults are stored in constants.py
|
|
5
|
+
|
|
1
6
|
prompt_template: |
|
|
2
7
|
Given following log snippets, and nothing else, explain what failure, if any, occured during build of this package.
|
|
3
8
|
|
logdetective/server/server.py
CHANGED
|
@@ -26,10 +26,13 @@ from logdetective.utils import (
|
|
|
26
26
|
validate_url,
|
|
27
27
|
compute_certainty,
|
|
28
28
|
format_snippets,
|
|
29
|
-
format_analyzed_snippets,
|
|
30
29
|
load_prompts,
|
|
31
30
|
)
|
|
32
|
-
from logdetective.server.utils import
|
|
31
|
+
from logdetective.server.utils import (
|
|
32
|
+
load_server_config,
|
|
33
|
+
get_log,
|
|
34
|
+
format_analyzed_snippets,
|
|
35
|
+
)
|
|
33
36
|
from logdetective.server.metric import track_request
|
|
34
37
|
from logdetective.server.models import (
|
|
35
38
|
BuildLog,
|
logdetective/server/utils.py
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import yaml
|
|
3
|
-
from logdetective.
|
|
3
|
+
from logdetective.constants import SNIPPET_DELIMITER
|
|
4
|
+
from logdetective.server.models import Config, AnalyzedSnippet
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def format_analyzed_snippets(snippets: list[AnalyzedSnippet]) -> str:
|
|
8
|
+
"""Format snippets for submission into staged prompt."""
|
|
9
|
+
summary = f"\n{SNIPPET_DELIMITER}\n".join(
|
|
10
|
+
[
|
|
11
|
+
f"[{e.text}] at line [{e.line_number}]: [{e.explanation.text}]"
|
|
12
|
+
for e in snippets
|
|
13
|
+
]
|
|
14
|
+
)
|
|
15
|
+
return summary
|
|
4
16
|
|
|
5
17
|
|
|
6
18
|
def load_server_config(path: str | None) -> Config:
|
logdetective/utils.py
CHANGED
|
@@ -7,8 +7,6 @@ import requests
|
|
|
7
7
|
import yaml
|
|
8
8
|
|
|
9
9
|
from llama_cpp import Llama, CreateCompletionResponse, CreateCompletionStreamResponse
|
|
10
|
-
from logdetective.constants import SNIPPET_DELIMITER
|
|
11
|
-
from logdetective.server.models import AnalyzedSnippet
|
|
12
10
|
from logdetective.models import PromptConfig
|
|
13
11
|
|
|
14
12
|
|
|
@@ -178,17 +176,6 @@ def format_snippets(snippets: list[str] | list[Tuple[int, str]]) -> str:
|
|
|
178
176
|
return summary
|
|
179
177
|
|
|
180
178
|
|
|
181
|
-
def format_analyzed_snippets(snippets: list[AnalyzedSnippet]) -> str:
|
|
182
|
-
"""Format snippets for submission into staged prompt."""
|
|
183
|
-
summary = f"\n{SNIPPET_DELIMITER}\n".join(
|
|
184
|
-
[
|
|
185
|
-
f"[{e.text}] at line [{e.line_number}]: [{e.explanation.text}]"
|
|
186
|
-
for e in snippets
|
|
187
|
-
]
|
|
188
|
-
)
|
|
189
|
-
return summary
|
|
190
|
-
|
|
191
|
-
|
|
192
179
|
def validate_url(url: str) -> bool:
|
|
193
180
|
"""Validate incoming URL to be at least somewhat sensible for log files
|
|
194
181
|
Only http and https protocols permitted. No result, params or query fields allowed.
|
|
@@ -2,9 +2,9 @@ logdetective/__init__.py,sha256=VqRngDcuFT7JWms8Qc_MsOvajoXVOKPr-S1kqY3Pqhc,59
|
|
|
2
2
|
logdetective/constants.py,sha256=eiS6eYhEgl_Rlyi_B9j00DDp9A-UDhuFz3ACWtKf_SU,1558
|
|
3
3
|
logdetective/drain3.ini,sha256=ni91eCT1TwTznZwcqWoOVMQcGEnWhEDNCoTPF7cfGfY,1360
|
|
4
4
|
logdetective/extractors.py,sha256=7ahzWbTtU9MveG1Q7wU9LO8OJgs85X-cHmWltUhCe9M,3491
|
|
5
|
-
logdetective/logdetective.py,sha256=
|
|
5
|
+
logdetective/logdetective.py,sha256=SDuzeS9sMp7rs6cTZAEd0ajtyWv9XnDkEPTF82nwaYo,5390
|
|
6
6
|
logdetective/models.py,sha256=nrGBmMRu8i6UhFflQKAp81Y3Sd_Aaoor0i_yqSJoLT0,1115
|
|
7
|
-
logdetective/prompts.yml,sha256=
|
|
7
|
+
logdetective/prompts.yml,sha256=3orDNqqZNadWCaNncgfk8D3Pqqef4IzfScoa_jUJzCY,1452
|
|
8
8
|
logdetective/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
logdetective/server/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
logdetective/server/database/base.py,sha256=oMJUvbWeapIUP-8Cf_DR9ptFg8CsYeaBAIjOVEzx8SM,1668
|
|
@@ -12,12 +12,12 @@ logdetective/server/database/models.py,sha256=arIahOCT-hTmh904DXrWSkH7rlo13Ppu-O
|
|
|
12
12
|
logdetective/server/metric.py,sha256=VYMifrfIhcqgyu6YYN0c1nt8fC1iJ2_LCB7Bh2AheoE,2679
|
|
13
13
|
logdetective/server/models.py,sha256=cf1ngu_-19rP_i49s5cEwIzh6SfL_ZpVy4EykCpfWck,8076
|
|
14
14
|
logdetective/server/plot.py,sha256=3o-CNHjel04ekpwSB4ckV7dbiF663cfPkimQ0aP9U_8,7073
|
|
15
|
-
logdetective/server/server.py,sha256=
|
|
15
|
+
logdetective/server/server.py,sha256=FDKx-6wsVoEwdEgcoepAT3GL0gZKjMSpB1VU-jaKt2w,24618
|
|
16
16
|
logdetective/server/templates/gitlab_comment.md.j2,sha256=kheTkhQ-LfuFkr8av-Mw2a-9VYEUbDTLwaa-CKI6OkI,1622
|
|
17
|
-
logdetective/server/utils.py,sha256=
|
|
18
|
-
logdetective/utils.py,sha256=
|
|
19
|
-
logdetective-0.5.
|
|
20
|
-
logdetective-0.5.
|
|
21
|
-
logdetective-0.5.
|
|
22
|
-
logdetective-0.5.
|
|
23
|
-
logdetective-0.5.
|
|
17
|
+
logdetective/server/utils.py,sha256=6y4gZCwQG4HcjWJwYdzwP46Jsm3xoNXZWH4kYmSWVZA,1741
|
|
18
|
+
logdetective/utils.py,sha256=_cBBkBwZHX5qxy0K5WK2MnHA4x_oor7R-QED2VZLbCA,6226
|
|
19
|
+
logdetective-0.5.10.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
20
|
+
logdetective-0.5.10.dist-info/METADATA,sha256=NbD3YEoEU-YAhH-VjOo95qWxyk1T1bq5wCih4N5oyqs,14738
|
|
21
|
+
logdetective-0.5.10.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
22
|
+
logdetective-0.5.10.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
|
|
23
|
+
logdetective-0.5.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|