llguidance 1.4.0__cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl → 1.5.0__cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.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.
llguidance/_lib.abi3.so CHANGED
Binary file
llguidance/_lib.pyi CHANGED
@@ -570,6 +570,26 @@ class LLExecutor:
570
570
  State rollback is performed to maintain matcher consistency.
571
571
  """
572
572
 
573
+ def consume_token_par(
574
+ self,
575
+ matchers: List[Tuple[LLMatcher, TokenId]],
576
+ ) -> List[bool]:
577
+ """
578
+ Consume a single token for each matcher in parallel.
579
+
580
+ Args:
581
+ matchers: List of tuples containing:
582
+ - LLMatcher: The matcher object
583
+ - TokenId: The token ID to consume
584
+
585
+ Returns:
586
+ List[bool]: Success/failure for each matcher (in order).
587
+
588
+ Note:
589
+ Matchers that fail (return False) are left in an error state,
590
+ consistent with the behavior of consume_token on a single matcher.
591
+ """
592
+
573
593
  class JsonCompileOptions(TypedDict, total=False):
574
594
  # defaults to ","
575
595
  item_separator: Optional[str]
llguidance/mlx.py CHANGED
@@ -8,7 +8,7 @@ from .numpy import get_bitmask_shape, allocate_token_bitmask, fill_next_token_bi
8
8
  from numpy.typing import NDArray
9
9
 
10
10
 
11
- @mx.custom_function # type: ignore[misc]
11
+ @mx.custom_function # type: ignore[untyped-decorator]
12
12
  def apply_token_bitmask_kernel(data: mx.array, mask: mx.array) -> mx.array:
13
13
  source = """
14
14
  uint batch = thread_position_in_grid.y; // Batch index
