freeplay 0.3.0a1__py3-none-any.whl → 0.3.0a2__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.
freeplay/model.py CHANGED
@@ -1,16 +1,8 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import List, Union, Any, Dict, Mapping, TypedDict
3
3
 
4
- from pydantic import RootModel
5
-
6
4
  InputValue = Union[str, int, bool, Dict[str, Any], List[Any]]
7
- InputVariable = RootModel[Union[Dict[str, "InputVariable"], List["InputVariable"], str, int, bool, float]]
8
- InputVariable.model_rebuild()
9
-
10
5
  InputVariables = Mapping[str, InputValue]
11
-
12
- PydanticInputVariables = RootModel[Dict[str, InputVariable]]
13
-
14
6
  TestRunInput = Mapping[str, InputValue]
15
7
 
16
8
 
freeplay/utils.py CHANGED
@@ -1,19 +1,27 @@
1
- from typing import Dict, Union, Optional
1
+ from typing import Dict, Union, Optional, Any
2
2
  import importlib.metadata
3
3
  import platform
4
4
 
5
5
  import pystache # type: ignore
6
- from pydantic import ValidationError
7
6
 
8
7
  from .errors import FreeplayError, FreeplayConfigurationError
9
- from .model import PydanticInputVariables, InputVariables
8
+ from .model import InputVariables
9
+
10
+
11
+ # Validate that the variables are of the correct type, and do not include functions, dates, classes or None values.
12
+ def all_valid(obj: Any) -> bool:
13
+ if isinstance(obj, (int, str, bool)):
14
+ return True
15
+ elif isinstance(obj, list):
16
+ return all(all_valid(item) for item in obj)
17
+ elif isinstance(obj, dict):
18
+ return all(isinstance(key, str) and all_valid(value) for key, value in obj.items())
19
+ else:
20
+ return False
10
21
 
11
22
 
12
23
  def bind_template_variables(template: str, variables: InputVariables) -> str:
13
- # Validate that the variables are of the correct type, and do not include functions or None values.
14
- try:
15
- PydanticInputVariables.model_validate(variables)
16
- except ValidationError as err:
24
+ if not all_valid(variables):
17
25
  raise FreeplayError(
18
26
  'Variables must be a string, number, bool, or a possibly nested'
19
27
  ' list or dict of strings, numbers and booleans.'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: freeplay
3
- Version: 0.3.0a1
3
+ Version: 0.3.0a2
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: FreePlay Engineering
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: click (==8.1.7)
17
17
  Requires-Dist: dacite (>=1.8.0,<2.0.0)
18
- Requires-Dist: pydantic (>=2.6.3,<3.0.0)
19
18
  Requires-Dist: pystache (>=0.6.5,<0.7.0)
20
19
  Requires-Dist: requests (>=2.20.0,<3.0.0dev)
21
20
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ freeplay/errors.py,sha256=bPqsw32YX-xSr7O-G49M0sSFF7mq-YF1WGq928UV47s,631
4
4
  freeplay/freeplay.py,sha256=vwtgLNcHnXTAjyuXU1cOjvYuLBqcZ-RQDAjdFAKh7q0,1479
5
5
  freeplay/freeplay_cli.py,sha256=lmdsYwzdpWmUKHz_ieCzB-e6j1EnDHlVw3XIEyP_NEk,3460
6
6
  freeplay/llm_parameters.py,sha256=bQbfuC8EICF0XMZQa5pwI3FkQqxmCUVqHO3gYHy3Tg8,898
7
- freeplay/model.py,sha256=O_Zk5W7gKgmkZ3_CvgP42nREM1irEFaRi8dCqOOfJe8,617
7
+ freeplay/model.py,sha256=pC24wUsedD4RTI4k1BcYuDjizroeEHINH6FtEa_RLCk,384
8
8
  freeplay/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  freeplay/resources/customer_feedback.py,sha256=aTM7Eez7iYmjXSpRqkHxf4pi6xBrzVnMiQCEJVfPGvg,527
10
10
  freeplay/resources/prompts.py,sha256=MvrB7rAuHMzRyz6kH9NqfD5Yt33g-pmK7x0tVlyM2Cs,12476
@@ -12,9 +12,9 @@ freeplay/resources/recordings.py,sha256=6hrunYZtWFgGBZx4HzZRKcEYCzHbmaBVH48lBcXr
12
12
  freeplay/resources/sessions.py,sha256=ioWdeTM9BSrEWKrFH66ysQIw5kCTlCVopJDmWtFgHz0,868
13
13
  freeplay/resources/test_runs.py,sha256=2NAwoW_Yx7K8YM7QyQ3sv9dN6p0gjNgUAR7wSzLYP6w,1452
14
14
  freeplay/support.py,sha256=7BizelIEIaSRFj2IL53-RQkjncUNlUS-DPUln2VxoJg,4532
15
- freeplay/utils.py,sha256=cRCCIzVqWNDKlTI-DDhXGyCkplbd-X4qzDs__aUpvww,1840
16
- freeplay-0.3.0a1.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
17
- freeplay-0.3.0a1.dist-info/METADATA,sha256=DXjd1Vm-1d1NZxgpicUltqAvUA8WuCDlHA4HBhj4-Rw,1645
18
- freeplay-0.3.0a1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
19
- freeplay-0.3.0a1.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
20
- freeplay-0.3.0a1.dist-info/RECORD,,
15
+ freeplay/utils.py,sha256=8ZncuwCnzsAhRsaoxOMGa0Py8kXqGHlB9Avr3n79fk0,2064
16
+ freeplay-0.3.0a2.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
17
+ freeplay-0.3.0a2.dist-info/METADATA,sha256=btKL7QhbCkbZKOo_EplzS33-fsoSH8q66iAnaYI_1iY,1604
18
+ freeplay-0.3.0a2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
19
+ freeplay-0.3.0a2.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
20
+ freeplay-0.3.0a2.dist-info/RECORD,,