lm-deluge 0.0.25__py3-none-any.whl → 0.0.26__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 lm-deluge might be problematic. Click here for more details.

lm_deluge/file.py CHANGED
@@ -1,3 +1,4 @@
1
+ from functools import cached_property
1
2
  import os
2
3
  import io
3
4
  import requests
@@ -68,13 +69,13 @@ class File:
68
69
  return encoded
69
70
  return f"data:{self._mime()};base64,{encoded}"
70
71
 
71
- @property
72
+ @cached_property
72
73
  def fingerprint(self) -> str:
73
74
  # Hash the file contents for fingerprinting
74
75
  file_bytes = self._bytes()
75
76
  return xxhash.xxh64(file_bytes).hexdigest()
76
77
 
77
- @property
78
+ @cached_property
78
79
  def size(self) -> int:
79
80
  """Return file size in bytes."""
80
81
  return len(self._bytes())
@@ -1,4 +1,5 @@
1
1
  from dataclasses import dataclass, field
2
+ from functools import cached_property
2
3
  from typing import Any, Callable
3
4
 
4
5
  from .config import SamplingParams
@@ -39,14 +40,18 @@ class RequestContext:
39
40
 
40
41
  # Computed properties
41
42
  cache_key: str = field(init=False)
42
- num_tokens: int = field(init=False)
43
+ # num_tokens: int = field(init=False)
43
44
 
44
- def __post_init__(self):
45
- # Compute cache key from prompt fingerprint
46
- self.cache_key = self.prompt.fingerprint
45
+ # def __post_init__(self):
46
+ # # Compute cache key from prompt fingerprint
47
+ # # self.cache_key = self.prompt.fingerprint
47
48
 
48
- # Compute token count
49
- self.num_tokens = self.prompt.count_tokens(self.sampling_params.max_new_tokens)
49
+ # # Compute token count
50
+ # self.num_tokens =
51
+
52
+ @cached_property
53
+ def num_tokens(self):
54
+ return self.prompt.count_tokens(self.sampling_params.max_new_tokens)
50
55
 
51
56
  def maybe_callback(self, response, tracker):
52
57
  if not self.callback:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lm_deluge
3
- Version: 0.0.25
3
+ Version: 0.0.26
4
4
  Summary: Python utility for using LLM API models.
5
5
  Author-email: Benjamin Anderson <ben@trytaylor.ai>
6
6
  Requires-Python: >=3.10
@@ -6,12 +6,12 @@ lm_deluge/client.py,sha256=nAGMwdUPDVx-x23hZF6U5Yhug6Zf5FT27RHj_kj8nZk,26369
6
6
  lm_deluge/config.py,sha256=H1tQyJDNHGFuwxqQNL5Z-CjWAC0luHSBA3iY_pxmACM,932
7
7
  lm_deluge/embed.py,sha256=CO-TOlC5kOTAM8lcnicoG4u4K664vCBwHF1vHa-nAGg,13382
8
8
  lm_deluge/errors.py,sha256=oHjt7YnxWbh-eXMScIzov4NvpJMo0-2r5J6Wh5DQ1tk,209
9
- lm_deluge/file.py,sha256=zQH1STMjCG9pczO7Fk9Jw0_0Pj_8CogcdIxTe4J4AJw,5414
9
+ lm_deluge/file.py,sha256=ggOXcAOI-LAykXLb3N3WfLlHdBjQIJtW9ltmfKCIsNQ,5466
10
10
  lm_deluge/gemini_limits.py,sha256=V9mpS9JtXYz7AY6OuKyQp5TuIMRH1BVv9YrSNmGmHNA,1569
11
11
  lm_deluge/image.py,sha256=Qpa0k5yXfrpSaHzVUwW_TEn7yEgmwzYGL17Sa7-KhSA,7729
12
12
  lm_deluge/models.py,sha256=3vgI1BlfT4_Higev25QhhXJufQvsI6pd0yjF9YL0crA,49812
13
13
  lm_deluge/prompt.py,sha256=cfwzCAmT-1K0v7SfEMUrxpBkJGgf7IFlWfNLJrCcoBM,37025
14
- lm_deluge/request_context.py,sha256=0X-5m8BKn51rnnjzGDDXqbuSUEFGjdayirQjbvPcjMI,2425
14
+ lm_deluge/request_context.py,sha256=o33LSEwnK6YPhZeulUoSE_VrdKCXiCQa0tjjixK2K6M,2540
15
15
  lm_deluge/rerank.py,sha256=-NBAJdHz9OB-SWWJnHzkFmeVO4wR6lFV7Vw-SxG7aVo,11457
16
16
  lm_deluge/tool.py,sha256=_coOKB9nPNVZoseMRumRyQ8BMR7_d0IlstzMHNT69JY,15732
17
17
  lm_deluge/tracker.py,sha256=-EkFDAklh5mclIFR-5SthAwNL4p1yKS8LUN7rhpOVPQ,9266
@@ -48,8 +48,8 @@ lm_deluge/util/logprobs.py,sha256=UkBZakOxWluaLqHrjARu7xnJ0uCHVfLGHJdnYlEcutk,11
48
48
  lm_deluge/util/spatial.py,sha256=BsF_UKhE-x0xBirc-bV1xSKZRTUhsOBdGqsMKme20C8,4099
49
49
  lm_deluge/util/validation.py,sha256=hz5dDb3ebvZrZhnaWxOxbNSVMI6nmaOODBkk0htAUhs,1575
50
50
  lm_deluge/util/xml.py,sha256=Ft4zajoYBJR3HHCt2oHwGfymGLdvp_gegVmJ-Wqk4Ck,10547
51
- lm_deluge-0.0.25.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
52
- lm_deluge-0.0.25.dist-info/METADATA,sha256=I-AUU79sc9sxjRV8UAPVWtlmzg10voZ2irH-bLkh_9E,12978
53
- lm_deluge-0.0.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
- lm_deluge-0.0.25.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
55
- lm_deluge-0.0.25.dist-info/RECORD,,
51
+ lm_deluge-0.0.26.dist-info/licenses/LICENSE,sha256=uNNXGXPCw2TC7CUs7SEBkA-Mz6QBQFWUUEWDMgEs1dU,1058
52
+ lm_deluge-0.0.26.dist-info/METADATA,sha256=2zzPvIBE0SdA0RAAKGnyUQDIq-sE_Eo34pfRu_ygi4I,12978
53
+ lm_deluge-0.0.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
54
+ lm_deluge-0.0.26.dist-info/top_level.txt,sha256=hqU-TJX93yBwpgkDtYcXyLr3t7TLSCCZ_reytJjwBaE,10
55
+ lm_deluge-0.0.26.dist-info/RECORD,,