byllm 0.4.3__tar.gz → 0.4.4__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: byllm
3
- Version: 0.4.3
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
@@ -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 by
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"]
@@ -0,0 +1,47 @@
1
+ """Plugin for Jac's with_llm feature."""
2
+
3
+ from typing import Callable
4
+
5
+ from byllm.llm import Model
6
+ from byllm.mtir import MTIR
7
+
8
+ from jaclang.runtimelib.machine import hookimpl
9
+
10
+
11
+ class JacMachine:
12
+ """Jac's with_llm feature."""
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
+
20
+ @staticmethod
21
+ @hookimpl
22
+ def call_llm(model: Model, mtir: MTIR) -> object:
23
+ """Call JacLLM and return the result."""
24
+ return model.invoke(mtir=mtir)
25
+
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "byllm"
3
- version = "0.4.3"
3
+ version = "0.4.4"
4
4
  description = "byLLM Provides Easy to use APIs for different LLM Providers to be used with Jaseci's Jaclang Programming Language."
5
5
  authors = ["Jason Mars <jason@jaseci.org>"]
6
6
  maintainers = ["Jason Mars <jason@jaseci.org>"]
@@ -1,40 +0,0 @@
1
- """Plugin for Jac's with_llm feature."""
2
-
3
- from typing import Callable
4
-
5
- from byllm.llm import Model
6
- from byllm.mtir import MTIR
7
-
8
- from jaclang.runtimelib.machine import hookimpl
9
-
10
-
11
- class JacMachine:
12
- """Jac's with_llm feature."""
13
-
14
- @staticmethod
15
- @hookimpl
16
- def call_llm(model: Model, mtir: MTIR) -> object:
17
- """Call JacLLM and return the result."""
18
- return model.invoke(mtir=mtir)
19
-
20
-
21
- def by(model: Model) -> Callable:
22
- """Python library mode decorator for Jac's by llm() syntax."""
23
-
24
- def _decorator(caller: Callable) -> Callable:
25
- def _wrapped_caller(*args: object, **kwargs: object) -> object:
26
- invoke_args: dict[int | str, object] = {}
27
- for i, arg in enumerate(args):
28
- invoke_args[i] = arg
29
- for key, value in kwargs.items():
30
- invoke_args[key] = value
31
- mtir = MTIR.factory(
32
- caller=caller,
33
- args=invoke_args,
34
- call_params=model.llm_connector.call_params,
35
- )
36
- return JacMachine.call_llm(model, mtir)
37
-
38
- return _wrapped_caller
39
-
40
- return _decorator
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes