freeplay 0.5.0a6__tar.gz → 0.5.1__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.
- {freeplay-0.5.0a6 → freeplay-0.5.1}/PKG-INFO +1 -1
- {freeplay-0.5.0a6 → freeplay-0.5.1}/pyproject.toml +1 -1
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/recordings.py +10 -3
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/sessions.py +12 -4
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/support.py +2 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/LICENSE +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/README.md +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/__init__.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/api_support.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/errors.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/freeplay.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/freeplay_cli.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/llm_parameters.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/model.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/py.typed +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/__init__.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/adapters.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/customer_feedback.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/prompts.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/test_cases.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/resources/test_runs.py +0 -0
- {freeplay-0.5.0a6 → freeplay-0.5.1}/src/freeplay/utils.py +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
|
+
import warnings
|
3
4
|
from dataclasses import dataclass, field
|
4
5
|
from typing import Any, Dict, List, Literal, Optional, Union
|
5
6
|
from uuid import UUID, uuid4
|
@@ -91,9 +92,11 @@ class RecordPayload:
|
|
91
92
|
response_info: Optional[ResponseInfo] = None
|
92
93
|
test_run_info: Optional[TestRunInfo] = None
|
93
94
|
eval_results: Optional[Dict[str, Union[bool, float]]] = None
|
94
|
-
|
95
|
+
parent_id: Optional[UUID] = None
|
95
96
|
completion_id: Optional[UUID] = None
|
96
|
-
|
97
|
+
# Deprecated field support for backward compatibility
|
98
|
+
# This field will be removed in v0.6.0
|
99
|
+
trace_info: Optional[TraceInfo] = None
|
97
100
|
|
98
101
|
@dataclass
|
99
102
|
class RecordUpdatePayload:
|
@@ -114,7 +117,7 @@ class Recordings:
|
|
114
117
|
def __init__(self, call_support: CallSupport):
|
115
118
|
self.call_support = call_support
|
116
119
|
|
117
|
-
def create(self, record_payload: RecordPayload) -> RecordResponse:
|
120
|
+
def create(self, record_payload: RecordPayload) -> RecordResponse:
|
118
121
|
if len(record_payload.all_messages) < 1:
|
119
122
|
raise FreeplayClientError("Messages list must have at least one message. "
|
120
123
|
"The last message should be the current response.")
|
@@ -127,6 +130,7 @@ class Recordings:
|
|
127
130
|
"inputs": record_payload.inputs,
|
128
131
|
"tool_schema": record_payload.tool_schema,
|
129
132
|
"session_info": {"custom_metadata": record_payload.session_info.custom_metadata},
|
133
|
+
"parent_id": str(record_payload.parent_id) if record_payload.parent_id is not None else None,
|
130
134
|
}
|
131
135
|
|
132
136
|
if record_payload.prompt_version_info is not None:
|
@@ -171,6 +175,7 @@ class Recordings:
|
|
171
175
|
record_api_payload['eval_results'] = record_payload.eval_results
|
172
176
|
|
173
177
|
if record_payload.trace_info is not None:
|
178
|
+
warnings.warn("trace_info in RecordPayload is deprecated and will be removed in v0.6.0. Use parent_id instead.", DeprecationWarning)
|
174
179
|
record_api_payload['trace_info'] = {
|
175
180
|
"trace_id": record_payload.trace_info.trace_id
|
176
181
|
}
|
@@ -211,6 +216,8 @@ class Recordings:
|
|
211
216
|
f'Status: {status_code}. {e.__class__}'
|
212
217
|
|
213
218
|
raise FreeplayError(message) from e
|
219
|
+
|
220
|
+
raise FreeplayError("Unexpected error occurred while recording to Freeplay.")
|
214
221
|
|
215
222
|
def update(self, record_update_payload: RecordUpdatePayload) -> RecordResponse: # type: ignore
|
216
223
|
record_update_api_payload: Dict[str, Any] = {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
from uuid import UUID, uuid4
|
2
2
|
from dataclasses import dataclass
|
3
3
|
from typing import Optional, Dict, Union
|
4
4
|
|
@@ -18,6 +18,7 @@ class TraceInfo:
|
|
18
18
|
trace_id: str
|
19
19
|
input: Optional[str] = None
|
20
20
|
agent_name: Optional[str] = None
|
21
|
+
parent_id: Optional[UUID] = None
|
21
22
|
custom_metadata: CustomMetadata = None
|
22
23
|
_call_support: CallSupport
|
23
24
|
|
@@ -28,12 +29,14 @@ class TraceInfo:
|
|
28
29
|
_call_support: CallSupport,
|
29
30
|
input: Optional[str] = None,
|
30
31
|
agent_name: Optional[str] = None,
|
32
|
+
parent_id: Optional[UUID] = None,
|
31
33
|
custom_metadata: CustomMetadata = None,
|
32
34
|
):
|
33
35
|
self.trace_id = trace_id
|
34
36
|
self.session_id = session_id
|
35
37
|
self.input = input
|
36
38
|
self.agent_name = agent_name
|
39
|
+
self.parent_id = parent_id
|
37
40
|
self.custom_metadata = custom_metadata
|
38
41
|
self._call_support = _call_support
|
39
42
|
|
@@ -53,6 +56,7 @@ class TraceInfo:
|
|
53
56
|
self.input,
|
54
57
|
output,
|
55
58
|
agent_name=self.agent_name,
|
59
|
+
parent_id=self.parent_id,
|
56
60
|
custom_metadata=self.custom_metadata,
|
57
61
|
eval_results=eval_results,
|
58
62
|
test_run_info=test_run_info
|
@@ -78,11 +82,13 @@ class Session:
|
|
78
82
|
self,
|
79
83
|
input: str,
|
80
84
|
agent_name: Optional[str] = None,
|
85
|
+
parent_id: Optional[UUID] = None,
|
81
86
|
custom_metadata: CustomMetadata = None
|
82
87
|
) -> TraceInfo:
|
83
88
|
return TraceInfo(
|
84
|
-
trace_id=str(
|
89
|
+
trace_id=str(uuid4()),
|
85
90
|
session_id=self.session_id,
|
91
|
+
parent_id=parent_id,
|
86
92
|
input=input,
|
87
93
|
agent_name=agent_name,
|
88
94
|
custom_metadata=custom_metadata,
|
@@ -91,9 +97,10 @@ class Session:
|
|
91
97
|
|
92
98
|
def restore_trace(
|
93
99
|
self,
|
94
|
-
trace_id:
|
100
|
+
trace_id: UUID,
|
95
101
|
input: Optional[str],
|
96
102
|
agent_name: Optional[str] = None,
|
103
|
+
parent_id: Optional[UUID] = None,
|
97
104
|
custom_metadata: CustomMetadata = None
|
98
105
|
) -> TraceInfo:
|
99
106
|
return TraceInfo(
|
@@ -101,6 +108,7 @@ class Session:
|
|
101
108
|
session_id=self.session_id,
|
102
109
|
input=input,
|
103
110
|
agent_name=agent_name,
|
111
|
+
parent_id=parent_id,
|
104
112
|
custom_metadata=custom_metadata,
|
105
113
|
_call_support=self._call_support
|
106
114
|
)
|
@@ -112,7 +120,7 @@ class Sessions:
|
|
112
120
|
|
113
121
|
def create(self, custom_metadata: CustomMetadata = None) -> Session:
|
114
122
|
return Session(
|
115
|
-
session_id=str(
|
123
|
+
session_id=str(uuid4()),
|
116
124
|
custom_metadata=custom_metadata,
|
117
125
|
_call_support=self.call_support,
|
118
126
|
)
|
@@ -400,6 +400,7 @@ class CallSupport:
|
|
400
400
|
trace_id: str,
|
401
401
|
input: str,
|
402
402
|
output: str,
|
403
|
+
parent_id: Optional[UUID] = None,
|
403
404
|
agent_name: Optional[str] = None,
|
404
405
|
custom_metadata: CustomMetadata = None,
|
405
406
|
eval_results: Optional[Dict[str, Union[bool, float]]] = None,
|
@@ -409,6 +410,7 @@ class CallSupport:
|
|
409
410
|
'agent_name': agent_name,
|
410
411
|
'input': input,
|
411
412
|
'output': output,
|
413
|
+
'parent_id': str(parent_id) if parent_id else None,
|
412
414
|
'custom_metadata': custom_metadata,
|
413
415
|
'eval_results': eval_results,
|
414
416
|
'test_run_info': asdict(test_run_info) if test_run_info else None
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|