janus-llm 4.3.5__py3-none-any.whl → 4.4.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.
- janus/__init__.py +1 -1
- janus/cli/aggregate.py +2 -2
- janus/cli/cli.py +6 -0
- janus/cli/constants.py +6 -0
- janus/cli/diagram.py +36 -7
- janus/cli/document.py +10 -1
- janus/cli/llm.py +7 -3
- janus/cli/partition.py +10 -1
- janus/cli/pipeline.py +123 -0
- janus/cli/self_eval.py +1 -3
- janus/cli/translate.py +10 -1
- janus/converter/_tests/test_translate.py +5 -5
- janus/converter/chain.py +180 -0
- janus/converter/converter.py +333 -78
- janus/converter/diagram.py +8 -6
- janus/converter/document.py +7 -3
- janus/converter/evaluate.py +140 -148
- janus/converter/partition.py +2 -10
- janus/converter/requirements.py +4 -40
- janus/converter/translate.py +2 -58
- janus/language/block.py +31 -2
- janus/metrics/metric.py +47 -124
- janus/parsers/reqs_parser.py +3 -3
- {janus_llm-4.3.5.dist-info → janus_llm-4.4.5.dist-info}/METADATA +12 -12
- {janus_llm-4.3.5.dist-info → janus_llm-4.4.5.dist-info}/RECORD +28 -28
- janus/metrics/_tests/test_llm.py +0 -90
- janus/metrics/llm_metrics.py +0 -202
- {janus_llm-4.3.5.dist-info → janus_llm-4.4.5.dist-info}/LICENSE +0 -0
- {janus_llm-4.3.5.dist-info → janus_llm-4.4.5.dist-info}/WHEEL +0 -0
- {janus_llm-4.3.5.dist-info → janus_llm-4.4.5.dist-info}/entry_points.txt +0 -0
janus/metrics/metric.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
import inspect
|
2
2
|
import json
|
3
|
-
from pathlib import Path
|
4
3
|
from typing import Callable, Optional
|
5
4
|
|
6
5
|
import click
|
7
6
|
import typer
|
8
7
|
from typing_extensions import Annotated
|
9
8
|
|
9
|
+
from janus.cli.constants import CONVERTERS
|
10
|
+
from janus.converter.converter import Converter
|
10
11
|
from janus.llm import load_model
|
11
12
|
from janus.llm.model_callbacks import COST_PER_1K_TOKENS
|
12
13
|
from janus.metrics.cli import evaluate
|
@@ -70,31 +71,6 @@ def metric(
|
|
70
71
|
help="Reference file or string to use as reference/baseline.",
|
71
72
|
),
|
72
73
|
] = None,
|
73
|
-
json_file_name: Annotated[
|
74
|
-
Optional[str],
|
75
|
-
typer.Option(
|
76
|
-
"--json",
|
77
|
-
"-j",
|
78
|
-
help="Json file to extract pairs from \
|
79
|
-
(if set ignores --target and --reference)",
|
80
|
-
),
|
81
|
-
] = None,
|
82
|
-
target_key: Annotated[
|
83
|
-
str,
|
84
|
-
typer.Option(
|
85
|
-
"--target-key",
|
86
|
-
"-tk",
|
87
|
-
help="json key to extract list of target strings",
|
88
|
-
),
|
89
|
-
] = "target",
|
90
|
-
reference_key: Annotated[
|
91
|
-
str,
|
92
|
-
typer.Option(
|
93
|
-
"--reference-key",
|
94
|
-
"-rk",
|
95
|
-
help="json key to extract list of reference strings",
|
96
|
-
),
|
97
|
-
] = "reference",
|
98
74
|
file_pairing_method: Annotated[
|
99
75
|
str,
|
100
76
|
typer.Option(
|
@@ -123,6 +99,14 @@ def metric(
|
|
123
99
|
is_flag=True,
|
124
100
|
),
|
125
101
|
] = False,
|
102
|
+
use_janus_inputs: Annotated[
|
103
|
+
bool,
|
104
|
+
typer.Option(
|
105
|
+
"-j",
|
106
|
+
"--use-janus-inputs",
|
107
|
+
help="present if janus output files should be evaluated",
|
108
|
+
),
|
109
|
+
] = False,
|
126
110
|
use_strings: Annotated[
|
127
111
|
bool,
|
128
112
|
typer.Option(
|
@@ -137,25 +121,23 @@ def metric(
|
|
137
121
|
):
|
138
122
|
out = []
|
139
123
|
llm = load_model(llm_name)
|
140
|
-
if
|
141
|
-
with open(
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
pairs[model_key][k] = (model_dict[target_key][k], ref[k])
|
158
|
-
elif target is not None and reference is not None:
|
124
|
+
if use_janus_inputs:
|
125
|
+
with open(target, "r") as f:
|
126
|
+
target_obj = json.load(f)
|
127
|
+
with open(reference, "r") as f:
|
128
|
+
reference_obj = json.load(f)
|
129
|
+
converter_cls = CONVERTERS.get(
|
130
|
+
target_obj["metadata"].get("converter_name", "Converter"),
|
131
|
+
Converter,
|
132
|
+
)
|
133
|
+
out = converter_cls.eval_obj_reference(
|
134
|
+
target=target_obj,
|
135
|
+
reference=reference_obj,
|
136
|
+
metric_func=function,
|
137
|
+
*args,
|
138
|
+
**kwargs,
|
139
|
+
)
|
140
|
+
else:
|
159
141
|
if use_strings:
|
160
142
|
target_contents = target
|
161
143
|
reference_contents = reference
|
@@ -175,25 +157,6 @@ def metric(
|
|
175
157
|
token_limit=llm.token_limit,
|
176
158
|
model_cost=COST_PER_1K_TOKENS[llm.model_id],
|
177
159
|
)
|
178
|
-
else:
|
179
|
-
raise ValueError(
|
180
|
-
"Error, specify json or target and reference files/strings"
|
181
|
-
)
|
182
|
-
if isinstance(pairs, dict):
|
183
|
-
out = {}
|
184
|
-
for k in pairs:
|
185
|
-
out[k] = apply_function_pairs(
|
186
|
-
pairs[k],
|
187
|
-
function,
|
188
|
-
progress,
|
189
|
-
language,
|
190
|
-
llm,
|
191
|
-
llm.token_limit,
|
192
|
-
COST_PER_1K_TOKENS[llm.model_id],
|
193
|
-
*args,
|
194
|
-
**kwargs,
|
195
|
-
)
|
196
|
-
else:
|
197
160
|
out = apply_function_pairs(
|
198
161
|
pairs,
|
199
162
|
function,
|
@@ -205,17 +168,15 @@ def metric(
|
|
205
168
|
*args,
|
206
169
|
**kwargs,
|
207
170
|
)
|
208
|
-
out_file = Path(out_file)
|
209
|
-
out_file.parent.mkdir(parents=True, exist_ok=True)
|
210
171
|
with open(out_file, "w") as f:
|
172
|
+
log.info(f"Writing output to {out_file}")
|
211
173
|
json.dump(out, f)
|
212
|
-
log.info(f"Saved results to file: {out_file}")
|
213
174
|
|
214
175
|
sig1 = inspect.signature(function)
|
215
176
|
sig2 = inspect.signature(func)
|
216
177
|
func.__signature__ = sig2.replace(
|
217
178
|
parameters=tuple(
|
218
|
-
list(sig2.parameters.values())[:
|
179
|
+
list(sig2.parameters.values())[:9]
|
219
180
|
+ list(sig1.parameters.values())[2:-1]
|
220
181
|
)
|
221
182
|
)
|
@@ -241,23 +202,14 @@ def metric(
|
|
241
202
|
"--target", "-t", help="Target file or string to evaluate."
|
242
203
|
),
|
243
204
|
] = None,
|
244
|
-
|
245
|
-
|
205
|
+
use_janus_inputs: Annotated[
|
206
|
+
bool,
|
246
207
|
typer.Option(
|
247
|
-
"--json",
|
248
208
|
"-j",
|
249
|
-
|
250
|
-
|
209
|
+
"--use-janus-inputs",
|
210
|
+
help="whether to use a janus output file as input",
|
251
211
|
),
|
252
|
-
] =
|
253
|
-
target_key: Annotated[
|
254
|
-
str,
|
255
|
-
typer.Option(
|
256
|
-
"--target-key",
|
257
|
-
"-tk",
|
258
|
-
help="json key to extract list of target strings",
|
259
|
-
),
|
260
|
-
] = "target",
|
212
|
+
] = False,
|
261
213
|
splitting_method: Annotated[
|
262
214
|
str,
|
263
215
|
typer.Option(
|
@@ -298,25 +250,17 @@ def metric(
|
|
298
250
|
**kwargs,
|
299
251
|
):
|
300
252
|
llm = load_model(llm_name)
|
301
|
-
if
|
302
|
-
with open(
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
if target_key not in model_dict:
|
313
|
-
continue
|
314
|
-
if model_key not in strings:
|
315
|
-
strings[model_key] = {}
|
316
|
-
for k in model_dict[target_key]:
|
317
|
-
strings[model_key][k] = model_dict[target_key][k]
|
318
|
-
# strings += list(json_obj[key][target_key].values())
|
319
|
-
elif target is not None:
|
253
|
+
if use_janus_inputs:
|
254
|
+
with open(target, "r") as f:
|
255
|
+
target_obj = json.load(f)
|
256
|
+
converter_cls = CONVERTERS.get(
|
257
|
+
target_obj["metadata"].get("converter_name", "Converter"),
|
258
|
+
Converter,
|
259
|
+
)
|
260
|
+
out = converter_cls.eval_obj(
|
261
|
+
target=target_obj, metric_func=function, *args, **kwargs
|
262
|
+
)
|
263
|
+
else:
|
320
264
|
if use_strings:
|
321
265
|
target_contents = target
|
322
266
|
else:
|
@@ -332,25 +276,6 @@ def metric(
|
|
332
276
|
token_limit=llm.token_limit,
|
333
277
|
model_cost=COST_PER_1K_TOKENS[llm.model_id],
|
334
278
|
)
|
335
|
-
else:
|
336
|
-
raise ValueError(
|
337
|
-
"Error: must specify either json file or target file/string"
|
338
|
-
)
|
339
|
-
if isinstance(strings, dict):
|
340
|
-
out = {}
|
341
|
-
for k in strings:
|
342
|
-
out[k] = apply_function_strings(
|
343
|
-
strings[k],
|
344
|
-
function,
|
345
|
-
progress,
|
346
|
-
language,
|
347
|
-
llm,
|
348
|
-
llm.token_limit,
|
349
|
-
COST_PER_1K_TOKENS[llm.model_id],
|
350
|
-
*args,
|
351
|
-
**kwargs,
|
352
|
-
)
|
353
|
-
else:
|
354
279
|
out = apply_function_strings(
|
355
280
|
strings,
|
356
281
|
function,
|
@@ -362,17 +287,15 @@ def metric(
|
|
362
287
|
*args,
|
363
288
|
**kwargs,
|
364
289
|
)
|
365
|
-
out_file = Path(out_file)
|
366
|
-
out_file.parent.mkdir(parents=True, exist_ok=True)
|
367
290
|
with open(out_file, "w") as f:
|
291
|
+
log.info(f"Writing output to {out_file}")
|
368
292
|
json.dump(out, f)
|
369
|
-
log.info(f"Saved results to file: {out_file}")
|
370
293
|
|
371
294
|
sig1 = inspect.signature(function)
|
372
295
|
sig2 = inspect.signature(func)
|
373
296
|
func.__signature__ = sig2.replace(
|
374
297
|
parameters=tuple(
|
375
|
-
list(sig2.parameters.values())[:
|
298
|
+
list(sig2.parameters.values())[:7]
|
376
299
|
+ list(sig1.parameters.values())[1:-1]
|
377
300
|
)
|
378
301
|
)
|
janus/parsers/reqs_parser.py
CHANGED
@@ -41,7 +41,7 @@ class RequirementsParser(JanusParser):
|
|
41
41
|
)
|
42
42
|
return json.dumps(obj)
|
43
43
|
|
44
|
-
def parse_combined_output(self, text: str):
|
44
|
+
def parse_combined_output(self, text: str) -> str:
|
45
45
|
"""Parse the output text from the LLM when multiple inputs are combined.
|
46
46
|
|
47
47
|
Arguments:
|
@@ -52,10 +52,10 @@ class RequirementsParser(JanusParser):
|
|
52
52
|
"""
|
53
53
|
json_strings = re.findall(r"\{.*?\}", text)
|
54
54
|
output_list = list()
|
55
|
-
for
|
55
|
+
for _, json_string in enumerate(json_strings, 1):
|
56
56
|
json_dict = json.loads(json_string)
|
57
57
|
output_list.append(json_dict["requirements"])
|
58
|
-
return output_list
|
58
|
+
return json.dumps(output_list)
|
59
59
|
|
60
60
|
def get_format_instructions(self) -> str:
|
61
61
|
"""Get the format instructions for the parser.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: janus-llm
|
3
|
-
Version: 4.
|
3
|
+
Version: 4.4.5
|
4
4
|
Summary: A transcoding library using LLMs.
|
5
5
|
License: Apache 2.0
|
6
6
|
Author: Michael Doyle
|
@@ -53,7 +53,7 @@ Description-Content-Type: text/markdown
|
|
53
53
|
|
54
54
|
|
55
55
|
<p align="center">
|
56
|
-
<img src="assets/icons/logo_horizontal.png">
|
56
|
+
<img src="https://raw.githubusercontent.com/janus-llm/janus-llm/public/assets/icons/logo_horizontal.png">
|
57
57
|
</p>
|
58
58
|
<p align="center">
|
59
59
|
<a href="https://github.com/janus-llm/janus-llm/actions/workflows/pages.yml" target="_blank">
|
@@ -78,16 +78,12 @@ Description-Content-Type: text/markdown
|
|
78
78
|
Janus (`janus-llm`) uses LLMs to aid in the modernization of legacy IT systems. The repository can currently do the following:
|
79
79
|
|
80
80
|
1. Chunk code of over 100 programming languages to fit within different model context windows and add to a [Chroma](https://trychroma.com) vector database.
|
81
|
-
2. Translate from one programming language to another on a file-by-file basis using an LLM
|
82
|
-
3. Translate from a binary file to a programming language using Ghidra decompilation.
|
83
|
-
4.
|
81
|
+
2. Translate from one programming language to another on a file-by-file basis using an LLM.
|
82
|
+
3. Translate from a binary file to a programming language using [Ghidra](https://github.com/NationalSecurityAgency/ghidra) decompilation.
|
83
|
+
4. Generate requirements, UML diagrams, code comments, and summaries from source code.
|
84
|
+
5. Evaluate the products that you generate.
|
85
|
+
6. Do 1-5 with a CLI tool (`janus`).
|
84
86
|
|
85
|
-
## Roadmap
|
86
|
-
|
87
|
-
### Priorities
|
88
|
-
|
89
|
-
1. Scripts interacting with Chroma Vector DB for RAG translation and understanding.
|
90
|
-
2. Evaluation of outputs in CLI using LLM self-evaluation or static analysis.
|
91
87
|
|
92
88
|
## Installation
|
93
89
|
|
@@ -111,10 +107,14 @@ export PATH=$PATH:$HOME/.local/bin
|
|
111
107
|
poetry install
|
112
108
|
```
|
113
109
|
|
110
|
+
### Documentation
|
111
|
+
|
112
|
+
See [the documentation](https://janus-llm.github.io/janus-llm) for more information on how to use the package.
|
113
|
+
|
114
114
|
### Contributing
|
115
115
|
|
116
116
|
See our [contributing pages](https://janus-llm.github.io/janus-llm/contributing.html)
|
117
117
|
|
118
118
|
### Copyright
|
119
|
-
Copyright ©
|
119
|
+
Copyright ©2025 The MITRE Corporation. ALL RIGHTS RESERVED. Approved for Public Release; Distribution Unlimited. Public Release Case Number 23-4084.
|
120
120
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
janus/__init__.py,sha256=
|
1
|
+
janus/__init__.py,sha256=GnzTgemQclNcCJL0IUvvlWD0XnSmMjzf9cBI55HYKv8,361
|
2
2
|
janus/__main__.py,sha256=Z1-R163-Ryac2kY1sKYfflqBl40nm-o54tlPjGiOP98,68
|
3
3
|
janus/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
janus/_tests/conftest.py,sha256=V7uW-oq3YbFiRPvrq15YoVVrA1n_83pjgiyTZ-IUGW8,963
|
@@ -7,28 +7,30 @@ janus/_tests/evaluator_tests/incose_tests/incose_large_test.json,sha256=_tiBnF_D
|
|
7
7
|
janus/_tests/evaluator_tests/incose_tests/incose_small_test.json,sha256=KHizvtrEvRLrBw25q34I-qonDyFUSUpHpOpFhCmKjAo,2557
|
8
8
|
janus/_tests/evaluator_tests/inline_comment_tests/mumps_inline_comment_test.m,sha256=i2U_YymEFxpX9w9_5wN_bV4ZHzk8THyVdvhH-2Xildk,3490
|
9
9
|
janus/_tests/test_cli.py,sha256=Y1Gx17fBNTQWJGmjPff8bZgg5AnUY0fMWAHzQ0qwi08,4316
|
10
|
-
janus/cli/aggregate.py,sha256=
|
11
|
-
janus/cli/cli.py,sha256
|
12
|
-
janus/cli/constants.py,sha256=
|
10
|
+
janus/cli/aggregate.py,sha256=MlK1ZHrCLcwp8Pl4sronWZaB5Pp6AkWiCtHMriOkLgQ,4139
|
11
|
+
janus/cli/cli.py,sha256=8n7Eo9-2-joVnCTDzrGu4RgemNtyuDaasaVGlhEiQXc,2820
|
12
|
+
janus/cli/constants.py,sha256=4mb3YW18Q8bWAfKa05IJbXUxzQrmN81ELL5pR37PtCw,1206
|
13
13
|
janus/cli/database.py,sha256=EkLv_fJNlG6oKvCcEzezdHIChaJlPUl3AgeejJU4rW0,9540
|
14
|
-
janus/cli/diagram.py,sha256=
|
15
|
-
janus/cli/document.py,sha256=
|
14
|
+
janus/cli/diagram.py,sha256=gOOneADH2klUzUx8CEM6qRtq2C5zDukzkF74R46DgWs,6254
|
15
|
+
janus/cli/document.py,sha256=3tp85dIZ6sF59v-fEE1BLzk9Hkv4tL5CuFtNWvVzhBQ,5685
|
16
16
|
janus/cli/embedding.py,sha256=WBNtcWPrXB4VfzKjeB_fOUm945gzgGjF2XbZkGltgYY,4215
|
17
|
-
janus/cli/llm.py,sha256=
|
18
|
-
janus/cli/partition.py,sha256=
|
19
|
-
janus/cli/
|
20
|
-
janus/cli/
|
17
|
+
janus/cli/llm.py,sha256=JfSPUfkGAQyg-chc18ZoBu8K8w0Q9OUbktHsG90wnsg,6537
|
18
|
+
janus/cli/partition.py,sha256=AHpB0mfhoQzcD0lAQFObbbD2Pw3KE5Hk0r_2XapT6Fg,3898
|
19
|
+
janus/cli/pipeline.py,sha256=8LB3_qqd284Sfs_hFu-Ih-9G_ZUcM00LtlaCsM6xzMk,3667
|
20
|
+
janus/cli/self_eval.py,sha256=fyshuaj_L36fIyBEpeBaVaSq5lPCLJzpeecI6ILV6ac,4419
|
21
|
+
janus/cli/translate.py,sha256=Etob8z-SU0V8oEimUtYfPvYXHgLUP6pkf4IRDr4dbU0,5948
|
21
22
|
janus/converter/__init__.py,sha256=7oDRGUyVGhxyiZQDYoY7z6Vyokmu-06hm2RMMfo9adg,393
|
22
23
|
janus/converter/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
23
|
-
janus/converter/_tests/test_translate.py,sha256=
|
24
|
+
janus/converter/_tests/test_translate.py,sha256=be1g0R0CUfIUI1U1TkqYLIVKRQMOe-rzS3J0xq_7aIE,5750
|
24
25
|
janus/converter/aggregator.py,sha256=MuAXMKmq6PuUo_w6ljyiuDn81Gk2dN-Ci7FVeLc6vhs,1966
|
25
|
-
janus/converter/
|
26
|
-
janus/converter/
|
27
|
-
janus/converter/
|
28
|
-
janus/converter/
|
29
|
-
janus/converter/
|
30
|
-
janus/converter/
|
31
|
-
janus/converter/
|
26
|
+
janus/converter/chain.py,sha256=PSE3AyzJFldiHs6nT4HwiDEcdlpAz3T42Rik3DuIbIw,6712
|
27
|
+
janus/converter/converter.py,sha256=_uuZk1E275Vv1EVznUeDCuej4PTLrDSjXmcabgQDw6o,38980
|
28
|
+
janus/converter/diagram.py,sha256=4FCeaEkjn5jh44_uYPrEP70rJ7plfIlpgjtExJBTQwo,1784
|
29
|
+
janus/converter/document.py,sha256=9qYdN0eDaacKi2wrT3qYiyjyhTSu4ZBg1VrJ9JVyH_o,5225
|
30
|
+
janus/converter/evaluate.py,sha256=w43xEyCGju901Ov9hFGO9EttLbi5hxzQ7nUmPSds33w,10625
|
31
|
+
janus/converter/partition.py,sha256=ASpo7cwLGSZenOvUQ04LN9uI_RbvpQvf9j868rtoddA,644
|
32
|
+
janus/converter/requirements.py,sha256=3HnRu7Z_h6OgsYxaKj3p_KAYizJYia2qvUnOHvjFMko,685
|
33
|
+
janus/converter/translate.py,sha256=jwuhSWIzhjuMJEbHnZS9Y2D8FXhfs6W8PLfpiAeRE6M,1973
|
32
34
|
janus/embedding/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
35
|
janus/embedding/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
36
|
janus/embedding/_tests/test_collections.py,sha256=llg-JSuRRFhKkHFiWWSHEWV3iaT6Lwue0lp2tEml9io,2668
|
@@ -53,7 +55,7 @@ janus/language/binary/_tests/hello.bin,sha256=SRcqx55Vm9GhstlNSA1jDm0AJCCPhP0Xuq
|
|
53
55
|
janus/language/binary/_tests/test_binary.py,sha256=cIKIxjj6kIY3rcxLwqUPESP9bxWrHqMHx9TNuICgfeQ,1724
|
54
56
|
janus/language/binary/binary.py,sha256=PHsVa8jcM7sW9aTboGRWXj6ewQznz0kVPNWtP4B9YPU,6555
|
55
57
|
janus/language/binary/reveng/decompile_script.py,sha256=veW51oJzuO-4UD3Er062jXZ_FYtTFo9OCkl82Z2xr6A,2182
|
56
|
-
janus/language/block.py,sha256=
|
58
|
+
janus/language/block.py,sha256=cLWQLVCx-8joXTxGCBNmTTe85H80HP3Awoit61Dlf40,11679
|
57
59
|
janus/language/combine.py,sha256=egZRl1xZXAFXa2ZjjfqnNckc9uxuo6e1MJgkRrCgvd8,3650
|
58
60
|
janus/language/file.py,sha256=dh2S3owuDOAKaV-GopLmdezmZ4U_Fyp2pLyGmEf0-QU,581
|
59
61
|
janus/language/mumps/__init__.py,sha256=-Ou_wJ-JgHezfp1dub2_qCYNiK9wO-zo2MlqxM9qiwE,48
|
@@ -89,7 +91,6 @@ janus/metrics/_tests/target.py,sha256=hiaJPP9CXkvFBV_wL-gOe_BzELTw0nvB6uCxhxtIiE
|
|
89
91
|
janus/metrics/_tests/test_bleu.py,sha256=k9hSSdGMITsTiXs-Aj4Q5t1_p2v2eD0O9m-vcRi2GKo,1652
|
90
92
|
janus/metrics/_tests/test_chrf.py,sha256=I6AB323mSNj9_0dRIgQdslN0OcQH2fzYxdep68d1LZU,2214
|
91
93
|
janus/metrics/_tests/test_file_pairing.py,sha256=8qB9xaZlaWmc6oAqQGYreRZLrZmrlVALcgtCz0Zp0uA,1892
|
92
|
-
janus/metrics/_tests/test_llm.py,sha256=foKsYM12E4hq4cWjrUDN3WCl9-ViiREgLhudcqRol7g,2977
|
93
94
|
janus/metrics/_tests/test_reading.py,sha256=iXu5SIo2-Opu7hgKcqCwfV-m6ZUSnEmHuXCXddOj1Vg,852
|
94
95
|
janus/metrics/_tests/test_rouge_score.py,sha256=dnP99nry-U5wyE-CiC0eQwm78IyScnmGQH3BeIEdmLY,2032
|
95
96
|
janus/metrics/_tests/test_similarity_score.py,sha256=tdzH_8hYb2h7fKxpd_a75di-GPnU_frZ0zn2aeYzkso,811
|
@@ -99,8 +100,7 @@ janus/metrics/chrf.py,sha256=c8AJLVUtzOezH0R7cJ9hwkLQCIHonm56TTYRTmYuBK4,1485
|
|
99
100
|
janus/metrics/cli.py,sha256=Duuw2RF47Z-t1pal0cg3L_-N_91rx29krirqtIwjYLY,157
|
100
101
|
janus/metrics/complexity_metrics.py,sha256=9sHxa9tY9IgdFC4grCmDSuu8Nkphm_FWbTecxgW78go,6574
|
101
102
|
janus/metrics/file_pairing.py,sha256=b0848gbDTqKVge-uGiujtHdsgcbkpJ04nWF2ul_gbCw,3749
|
102
|
-
janus/metrics/
|
103
|
-
janus/metrics/metric.py,sha256=ZQXz2LLXA3_WW6BluF8Q2LdJKYVWZLYmhO4Ai116ZPY,17168
|
103
|
+
janus/metrics/metric.py,sha256=CXnj6gM1LzMJ2QUPWc1N7bg3V36EdHlLo3Idu31o7E0,13709
|
104
104
|
janus/metrics/prompts/clarity.txt,sha256=UTo7a_E28a9JIto6wskQSUANPGdO6oPxf_3B2sqhgZw,328
|
105
105
|
janus/metrics/prompts/completeness.txt,sha256=5z4a_9a2ruToQnQiW6S02A_IYBIOgwg4KIWHXChA2Co,518
|
106
106
|
janus/metrics/prompts/faithfulness.txt,sha256=UdvfuW99_OsT7D7GhVQpG1StwnC3PFZwNbENS_Gev_c,460
|
@@ -122,7 +122,7 @@ janus/parsers/eval_parsers/incose_parser.py,sha256=udyK-24ocfrB1SzmggcERm73dBynr
|
|
122
122
|
janus/parsers/eval_parsers/inline_comment_parser.py,sha256=QzKgzeWPhyIEkLxJBpeutSocSJjjXEcWRRS635bXEO8,3973
|
123
123
|
janus/parsers/parser.py,sha256=YwkiFthesUaxHngrt4v2lb_HYgKpusnlVgTMwi3WttE,1874
|
124
124
|
janus/parsers/partition_parser.py,sha256=2l4fERb7lf-RTKBTi-TZBys0kJXlzRJWeB8RHNzyTDs,5834
|
125
|
-
janus/parsers/reqs_parser.py,sha256=
|
125
|
+
janus/parsers/reqs_parser.py,sha256=5kS3gtiofZLfnV4GaPEiSwxx3bAG4k-DBDc5wuGF6MQ,2523
|
126
126
|
janus/parsers/uml.py,sha256=iB9j0gtaT4Zo4tYFCGQNRzXa6--wDCuw-sLeQk19kfc,3429
|
127
127
|
janus/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
128
128
|
janus/prompts/prompt.py,sha256=JPr6wvIu1ZpUtTa93WJxa3fbosswtIJqqOY5H8nE2XA,10586
|
@@ -203,8 +203,8 @@ janus/utils/enums.py,sha256=o26C6xIqYSiC2areAGSAB4alP_uHfpKxNn5TnlZzlTI,29656
|
|
203
203
|
janus/utils/logger.py,sha256=vKofNjSvnXduvfkAWf1kkEES32tI7iI-bojfjIa3XoQ,2466
|
204
204
|
janus/utils/pdf_docs_reader.py,sha256=beMKHdYrFwg0m_i7n0OTJrut3sf4rEWFd7P_80A76WY,5140
|
205
205
|
janus/utils/progress.py,sha256=PIpcQec7SrhsfqB25LHj2CDDkfm9umZx90d9LZnAx6k,1469
|
206
|
-
janus_llm-4.
|
207
|
-
janus_llm-4.
|
208
|
-
janus_llm-4.
|
209
|
-
janus_llm-4.
|
210
|
-
janus_llm-4.
|
206
|
+
janus_llm-4.4.5.dist-info/LICENSE,sha256=_j0st0a-HB6MRbP3_BW3PUqpS16v54luyy-1zVyl8NU,10789
|
207
|
+
janus_llm-4.4.5.dist-info/METADATA,sha256=EXj2wwef6SuUSXttNoB4oWXxD2eyqTKvsgXDqD0MQEo,4739
|
208
|
+
janus_llm-4.4.5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
209
|
+
janus_llm-4.4.5.dist-info/entry_points.txt,sha256=rzOrXUSS0SNN8I-fKV0-IBoYLTCMXnZfMtu4HetlCkU,43
|
210
|
+
janus_llm-4.4.5.dist-info/RECORD,,
|
janus/metrics/_tests/test_llm.py
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
import unittest
|
2
|
-
from unittest.mock import patch
|
3
|
-
|
4
|
-
import pytest
|
5
|
-
|
6
|
-
from janus.llm.models_info import load_model
|
7
|
-
from janus.metrics.llm_metrics import llm_evaluate_option, llm_evaluate_ref_option
|
8
|
-
|
9
|
-
|
10
|
-
class TestLLMMetrics(unittest.TestCase):
|
11
|
-
def setUp(self):
|
12
|
-
self.bad_code = """
|
13
|
-
if __name__ == "__main__":
|
14
|
-
a1, a2, b3, b4 = 0, [1, 2000, "a"], 2, (1, 2)
|
15
|
-
for a in a2:
|
16
|
-
if b3:
|
17
|
-
elif not b3:
|
18
|
-
try:
|
19
|
-
pass
|
20
|
-
except:
|
21
|
-
raise ValueError
|
22
|
-
elif 1:
|
23
|
-
print(1)
|
24
|
-
else:
|
25
|
-
print(b4[0])
|
26
|
-
for (x, y) in range(a1, b3):
|
27
|
-
for i in range(003300):
|
28
|
-
for z in a2:
|
29
|
-
printf(b4[2])
|
30
|
-
"""
|
31
|
-
self.impressive_code = """
|
32
|
-
# This program prints out Hello, world!
|
33
|
-
|
34
|
-
print('Hello, world!')
|
35
|
-
"""
|
36
|
-
self.impressive_code_reference = """
|
37
|
-
# An implementation of python Hello, world!
|
38
|
-
|
39
|
-
print("'Hello, world!")
|
40
|
-
"""
|
41
|
-
|
42
|
-
@patch(".llm.models_info.load_model")
|
43
|
-
@patch("janus.metrics.llm_metrics.llm_evaluate")
|
44
|
-
@pytest.mark.llm_eval
|
45
|
-
def test_llm_self_eval_quality(self, mock_llm_evaluate, mock_load_model):
|
46
|
-
"""Test that the quality llm self eval recognizes bad_code as bad code
|
47
|
-
(<5 on a scale of 1-10)"""
|
48
|
-
mock_llm_evaluate.return_value = 4 # return a value less than 5
|
49
|
-
mock_load_model.return_value = [None] # return a dummy model
|
50
|
-
|
51
|
-
bad_code_quality = llm_evaluate_option(
|
52
|
-
self.bad_code,
|
53
|
-
self.bad_code,
|
54
|
-
metric="quality",
|
55
|
-
language="python",
|
56
|
-
llm=load_model("gpt-4o")[0],
|
57
|
-
)
|
58
|
-
self.assertLess(bad_code_quality, 5)
|
59
|
-
|
60
|
-
mock_llm_evaluate.return_value = 6 # return a value greater than 5
|
61
|
-
impressive_code_quality = llm_evaluate_option(
|
62
|
-
self.impressive_code,
|
63
|
-
self.impressive_code,
|
64
|
-
metric="quality",
|
65
|
-
language="python",
|
66
|
-
llm=load_model("gpt-4o")[0],
|
67
|
-
)
|
68
|
-
self.assertGreater(impressive_code_quality, 5)
|
69
|
-
|
70
|
-
@patch("janus.llm.models_info.load_model")
|
71
|
-
@patch("janus.metrics.llm_metrics.llm_evaluate")
|
72
|
-
@pytest.mark.llm_eval
|
73
|
-
def test_llm_self_eval_faithfulness(self, mock_llm_evaluate, mock_load_model):
|
74
|
-
"""The two Hello, world! samples are more or less the same,
|
75
|
-
so the faithfulness score should be high"""
|
76
|
-
mock_llm_evaluate.return_value = 9 # return a high value
|
77
|
-
mock_load_model.return_value = [None] # return a dummy model
|
78
|
-
|
79
|
-
faithfulness = llm_evaluate_ref_option(
|
80
|
-
self.impressive_code,
|
81
|
-
self.impressive_code_reference,
|
82
|
-
metric="faithfulness",
|
83
|
-
language="python",
|
84
|
-
llm=load_model("gpt-4o")[0],
|
85
|
-
)
|
86
|
-
self.assertGreater(faithfulness, 8)
|
87
|
-
|
88
|
-
|
89
|
-
if __name__ == "__main__":
|
90
|
-
unittest.main()
|