promptbuilder 0.4.42__tar.gz → 0.4.43__tar.gz

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.
Files changed (41) hide show
  1. {promptbuilder-0.4.42/promptbuilder.egg-info → promptbuilder-0.4.43}/PKG-INFO +1 -1
  2. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/base_client.py +12 -3
  3. {promptbuilder-0.4.42 → promptbuilder-0.4.43/promptbuilder.egg-info}/PKG-INFO +1 -1
  4. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/setup.py +1 -1
  5. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/LICENSE +0 -0
  6. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/MANIFEST.in +0 -0
  7. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/Readme.md +0 -0
  8. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/__init__.py +0 -0
  9. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/agent/__init__.py +0 -0
  10. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/agent/agent.py +0 -0
  11. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/agent/context.py +0 -0
  12. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/agent/tool.py +0 -0
  13. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/agent/utils.py +0 -0
  14. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/embeddings.py +0 -0
  15. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/__init__.py +0 -0
  16. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/aisuite_client.py +0 -0
  17. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/anthropic_client.py +0 -0
  18. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/bedrock_client.py +0 -0
  19. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/config.py +0 -0
  20. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/exceptions.py +0 -0
  21. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/google_client.py +0 -0
  22. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/litellm_client.py +0 -0
  23. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/logfire_decorators.py +0 -0
  24. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/main.py +0 -0
  25. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/openai_client.py +0 -0
  26. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/types.py +0 -0
  27. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/llm_client/utils.py +0 -0
  28. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder/prompt_builder.py +0 -0
  29. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder.egg-info/SOURCES.txt +0 -0
  30. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder.egg-info/dependency_links.txt +0 -0
  31. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder.egg-info/requires.txt +0 -0
  32. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/promptbuilder.egg-info/top_level.txt +0 -0
  33. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/pyproject.toml +0 -0
  34. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/setup.cfg +0 -0
  35. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_google_conversions.py +0 -0
  36. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_llm_client.py +0 -0
  37. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_llm_client_async.py +0 -0
  38. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_models_list.py +0 -0
  39. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_timeout_google.py +0 -0
  40. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_timeout_litellm.py +0 -0
  41. {promptbuilder-0.4.42 → promptbuilder-0.4.43}/tests/test_timeout_openai.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.42
3
+ Version: 0.4.43
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -1,5 +1,6 @@
1
1
  import re
2
2
  import json
3
+ import hjson
3
4
  import os
4
5
  import hashlib
5
6
  import logging
@@ -58,7 +59,15 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
58
59
  return self.provider + ":" + self.model
59
60
 
60
61
  @staticmethod
61
- def as_json(text: str, raise_on_error: bool = True) -> Json:
62
+ @overload
63
+ def as_json(text: str, raise_on_error: Literal[True]) -> Json: ...
64
+
65
+ @staticmethod
66
+ @overload
67
+ def as_json(text: str, raise_on_error: Literal[False]) -> Json | None: ...
68
+
69
+ @staticmethod
70
+ def as_json(text: str, raise_on_error: bool = True) -> Json | None:
62
71
  # Remove markdown code block formatting if present
63
72
  text = text.strip()
64
73
 
@@ -70,8 +79,8 @@ class BaseLLMClient(ABC, utils.InheritDecoratorsMixin):
70
79
  text = match.group(1).strip()
71
80
 
72
81
  try:
73
- return json.loads(text, strict=False)
74
- except json.JSONDecodeError as e:
82
+ return hjson.loads(text, strict=False)
83
+ except hjson.HjsonDecodeError as e:
75
84
  if raise_on_error:
76
85
  raise ValueError(f"Failed to parse LLM response as JSON:\n{text}")
77
86
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: promptbuilder
3
- Version: 0.4.42
3
+ Version: 0.4.43
4
4
  Summary: Library for building prompts for LLMs
5
5
  Home-page: https://github.com/kapulkin/promptbuilder
6
6
  Author: Kapulkin Stanislav
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="promptbuilder",
5
- version="0.4.42",
5
+ version="0.4.43",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "pydantic",
File without changes
File without changes
File without changes