banks 2.1.0__py3-none-any.whl → 2.1.2__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.
banks/__about__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2023-present Massimiliano Pippi <mpippi@gmail.com>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "2.1.0"
4
+ __version__ = "2.1.2"
banks/extensions/chat.py CHANGED
@@ -1,7 +1,6 @@
1
1
  # SPDX-FileCopyrightText: 2023-present Massimiliano Pippi <mpippi@gmail.com>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- import re
5
4
 
6
5
  from jinja2 import TemplateSyntaxError, nodes
7
6
  from jinja2.ext import Extension
@@ -9,7 +8,6 @@ from jinja2.ext import Extension
9
8
  from banks.types import chat_message_from_text
10
9
 
11
10
  SUPPORTED_TYPES = ("system", "user", "assistant")
12
- CONTENT_BLOCK_REGEX = re.compile(r"<content_block>((?s:.)*)<\/content_block>")
13
11
 
14
12
 
15
13
  class ChatExtension(Extension):
@@ -52,8 +50,8 @@ class ChatExtension(Extension):
52
50
  raise TemplateSyntaxError(error_msg, lineno)
53
51
 
54
52
  if attr_value.value not in SUPPORTED_TYPES:
55
- types = ",".join(SUPPORTED_TYPES)
56
- msg = f"Unknown role type '{attr_value}', use one of ({types})"
53
+ types = ", ".join(SUPPORTED_TYPES)
54
+ msg = f"Unknown role type '{attr_value.value}', use one of ({types})"
57
55
  raise TemplateSyntaxError(msg, lineno)
58
56
 
59
57
  # Pass the role name to the CallBlock node
banks/types.py CHANGED
@@ -16,7 +16,7 @@ from typing_extensions import Self
16
16
  from .utils import parse_params_from_docstring, python_type_to_jsonschema
17
17
 
18
18
  # pylint: disable=invalid-name
19
- CONTENT_BLOCK_REGEX = re.compile(r"(<content_block>\{.*?\}<\/content_block>)|([^<](?:(?!<content_block>).)*)")
19
+ CONTENT_BLOCK_REGEX = re.compile(r"(<content_block>\{.*?\}<\/content_block>)|([^<](?:(?!<content_block>)[\s\S])*)")
20
20
 
21
21
 
22
22
  class ContentBlockType(str, Enum):
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: banks
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: A prompt programming language
5
- Project-URL: Documentation, https://github.com/unknown/banks#readme
6
- Project-URL: Issues, https://github.com/unknown/banks/issues
7
- Project-URL: Source, https://github.com/unknown/banks
5
+ Project-URL: Documentation, https://github.com/masci/banks#readme
6
+ Project-URL: Issues, https://github.com/masci/banks/issues
7
+ Project-URL: Source, https://github.com/masci/banks
8
8
  Author-email: Massimiliano Pippi <mpippi@gmail.com>
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE.txt
@@ -22,6 +22,7 @@ Requires-Dist: deprecated
22
22
  Requires-Dist: eval-type-backport; python_version < '3.10'
23
23
  Requires-Dist: griffe
24
24
  Requires-Dist: jinja2
25
+ Requires-Dist: platformdirs
25
26
  Requires-Dist: pydantic
26
27
  Provides-Extra: all
27
28
  Requires-Dist: litellm; extra == 'all'
@@ -122,8 +123,14 @@ print(p.chat_messages({"persona": "helpful assistant"}))
122
123
 
123
124
  # Output:
124
125
  # [
125
- # ChatMessage(role='system', content='You are a helpful assistant.\n'),
126
- # ChatMessage(role='user', content='Hello, how are you?\n')
126
+ # ChatMessage(role='system', content=[
127
+ # ContentBlock(type=<ContentBlockType.text: 'text'>, cache_control=None, text='You are a helpful assistant.',
128
+ # image_url=None, input_audio=None)
129
+ # ], tool_call_id=None, name=None),
130
+ # ChatMessage(role='user', content=[
131
+ # ContentBlock(type=<ContentBlockType.text: 'text'>, cache_control=None, text='Hello, how are you?',
132
+ # image_url=None, input_audio=None)
133
+ # ], tool_call_id=None, name=None)
127
134
  # ]
