synth-ai 0.1.0.dev26__py3-none-any.whl → 0.1.0.dev28__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.
@@ -94,11 +94,122 @@ class TestSonnetThinking(unittest.TestCase):
94
94
  print(f"Medium Effort Response:\n{response_medium}\n")
95
95
  self.assertIsInstance(response_medium, str)
96
96
 
97
+ async def test_thinking_blocks_attributes(self):
98
+ """Test to verify thinking blocks have the correct attributes and structure"""
99
+ messages = [
100
+ {"role": "system", "content": "You are a helpful AI assistant."},
101
+ {
102
+ "role": "user",
103
+ "content": "Please solve this math problem step by step: If a train travels at 60 mph for 2.5 hours, how far does it travel?",
104
+ },
105
+ ]
106
+
107
+ print("\n=== Testing Thinking Blocks Structure ===")
108
+ try:
109
+ response = await self.lm.respond_async(messages=messages)
110
+ print(f"Response received successfully: {response[:100]}...")
111
+ self.assertIsInstance(response, str)
112
+ self.assertGreater(len(response), 0)
113
+ except AttributeError as e:
114
+ if "'TextBlock' object has no attribute 'value'" in str(e):
115
+ self.fail(
116
+ "TextBlock missing 'value' attribute - API response structure may have changed"
117
+ )
118
+ raise
119
+
120
+ async def test_thinking_blocks_with_structured_output(self):
121
+ """Test thinking blocks with structured output to verify attribute handling"""
122
+ from pydantic import BaseModel
123
+
124
+ class SimpleResponse(BaseModel):
125
+ answer: str
126
+ explanation: str
127
+
128
+ messages = [
129
+ {"role": "system", "content": "You are a helpful AI assistant."},
130
+ {"role": "user", "content": "What is 2+2? Provide answer and explanation."},
131
+ ]
132
+
133
+ print("\n=== Testing Thinking Blocks with Structured Output ===")
134
+ try:
135
+ response = await self.lm.respond_async(
136
+ messages=messages, response_model=SimpleResponse
137
+ )
138
+ print(f"Structured response received: {response}")
139
+ self.assertIsInstance(response, SimpleResponse)
140
+ self.assertTrue(hasattr(response, "answer"))
141
+ self.assertTrue(hasattr(response, "explanation"))
142
+ except AttributeError as e:
143
+ if "'TextBlock' object has no attribute 'value'" in str(e):
144
+ self.fail("TextBlock missing 'value' attribute in structured output")
145
+ raise
146
+
147
+ async def test_thinking_blocks_raw_response(self):
148
+ """Test to examine the raw response structure from the API"""
149
+ messages = [
150
+ {"role": "system", "content": "You are a helpful AI assistant."},
151
+ {"role": "user", "content": "Count from 1 to 3."},
152
+ ]
153
+
154
+ print("\n=== Testing Raw Response Structure ===")
155
+ try:
156
+ # Access the raw response if possible
157
+ response = await self.lm.respond_async(messages=messages)
158
+ print(f"Raw response type: {type(response)}")
159
+ print(f"Raw response content: {response}")
160
+
161
+ # Add detailed response structure inspection
162
+ print("\nResponse Structure Details:")
163
+ print(f"Is string: {isinstance(response, str)}")
164
+ if hasattr(response, "content"):
165
+ for i, block in enumerate(response.content):
166
+ print(f"\nBlock {i}:")
167
+ print(f"Type: {block.type}")
168
+ print(f"Available attributes: {dir(block)}")
169
+ if hasattr(block, "text"):
170
+ print(f"Has .text: {block.text}")
171
+ if hasattr(block, "value"):
172
+ print(f"Has .value: {block.value}")
173
+
174
+ self.assertIsInstance(response, str)
175
+ except Exception as e:
176
+ print(f"Exception type: {type(e)}")
177
+ print(f"Exception message: {str(e)}")
178
+ print(f"Full exception details: {dir(e)}")
179
+ raise
180
+
181
+ async def test_thinking_blocks_structure(self):
182
+ """Test specifically for thinking blocks structure"""
183
+ messages = [
184
+ {"role": "system", "content": "You are a helpful AI assistant."},
185
+ {"role": "user", "content": "What is 2+2?"},
186
+ ]
187
+
188
+ print("\n=== Testing Thinking Blocks Structure ===")
189
+ try:
190
+ # Set high reasoning effort to trigger thinking
191
+ self.lm.lm_config["reasoning_effort"] = "high"
192
+ response = await self.lm.respond_async(messages=messages)
193
+ print(f"Response with thinking:\n{response}")
194
+ self.assertIsInstance(response, str)
195
+ self.assertGreater(len(response), 0)
196
+ except AttributeError as e:
197
+ print(f"Attribute Error Details:")
198
+ print(f"Error message: {str(e)}")
199
+ print(f"Error type: {type(e)}")
200
+ if hasattr(e, "__context__"):
201
+ print(f"Context: {e.__context__}")
202
+ raise
203
+
97
204
  def test_all(self):
