freeplay 0.5.0a5__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.
Files changed (22) hide show
  1. {freeplay-0.5.0a5 → freeplay-0.5.1}/PKG-INFO +1 -1
  2. {freeplay-0.5.0a5 → freeplay-0.5.1}/pyproject.toml +1 -1
  3. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/prompts.py +7 -2
  4. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/recordings.py +15 -10
  5. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/sessions.py +12 -4
  6. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/support.py +2 -0
  7. {freeplay-0.5.0a5 → freeplay-0.5.1}/LICENSE +0 -0
  8. {freeplay-0.5.0a5 → freeplay-0.5.1}/README.md +0 -0
  9. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/__init__.py +0 -0
  10. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/api_support.py +0 -0
  11. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/errors.py +0 -0
  12. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/freeplay.py +0 -0
  13. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/freeplay_cli.py +0 -0
  14. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/llm_parameters.py +0 -0
  15. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/model.py +0 -0
  16. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/py.typed +0 -0
  17. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/__init__.py +0 -0
  18. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/adapters.py +0 -0
  19. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/customer_feedback.py +0 -0
  20. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/test_cases.py +0 -0
  21. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/resources/test_runs.py +0 -0
  22. {freeplay-0.5.0a5 → freeplay-0.5.1}/src/freeplay/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: freeplay
3
- Version: 0.5.0a5
3
+ Version: 0.5.1
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: FreePlay Engineering
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "freeplay"
3
- version = "0.5.0a5"
3
+ version = "0.5.1"
4
4
  description = ""
5
5
  authors = ["FreePlay Engineering <engineering@freeplay.ai>"]
6
6
  license = "MIT"
@@ -93,12 +93,17 @@ GenericProviderMessage = ProviderMessage
93
93
 
94
94
 
95
95
  # SDK-Exposed Classes
96
+
97
+ @dataclass
98
+ class PromptVersionInfo:
99
+ prompt_template_version_id: str
100
+ environment: Optional[str]
101
+
96
102
  @dataclass
97
- class PromptInfo:
103
+ class PromptInfo(PromptVersionInfo):
98
104
  prompt_template_id: str
99
105
  prompt_template_version_id: str
100
106
  template_name: str
101
- environment: Optional[str]
102
107
  model_parameters: LLMParameters
103
108
  provider_info: Optional[Dict[str, Any]]
104
109
  provider: str
@@ -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
@@ -11,14 +12,13 @@ from freeplay.errors import FreeplayClientError, FreeplayError
11
12
  from freeplay.llm_parameters import LLMParameters
12
13
  from freeplay.model import (
13
14
  InputVariables,
14
- MediaInput,
15
15
  MediaInputMap,
16
- MediaInputUrl,
17
16
  OpenAIFunctionCall,
18
17
  TestRunInfo,
19
18
  )
20
19
  from freeplay.resources.prompts import (
21
20
  PromptInfo,
21
+ PromptVersionInfo,
22
22
  )
23
23
  from freeplay.resources.sessions import SessionInfo, TraceInfo
24
24
  from freeplay.support import CallSupport, media_inputs_to_json
@@ -85,16 +85,18 @@ class RecordPayload:
85
85
  default_factory=lambda: SessionInfo(session_id=str(uuid4()), custom_metadata=None)
86
86
  )
87
87
  inputs: Optional[InputVariables] = None
88
- prompt_info: Optional[PromptInfo] = None
88
+ prompt_version_info: Optional[PromptVersionInfo] = None
89
89
  call_info: Optional[CallInfo] = None
90
90
  media_inputs: Optional[MediaInputMap] = None
91
91
  tool_schema: Optional[List[Dict[str, Any]]] = None
92
92
  response_info: Optional[ResponseInfo] = None
93
93
  test_run_info: Optional[TestRunInfo] = None
94
94
  eval_results: Optional[Dict[str, Union[bool, float]]] = None
95
- trace_info: Optional[TraceInfo] = None
95
+ parent_id: Optional[UUID] = None
96
96
  completion_id: Optional[UUID] = None
97
-
97
+ # Deprecated field support for backward compatibility
98
+ # This field will be removed in v0.6.0
99
+ trace_info: Optional[TraceInfo] = None
98
100
 
99
101
  @dataclass
100
102
  class RecordUpdatePayload:
@@ -115,7 +117,7 @@ class Recordings:
115
117
  def __init__(self, call_support: CallSupport):
116
118
  self.call_support = call_support
117
119
 
118
- def create(self, record_payload: RecordPayload) -> RecordResponse: # type: ignore
120
+ def create(self, record_payload: RecordPayload) -> RecordResponse:
119
121
  if len(record_payload.all_messages) < 1:
120
122
  raise FreeplayClientError("Messages list must have at least one message. "
121
123
  "The last message should be the current response.")
@@ -128,13 +130,13 @@ class Recordings:
128
130
  "inputs": record_payload.inputs,
129
131
  "tool_schema": record_payload.tool_schema,
130
132
  "session_info": {"custom_metadata": record_payload.session_info.custom_metadata},
131
-
133
+ "parent_id": str(record_payload.parent_id) if record_payload.parent_id is not None else None,
132
134
  }
133
135
 
134
- if record_payload.prompt_info is not None:
136
+ if record_payload.prompt_version_info is not None:
135
137
  record_api_payload["prompt_info"] = {
136
- "environment": record_payload.prompt_info.environment,
137
- "prompt_template_version_id": record_payload.prompt_info.prompt_template_version_id,
138
+ "environment": record_payload.prompt_version_info.environment,
139
+ "prompt_template_version_id": record_payload.prompt_version_info.prompt_template_version_id,
138
140
  }
139
141
 
140
142
  if record_payload.call_info is not None:
@@ -173,6 +175,7 @@ class Recordings:
173
175
  record_api_payload['eval_results'] = record_payload.eval_results
174
176
 
175
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)
176
179
  record_api_payload['trace_info'] = {
177
180
  "trace_id": record_payload.trace_info.trace_id
178
181
  }
@@ -213,6 +216,8 @@ class Recordings:
213
216
  f'Status: {status_code}. {e.__class__}'
214
217
 
215
218
  raise FreeplayError(message) from e
219
+
220
+ raise FreeplayError("Unexpected error occurred while recording to Freeplay.")
216
221
 
217
222
  def update(self, record_update_payload: RecordUpdatePayload) -> RecordResponse: # type: ignore
218
223
  record_update_api_payload: Dict[str, Any] = {
@@ -1,4 +1,4 @@
1
- import uuid
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(uuid.uuid4()),
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: uuid.UUID,
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(uuid.uuid4()),
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