128
135
  ```
129
136
 
@@ -1,14 +1,14 @@
1
- banks/__about__.py,sha256=SSBz0MgZ9q64ZdiBB2-eDQrCPp7s3dQpEdyZr3zxXrs,132
1
+ banks/__about__.py,sha256=FgQqeZsldfp1gHFQOfAIpO9mYK5Yl83xo-6r31g2O-0,132
2
2
  banks/__init__.py,sha256=4IBopxXstFZliCvSjOuTurSQb32Vy26EXOPhmNZ4Hus,334
3
3
  banks/cache.py,sha256=uUGAu82-mfrscc2q24x19ZMZBkoQzf3hh7_V300J-Ik,1069
4
4
  banks/config.py,sha256=c6B1cXUZ-NN0XmJvfezXeHPXHP7knk8TfbmcZL7gCzk,1082
5
5
  banks/env.py,sha256=PBSz-iH_E3_KYofAfsQZLrYMZXVLNJLxgSFD7GB1Xd0,1233
6
6
  banks/errors.py,sha256=I5cgsa7wtolRVKBSq_aH5xs27yVcErBlMyUswCnM-es,580
7
7
  banks/prompt.py,sha256=RhPq3wpE-AiCfCftZpPFj2HXGdazwYD502Pr1e-j7FY,8162
8
- banks/types.py,sha256=R53mLqmTm9HoDJDfRP4mjfpORthkKJbn-6kxudsi_bw,5515
8
+ banks/types.py,sha256=03x7E7FPVfuN39xY--c0fKumnyVUVzNrq9pgG5R-pAU,5520
9
9
  banks/utils.py,sha256=ZetGG3qhXMYOitDZQCWbE33wHEqR0ih2ZEg_dIW8OeI,1827
10
10
  banks/extensions/__init__.py,sha256=Lx4UrOzywYQY7a8qvIqvc3ql54nwK0lNP7x3jYdbREY,110
11
- banks/extensions/chat.py,sha256=3eGsvtBxcaXwjCNiaKVgVc7HN8p1p9CIAGgqlt9F_-U,2560
11
+ banks/extensions/chat.py,sha256=VV6UV1wQZcJ0KbIFHSFmDeptWtww4o2IXF5pXB6TpTM,2478
12
12
  banks/extensions/completion.py,sha256=kF55PiNxjqpslUTAd46H4jOy0eFiLLm5hEcwxS4_oxs,7356
13
13
  banks/extensions/docs.py,sha256=vWOZvu2JoS4LwUG-BR3jPqThirYvu3Fdba331UxooYM,1098
14
14
  banks/filters/__init__.py,sha256=LV4mtTYkmLPo0OST8PMhJJmyC8azZJgU-ZKtpAVU1_0,325
@@ -21,7 +21,7 @@ banks/registries/__init__.py,sha256=iRK-8420cKBckOTd5KcIFQyV66EsF0Mc7UHCkzf8qZU,
21
21
  banks/registries/directory.py,sha256=WXVL8gIrH2OqDYcC89TuTW-iXSwT9WqJq_OWe_kYC2Q,5803
22
22
  banks/registries/file.py,sha256=8ayvFrcM8Tk0DWgGXmKD2DRBfGXr5CmgtdQaQ5cXhow,4054
23
23
  banks/registries/redis.py,sha256=eBL92URJa-NegOxRLS4b2xrDRDxz6iiaz_7Ddi32Rtc,2756
24
- banks-2.1.0.dist-info/METADATA,sha256=u7JknR5Ax29j-Rw2vBIb0ZJUXmhuYZqFcO7bQZBswvg,11727
25
- banks-2.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
- banks-2.1.0.dist-info/licenses/LICENSE.txt,sha256=NZJne_JTwMFwq_g-kq-sm4PuaeVOgu1l3NUGOgBHX-g,1102
27
- banks-2.1.0.dist-info/RECORD,,
24
+ banks-2.1.2.dist-info/METADATA,sha256=o-tu_uFkiR7T3pkakUGoIZq4iOWIy7bkTay_9vX36lw,12098
25
+ banks-2.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
+ banks-2.1.2.dist-info/licenses/LICENSE.txt,sha256=NZJne_JTwMFwq_g-kq-sm4PuaeVOgu1l3NUGOgBHX-g,1102
27
+ banks-2.1.2.dist-info/RECORD,,
File without changes