llguidance/numpy.py CHANGED
@@ -80,3 +80,22 @@ def fill_next_token_bitmask_par_with_draft_tokens(executor: LLExecutor,
80
80
  batch, vocab = bitmask.shape
81
81
  assert bitmask.flags["C_CONTIGUOUS"], "Mask must be contiguous"
82
82
  executor.unsafe_compute_mask_ptr_with_draft_token(matchers, bitmask.ctypes.data, vocab * 4, batch)
83
+
84
+
85
+ def consume_token_par(executor: LLExecutor,
86
+ matchers: List[Tuple[LLMatcher, int]]) -> List[bool]:
87
+ """
88
+ Consume a single token for each matcher in parallel.
89
+
90
+ Args:
91
+ executor: The LLExecutor to use for parallel execution.
92
+ matchers: List of tuples containing (LLMatcher, token_id).
93
+
94
+ Returns:
95
+ List[bool]: Success/failure for each matcher (in order).
96
+
97
+ Note:
98
+ Matchers that fail (return False) are left in an error state,
99
+ consistent with the behavior of consume_token on a single matcher.
100
+ """
101
+ return executor.consume_token_par(matchers)
llguidance/torch.py CHANGED
@@ -77,3 +77,22 @@ def fill_next_token_bitmask_par_with_draft_tokens(executor: LLExecutor,
77
77
  batch, vocab = bitmask.shape
78
78
  assert bitmask.is_contiguous(), "Mask must be contiguous"
79
79
  executor.unsafe_compute_mask_ptr_with_draft_token(matchers, bitmask.data_ptr(), vocab * 4, batch)
80
+
81
+
82
+ def consume_token_par(executor: LLExecutor,
83
+ matchers: List[Tuple[LLMatcher, int]]) -> List[bool]:
84
+ """
85
+ Consume a single token for each matcher in parallel.
86
+
87
+ Args:
88
+ executor: The LLExecutor to use for parallel execution.
89
+ matchers: List of tuples containing (LLMatcher, token_id).
90
+
91
+ Returns:
92
+ List[bool]: Success/failure for each matcher (in order).
93
+
94
+ Note:
95
+ Matchers that fail (return False) are left in an error state,
96
+ consistent with the behavior of consume_token on a single matcher.
97
+ """
98
+ return executor.consume_token_par(matchers)
@@ -1,14 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llguidance
3
- Version: 1.4.0
3
+ Version: 1.5.0
4
4
  License-File: LICENSE
5
5
  Summary: Bindings for the Low-level Guidance (llguidance) Rust library for use within Guidance
6
6
  Author: Michal Moskal
7
7
  License-Expression: MIT
8
8
  Requires-Python: >=3.10
9
9
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
10
- Project-URL: repository, https://github.com/microsoft/llguidance
11
10
  Project-URL: issue_tracker, https://github.com/microsoft/llguidance/issues
11
+ Project-URL: repository, https://github.com/microsoft/llguidance
12
+
13
+ <div align="right">
14
+ <a href="https://discord.gg/cjPfAK43dz"><img src="https://img.shields.io/badge/Discord-Join%20Us-5865F2?logo=discord&logoColor=white" alt="Discord"></a>
15
+ <a href="mailto:guidanceai@microsoft.com"><img src="https://img.shields.io/badge/Email-guidanceai%40microsoft.com-0078D4?logo=microsoft-outlook&logoColor=white" alt="Email"></a>
16
+ <img src="https://img.shields.io/badge/Hours-10am--2pm%20Pacific-gray" alt="Hours">
17
+ </div>
12
18
 
13
19
  # Low-level Guidance (llguidance)
14
20
 
@@ -35,7 +41,7 @@ Project-URL: issue_tracker, https://github.com/microsoft/llguidance/issues
35
41
  ## About
36
42
 
37
43
  This library implements constrained decoding (also called constrained sampling or
38
- structured outputs) for Large Langauge Models (LLMs).
44
+ structured outputs) for Large Language Models (LLMs).
39
45
  It can enforce arbitrary context-free grammar on the output of LLM
40
46
  and is fast - on the order of 50μs of CPU time per token
41
47
  (for 128k tokenizer) with negligible startup costs.
@@ -1,10 +1,7 @@
1
- llguidance-1.4.0.dist-info/METADATA,sha256=NpVepLhgx0KTvLTXRN1-k-RYfpKXNziLxSMQh2QZpdk,10302
2
- llguidance-1.4.0.dist-info/WHEEL,sha256=dY-16_uqpeJeKa9TH_TLDl5sXNjJIyZ_Q6aJg0vnMsg,145
3
- llguidance-1.4.0.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
4
1
  llguidance/__init__.py,sha256=F9svXvm6oafbuUf_eq34PHJV4c7-yN133vmbWN6nIkc,590
5
2
  llguidance/_grammar_from.py,sha256=-vHqkPqJe6t0JKKuQhlUu08kYpPIVknMh8tZlh8FYeQ,2384
6
- llguidance/_lib.abi3.so,sha256=2vjFu2aGBBXoinSsRMSlVvn557RHIboGHcEOAdpsNzk,7191256
7
- llguidance/_lib.pyi,sha256=1m69VQ-7XaQLJKf6Vw5qf-UEh1cEigVMZM0Hj-XgSiw,24213
3
+ llguidance/_lib.abi3.so,sha256=uU52BBgsVfyqn1voEbl6eBL9iXt1_5gSbtE_ZlRNjWI,7005360
4
+ llguidance/_lib.pyi,sha256=UD2X7uyV7D-nwKJ9GpXrUFA3ZoIjTmKVPjFcjkhunpQ,24830
8
5
  llguidance/_struct_tag.py,sha256=83okmGWShxZud7S2vHjPRiInhFw0QVTHkeN8wtR8hR8,4430
9
6
  llguidance/_tokenizer.py,sha256=yC-RcgyMZN-olV-PnN4XkjlH-fOU8E9jrwO8VkXLv4M,1084
10
7
  llguidance/_util.py,sha256=6JV5SxjoH7hZPaSHhPRD_G6JzIhbKFFTqWTpp88VIiU,260
@@ -12,9 +9,12 @@ llguidance/cli.py,sha256=jhXdWbJC5rs6J8aknHtiuJeIWHcajZ7jYUj0ydeDJ68,2384
12
9
  llguidance/gbnf_to_lark.py,sha256=32XJ5Dzq-iSySnkV_rLaNZ888JjHBIr_QkSYdhtMAME,16635
13
10
  llguidance/hf.py,sha256=sLJKZxGpftuAY5eSCYpogzim3WZA7-vs9SOVgnzf3xI,1933
14
11
  llguidance/llamacpp.py,sha256=d_LjNbomBhj7uTo90h0muvPkOMso8NLe7H_YfPCqA8U,2284
15
- llguidance/mlx.py,sha256=ydMNSjnI2db8F685waOSWQLIoQTB9oehGBXnp9T3A6Q,2427
16
- llguidance/numpy.py,sha256=ZxHoQ_OmAgUHmxa_6KA8ruuKzXZLjmanPM9BYlKI0bo,3327
12
+ llguidance/mlx.py,sha256=zvE3hxZNNXgX0JhNb19eK3bbHDaZWochEOH12C5fCgk,2440
13
+ llguidance/numpy.py,sha256=mXvm4gp7WX_avVYKz2v4AlE4_v0dAgLuqmWy3PKOu6g,3947
17
14
  llguidance/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
15
  llguidance/tiktoken.py,sha256=-mYDPxq4LM2FI9K8kLL0Us0qN-fZpNK0qIwboDPjfSk,1101
19
- llguidance/torch.py,sha256=qLwQjaxZbvaVss7Qy_XP-SEPGYRqJRkvd6KE4LmzZJ8,3372
20
- llguidance-1.4.0.dist-info/RECORD,,
16
+ llguidance/torch.py,sha256=BhR7hKaZK0sltMXqr3vIcMx0FXz9k8XW5FbJIL0QvGU,3992
17
+ llguidance-1.5.0.dist-info/METADATA,sha256=TLsiUVDRHA9S5IbbaDeKmUj6-C9qvZNSoj6-FfM5yc0,10751
18
+ llguidance-1.5.0.dist-info/WHEEL,sha256=btCZOUXJMzNcRkylrJSGktvUfAhpsQmBEeAGzSFPuxs,145
19
+ llguidance-1.5.0.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
20
+ llguidance-1.5.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.10.1)
2
+ Generator: maturin (1.11.5)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp39-abi3-manylinux_2_17_aarch64
5
5
  Tag: cp39-abi3-manylinux2014_aarch64