janus-llm 3.0.1__tar.gz → 3.1.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {janus_llm-3.0.1 → janus_llm-3.1.0}/PKG-INFO +1 -1
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/__init__.py +1 -1
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/diagram.py +3 -1
- janus_llm-3.1.0/janus/parsers/uml.py +51 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/pyproject.toml +1 -1
- {janus_llm-3.0.1 → janus_llm-3.1.0}/LICENSE +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/README.md +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/__main__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/_tests/conftest.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/_tests/test_cli.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/cli.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/_tests/test_translate.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/converter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/document.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/evaluate.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/requirements.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/converter/translate.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/_tests/test_collections.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/_tests/test_database.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/_tests/test_vectorize.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/collections.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/database.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/embedding_models_info.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/embedding/vectorize.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/_tests/test_combine.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/_tests/test_splitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/alc/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/alc/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/alc/_tests/test_alc.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/alc/alc.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/binary/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/binary/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/binary/_tests/test_binary.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/binary/binary.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/binary/reveng/decompile_script.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/block.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/combine.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/file.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/mumps/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/mumps/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/mumps/_tests/test_mumps.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/mumps/mumps.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/mumps/patterns.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/basic_splitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/chunk_splitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/registry.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/simple_ast.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/naive/tag_splitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/node.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/splitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/treesitter/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/treesitter/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/treesitter/_tests/test_treesitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/language/treesitter/treesitter.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/llm/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/llm/model_callbacks.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/llm/models_info.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/reference.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/target.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_bleu.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_chrf.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_file_pairing.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_llm.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_reading.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_rouge_score.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_similarity_score.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/_tests/test_treesitter_metrics.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/bleu.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/chrf.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/cli.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/complexity_metrics.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/file_pairing.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/llm_metrics.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/metric.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/reading.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/rouge_score.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/similarity.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/metrics/splitting.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/_tests/test_code_parser.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/code_parser.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/doc_parser.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/eval_parser.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/parsers/reqs_parser.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/prompts/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/prompts/prompt.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/_tests/__init__.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/_tests/test_logger.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/_tests/test_progress.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/enums.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/logger.py +0 -0
- {janus_llm-3.0.1 → janus_llm-3.1.0}/janus/utils/progress.py +0 -0
@@ -5,7 +5,7 @@ from langchain_core._api.deprecation import LangChainDeprecationWarning
|
|
5
5
|
from .converter.translate import Translator
|
6
6
|
from .metrics import * # noqa: F403
|
7
7
|
|
8
|
-
__version__ = "3.0
|
8
|
+
__version__ = "3.1.0"
|
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)
|
@@ -5,6 +5,7 @@ from janus.converter.converter import run_if_changed
|
|
5
5
|
from janus.converter.document import Documenter
|
6
6
|
from janus.language.block import TranslatedCodeBlock
|
7
7
|
from janus.llm.models_info import MODEL_PROMPT_ENGINES
|
8
|
+
from janus.parsers.uml import UMLSyntaxParser
|
8
9
|
from janus.utils.logger import create_logger
|
9
10
|
|
10
11
|
log = create_logger(__name__)
|
@@ -39,6 +40,7 @@ class DiagramGenerator(Documenter):
|
|
39
40
|
self._diagram_type = diagram_type
|
40
41
|
self._add_documentation = add_documentation
|
41
42
|
self._documenter = None
|
43
|
+
self._diagram_parser = UMLSyntaxParser(language="plantuml")
|
42
44
|
if add_documentation:
|
43
45
|
self._diagram_prompt_template_name = "diagram_with_documentation"
|
44
46
|
else:
|
@@ -83,7 +85,7 @@ class DiagramGenerator(Documenter):
|
|
83
85
|
|
84
86
|
self._parser.set_reference(block.original)
|
85
87
|
|
86
|
-
query_and_parse = self.diagram_prompt | self._llm | self.
|
88
|
+
query_and_parse = self.diagram_prompt | self._llm | self._diagram_parser
|
87
89
|
|
88
90
|
if self._add_documentation:
|
89
91
|
block.text = query_and_parse.invoke(
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import re
|
2
|
+
import subprocess # nosec
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import List, Tuple
|
5
|
+
|
6
|
+
from langchain_core.exceptions import OutputParserException
|
7
|
+
|
8
|
+
from janus.utils.logger import create_logger
|
9
|
+
|
10
|
+
from .code_parser import CodeParser
|
11
|
+
|
12
|
+
log = create_logger(__name__)
|
13
|
+
|
14
|
+
|
15
|
+
class UMLSyntaxParser(CodeParser):
|
16
|
+
def _get_uml_output(self, file: str) -> Tuple[str, str]:
|
17
|
+
# NOTE: running subprocess with shell=False, added nosec to label that we know
|
18
|
+
# risk exists
|
19
|
+
try:
|
20
|
+
plantuml_path = Path.home().expanduser() / ".janus/lib/plantuml.jar"
|
21
|
+
res = subprocess.run(
|
22
|
+
["java", "-jar", plantuml_path, file],
|
23
|
+
stdout=subprocess.PIPE,
|
24
|
+
stderr=subprocess.PIPE,
|
25
|
+
) # nosec
|
26
|
+
stdout = res.stdout.decode("utf-8")
|
27
|
+
stderr = res.stderr.decode("utf-8")
|
28
|
+
except FileNotFoundError:
|
29
|
+
log.warning("Plant UML executable not found, skipping syntax check")
|
30
|
+
stdout = ""
|
31
|
+
stderr = ""
|
32
|
+
return stdout, stderr
|
33
|
+
|
34
|
+
def _get_errs(self, s: str) -> List[str]:
|
35
|
+
return [x.group() for x in re.finditer(r"Error (.*)\n", s)]
|
36
|
+
|
37
|
+
def parse(self, text: str) -> str:
|
38
|
+
text = super().parse(text)
|
39
|
+
janus_path = Path.home().expanduser() / Path(".janus")
|
40
|
+
if not janus_path.exists():
|
41
|
+
janus_path.mkdir()
|
42
|
+
temp_file_path = janus_path / "tmp.txt"
|
43
|
+
with open(temp_file_path, "w") as f:
|
44
|
+
f.write(text)
|
45
|
+
uml_std_out, uml_std_err = self._get_uml_output(temp_file_path)
|
46
|
+
uml_errs = self._get_errs(uml_std_out) + self._get_errs(uml_std_err)
|
47
|
+
if len(uml_errs) > 0:
|
48
|
+
raise OutputParserException(
|
49
|
+
"Error: Received UML Errors:\n" + "\n".join(uml_errs)
|
50
|
+
)
|
51
|
+
return text
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "janus-llm"
|
3
|
-
version = "3.0
|
3
|
+
version = "3.1.0"
|
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
|