promptbuilder 0.4.24__py3-none-any.whl → 0.4.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.
@@ -74,9 +74,6 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
74
74
  except json.JSONDecodeError as e:
75
75
  raise ValueError(f"Failed to parse LLM response as JSON:\n{text}")
76
76
 
77
- @logfire_decorators.create
78
- @utils.retry_cls
79
- @utils.rpm_limit_cls
80
77
  def create(
81
78
  self,
82
79
  messages: list[Content],
@@ -107,7 +104,8 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
107
104
 
108
105
  total_count = BaseLLMClient._response_out_tokens(response)
109
106
 
110
- while autocomplete and response.candidates and response.candidates[0].finish_reason == FinishReason.MAX_TOKENS:
107
+ finish_reason = response.candidates[0].finish_reason.value if response.candidates and response.candidates[0].finish_reason else None
108
+ while autocomplete and response.candidates and finish_reason == FinishReason.MAX_TOKENS.value:
111
109
  BaseLLMClient._append_generated_part(messages, response)
112
110
 
113
111
  response = self._create(
@@ -124,6 +122,9 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
124
122
  break
125
123
  return response
126
124
 
125
+ @logfire_decorators.create
126
+ @utils.retry_cls
127
+ @utils.rpm_limit_cls
127
128
  @abstractmethod
128
129
  def _create(
129
130
  self,
@@ -406,9 +407,6 @@ class BaseLLMClientAsync(ABC, utils.InheritDecoratorsMixin):
406
407
  """Return the model identifier"""
407
408
  return self.provider + ":" + self.model
408
409
 
409
- @logfire_decorators.create_async
410
- @utils.retry_cls_async
411
- @utils.rpm_limit_cls_async
412
410
  async def create(
413
411
  self,
414
412
  messages: list[Content],
@@ -439,7 +437,8 @@ class BaseLLMClientAsync(ABC, utils.InheritDecoratorsMixin):
439
437
 
440
438
  total_count = BaseLLMClient._response_out_tokens(response)
441
439
 
442
- while autocomplete and response.candidates and response.candidates[0].finish_reason == FinishReason.MAX_TOKENS:
440
+ finish_reason = response.candidates[0].finish_reason.value if response.candidates and response.candidates[0].finish_reason else None
441
+ while autocomplete and response.candidates and finish_reason == FinishReason.MAX_TOKENS.value:
443
442
  BaseLLMClient._append_generated_part(messages, response)
444
443
 
445
444
  response = await self._create(
@@ -456,6 +455,9 @@ class BaseLLMClientAsync(ABC, utils.InheritDecoratorsMixin):
456
455
  break
457
456
  return response
458
457
 
458
+ @logfire_decorators.create_async
459
+ @utils.retry_cls_async
460
+ @utils.rpm_limit_cls_async
459
461
  @abstractmethod
460
462
  async def _create(
461
463
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.24
3
+ Version: 0.4.26
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -9,7 +9,7 @@ promptbuilder/agent/utils.py,sha256=vTkphKw04v_QDIJtoB2JKK0RGY6iI1t_0LbmuStunzI,
9
9
  promptbuilder/llm_client/__init__.py,sha256=wJ33cnRtZX_YPsbcGxEu3SEZMOhPX7-fHI59MEPUe7I,517
10
10
  promptbuilder/llm_client/aisuite_client.py,sha256=_TfB1xv73kIn4n8ulV3bj8bHOVm4DOD5uIdX-pbYoXY,15563
11
11
  promptbuilder/llm_client/anthropic_client.py,sha256=HSIAZVOQoi3hinjhBVGqpt91k0x38xj6EUsPSUrlAA0,28076
12
- promptbuilder/llm_client/base_client.py,sha256=0U449lHLjl3llyjQlB4hkMGOWl8cE-BtdT7L14AtIco,27835
12
+ promptbuilder/llm_client/base_client.py,sha256=fFaSuEvSY_bu6CJigpa5aFwAfv3x_3W0Y8x22rtC5no,28085
13
13
  promptbuilder/llm_client/bedrock_client.py,sha256=rJMzVV7x_sNJ1nVVqWU1sU-Pq7xlxFxIa_hTD2wtM1Y,27943
14
14
  promptbuilder/llm_client/config.py,sha256=exQEm35wp7lK5SfXNpN5H9VZEb2LVa4pyZ-cxGt1U-U,1124
15
15
  promptbuilder/llm_client/exceptions.py,sha256=t-X7r_a8B1jNu8eEavde1jXu5dz97yV3IG4YHOtgh0Y,4836
@@ -19,8 +19,8 @@ promptbuilder/llm_client/main.py,sha256=5r_MhKVTD4cS90AHR89JJRKiWYBk35Y3JvhvmOxk
19
19
  promptbuilder/llm_client/openai_client.py,sha256=lT0RCiixJBoCtzUbL_0J5NQ5G8KGONzK3dQ73_NgL78,24789
20
20
  promptbuilder/llm_client/types.py,sha256=kgbg5FRzvZwu98y1OhAZJDneXBNPnsFZueQCr9HXIY4,8063
21
21
  promptbuilder/llm_client/utils.py,sha256=79lvSppjrrItHB5MIozbp_5Oq7TsOK4Qzt9Ae3XMLFw,7624
22
- promptbuilder-0.4.24.dist-info/licenses/LICENSE,sha256=fqXmInzgsvEOIaKSBgcrwKyYCGYF0MKErJ0YivtODcc,1096
23
- promptbuilder-0.4.24.dist-info/METADATA,sha256=pHr-63JQFZe_KY1u-uDkq41wu4FnBgyxGHZMAuRddfk,3729
24
- promptbuilder-0.4.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- promptbuilder-0.4.24.dist-info/top_level.txt,sha256=UBVcYn4UgrPy3O3fmmnPEU_kieuplBMgheetIMei4EI,14
26
- promptbuilder-0.4.24.dist-info/RECORD,,
22
+ promptbuilder-0.4.26.dist-info/licenses/LICENSE,sha256=fqXmInzgsvEOIaKSBgcrwKyYCGYF0MKErJ0YivtODcc,1096
23
+ promptbuilder-0.4.26.dist-info/METADATA,sha256=auEvAYB6we0dVXrJX6lZX24o9bV0UHCFZBZ8J9rHK5U,3729
24
+ promptbuilder-0.4.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ promptbuilder-0.4.26.dist-info/top_level.txt,sha256=UBVcYn4UgrPy3O3fmmnPEU_kieuplBMgheetIMei4EI,14
26
+ promptbuilder-0.4.26.dist-info/RECORD,,