janus-llm 3.5.1__py3-none-any.whl → 3.5.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- janus/__init__.py +1 -1
- janus/_tests/test_cli.py +1 -0
- janus/cli.py +33 -4
- janus/language/alc/alc.py +1 -1
- janus/language/naive/simple_ast.py +3 -2
- janus/language/splitter.py +5 -2
- janus/llm/models_info.py +7 -0
- {janus_llm-3.5.1.dist-info → janus_llm-3.5.3.dist-info}/METADATA +1 -1
- {janus_llm-3.5.1.dist-info → janus_llm-3.5.3.dist-info}/RECORD +12 -12
- {janus_llm-3.5.1.dist-info → janus_llm-3.5.3.dist-info}/LICENSE +0 -0
- {janus_llm-3.5.1.dist-info → janus_llm-3.5.3.dist-info}/WHEEL +0 -0
- {janus_llm-3.5.1.dist-info → janus_llm-3.5.3.dist-info}/entry_points.txt +0 -0
janus/__init__.py
CHANGED
@@ -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)
|
janus/_tests/test_cli.py
CHANGED
janus/cli.py
CHANGED
@@ -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
|
|
@@ -185,7 +186,7 @@ def translate(
|
|
185
186
|
"-L",
|
186
187
|
help="The custom name of the model set with 'janus llm add'.",
|
187
188
|
),
|
188
|
-
]
|
189
|
+
],
|
189
190
|
max_prompts: Annotated[
|
190
191
|
int,
|
191
192
|
typer.Option(
|
@@ -324,7 +325,7 @@ def document(
|
|
324
325
|
"-L",
|
325
326
|
help="The custom name of the model set with 'janus llm add'.",
|
326
327
|
),
|
327
|
-
]
|
328
|
+
],
|
328
329
|
max_prompts: Annotated[
|
329
330
|
int,
|
330
331
|
typer.Option(
|
@@ -480,7 +481,7 @@ def aggregate(
|
|
480
481
|
"-L",
|
481
482
|
help="The custom name of the model set with 'janus llm add'.",
|
482
483
|
),
|
483
|
-
]
|
484
|
+
],
|
484
485
|
max_prompts: Annotated[
|
485
486
|
int,
|
486
487
|
typer.Option(
|
@@ -597,7 +598,7 @@ def diagram(
|
|
597
598
|
"-L",
|
598
599
|
help="The custom name of the model set with 'janus llm add'.",
|
599
600
|
),
|
600
|
-
]
|
601
|
+
],
|
601
602
|
max_prompts: Annotated[
|
602
603
|
int,
|
603
604
|
typer.Option(
|
@@ -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()
|
janus/language/alc/alc.py
CHANGED
@@ -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)
|
janus/language/splitter.py
CHANGED
@@ -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
|
)
|
janus/llm/models_info.py
CHANGED
@@ -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,9 +1,9 @@
|
|
1
|
-
janus/__init__.py,sha256=
|
1
|
+
janus/__init__.py,sha256=7OGST6n7Xx5q_ty0BF_UaZ2cjaepl2HSiPRJXY7XZcQ,361
|
2
2
|
janus/__main__.py,sha256=lEkpNtLVPtFo8ySDZeXJ_NXDHb0GVdZFPWB4gD4RPS8,64
|
3
3
|
janus/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
janus/_tests/conftest.py,sha256=V7uW-oq3YbFiRPvrq15YoVVrA1n_83pjgiyTZ-IUGW8,963
|
5
|
-
janus/_tests/test_cli.py,sha256=
|
6
|
-
janus/cli.py,sha256=
|
5
|
+
janus/_tests/test_cli.py,sha256=6ef7h11bg4i7Q6L1-r0ZdcY7YrH4n472kvDiA03T4c8,4275
|
6
|
+
janus/cli.py,sha256=RuXaM9rWKW4bvy4ML_epcygDIMSAERM9Os7giO-Ivbk,37810
|
7
7
|
janus/converter/__init__.py,sha256=U2EOMcCykiC0ZqhorNefOP_04hOF18qhYoPKrVp1Vrk,345
|
8
8
|
janus/converter/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
janus/converter/_tests/test_translate.py,sha256=yzcFEGc_z8QmBBBmC9dZnfL9tT8CD1rkpc8Hz44Jp4c,5631
|
@@ -30,7 +30,7 @@ janus/language/_tests/test_splitter.py,sha256=Hqexa39LLEXlK3ZUw7Zot4PUIACvye2vkq
|
|
30
30
|
janus/language/alc/__init__.py,sha256=j7vOMGhT1Vri6p8dsjSaY-fkO5uFn0sJ0nrNGGvcizM,42
|
31
31
|
janus/language/alc/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
32
32
|
janus/language/alc/_tests/test_alc.py,sha256=NgVeOctm9zf-S328DdUNn9et_-lK1t5O0O2FKElb91Q,1027
|
33
|
-
janus/language/alc/alc.py,sha256=
|
33
|
+
janus/language/alc/alc.py,sha256=hiHpS-odevqbOS6TkJJgghiGXKU1ObwrNzAI66DNsP8,6598
|
34
34
|
janus/language/binary/__init__.py,sha256=AlNAe12ZA366kcGSrQ1FJyOdbwxFqGBFkYR2K6yL818,51
|
35
35
|
janus/language/binary/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
36
36
|
janus/language/binary/_tests/test_binary.py,sha256=SDdI6tsQj9yXle7wBsksHuKULLMHv7mNgUkDx1nCvpw,1733
|
@@ -48,17 +48,17 @@ janus/language/naive/__init__.py,sha256=_Gq4inONyVYxe8WLB59d_69kqGbtF40BGKoJPnK4
|
|
48
48
|
janus/language/naive/basic_splitter.py,sha256=RM9pJK2YkHfb6_EFEV-dh_rLqkjS6v0cn3ASPf8A6Fg,459
|
49
49
|
janus/language/naive/chunk_splitter.py,sha256=ebRSbaJhDW-Hyr5__ukbdmAl6kQ1WWFqrq_SfCgHo6k,772
|
50
50
|
janus/language/naive/registry.py,sha256=8YQX1q0IdAm7t69-oC_00I-vfkdRnHuX-OD3KEjEIuU,294
|
51
|
-
janus/language/naive/simple_ast.py,sha256=
|
51
|
+
janus/language/naive/simple_ast.py,sha256=YzeUJomVsnttJc8tI9eDROb2Hx9Vm9XKmOnLEp3TkzI,3112
|
52
52
|
janus/language/naive/tag_splitter.py,sha256=IXWMn9tBVUGAtzvQi89GhoZ6g7fPXk5MzO0kMCr2mb0,2045
|
53
53
|
janus/language/node.py,sha256=baoYFtapwBQqBtUN6EvHFYRkbR-EcEw1b3fQvH9zIAM,204
|
54
|
-
janus/language/splitter.py,sha256=
|
54
|
+
janus/language/splitter.py,sha256=ckrNgN2G3c2cp7AJeZmem21H2FF2pYZtOivqwyLIb6M,17029
|
55
55
|
janus/language/treesitter/__init__.py,sha256=mUliw7ZJLZ8NkJKyUQMSoUV82hYXE0HvLHrEdGPJF4Q,43
|
56
56
|
janus/language/treesitter/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
57
57
|
janus/language/treesitter/_tests/test_treesitter.py,sha256=4S_UdH6AfJ0j6hyInZ2CFLRqLXb0Bq-AMYd7A8-Y3iU,2188
|
58
58
|
janus/language/treesitter/treesitter.py,sha256=FU86H8j2cfRLtwyNeEnf9A6gzZEvDwmnFCIrQymUJso,7541
|
59
59
|
janus/llm/__init__.py,sha256=TKLYvnsWKWfxMucy-lCLQ-4bkN9ENotJZDywDEQmrKg,45
|
60
60
|
janus/llm/model_callbacks.py,sha256=K7P5NY-rf7IYRAFHnZ3kzhrQWE6g_najx8uxlaSiz3E,7110
|
61
|
-
janus/llm/models_info.py,sha256=
|
61
|
+
janus/llm/models_info.py,sha256=mSY0lnMN7hg5-Gtbz207-Y4EZiCzB8GDU9KV2jMCKYE,8668
|
62
62
|
janus/metrics/__init__.py,sha256=AsxtZJUzZiXJPr2ehPPltuYP-ddechjg6X85WZUO7mA,241
|
63
63
|
janus/metrics/_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
64
64
|
janus/metrics/_tests/reference.py,sha256=hiaJPP9CXkvFBV_wL-gOe_BzELTw0nvB6uCxhxtIiE8,13
|
@@ -102,8 +102,8 @@ janus/utils/_tests/test_progress.py,sha256=Rs_u5PiGjP-L-o6C1fhwfE1ig8jYu9Xo9s4p8
|
|
102
102
|
janus/utils/enums.py,sha256=AoilbdiYyMvY2Mp0AM4xlbLSELfut2XMwhIM1S_msP4,27610
|
103
103
|
janus/utils/logger.py,sha256=KZeuaMAnlSZCsj4yL0P6N-JzZwpxXygzACWfdZFeuek,2337
|
104
104
|
janus/utils/progress.py,sha256=PIpcQec7SrhsfqB25LHj2CDDkfm9umZx90d9LZnAx6k,1469
|
105
|
-
janus_llm-3.5.
|
106
|
-
janus_llm-3.5.
|
107
|
-
janus_llm-3.5.
|
108
|
-
janus_llm-3.5.
|
109
|
-
janus_llm-3.5.
|
105
|
+
janus_llm-3.5.3.dist-info/LICENSE,sha256=_j0st0a-HB6MRbP3_BW3PUqpS16v54luyy-1zVyl8NU,10789
|
106
|
+
janus_llm-3.5.3.dist-info/METADATA,sha256=tNfk-v8PG8wfl1Fj1MIa3vWJcHNZkxmUIOKsbvb_5WQ,4184
|
107
|
+
janus_llm-3.5.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
108
|
+
janus_llm-3.5.3.dist-info/entry_points.txt,sha256=OGhQwzj6pvXp79B0SaBD5apGekCu7Dwe9fZZT_TZ544,39
|
109
|
+
janus_llm-3.5.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|