byllm 0.4.2__py2.py3-none-any.whl → 0.4.4__py2.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.
Potentially problematic release.
This version of byllm might be problematic. Click here for more details.
- byllm/__init__.py +3 -1
- byllm/plugin.py +28 -21
- byllm/schema.py +4 -1
- {byllm-0.4.2.dist-info → byllm-0.4.4.dist-info}/METADATA +7 -8
- byllm-0.4.4.dist-info/RECORD +11 -0
- {byllm-0.4.2.dist-info → byllm-0.4.4.dist-info}/WHEEL +1 -1
- byllm-0.4.2.dist-info/RECORD +0 -11
- {byllm-0.4.2.dist-info → byllm-0.4.4.dist-info}/entry_points.txt +0 -0
byllm/__init__.py
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
from byllm.llm import Model
|
|
4
4
|
from byllm.mtir import MTIR
|
|
5
|
-
from byllm.plugin import
|
|
5
|
+
from byllm.plugin import JacMachine
|
|
6
6
|
from byllm.types import Image, MockToolCall, Video
|
|
7
7
|
|
|
8
|
+
by = JacMachine.by
|
|
9
|
+
|
|
8
10
|
__all__ = ["by", "Image", "MockToolCall", "Model", "MTIR", "Video"]
|
byllm/plugin.py
CHANGED
|
@@ -11,30 +11,37 @@ from jaclang.runtimelib.machine import hookimpl
|
|
|
11
11
|
class JacMachine:
|
|
12
12
|
"""Jac's with_llm feature."""
|
|
13
13
|
|
|
14
|
+
@staticmethod
|
|
15
|
+
@hookimpl
|
|
16
|
+
def get_mtir(caller: Callable, args: dict, call_params: dict) -> object:
|
|
17
|
+
"""Call JacLLM and return the result."""
|
|
18
|
+
return MTIR.factory(caller, args, call_params)
|
|
19
|
+
|
|
14
20
|
@staticmethod
|
|
15
21
|
@hookimpl
|
|
16
22
|
def call_llm(model: Model, mtir: MTIR) -> object:
|
|
17
23
|
"""Call JacLLM and return the result."""
|
|
18
24
|
return model.invoke(mtir=mtir)
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
@staticmethod
|
|
27
|
+
@hookimpl
|
|
28
|
+
def by(model: Model) -> Callable:
|
|
29
|
+
"""Python library mode decorator for Jac's by llm() syntax."""
|
|
30
|
+
|
|
31
|
+
def _decorator(caller: Callable) -> Callable:
|
|
32
|
+
def _wrapped_caller(*args: object, **kwargs: object) -> object:
|
|
33
|
+
invoke_args: dict[int | str, object] = {}
|
|
34
|
+
for i, arg in enumerate(args):
|
|
35
|
+
invoke_args[i] = arg
|
|
36
|
+
for key, value in kwargs.items():
|
|
37
|
+
invoke_args[key] = value
|
|
38
|
+
mtir = MTIR.factory(
|
|
39
|
+
caller=caller,
|
|
40
|
+
args=invoke_args,
|
|
41
|
+
call_params=model.llm_connector.call_params,
|
|
42
|
+
)
|
|
43
|
+
return model.invoke(mtir=mtir)
|
|
44
|
+
|
|
45
|
+
return _wrapped_caller
|
|
46
|
+
|
|
47
|
+
return _decorator
|
byllm/schema.py
CHANGED
|
@@ -117,7 +117,10 @@ def _type_to_schema(ty: type, title: str = "", desc: str = "") -> dict:
|
|
|
117
117
|
f"Enum {ty.__name__} has mixed types. Not supported for schema generation."
|
|
118
118
|
)
|
|
119
119
|
enum_type = enum_type or int
|
|
120
|
-
|
|
120
|
+
|
|
121
|
+
enum_desc = f"\nThe value *should* be one in this list: {enum_values} where"
|
|
122
|
+
enum_desc += " the names are [" + ", ".join([e.name for e in ty]) + "]."
|
|
123
|
+
|
|
121
124
|
if enum_type not in (int, str):
|
|
122
125
|
raise ValueError(
|
|
123
126
|
f"Enum {ty.__name__} has unsupported type {enum_type}. "
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: byllm
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: byLLM Provides Easy to use APIs for different LLM Providers to be used with Jaseci's Jaclang Programming Language.
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: llm,jaclang,jaseci,byLLM
|
|
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
25
25
|
Classifier: Programming Language :: Python :: 3.14
|
|
26
26
|
Provides-Extra: tools
|
|
27
27
|
Provides-Extra: video
|
|
28
|
-
Requires-Dist: jaclang (>=0.8.
|
|
28
|
+
Requires-Dist: jaclang (>=0.8.8)
|
|
29
29
|
Requires-Dist: litellm (>=1.75.5.post1)
|
|
30
30
|
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
|
31
31
|
Requires-Dist: pillow (>=10.4.0,<10.5.0)
|
|
@@ -42,8 +42,7 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
[Usage docs]: https://www.jac-lang.org/learn/jac-byllm/usage/
|
|
43
43
|
[Research Paper]: https://arxiv.org/abs/2405.08965
|
|
44
44
|
|
|
45
|
-
# byLLM :
|
|
46
|
-
> Prompt No More!
|
|
45
|
+
# byLLM : Less Prompting! More Coding!
|
|
47
46
|
|
|
48
47
|
[](https://pypi.org/project/byllm/) [](https://github.com/jaseci-labs/jaseci/actions/workflows/test-jaseci.yml)
|
|
49
48
|
|
|
@@ -74,7 +73,7 @@ with entry {
|
|
|
74
73
|
|
|
75
74
|
This simple piece of code replaces traditional prompt engineering without introducing additional complexity.
|
|
76
75
|
|
|
77
|
-
## Power Types with LLMs
|
|
76
|
+
## Power of Types with LLMs
|
|
78
77
|
|
|
79
78
|
Consider a program that detects the personality type of a historical figure from their name. This can eb built in a way that LLM picks from an enum and the output strictly adhere this type.
|
|
80
79
|
|
|
@@ -104,9 +103,9 @@ Even if we are elimination prompt engineering entierly, we allow specific ways t
|
|
|
104
103
|
```python
|
|
105
104
|
"""Represents the personal record of a person"""
|
|
106
105
|
obj Person {
|
|
107
|
-
has name;
|
|
108
|
-
has dob;
|
|
109
|
-
has ssn;
|
|
106
|
+
has name: str;
|
|
107
|
+
has dob: str;
|
|
108
|
+
has ssn: str;
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
sem Person.name = "Full name of the person";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
byllm/__init__.py,sha256=fB2Jt0gjpW_B4HZJ3KmbbCDSeMS4K6AN41qbDYHRO70,254
|
|
2
|
+
byllm/llm.py,sha256=fjraqQaT1uiwxTjLW7Wm8TDnnl7N5xDztA2KhyUfIQE,3560
|
|
3
|
+
byllm/llm_connector.py,sha256=XK8ftsafTYWq7aAjDxk4R4OeyJ1P1ou2qrZAXOU9xmU,8546
|
|
4
|
+
byllm/mtir.py,sha256=V4fpc0-j_7pb8rVMV8yskc9XczUCtHczrj5OZGXKA8g,7083
|
|
5
|
+
byllm/plugin.py,sha256=RrL2nwLlNi5Ipzig4x1KKb3K-3o_HxY83OG6ti2q7k4,1436
|
|
6
|
+
byllm/schema.py,sha256=VnqL03DYhroWjWRioLRoGBLNbjixw8Nk381gsHLpNXw,8927
|
|
7
|
+
byllm/types.py,sha256=rS_ISxYeHmXQiP1rv9qMKDiojdwk_x7bckOhn8_DFJk,11311
|
|
8
|
+
byllm-0.4.4.dist-info/METADATA,sha256=M7bPyBdZzHrVfY_y24_-dXRoIcCvBWUnGeI8YsajYho,7616
|
|
9
|
+
byllm-0.4.4.dist-info/WHEEL,sha256=MICUlqIgkuEnKh9OWy254Ca7q2MHOW-q0u36TZR60nU,92
|
|
10
|
+
byllm-0.4.4.dist-info/entry_points.txt,sha256=hUzQdaP8qTKkAqHfBpcqxQK02wixeyyzx3y-s6KyrQg,37
|
|
11
|
+
byllm-0.4.4.dist-info/RECORD,,
|
byllm-0.4.2.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
byllm/__init__.py,sha256=Iqi_KAnRkr5vC9OYMWa9e5vZE3PiR2ror_Th1wa8F9Q,226
|
|
2
|
-
byllm/llm.py,sha256=fjraqQaT1uiwxTjLW7Wm8TDnnl7N5xDztA2KhyUfIQE,3560
|
|
3
|
-
byllm/llm_connector.py,sha256=XK8ftsafTYWq7aAjDxk4R4OeyJ1P1ou2qrZAXOU9xmU,8546
|
|
4
|
-
byllm/mtir.py,sha256=V4fpc0-j_7pb8rVMV8yskc9XczUCtHczrj5OZGXKA8g,7083
|
|
5
|
-
byllm/plugin.py,sha256=T_uSAkiyuPiufo5SEUNcgMOU0Ns5Zbg7BPfMo_ihC9s,1132
|
|
6
|
-
byllm/schema.py,sha256=q5Tnfv9sNDxkiK9579MJ4SXgtXzirIbsJYCzZ5mstUM,8838
|
|
7
|
-
byllm/types.py,sha256=rS_ISxYeHmXQiP1rv9qMKDiojdwk_x7bckOhn8_DFJk,11311
|
|
8
|
-
byllm-0.4.2.dist-info/METADATA,sha256=edJ9DvRcQzm01stAEFNzkJoFPJkp1qTXbH0OMKon8Ps,7639
|
|
9
|
-
byllm-0.4.2.dist-info/WHEEL,sha256=hHsm7XBrBXzBRNffhH1pmcsQOxyb5EETurgI-_j97X0,92
|
|
10
|
-
byllm-0.4.2.dist-info/entry_points.txt,sha256=hUzQdaP8qTKkAqHfBpcqxQK02wixeyyzx3y-s6KyrQg,37
|
|
11
|
-
byllm-0.4.2.dist-info/RECORD,,
|
|
File without changes
|