freeplay 0.3.2__py3-none-any.whl → 0.3.3__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 +1 -0
- freeplay/resources/customer_feedback.py +16 -1
- freeplay/resources/prompts.py +5 -2
- freeplay/resources/test_runs.py +7 -2
- freeplay/support.py +16 -1
- {freeplay-0.3.2.dist-info → freeplay-0.3.3.dist-info}/METADATA +2 -1
- {freeplay-0.3.2.dist-info → freeplay-0.3.3.dist-info}/RECORD +10 -10
- {freeplay-0.3.2.dist-info → freeplay-0.3.3.dist-info}/WHEEL +1 -1
- {freeplay-0.3.2.dist-info → freeplay-0.3.3.dist-info}/LICENSE +0 -0
- {freeplay-0.3.2.dist-info → freeplay-0.3.3.dist-info}/entry_points.txt +0 -0
freeplay/model.py
CHANGED
@@ -4,6 +4,7 @@ from typing import List, Union, Any, Dict, Mapping, TypedDict
|
|
4
4
|
InputValue = Union[str, int, bool, Dict[str, Any], List[Any]]
|
5
5
|
InputVariables = Mapping[str, InputValue]
|
6
6
|
TestRunInput = Mapping[str, InputValue]
|
7
|
+
FeedbackValue = Union[bool, str, int, float]
|
7
8
|
|
8
9
|
|
9
10
|
@dataclass
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
from typing import Dict, Union
|
3
3
|
|
4
|
+
from freeplay.model import FeedbackValue
|
4
5
|
from freeplay.support import CallSupport
|
5
6
|
|
6
7
|
|
@@ -9,10 +10,24 @@ class CustomerFeedbackResponse:
|
|
9
10
|
pass
|
10
11
|
|
11
12
|
|
13
|
+
@dataclass
|
14
|
+
class TraceFeedbackResponse:
|
15
|
+
pass
|
16
|
+
|
17
|
+
|
12
18
|
class CustomerFeedback:
|
13
19
|
def __init__(self, call_support: CallSupport) -> None:
|
14
20
|
self.call_support = call_support
|
15
21
|
|
16
|
-
def update(self, completion_id: str, feedback: Dict[str,
|
22
|
+
def update(self, completion_id: str, feedback: Dict[str, FeedbackValue]) -> CustomerFeedbackResponse:
|
17
23
|
self.call_support.update_customer_feedback(completion_id, feedback)
|
18
24
|
return CustomerFeedbackResponse()
|
25
|
+
|
26
|
+
def update_trace(
|
27
|
+
self,
|
28
|
+
project_id: str,
|
29
|
+
trace_id: str,
|
30
|
+
feedback: Dict[str, FeedbackValue]
|
31
|
+
) -> TraceFeedbackResponse:
|
32
|
+
self.call_support.update_trace_feedback(project_id, trace_id, feedback)
|
33
|
+
return TraceFeedbackResponse()
|
freeplay/resources/prompts.py
CHANGED
@@ -303,8 +303,11 @@ class FilesystemTemplateResolver(TemplateResolver):
|
|
303
303
|
def __normalize_roles(messages: List[Dict[str, str]]) -> List[Dict[str, str]]:
|
304
304
|
normalized = []
|
305
305
|
for message in messages:
|
306
|
-
|
307
|
-
|
306
|
+
if 'kind' in message:
|
307
|
+
normalized.append(message)
|
308
|
+
else:
|
309
|
+
role = FilesystemTemplateResolver.__role_translations.get(message['role']) or message['role']
|
310
|
+
normalized.append({'role': role, 'content': message['content']})
|
308
311
|
return normalized
|
309
312
|
|
310
313
|
@staticmethod
|
freeplay/resources/test_runs.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
|
-
from typing import List, Optional
|
2
|
+
from typing import List, Optional, Dict
|
3
3
|
|
4
4
|
from freeplay.model import InputVariables
|
5
5
|
from freeplay.resources.recordings import TestRunInfo
|
@@ -13,10 +13,12 @@ class TestCase:
|
|
13
13
|
test_case_id: str,
|
14
14
|
variables: InputVariables,
|
15
15
|
output: Optional[str],
|
16
|
+
history: Optional[List[Dict[str, str]]]
|
16
17
|
):
|
17
18
|
self.id = test_case_id
|
18
19
|
self.variables = variables
|
19
20
|
self.output = output
|
21
|
+
self.history = history
|
20
22
|
|
21
23
|
|
22
24
|
@dataclass
|
@@ -64,7 +66,10 @@ class TestRuns:
|
|
64
66
|
) -> TestRun:
|
65
67
|
test_run = self.call_support.create_test_run(project_id, testlist, include_outputs, name, description)
|
66
68
|
test_cases = [
|
67
|
-
TestCase(test_case_id=test_case.id,
|
69
|
+
TestCase(test_case_id=test_case.id,
|
70
|
+
variables=test_case.variables,
|
71
|
+
output=test_case.output,
|
72
|
+
history=test_case.history)
|
68
73
|
for test_case in test_run.test_cases
|
69
74
|
]
|
70
75
|
|
freeplay/support.py
CHANGED
@@ -5,7 +5,7 @@ from typing import Optional, Dict, Any, List, Union
|
|
5
5
|
from freeplay import api_support
|
6
6
|
from freeplay.api_support import try_decode
|
7
7
|
from freeplay.errors import freeplay_response_error, FreeplayServerError
|
8
|
-
from freeplay.model import InputVariables
|
8
|
+
from freeplay.model import InputVariables, FeedbackValue
|
9
9
|
|
10
10
|
|
11
11
|
@dataclass
|
@@ -49,6 +49,7 @@ class TestCaseTestRunResponse:
|
|
49
49
|
self.variables: InputVariables = test_case['variables']
|
50
50
|
self.id: str = test_case['test_case_id']
|
51
51
|
self.output: Optional[str] = test_case.get('output')
|
52
|
+
self.history: Optional[List[Dict[str, str]]] = test_case.get('history')
|
52
53
|
|
53
54
|
|
54
55
|
class TestRunResponse:
|
@@ -163,6 +164,20 @@ class CallSupport:
|
|
163
164
|
if response.status_code != 201:
|
164
165
|
raise freeplay_response_error("Error updating customer feedback", response)
|
165
166
|
|
167
|
+
def update_trace_feedback(
|
168
|
+
self, project_id: str, trace_id: str, feedback: Dict[str, FeedbackValue]
|
169
|
+
) -> None:
|
170
|
+
response = api_support.post_raw(
|
171
|
+
self.freeplay_api_key,
|
172
|
+
f'{self.api_base}/v2/projects/{project_id}/trace-feedback/id/{trace_id}',
|
173
|
+
feedback
|
174
|
+
)
|
175
|
+
if response.status_code != 201:
|
176
|
+
raise freeplay_response_error(
|
177
|
+
f'Error updating trace feedback for {trace_id} in project {project_id}',
|
178
|
+
response
|
179
|
+
)
|
180
|
+
|
166
181
|
def create_test_run(
|
167
182
|
self,
|
168
183
|
project_id: str,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: freeplay
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.3
|
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: click (==8.1.7)
|
16
17
|
Requires-Dist: dacite (>=1.8.0,<2.0.0)
|
17
18
|
Requires-Dist: pystache (>=0.6.5,<0.7.0)
|
@@ -4,18 +4,18 @@ freeplay/errors.py,sha256=vwotUBldxDzREZOmLUeoiDoZjcvDwgH1AMwKBLhLooE,807
|
|
4
4
|
freeplay/freeplay.py,sha256=cj0TGxIziS5tEL12czMJrrKrCKRoYR_Qxsipg3ClpsU,1496
|
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=
|
7
|
+
freeplay/model.py,sha256=LrBUOSbkNuBV44fl2Wq3UO54dQt0AlUBBjs3f5sK0HM,429
|
8
8
|
freeplay/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
freeplay/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
freeplay/resources/customer_feedback.py,sha256=
|
11
|
-
freeplay/resources/prompts.py,sha256=
|
10
|
+
freeplay/resources/customer_feedback.py,sha256=bw8MfEOKbGgn4FOyvcADrcs9GhcpNXNTgxKjBjIzywE,899
|
11
|
+
freeplay/resources/prompts.py,sha256=I9dwRm6nT9lKlKzewQ2rGSsmM1vn0T_H_cPqRy-UaPI,18863
|
12
12
|
freeplay/resources/recordings.py,sha256=kUElo6Yvc6lyo221ghbElx75uxftw7HpgBV_R9gYlE4,5938
|
13
13
|
freeplay/resources/sessions.py,sha256=pgfqCBa-qGwwdfym9nnHizEg0Jf4sd_chLAfunwtMCQ,2787
|
14
|
-
freeplay/resources/test_runs.py,sha256=
|
15
|
-
freeplay/support.py,sha256=
|
14
|
+
freeplay/resources/test_runs.py,sha256=qF4CE4XiX_6epcs5bFKJg73C94YgrJQTxnCJLBERkos,2549
|
15
|
+
freeplay/support.py,sha256=nuly_GCWEAEz0CmjlviadKK2_r4X6RdxxiQ6yo78wdk,8449
|
16
16
|
freeplay/utils.py,sha256=8ZncuwCnzsAhRsaoxOMGa0Py8kXqGHlB9Avr3n79fk0,2064
|
17
|
-
freeplay-0.3.
|
18
|
-
freeplay-0.3.
|
19
|
-
freeplay-0.3.
|
20
|
-
freeplay-0.3.
|
21
|
-
freeplay-0.3.
|
17
|
+
freeplay-0.3.3.dist-info/LICENSE,sha256=_jzIw45hB1XHGxiQ8leZ0GH_X7bR_a8qgxaqnHbCUOo,1064
|
18
|
+
freeplay-0.3.3.dist-info/METADATA,sha256=EroyDAvZii-2KfR9xvNjqcUOIGuW78yooSvNwFDRxTA,1602
|
19
|
+
freeplay-0.3.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
20
|
+
freeplay-0.3.3.dist-info/entry_points.txt,sha256=32s3rf2UUCqiJT4jnClEXZhdXlvl30uwpcxz-Gsy4UU,54
|
21
|
+
freeplay-0.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|