freeplay 0.2.39__py3-none-any.whl → 0.2.40__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/api_support.py CHANGED
@@ -76,8 +76,13 @@ def get(target_type: t.Type[T], api_key: str, url: str) -> T:
76
76
  return maybe_object
77
77
 
78
78
 
79
- def get_raw(api_key: str, url: str) -> Response:
79
+ def get_raw(
80
+ api_key: str,
81
+ url: str,
82
+ params: t.Optional[Dict[str, str]] = None
83
+ ) -> Response:
80
84
  return requests.get(
81
85
  url=url,
82
86
  headers=build_request_header(api_key),
87
+ params=params
83
88
  )
freeplay/support.py CHANGED
@@ -21,8 +21,9 @@ JsonDom = Dict[str, Any]
21
21
 
22
22
  class TestCaseTestRunResponse:
23
23
  def __init__(self, test_case: JsonDom):
24
- self.variables: InputVariables = test_case['variables']
25
24
  self.id: str = test_case['id']
25
+ self.variables: InputVariables = test_case['variables']
26
+ self.output: Optional[str] = test_case.get('output')
26
27
 
27
28
 
28
29
  class TestRunResponse:
@@ -104,7 +105,10 @@ class CallSupport:
104
105
  def get_prompt(self, project_id: str, template_name: str, environment: str) -> PromptTemplate:
105
106
  response = api_support.get_raw(
106
107
  api_key=self.freeplay_api_key,
107
- url=f'{self.api_base}/v2/projects/{project_id}/prompt-templates/name/{template_name}'
108
+ url=f'{self.api_base}/v2/projects/{project_id}/prompt-templates/name/{template_name}',
109
+ params={
110
+ 'environment': environment
111
+ }
108
112
  )
109
113
 
110
114
  if response.status_code != 200:
@@ -138,11 +142,19 @@ class CallSupport:
138
142
 
139
143
  return maybe_prompts
140
144
 
141
- def create_test_run(self, project_id: str, testlist: str) -> TestRunResponse:
145
+ def create_test_run(
146
+ self,
147
+ project_id: str,
148
+ testlist: str,
149
+ include_test_case_outputs: bool = False
150
+ ) -> TestRunResponse:
142
151
  response = api_support.post_raw(
143
152
  api_key=self.freeplay_api_key,
144
153
  url=f'{self.api_base}/projects/{project_id}/test-runs-cases',
145
- payload={'testlist_name': testlist},
154
+ payload={
155
+ 'testlist_name': testlist,
156
+ 'include_test_case_outputs': include_test_case_outputs,
157
+ },
146
158
  )
147
159
 
148
160
  if response.status_code != 201:
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass
2
- from typing import List
2
+ from typing import List, Optional
3
3
 
4
4
  from freeplay.model import InputVariables
5
5
  from freeplay.support import CallSupport
@@ -8,9 +8,15 @@ from freeplay.thin.resources.recordings import TestRunInfo
8
8
 
9
9
  @dataclass
10
10
  class TestCase:
11
- def __init__(self, test_case_id: str, variables: InputVariables):
11
+ def __init__(
12
+ self,
13
+ test_case_id: str,
14
+ variables: InputVariables,
15
+ output: Optional[str],
16
+ ):
12
17
  self.id = test_case_id
13
18
  self.variables = variables
19
+ self.output = output
14
20
 
15
21
 
16
22
  @dataclass
@@ -34,10 +40,10 @@ class TestRuns:
34
40
  def __init__(self, call_support: CallSupport) -> None:
35
41
  self.call_support = call_support
36
42
 
37
- def create(self, project_id: str, testlist: str) -> TestRun:
38
- test_run = self.call_support.create_test_run(project_id, testlist)
43
+ def create(self, project_id: str, testlist: str, include_outputs: bool = False) -> TestRun:
44
+ test_run = self.call_support.create_test_run(project_id, testlist, include_outputs)
39
45
  test_cases = [
40
- TestCase(test_case_id=test_case.id, variables=test_case.variables)
46
+ TestCase(test_case_id=test_case.id, variables=test_case.variables, output=test_case.output)
41
47
  for test_case in test_run.test_cases
42
48
  ]
43
49
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: freeplay
3
- Version: 0.2.39
3
+ Version: 0.2.40
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: FreePlay Engineering
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.8
12
12
  Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
15
16
  Requires-Dist: anthropic (>=0.7.7,<0.8.0)
