logdetective 0.2.8__py3-none-any.whl → 0.2.9__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/constants.py +20 -3
- logdetective/server.py +17 -7
- {logdetective-0.2.8.dist-info → logdetective-0.2.9.dist-info}/METADATA +1 -1
- {logdetective-0.2.8.dist-info → logdetective-0.2.9.dist-info}/RECORD +7 -7
- {logdetective-0.2.8.dist-info → logdetective-0.2.9.dist-info}/LICENSE +0 -0
- {logdetective-0.2.8.dist-info → logdetective-0.2.9.dist-info}/WHEEL +0 -0
- {logdetective-0.2.8.dist-info → logdetective-0.2.9.dist-info}/entry_points.txt +0 -0
logdetective/constants.py
CHANGED
|
@@ -32,9 +32,7 @@ Answer:
|
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
SNIPPET_PROMPT_TEMPLATE = """
|
|
35
|
-
Analyse following RPM build log snippet.
|
|
36
|
-
Analysis of the snippets must be in a format of [X] : [Y], where [X] is a log snippet, and [Y] is the explanation.
|
|
37
|
-
Snippets themselves must not be altered in any way whatsoever.
|
|
35
|
+
Analyse following RPM build log snippet. Decribe contents accurately, without speculation or suggestions for resolution.
|
|
38
36
|
|
|
39
37
|
Snippet:
|
|
40
38
|
|
|
@@ -43,3 +41,22 @@ Snippet:
|
|
|
43
41
|
Analysis:
|
|
44
42
|
|
|
45
43
|
"""
|
|
44
|
+
|
|
45
|
+
PROMPT_TEMPLATE_STAGED = """
|
|
46
|
+
Given following log snippets, their explanation, and nothing else, explain what failure, if any, occured during build of this package.
|
|
47
|
+
|
|
48
|
+
Snippets are in a format of [X] : [Y], where [X] is a log snippet, and [Y] is the explanation.
|
|
49
|
+
|
|
50
|
+
Snippets are delimited with '================'.
|
|
51
|
+
|
|
52
|
+
Drawing on information from all snippets, provide complete explanation of the issue and recommend solution.
|
|
53
|
+
|
|
54
|
+
Snippets:
|
|
55
|
+
|
|
56
|
+
{}
|
|
57
|
+
|
|
58
|
+
Analysis:
|
|
59
|
+
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
SNIPPET_DELIMITER = '================'
|
logdetective/server.py
CHANGED
|
@@ -2,7 +2,7 @@ import asyncio
|
|
|
2
2
|
import json
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
|
-
from typing import List, Annotated
|
|
5
|
+
from typing import List, Annotated, Dict
|
|
6
6
|
|
|
7
7
|
from llama_cpp import CreateCompletionResponse
|
|
8
8
|
from fastapi import FastAPI, HTTPException, Depends, Header
|
|
@@ -10,7 +10,9 @@ from fastapi.responses import StreamingResponse
|
|
|
10
10
|
from pydantic import BaseModel
|
|
11
11
|
import requests
|
|
12
12
|
|
|
13
|
-
from logdetective.constants import
|
|
13
|
+
from logdetective.constants import (
|
|
14
|
+
PROMPT_TEMPLATE, SNIPPET_PROMPT_TEMPLATE,
|
|
15
|
+
PROMPT_TEMPLATE_STAGED, SNIPPET_DELIMITER)
|
|
14
16
|
from logdetective.extractors import DrainExtractor
|
|
15
17
|
from logdetective.utils import validate_url, compute_certainty
|
|
16
18
|
|
|
@@ -38,10 +40,10 @@ class StagedResponse(Response):
|
|
|
38
40
|
explanation: CreateCompletionResponse
|
|
39
41
|
https://llama-cpp-python.readthedocs.io/en/latest/api-reference/#llama_cpp.llama_types.CreateCompletionResponse
|
|
40
42
|
response_certainty: float
|
|
41
|
-
snippets:
|
|
43
|
+
snippets:
|
|
44
|
+
list of dictionaries { 'snippet' : '<original_text>, 'comment': CreateCompletionResponse }
|
|
42
45
|
"""
|
|
43
|
-
snippets: List[CreateCompletionResponse]
|
|
44
|
-
|
|
46
|
+
snippets: List[Dict[str, str | CreateCompletionResponse]]
|
|
45
47
|
|
|
46
48
|
LOG = logging.getLogger("logdetective")
|
|
47
49
|
|
|
@@ -208,10 +210,18 @@ async def analyze_log_staged(build_log: BuildLog):
|
|
|
208
210
|
analyzed_snippets = await asyncio.gather(
|
|
209
211
|
*[submit_text(SNIPPET_PROMPT_TEMPLATE.format(s)) for s in log_summary])
|
|
210
212
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
+
analyzed_snippets = [
|
|
214
|
+
{"snippet":e[0], "comment":e[1]} for e in zip(log_summary, analyzed_snippets)]
|
|
215
|
+
|
|
216
|
+
final_prompt = PROMPT_TEMPLATE_STAGED.format(
|
|
217
|
+
f"\n{SNIPPET_DELIMITER}\n".join([
|
|
218
|
+
f"[{e["snippet"]}] : [{e["comment"]["choices"][0]["text"]}]"
|
|
219
|
+
for e in analyzed_snippets]))
|
|
220
|
+
|
|
221
|
+
final_analysis = await submit_text(final_prompt)
|
|
213
222
|
|
|
214
223
|
certainty = 0
|
|
224
|
+
|
|
215
225
|
if "logprobs" in final_analysis["choices"][0]:
|
|
216
226
|
try:
|
|
217
227
|
certainty = compute_certainty(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
logdetective/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
logdetective/constants.py,sha256=
|
|
2
|
+
logdetective/constants.py,sha256=6XekuU7sbkY1Pmu4NJajgFbJ0no8PQ3DxQm8NeLKtjE,1383
|
|
3
3
|
logdetective/drain3.ini,sha256=ni91eCT1TwTznZwcqWoOVMQcGEnWhEDNCoTPF7cfGfY,1360
|
|
4
4
|
logdetective/extractors.py,sha256=eRizRiKhC3MPTHXS5nlRKcEudEaqct7G28V1bZYGkqI,3103
|
|
5
5
|
logdetective/logdetective.py,sha256=f7ASCJg_Yt6VBFieXBYgQYdenfXjC60ZdLHhzQHideI,4372
|
|
6
|
-
logdetective/server.py,sha256=
|
|
6
|
+
logdetective/server.py,sha256=DGW5Lk4u7zwmIk0ZeZj1w37zjvHEDSv1KEibc-yTwzY,9614
|
|
7
7
|
logdetective/utils.py,sha256=nTbaDVEfbHVQPTZe58T04HHZ6JWUJ1PonRRnzGX8hY0,4794
|
|
8
|
-
logdetective-0.2.
|
|
9
|
-
logdetective-0.2.
|
|
10
|
-
logdetective-0.2.
|
|
11
|
-
logdetective-0.2.
|
|
12
|
-
logdetective-0.2.
|
|
8
|
+
logdetective-0.2.9.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
9
|
+
logdetective-0.2.9.dist-info/METADATA,sha256=seYd175pEZg4VhJkQBMo0_M_Kt0VAy0Y-8d7_UblnSQ,9797
|
|
10
|
+
logdetective-0.2.9.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
11
|
+
logdetective-0.2.9.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
|
|
12
|
+
logdetective-0.2.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|