98
205
  print("\nStarting Claude 3.7 Sonnet Thinking Tests...")
99
206
  asyncio.run(self.test_thinking_response())
100
207
  asyncio.run(self.test_thinking_structured_output())
101
208
  asyncio.run(self.test_thinking_with_high_effort())
209
+ asyncio.run(self.test_thinking_blocks_attributes())
210
+ asyncio.run(self.test_thinking_blocks_with_structured_output())
211
+ asyncio.run(self.test_thinking_blocks_raw_response())
212
+ asyncio.run(self.test_thinking_blocks_structure())
102
213
  print("\nAll tests completed successfully!")
103
214
 
104
215
 
@@ -114,7 +114,7 @@ class AnthropicAPI(VendorBase):
114
114
  thinking_blocks = [
115
115
  block for block in response.content if block.type == "text"
116
116
  ]
117
- api_result = thinking_blocks[-1].value if thinking_blocks else ""
117
+ api_result = thinking_blocks[-1].text if thinking_blocks else ""
118
118
 
119
119
  used_cache_handler.add_to_managed_cache(
120
120
  model, messages, lm_config=lm_config, output=api_result
@@ -196,7 +196,7 @@ class AnthropicAPI(VendorBase):
196
196
  thinking_blocks = [
197
197
  block for block in response.content if block.type == "text"
198
198
  ]
199
- api_result = thinking_blocks[-1].value if thinking_blocks else ""
199
+ api_result = thinking_blocks[-1].text if thinking_blocks else ""
200
200
 
201
201
  used_cache_handler.add_to_managed_cache(
202
202
  model, messages, lm_config=lm_config, output=api_result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: synth-ai
3
- Version: 0.1.0.dev26
3
+ Version: 0.1.0.dev28
4
4
  Summary: Software for aiding the best and multiplying the will.
5
5
  Home-page: https://github.com/synth-laboratories/synth-ai
6
6
  Author: Josh Purtell
@@ -4,7 +4,7 @@ public_tests/test_all_structured_outputs.py,sha256=x7Gj5Ykpw8Ut_XlSOEBHRLJSagYSH
4
4
  public_tests/test_models.py,sha256=7ZJ2HPDZWhcIeZDDu8Iyt5lOy1xpKpYHM8FzsyEKQmc,5703
5
5
  public_tests/test_reasoning_models.py,sha256=twKNTrWyeTgtqSC2A4V0g79Uq_SjZiBeWp6ntJIAGNM,2779
6
6
  public_tests/test_recursive_structured_outputs.py,sha256=Ne-9XwnOxN7eSpGbNHOpegR-sRj589I84T6y8Z_4QnA,5781
7
- public_tests/test_sonnet_thinking.py,sha256=SqDKQbjVVhFPBZfS-C0vY_9Hn7Qo-0XEujp0uekU2Ro,3809
7
+ public_tests/test_sonnet_thinking.py,sha256=jZREMZ4JMDkBflqwJbzd-OQ4PUEjn5m4VgwjSCX04MQ,8749
8
8
  public_tests/test_structured_outputs.py,sha256=MZitgGedFlvxeaVFzuDQb2xXs8apwvDLTINpGBfsTdM,3653
9
9
  public_tests/test_synth_sdk.py,sha256=jqJHKpvBn9qj21P76z9onXfPg88jyUmBTKmdvCsQMk8,14885
10
10
  synth_ai/__init__.py,sha256=2siivzLbT2r-EA7m91dcJB-6Vsurc5_sX3WiKf4_o8Y,198
@@ -36,7 +36,7 @@ synth_ai/zyk/lms/vendors/constants.py,sha256=zqCOyXZqo297wboR9EKVSkvpq6JCMSJyeso
36
36
  synth_ai/zyk/lms/vendors/openai_standard.py,sha256=TJz1u6IcJ1KHjbofyHs0rlFa13smVXFTtqBSVqEYJqo,5818
37
37
  synth_ai/zyk/lms/vendors/retries.py,sha256=m-WvAiPix9ovnO2S-m53Td5VZDWBVBFuHuSK9--OVxw,38
38
38
  synth_ai/zyk/lms/vendors/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
- synth_ai/zyk/lms/vendors/core/anthropic_api.py,sha256=rVAVrjgMXeih3qbISBHf1euilue9Au1n-xDDyQB81n0,12594
39
+ synth_ai/zyk/lms/vendors/core/anthropic_api.py,sha256=l75WSqR7pS0gNRI-x0GyTkz8UL40o9Q2xwK-Rq5pddk,12592
40
40
  synth_ai/zyk/lms/vendors/core/gemini_api.py,sha256=Cp8BpSk1yCC3SYrEK1pFOnCdUc65XIPonFEirZ6W2rA,5395
41
41
  synth_ai/zyk/lms/vendors/core/mistral_api.py,sha256=m11ItQ46VyyCUy6hv6mw5OmiqwHr07wV_NJVNnPHgiA,8080
42
42
  synth_ai/zyk/lms/vendors/core/openai_api.py,sha256=700M0QfAxDZXAURnlY--ReEwIEPJPMCwY0JIpu4vptM,5881
@@ -47,11 +47,11 @@ synth_ai/zyk/lms/vendors/supported/deepseek.py,sha256=diFfdhPMO5bLFZxnYj7VT0v6jK
47
47
  synth_ai/zyk/lms/vendors/supported/groq.py,sha256=Fbi7QvhdLx0F-VHO5PY-uIQlPR0bo3C9h1MvIOx8nz0,388
48
48
  synth_ai/zyk/lms/vendors/supported/ollama.py,sha256=K30VBFRTd7NYyPmyBVRZS2sm0UB651AHp9i3wd55W64,469
49
49
  synth_ai/zyk/lms/vendors/supported/together.py,sha256=Ni_jBqqGPN0PkkY-Ew64s3gNKk51k3FCpLSwlNhKbf0,342
50
- synth_ai-0.1.0.dev26.dist-info/licenses/LICENSE,sha256=ynhjRQUfqA_RdGRATApfFA_fBAy9cno04sLtLUqxVFM,1069
50
+ synth_ai-0.1.0.dev28.dist-info/licenses/LICENSE,sha256=ynhjRQUfqA_RdGRATApfFA_fBAy9cno04sLtLUqxVFM,1069
51
51
  tests/test_agent.py,sha256=CjPPWuMWC_TzX1DkDald-bbAxgjXE-HPQvFhq2B--5k,22363
52
52
  tests/test_recursive_structured_outputs.py,sha256=Ne-9XwnOxN7eSpGbNHOpegR-sRj589I84T6y8Z_4QnA,5781
53
53
  tests/test_structured_outputs.py,sha256=J7sfbGZ7OeB5ONIKpcCTymyayNyAdFfGokC1bcUrSx0,3651
54
- synth_ai-0.1.0.dev26.dist-info/METADATA,sha256=komo_GbGRf8PbB5uHKqKNCEnHK1cRK9GTvzAEoUFsFM,2795
55
- synth_ai-0.1.0.dev26.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
56
- synth_ai-0.1.0.dev26.dist-info/top_level.txt,sha256=5GzJO9j-KbJ_4ppxhmCUa_qdhHM4-9cHHNU76yAI8do,42
57
- synth_ai-0.1.0.dev26.dist-info/RECORD,,
54
+ synth_ai-0.1.0.dev28.dist-info/METADATA,sha256=HLddXeCXyIpgrBJSD8sQ4iKH7MmArT_-XhGhlVwv7tE,2795
55
+ synth_ai-0.1.0.dev28.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
56
+ synth_ai-0.1.0.dev28.dist-info/top_level.txt,sha256=5GzJO9j-KbJ_4ppxhmCUa_qdhHM4-9cHHNU76yAI8do,42
57
+ synth_ai-0.1.0.dev28.dist-info/RECORD,,