janus-llm 3.5.2__tar.gz → 3.5.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {janus_llm-3.5.2 → janus_llm-3.5.3}/PKG-INFO +1 -1
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/__init__.py +1 -1
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/cli.py +29 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/alc/alc.py +1 -1
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/simple_ast.py +3 -2
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/splitter.py +5 -2
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/llm/models_info.py +7 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/pyproject.toml +1 -1
- {janus_llm-3.5.2 → janus_llm-3.5.3}/LICENSE +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/README.md +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/__main__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/_tests/conftest.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/_tests/test_cli.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/_tests/test_translate.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/aggregator.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/converter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/diagram.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/document.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/evaluate.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/requirements.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/converter/translate.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/_tests/test_collections.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/_tests/test_database.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/_tests/test_vectorize.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/collections.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/database.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/embedding_models_info.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/embedding/vectorize.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/_tests/test_combine.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/_tests/test_splitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/alc/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/alc/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/alc/_tests/test_alc.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/binary/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/binary/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/binary/_tests/test_binary.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/binary/binary.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/binary/reveng/decompile_script.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/block.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/combine.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/file.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/mumps/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/mumps/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/mumps/_tests/test_mumps.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/mumps/mumps.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/mumps/patterns.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/basic_splitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/chunk_splitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/registry.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/naive/tag_splitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/node.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/treesitter/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/treesitter/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/treesitter/_tests/test_treesitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/language/treesitter/treesitter.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/llm/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/llm/model_callbacks.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/reference.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/target.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_bleu.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_chrf.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_file_pairing.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_llm.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_reading.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_rouge_score.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_similarity_score.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/_tests/test_treesitter_metrics.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/bleu.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/chrf.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/cli.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/complexity_metrics.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/file_pairing.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/llm_metrics.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/metric.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/reading.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/rouge_score.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/similarity.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/metrics/splitting.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/_tests/test_code_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/code_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/doc_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/eval_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/refiner_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/reqs_parser.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/parsers/uml.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/prompts/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/prompts/prompt.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/refiners/refiner.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/_tests/__init__.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/_tests/test_logger.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/_tests/test_progress.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/enums.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/logger.py +0 -0
- {janus_llm-3.5.2 → janus_llm-3.5.3}/janus/utils/progress.py +0 -0
@@ -5,7 +5,7 @@ from langchain_core._api.deprecation import LangChainDeprecationWarning
|
|
5
5
|
from janus.converter.translate import Translator
|
6
6
|
from janus.metrics import * # noqa: F403
|
7
7
|
|
8
|
-
__version__ = "3.5.
|
8
|
+
__version__ = "3.5.3"
|
9
9
|
|
10
10
|
# Ignoring a deprecation warning from langchain_core that I can't seem to hunt down
|
11
11
|
warnings.filterwarnings("ignore", category=LangChainDeprecationWarning)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
3
|
import os
|
4
|
+
import subprocess # nosec
|
4
5
|
from pathlib import Path
|
5
6
|
from typing import List, Optional
|
6
7
|
|
@@ -1156,5 +1157,33 @@ app.add_typer(evaluate, name="evaluate")
|
|
1156
1157
|
app.add_typer(embedding, name="embedding")
|
1157
1158
|
|
1158
1159
|
|
1160
|
+
@app.command()
|
1161
|
+
def render(
|
1162
|
+
input_dir: Annotated[
|
1163
|
+
str,
|
1164
|
+
typer.Option(
|
1165
|
+
"--input",
|
1166
|
+
"-i",
|
1167
|
+
),
|
1168
|
+
],
|
1169
|
+
output_dir: Annotated[str, typer.Option("--output", "-o")],
|
1170
|
+
):
|
1171
|
+
input_dir = Path(input_dir)
|
1172
|
+
output_dir = Path(output_dir)
|
1173
|
+
for input_file in input_dir.rglob("*.json"):
|
1174
|
+
with open(input_file, "r") as f:
|
1175
|
+
data = json.load(f)
|
1176
|
+
input_tail = input_file.relative_to(input_dir)
|
1177
|
+
output_file = output_dir / input_tail
|
1178
|
+
output_file = output_file.with_suffix(".txt")
|
1179
|
+
if not output_file.parent.exists():
|
1180
|
+
output_file.parent.mkdir()
|
1181
|
+
with open(output_file, "w") as f:
|
1182
|
+
f.write(data["output"])
|
1183
|
+
jar_path = homedir / ".janus/lib/plantuml.jar"
|
1184
|
+
subprocess.run(["java", "-jar", jar_path, output_file]) # nosec
|
1185
|
+
output_file.unlink()
|
1186
|
+
|
1187
|
+
|
1159
1188
|
if __name__ == "__main__":
|
1160
1189
|
app()
|
@@ -63,7 +63,7 @@ class AlcSplitter(TreeSitterSplitter):
|
|
63
63
|
# instruction and containing all the subsequent nodes up until the
|
64
64
|
# next csect or dsect instruction
|
65
65
|
sects: list[list[CodeBlock]] = [[]]
|
66
|
-
for c in block.children:
|
66
|
+
for c in sorted(block.children):
|
67
67
|
if c.node_type == "csect_instruction":
|
68
68
|
c.context_tags["alc_section"] = "CSECT"
|
69
69
|
sects.append([c])
|
@@ -19,6 +19,7 @@ def get_flexible_ast(language: str, **kwargs) -> Splitter:
|
|
19
19
|
Returns:
|
20
20
|
A flexible AST splitter for the given language.
|
21
21
|
"""
|
22
|
+
kwargs.update(protected_node_types=())
|
22
23
|
if language == "ibmhlasm":
|
23
24
|
return AlcSplitter(**kwargs)
|
24
25
|
elif language == "mumps":
|
@@ -28,7 +29,7 @@ def get_flexible_ast(language: str, **kwargs) -> Splitter:
|
|
28
29
|
|
29
30
|
|
30
31
|
@register_splitter("ast-strict")
|
31
|
-
def get_strict_ast(language: str, **kwargs) -> Splitter:
|
32
|
+
def get_strict_ast(language: str, prune_unprotected=True, **kwargs) -> Splitter:
|
32
33
|
"""Get a strict AST splitter for the given language.
|
33
34
|
|
34
35
|
The strict splitter will only return nodes that are of a functional type.
|
@@ -41,7 +42,7 @@ def get_strict_ast(language: str, **kwargs) -> Splitter:
|
|
41
42
|
"""
|
42
43
|
kwargs.update(
|
43
44
|
protected_node_types=LANGUAGES[language]["functional_node_types"],
|
44
|
-
prune_unprotected=
|
45
|
+
prune_unprotected=prune_unprotected,
|
45
46
|
)
|
46
47
|
if language == "ibmhlasm":
|
47
48
|
return AlcSplitter(**kwargs)
|
@@ -387,7 +387,10 @@ class Splitter(FileManager):
|
|
387
387
|
return
|
388
388
|
|
389
389
|
if self._is_protected(node):
|
390
|
-
|
390
|
+
log.error(
|
391
|
+
"Protected node too large for context!"
|
392
|
+
f" ({node.tokens} > {self.max_tokens})"
|
393
|
+
)
|
391
394
|
|
392
395
|
if node.children:
|
393
396
|
for child in node.children:
|
@@ -423,7 +426,7 @@ class Splitter(FileManager):
|
|
423
426
|
name = f"{node.name}-L#{node_line}"
|
424
427
|
tokens = self._count_tokens(line)
|
425
428
|
if tokens > self.max_tokens:
|
426
|
-
|
429
|
+
log.error(
|
427
430
|
"Irreducible node too large for context!"
|
428
431
|
f" ({tokens} > {self.max_tokens})"
|
429
432
|
)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import json
|
2
2
|
import os
|
3
|
+
import time
|
3
4
|
from pathlib import Path
|
4
5
|
from typing import Any, Callable
|
5
6
|
|
@@ -247,6 +248,12 @@ def load_model(
|
|
247
248
|
model_args = model_config["model_args"]
|
248
249
|
if model_config["model_type"] == "OpenAI":
|
249
250
|
model_args.update(_open_ai_defaults)
|
251
|
+
log.warning("Do NOT use this model in sensitive environments!")
|
252
|
+
log.warning("If you would like to cancel, please press Ctrl+C.")
|
253
|
+
log.warning("Waiting 10 seconds...")
|
254
|
+
# Give enough time for the user to read the warnings and cancel
|
255
|
+
time.sleep(10)
|
256
|
+
|
250
257
|
model = model_constructor(**model_args)
|
251
258
|
return (
|
252
259
|
model,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "janus-llm"
|
3
|
-
version = "3.5.
|
3
|
+
version = "3.5.3"
|
4
4
|
description = "A transcoding library using LLMs."
|
5
5
|
authors = ["Michael Doyle <mdoyle@mitre.org>", "Chris Glasz <cglasz@mitre.org>",
|
6
6
|
"Chris Tohline <ctohline@mitre.org>", "William Macke <wmacke@mitre.org>",
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|