16
17
  Requires-Dist: click (==8.1.7)
17
18
  Requires-Dist: dacite (>=1.8.0,<2.0.0)
@@ -1,5 +1,5 @@
1
1
  freeplay/__init__.py,sha256=74A9S9hmLq9BNHsdx0-37yDxlSukudNl9bJ0TE60Z30,61
2
- freeplay/api_support.py,sha256=u8b1e9prlR4_qOcqmFduU7U35ubQt1tWJ6bXhUdsv0c,2240
2
+ freeplay/api_support.py,sha256=Tmc6VRcmPcIgXrDNJXz0VbBD969t5QHAyV3yZlMsYRI,2331
3
3
  freeplay/completions.py,sha256=F1rMBtQaCtn0rBQqvCurkV25g8gLtwnEod5rRvf-txY,1176
4
4
  freeplay/errors.py,sha256=bPqsw32YX-xSr7O-G49M0sSFF7mq-YF1WGq928UV47s,631
5
5
  freeplay/flavors.py,sha256=9jVvhym9L5zyWM3RTBViibIgG6f6Fh1_63uMEVZAFT4,17259
@@ -10,7 +10,7 @@ freeplay/model.py,sha256=7BRAuyxsLl8X-ue8wXPmAiKYp4OaYI-HkaGc3t5qtMU,534
10
10
  freeplay/provider_config.py,sha256=hruf3Khusrwb76_-hv7ouuxmvJuaRyC1UxIw7XlJx8A,1416
11
11
  freeplay/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  freeplay/record.py,sha256=69vO9vYGFL8gLrvRqLzlvodVNo05GOzKDJnCyhUha08,3615
13
- freeplay/support.py,sha256=tipac902gW1TRICUgxGhO4X645XRglxHHmaqYvqfifo,14197
13
+ freeplay/support.py,sha256=ERXFKxZHl-TfgjJJYW-ssAFdSz_CJIs25wFlCPp4DWc,14535
14
14
  freeplay/thin/__init__.py,sha256=XgU_eMmTpOPCa9w5mVOyxPgwAgRFfVdRWDazYGYZtQ0,351
15
15
  freeplay/thin/freeplay_thin.py,sha256=0w_ECjassczsHJUcpzPxEHUDbiGo7Ey7Ba7vIaWc5ds,1619
16
16
  freeplay/thin/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -18,10 +18,10 @@ freeplay/thin/resources/customer_feedback.py,sha256=aTM7Eez7iYmjXSpRqkHxf4pi6xBr
18
18
  freeplay/thin/resources/prompts.py,sha256=3sfH1k1AAXRfgHxfV6Acws0fAiMswgE93auRKWLGVIQ,10135
19
19
  freeplay/thin/resources/recordings.py,sha256=H_l5_J7nhoL5p0P37JsEC1_XROKc0PDsrV1UomNhy3E,5670
20
20
  freeplay/thin/resources/sessions.py,sha256=ioWdeTM9BSrEWKrFH66ysQIw5kCTlCVopJDmWtFgHz0,868
21
- freeplay/thin/resources/test_runs.py,sha256=L8A1tQHzYg9UmLgbNFtFa8pGXqyrcoyTtSE0sSnd9UE,1267
21
+ freeplay/thin/resources/test_runs.py,sha256=mhRFjR-7z_1wGAkwRjDjALBjT1E6pen91DF8kZHjbLg,1457
22
22
  freeplay/utils.py,sha256=cRCCIzVqWNDKlTI-DDhXGyCkplbd-X4qzDs__aUpvww,1840
23
- freeplay-0.2.39.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
24
- freeplay-0.2.39.dist-info/METADATA,sha256=Ug67atDyXaZQXpe6GorSOSog1ftU0QO7rR6x8j5wcUk,1625
25
- freeplay-0.2.39.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
26
- freeplay-0.2.39.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
27
- freeplay-0.2.39.dist-info/RECORD,,
23
+ freeplay-0.2.40.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
24
+ freeplay-0.2.40.dist-info/METADATA,sha256=nLiaDUCGVR0uvEG-HPL0XOUPFTsQgdZ16XT-LQ5357E,1676
25
+ freeplay-0.2.40.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
26
+ freeplay-0.2.40.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
27
+ freeplay-0.2.40.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.6.1
2
+ Generator: poetry-core 1.8.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any