logdetective 0.11.1__py3-none-any.whl → 0.11.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.
- logdetective/server/llm.py +5 -2
- {logdetective-0.11.1.dist-info → logdetective-0.11.2.dist-info}/METADATA +15 -7
- {logdetective-0.11.1.dist-info → logdetective-0.11.2.dist-info}/RECORD +6 -6
- {logdetective-0.11.1.dist-info → logdetective-0.11.2.dist-info}/LICENSE +0 -0
- {logdetective-0.11.1.dist-info → logdetective-0.11.2.dist-info}/WHEEL +0 -0
- {logdetective-0.11.1.dist-info → logdetective-0.11.2.dist-info}/entry_points.txt +0 -0
logdetective/server/llm.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import asyncio
|
|
3
3
|
import json
|
|
4
|
+
import random
|
|
4
5
|
from typing import List, Tuple, Dict, Any, Union
|
|
5
6
|
|
|
6
7
|
import backoff
|
|
@@ -102,7 +103,7 @@ def should_we_giveup(exc: aiohttp.ClientResponseError) -> bool:
|
|
|
102
103
|
> a truthy value if the exception should not be retried
|
|
103
104
|
"""
|
|
104
105
|
LOG.info("Should we give up on retrying error %s", exc)
|
|
105
|
-
return exc.status <
|
|
106
|
+
return exc.status < 400
|
|
106
107
|
|
|
107
108
|
|
|
108
109
|
def we_give_up(details: backoff._typing.Details):
|
|
@@ -110,6 +111,7 @@ def we_give_up(details: backoff._typing.Details):
|
|
|
110
111
|
retries didn't work (or we got a different exc)
|
|
111
112
|
we give up and raise proper 500 for our API endpoint
|
|
112
113
|
"""
|
|
114
|
+
LOG.error("Last exception: %s", details["exception"])
|
|
113
115
|
LOG.error("Inference error: %s", details["args"])
|
|
114
116
|
raise HTTPException(500, "Request to the inference API failed")
|
|
115
117
|
|
|
@@ -117,7 +119,8 @@ def we_give_up(details: backoff._typing.Details):
|
|
|
117
119
|
@backoff.on_exception(
|
|
118
120
|
lambda: backoff.constant([10, 30, 120]),
|
|
119
121
|
aiohttp.ClientResponseError,
|
|
120
|
-
max_tries=3
|
|
122
|
+
max_tries=4, # 4 tries and 3 retries
|
|
123
|
+
jitter=lambda wait_gen_value: random.uniform(wait_gen_value, wait_gen_value + 30),
|
|
121
124
|
giveup=should_we_giveup,
|
|
122
125
|
raise_on_giveup=False,
|
|
123
126
|
on_giveup=we_give_up,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: logdetective
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.2
|
|
4
4
|
Summary: Log using LLM AI to search for build/test failures and provide ideas for fixing these.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Jiri Podivin
|
|
@@ -48,14 +48,16 @@ Log Detective
|
|
|
48
48
|
|
|
49
49
|
[PyPI Releases]: https://pypi.org/project/logdetective/#history
|
|
50
50
|
|
|
51
|
-
A
|
|
51
|
+
A tool, service and RHEL process integration to analyze logs using a Large Language Model (LLM) and a [Drain template miner](https://github.com/logpai/Drain3).
|
|
52
|
+
|
|
53
|
+
The service that explains logs is available here: https://logdetective.com/explain
|
|
52
54
|
|
|
53
55
|
Note: if you are looking for code of website logdetective.com it is in [github.com/fedora-copr/logdetective-website](https://github.com/fedora-copr/logdetective-website).
|
|
54
56
|
|
|
55
57
|
Installation
|
|
56
58
|
------------
|
|
57
59
|
|
|
58
|
-
**Fedora
|
|
60
|
+
**Fedora 41+**
|
|
59
61
|
|
|
60
62
|
dnf install logdetective
|
|
61
63
|
|
|
@@ -70,11 +72,12 @@ First, ensure that the necessary dependencies for the `llama-cpp-python` project
|
|
|
70
72
|
|
|
71
73
|
Then, install the `logdetective` project using pip:
|
|
72
74
|
|
|
73
|
-
# then install logdetective project
|
|
74
75
|
pip install logdetective
|
|
75
76
|
|
|
76
77
|
**Local repository install**
|
|
77
78
|
|
|
79
|
+
Clone this repository and install with pip:
|
|
80
|
+
|
|
78
81
|
pip install .
|
|
79
82
|
|
|
80
83
|
Usage
|
|
@@ -111,14 +114,14 @@ Example of altered prompts:
|
|
|
111
114
|
logdetective https://kojipkgs.fedoraproject.org//work/tasks/3367/131313367/build.log --prompts ~/my-prompts.yml
|
|
112
115
|
|
|
113
116
|
|
|
114
|
-
Note that streaming with some models (notably Meta-Llama-3 is broken) is broken and can be
|
|
117
|
+
Note that streaming with some models (notably Meta-Llama-3 is broken) is broken and can be worked around by `no-stream` option:
|
|
115
118
|
|
|
116
119
|
logdetective https://example.com/logs.txt --model QuantFactory/Meta-Llama-3-8B-Instruct-GGUF --no-stream
|
|
117
120
|
|
|
118
121
|
|
|
119
122
|
Real Example
|
|
120
123
|
------------
|
|
121
|
-
Let's have a look at a real world example. Log Detective can work with any logs though we optimize it for build logs.
|
|
124
|
+
Let's have a look at a real world example. Log Detective can work with any logs though we optimize it for RPM build logs.
|
|
122
125
|
|
|
123
126
|
We're going to analyze a failed build of a python-based library that happened in Fedora Koji buildsystem:
|
|
124
127
|
```
|
|
@@ -184,8 +187,13 @@ Contributing
|
|
|
184
187
|
------------
|
|
185
188
|
|
|
186
189
|
Contributions are welcome! Please submit a pull request if you have any improvements or new features to add. Make sure your changes pass all existing tests before submitting.
|
|
190
|
+
For bigger code changes, please consult us first by creating an issue.
|
|
191
|
+
|
|
192
|
+
We are always looking for more annotated snippets that will increase the quality of Log Detective's results. The contributions happen in our website: https://logdetective.com/
|
|
193
|
+
|
|
194
|
+
Log Detective performs several inference queries while evaluating a log file. Prompts are stored in a separate file (more info below: https://github.com/fedora-copr/logdetective?tab=readme-ov-file#system-prompts). If you have an idea for improvements to our prompts, please open a PR and we'd happy to test it out.
|
|
187
195
|
|
|
188
|
-
To develop
|
|
196
|
+
To develop Log Detective, you should fork this repository, clone your fork, and install dependencies using pip:
|
|
189
197
|
|
|
190
198
|
git clone https://github.com/yourusername/logdetective.git
|
|
191
199
|
cd logdetective
|
|
@@ -16,7 +16,7 @@ logdetective/server/database/models/merge_request_jobs.py,sha256=hw88wV1-3x7i53s
|
|
|
16
16
|
logdetective/server/database/models/metrics.py,sha256=yl9fS4IPVFWDeFvPAxO6zOVu6oLF319ApvVLAgnD5yU,13928
|
|
17
17
|
logdetective/server/emoji.py,sha256=g9GtMChwznD8g1xonsh-I_3xqRn6LBeg3sjPJWcI0Yg,3333
|
|
18
18
|
logdetective/server/gitlab.py,sha256=fpJp28YsvHvm4DjrvzrgamLk31Fo5UyvT6GNWway9KM,15227
|
|
19
|
-
logdetective/server/llm.py,sha256=
|
|
19
|
+
logdetective/server/llm.py,sha256=JtSCZj8SLnoyTCUdhA0TwcsMZfmHFFru2bJ9txI3GuU,8727
|
|
20
20
|
logdetective/server/metric.py,sha256=B3ew_qSmtEMj6xl-FoOtS4F_bkplp-shhtfHF1cG_Io,4010
|
|
21
21
|
logdetective/server/models.py,sha256=eNEB3WJWeZ9Pe6qsmTKQwAE8wu8u51OwLILzV9__YJM,11248
|
|
22
22
|
logdetective/server/plot.py,sha256=eZs4r9gua-nW3yymSMIz1leL9mb4QKlh6FJZSeOfZ5M,14872
|
|
@@ -24,8 +24,8 @@ logdetective/server/server.py,sha256=9shFgRkWcJVM2L7HHoQBMCfKuJamh2L4tC96duFPEOA
|
|
|
24
24
|
logdetective/server/templates/gitlab_full_comment.md.j2,sha256=DQZ2WVFedpuXI6znbHIW4wpF9BmFS8FaUkowh8AnGhE,1627
|
|
25
25
|
logdetective/server/templates/gitlab_short_comment.md.j2,sha256=fzScpayv2vpRLczP_0O0YxtA8rsKvR6gSv4ntNdWb98,1443
|
|
26
26
|
logdetective/utils.py,sha256=hdExAC8FtDIxvdgIq-Ro6LVM-JZ-k_UofaMzaDAHvzM,6088
|
|
27
|
-
logdetective-0.11.
|
|
28
|
-
logdetective-0.11.
|
|
29
|
-
logdetective-0.11.
|
|
30
|
-
logdetective-0.11.
|
|
31
|
-
logdetective-0.11.
|
|
27
|
+
logdetective-0.11.2.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
28
|
+
logdetective-0.11.2.dist-info/METADATA,sha256=BVRCWRVzlm-Aa0b51d0ZCbKz2ty1htTzHzX9XGiXALI,17137
|
|
29
|
+
logdetective-0.11.2.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
30
|
+
logdetective-0.11.2.dist-info/entry_points.txt,sha256=3K_vXja6PmcA8sNdUi63WdImeiNhVZcEGPTaoJmltfA,63
|
|
31
|
+
logdetective-0.11.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|