promptbuilder 0.4.21__py3-none-any.whl → 0.4.22__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.
@@ -5,6 +5,7 @@ import hashlib
5
5
  import logging
6
6
  from abc import ABC, abstractmethod
7
7
  from typing import Iterator, AsyncIterator, Literal, overload
8
+ from pydantic import BaseModel
8
9
 
9
10
  from promptbuilder.llm_client.types import Response, Content, Part, Tool, ToolConfig, FunctionCall, FunctionCallingConfig, Json, ThinkingConfig, ApiKey, PydanticStructure, ResultType, FinishReason
10
11
  import promptbuilder.llm_client.utils as utils
@@ -605,7 +606,12 @@ class CachedLLMClient(BaseLLMClient):
605
606
  with open(cache_path, "rt") as f:
606
607
  cache_data = json.load(f)
607
608
  if cache_data["full_model_name"] == llm_client.full_model_name and json.dumps(cache_data["request"]) == json.dumps(messages_dump):
608
- return Response(**cache_data["response"]), messages_dump, cache_path
609
+ response = Response(**cache_data["response"])
610
+ result_type = kwargs.get("result_type", None)
611
+ if result_type is not None and isinstance(result_type, type(BaseModel)):
612
+ response.parsed = result_type.model_validate(response.parsed)
613
+
614
+ return response, messages_dump, cache_path
609
615
  else:
610
616
  logger.debug(f"Cache mismatch for {key}")
611
617
  except (json.JSONDecodeError, KeyError) as e:
@@ -637,4 +643,3 @@ class CachedLLMClientAsync(BaseLLMClientAsync):
637
643
  response = await self.llm_client.create(messages, **kwargs)
638
644
  CachedLLMClient.save_cache(cache_path, self.llm_client.full_model_name, messages_dump, response)
639
645
  return response
640
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.21
3
+ Version: 0.4.22
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  Requires-Dist: pydantic
15
15
  Requires-Dist: pytest
16
16
  Requires-Dist: aisuite-async
17
- Requires-Dist: google-genai<=1.21.0,>=1.4.0
17
+ Requires-Dist: google-genai>=1.4.0
18
18
  Requires-Dist: anthropic
19
19
  Requires-Dist: openai
20
20
  Requires-Dist: aioboto3
@@ -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=aMqg05zefzck9Lz7pm7jZoKFdzr_ymFYhrAjZtzdHlQ,15561
11
11
  promptbuilder/llm_client/anthropic_client.py,sha256=vWuyFZL_LohOE0UYjB1-zTr4tJZMUcGk8H10gpjzdkk,28074
12
- promptbuilder/llm_client/base_client.py,sha256=GS-Qb20WtZnljmEUD2ibhTHDet7exoyhQ0_mGNAEKlg,24219
12
+ promptbuilder/llm_client/base_client.py,sha256=xDDCIAIuLVf6ouItLVzGhP0a3hkr71oTH9jH790zkWE,24556
13
13
  promptbuilder/llm_client/bedrock_client.py,sha256=e9vUClbybQb32028oDBW6IbyPYqj1ZSSv9y36ZqUWxM,27941
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=GdyTbUPsbACXZYF0BnCRyLVw24_WM1R_MMr6pDpiiV4,24787
20
20
  promptbuilder/llm_client/types.py,sha256=2E-aPRb5uAkLFJocmjF1Lh2aQRq9r8a5JRIw-duHfjA,7460
21
21
  promptbuilder/llm_client/utils.py,sha256=79lvSppjrrItHB5MIozbp_5Oq7TsOK4Qzt9Ae3XMLFw,7624
22
- promptbuilder-0.4.21.dist-info/licenses/LICENSE,sha256=fqXmInzgsvEOIaKSBgcrwKyYCGYF0MKErJ0YivtODcc,1096
23
- promptbuilder-0.4.21.dist-info/METADATA,sha256=A44iObCMOJxcKjF6fYxU-O-QugjMPrgkJJJDu2Rm4Vc,3738
24
- promptbuilder-0.4.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- promptbuilder-0.4.21.dist-info/top_level.txt,sha256=UBVcYn4UgrPy3O3fmmnPEU_kieuplBMgheetIMei4EI,14
26
- promptbuilder-0.4.21.dist-info/RECORD,,
22
+ promptbuilder-0.4.22.dist-info/licenses/LICENSE,sha256=fqXmInzgsvEOIaKSBgcrwKyYCGYF0MKErJ0YivtODcc,1096
23
+ promptbuilder-0.4.22.dist-info/METADATA,sha256=GtIz1H1kWvHz_1nyCYbkzmkUwsGLYE5jtaKCpt59eHc,3729
24
+ promptbuilder-0.4.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ promptbuilder-0.4.22.dist-info/top_level.txt,sha256=UBVcYn4UgrPy3O3fmmnPEU_kieuplBMgheetIMei4EI,14
26
+ promptbuilder-0.4.22.dist-info/RECORD,,