synth-ai 0.1.0.dev38__py3-none-any.whl → 0.1.0.dev49__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.
Files changed (69) hide show
  1. synth_ai/__init__.py +3 -1
  2. {synth_ai-0.1.0.dev38.dist-info → synth_ai-0.1.0.dev49.dist-info}/METADATA +12 -11
  3. synth_ai-0.1.0.dev49.dist-info/RECORD +6 -0
  4. {synth_ai-0.1.0.dev38.dist-info → synth_ai-0.1.0.dev49.dist-info}/WHEEL +1 -1
  5. synth_ai-0.1.0.dev49.dist-info/top_level.txt +1 -0
  6. private_tests/try_synth_sdk.py +0 -1
  7. public_tests/test_agent.py +0 -538
  8. public_tests/test_all_structured_outputs.py +0 -196
  9. public_tests/test_anthropic_structured_outputs.py +0 -0
  10. public_tests/test_deepseek_structured_outputs.py +0 -0
  11. public_tests/test_deepseek_tools.py +0 -64
  12. public_tests/test_gemini_output.py +0 -188
  13. public_tests/test_gemini_structured_outputs.py +0 -106
  14. public_tests/test_models.py +0 -183
  15. public_tests/test_openai_structured_outputs.py +0 -106
  16. public_tests/test_reasoning_effort.py +0 -75
  17. public_tests/test_reasoning_models.py +0 -92
  18. public_tests/test_recursive_structured_outputs.py +0 -180
  19. public_tests/test_structured.py +0 -137
  20. public_tests/test_structured_outputs.py +0 -109
  21. public_tests/test_synth_sdk.py +0 -384
  22. public_tests/test_text.py +0 -160
  23. public_tests/test_tools.py +0 -319
  24. synth_ai/zyk/__init__.py +0 -3
  25. synth_ai/zyk/lms/__init__.py +0 -0
  26. synth_ai/zyk/lms/caching/__init__.py +0 -0
  27. synth_ai/zyk/lms/caching/constants.py +0 -1
  28. synth_ai/zyk/lms/caching/dbs.py +0 -0
  29. synth_ai/zyk/lms/caching/ephemeral.py +0 -72
  30. synth_ai/zyk/lms/caching/handler.py +0 -142
  31. synth_ai/zyk/lms/caching/initialize.py +0 -13
  32. synth_ai/zyk/lms/caching/persistent.py +0 -83
  33. synth_ai/zyk/lms/config.py +0 -8
  34. synth_ai/zyk/lms/core/__init__.py +0 -0
  35. synth_ai/zyk/lms/core/all.py +0 -47
  36. synth_ai/zyk/lms/core/exceptions.py +0 -9
  37. synth_ai/zyk/lms/core/main.py +0 -314
  38. synth_ai/zyk/lms/core/vendor_clients.py +0 -85
  39. synth_ai/zyk/lms/cost/__init__.py +0 -0
  40. synth_ai/zyk/lms/cost/monitor.py +0 -1
  41. synth_ai/zyk/lms/cost/statefulness.py +0 -1
  42. synth_ai/zyk/lms/structured_outputs/__init__.py +0 -0
  43. synth_ai/zyk/lms/structured_outputs/handler.py +0 -442
  44. synth_ai/zyk/lms/structured_outputs/inject.py +0 -314
  45. synth_ai/zyk/lms/structured_outputs/rehabilitate.py +0 -187
  46. synth_ai/zyk/lms/tools/base.py +0 -104
  47. synth_ai/zyk/lms/vendors/__init__.py +0 -0
  48. synth_ai/zyk/lms/vendors/base.py +0 -31
  49. synth_ai/zyk/lms/vendors/constants.py +0 -22
  50. synth_ai/zyk/lms/vendors/core/__init__.py +0 -0
  51. synth_ai/zyk/lms/vendors/core/anthropic_api.py +0 -413
  52. synth_ai/zyk/lms/vendors/core/gemini_api.py +0 -306
  53. synth_ai/zyk/lms/vendors/core/mistral_api.py +0 -327
  54. synth_ai/zyk/lms/vendors/core/openai_api.py +0 -185
  55. synth_ai/zyk/lms/vendors/local/__init__.py +0 -0
  56. synth_ai/zyk/lms/vendors/local/ollama.py +0 -0
  57. synth_ai/zyk/lms/vendors/openai_standard.py +0 -375
  58. synth_ai/zyk/lms/vendors/retries.py +0 -3
  59. synth_ai/zyk/lms/vendors/supported/__init__.py +0 -0
  60. synth_ai/zyk/lms/vendors/supported/deepseek.py +0 -73
  61. synth_ai/zyk/lms/vendors/supported/groq.py +0 -16
  62. synth_ai/zyk/lms/vendors/supported/ollama.py +0 -14
  63. synth_ai/zyk/lms/vendors/supported/together.py +0 -11
  64. synth_ai-0.1.0.dev38.dist-info/RECORD +0 -67
  65. synth_ai-0.1.0.dev38.dist-info/top_level.txt +0 -4
  66. tests/test_agent.py +0 -538
  67. tests/test_recursive_structured_outputs.py +0 -180
  68. tests/test_structured_outputs.py +0 -100
  69. {synth_ai-0.1.0.dev38.dist-info → synth_ai-0.1.0.dev49.dist-info}/licenses/LICENSE +0 -0
@@ -1,180 +0,0 @@
1
- import asyncio
2
- import unittest
3
- from typing import List
4
-
5
- from pydantic import BaseModel, Field
6
-
7
- from synth_ai.zyk.lms.core.main import LM
8
-
9
-
10
- # Define example structured output models
11
- class SimpleResponse(BaseModel):
12
- message: str
13
- confidence: float
14
-
15
-
16
- class ComplexResponse(BaseModel):
17
- title: str
18
- tags: List[str]
19
- content: str
20
-
21
-
22
- class NestedResponse(BaseModel):
23
- main_category: str
24
- subcategories: List[str]
25
- details: SimpleResponse
26
-
27
-
28
- # Define nested structured output models
29
- class Address(BaseModel):
30
- street: str
31
- city: str
32
- country: str
33
-
34
-
35
- class PersonalInfo(BaseModel):
36
- name: str
37
- age: int
38
- address: Address
39
-
40
-
41
- class WorkInfo(BaseModel):
42
- company: str
43
- position: str
44
- years_experience: int
45
-
46
-
47
- class NestedPersonResponse(BaseModel):
48
- personal: PersonalInfo
49
- work: WorkInfo
50
- skills: List[str]
51
-
52
-
53
- class ProjectDetails(BaseModel):
54
- name: str
55
- description: str
56
- technologies: List[str]
57
-
58
-
59
- class NestedPortfolioResponse(BaseModel):
60
- developer: PersonalInfo
61
- projects: List[ProjectDetails]
62
- total_experience: int
63
-
64
-
65
- class NestedCompanyResponse(BaseModel):
66
- name: str
67
- founded: int
68
- headquarters: Address
69
- employees: List[PersonalInfo]
70
- main_products: List[str]
71
-
72
-
73
- class TestLMStructuredOutputs(unittest.TestCase):
74
- @classmethod
75
- def setUpClass(cls):
76
- # Initialize the LM once for all tests
77
- cls.lm = LM(
78
- model_name="gpt-4o-mini",
79
- formatting_model_name="gpt-4o-mini",
80
- temperature=0.7,
81
- max_retries="Few",
82
- structured_output_mode="forced_json",
83
- )
84
-
85
- def test_sync_simple_response(self):
86
- result = self.lm.respond_sync(
87
- system_message="You are a helpful assistant.",
88
- user_message="Give me a short greeting and your confidence level.",
89
- response_model=SimpleResponse,
90
- )
91
- self.assertIsInstance(result, SimpleResponse)
92
- self.assertIsInstance(result.message, str)
93
- self.assertIsInstance(result.confidence, float)
94
- self.assertGreaterEqual(result.confidence, 0)
95
- self.assertLessEqual(result.confidence, 1)
96
-
97
- def test_sync_complex_response(self):
98
- result = self.lm.respond_sync(
99
- system_message="You are a content creator.",
100
- user_message="Create a short blog post about AI.",
101
- response_model=ComplexResponse,
102
- )
103
- self.assertIsInstance(result, ComplexResponse)
104
- self.assertIsInstance(result.title, str)
105
- self.assertIsInstance(result.tags, list)
106
- self.assertIsInstance(result.content, str)
107
-
108
- async def async_nested_response(self):
109
- result = await self.lm.respond_async(
110
- system_message="You are a categorization expert.",
111
- user_message="Categorize 'Python' and provide a brief description.",
112
- response_model=NestedResponse,
113
- )
114
- self.assertIsInstance(result, NestedResponse)
115
- self.assertIsInstance(result.main_category, str)
116
- self.assertIsInstance(result.subcategories, list)
117
- self.assertIsInstance(result.details, SimpleResponse)
118
-
119
- def test_async_nested_response(self):
120
- asyncio.run(self.async_nested_response())
121
-
122
-
123
- class TestLMNestedStructuredOutputs(unittest.TestCase):
124
- @classmethod
125
- def setUpClass(cls):
126
- # Initialize the LM once for all tests
127
- cls.lm = LM(
128
- model_name="gpt-4o-mini",
129
- formatting_model_name="gpt-4o-mini",
130
- temperature=0.7,
131
- max_retries="Few",
132
- structured_output_mode="forced_json",
133
- )
134
-
135
- def test_sync_nested_person_response(self):
136
- result = self.lm.respond_sync(
137
- system_message="You are an HR assistant.",
138
- user_message="Provide detailed information about a fictional employee named John Doe.",
139
- response_model=NestedPersonResponse,
140
- )
141
- self.assertIsInstance(result, NestedPersonResponse)
142
- self.assertIsInstance(result.personal, PersonalInfo)
143
- self.assertIsInstance(result.personal.address, Address)
144
- self.assertIsInstance(result.work, WorkInfo)
145
- self.assertIsInstance(result.skills, list)
146
-
147
- def test_sync_nested_portfolio_response(self):
148
- result = self.lm.respond_sync(
149
- system_message="You are a portfolio manager.",
150
- user_message="Create a portfolio for a fictional software developer with multiple projects.",
151
- response_model=NestedPortfolioResponse,
152
- )
153
- self.assertIsInstance(result, NestedPortfolioResponse)
154
- self.assertIsInstance(result.developer, PersonalInfo)
155
- self.assertIsInstance(result.developer.address, Address)
156
- self.assertIsInstance(result.projects, list)
157
- for project in result.projects:
158
- self.assertIsInstance(project, ProjectDetails)
159
- self.assertIsInstance(result.total_experience, int)
160
-
161
- async def async_nested_company_response(self):
162
- result = await self.lm.respond_async(
163
- system_message="You are a company information specialist.",
164
- user_message="Provide detailed information about a fictional tech company.",
165
- response_model=NestedCompanyResponse,
166
- )
167
- self.assertIsInstance(result, NestedCompanyResponse)
168
- self.assertIsInstance(result.headquarters, Address)
169
- self.assertIsInstance(result.employees, list)
170
- for employee in result.employees:
171
- self.assertIsInstance(employee, PersonalInfo)
172
- self.assertIsInstance(employee.address, Address)
173
- self.assertIsInstance(result.main_products, list)
174
-
175
- def test_async_nested_company_response(self):
176
- asyncio.run(self.async_nested_company_response())
177
-
178
-
179
- if __name__ == "__main__":
180
- unittest.main()
@@ -1,100 +0,0 @@
1
- import asyncio
2
- import unittest
3
- from typing import List
4
-
5
- from pydantic import BaseModel, Field
6
-
7
- from synth_ai.zyk.lms.core.main import LM
8
-
9
-
10
- # Define example structured output models
11
- class SimpleResponse(BaseModel):
12
- message: str
13
- confidence_between_zero_one: float = Field(
14
- ..., description="Confidence level between 0 and 1"
15
- )
16
-
17
-
18
- class ComplexResponse(BaseModel):
19
- title: str
20
- tags: List[str]
21
- content: str
22
-
23
-
24
- class NestedResponse(BaseModel):
25
- main_category: str
26
- subcategories: List[str]
27
- details: SimpleResponse
28
-
29
-
30
- class TestLMStructuredOutputs(unittest.TestCase):
31
- @classmethod
32
- def setUpClass(cls):
33
- # Initialize LMs for both forced_json and stringified_json modes
34
- cls.lm_forced_json = LM(
35
- model_name="gpt-4o-mini",
36
- formatting_model_name="gpt-4o-mini",
37
- temperature=0.7,
38
- max_retries="Few",
39
- structured_output_mode="forced_json",
40
- )
41
- cls.lm_stringified_json = LM(
42
- model_name="gpt-4o-mini",
43
- formatting_model_name="gpt-4o-mini",
44
- temperature=0.7,
45
- max_retries="Few",
46
- structured_output_mode="stringified_json",
47
- )
48
-
49
- def test_sync_simple_response(self):
50
- for lm in [self.lm_forced_json, self.lm_stringified_json]:
51
- with self.subTest(
52
- mode=lm.structured_output_handler.handler.structured_output_mode
53
- ):
54
- result = lm.respond_sync(
55
- system_message="You are a helpful assistant.",
56
- user_message="Give me a short greeting and your confidence level.",
57
- response_model=SimpleResponse,
58
- )
59
- self.assertIsInstance(result, SimpleResponse)
60
- self.assertIsInstance(result.message, str)
61
- self.assertIsInstance(result.confidence_between_zero_one, float)
62
- self.assertGreaterEqual(result.confidence_between_zero_one, 0)
63
- self.assertLessEqual(result.confidence_between_zero_one, 1)
64
-
65
- def test_sync_complex_response(self):
66
- for lm in [self.lm_forced_json, self.lm_stringified_json]:
67
- with self.subTest(
68
- mode=lm.structured_output_handler.handler.structured_output_mode
69
- ):
70
- result = lm.respond_sync(
71
- system_message="You are a content creator.",
72
- user_message="Create a short blog post about AI.",
73
- response_model=ComplexResponse,
74
- )
75
- self.assertIsInstance(result, ComplexResponse)
76
- self.assertIsInstance(result.title, str)
77
- self.assertIsInstance(result.tags, list)
78
- self.assertIsInstance(result.content, str)
79
-
80
- async def async_nested_response(self, lm):
81
- result = await lm.respond_async(
82
- system_message="You are a categorization expert.",
83
- user_message="Categorize 'Python' and provide a brief description.",
84
- response_model=NestedResponse,
85
- )
86
- self.assertIsInstance(result, NestedResponse)
87
- self.assertIsInstance(result.main_category, str)
88
- self.assertIsInstance(result.subcategories, list)
89
- self.assertIsInstance(result.details, SimpleResponse)
90
-
91
- def test_async_nested_response(self):
92
- for lm in [self.lm_forced_json, self.lm_stringified_json]: #
93
- with self.subTest(
94
- mode=lm.structured_output_handler.handler.structured_output_mode
95
- ):
96
- asyncio.run(self.async_nested_response(lm))
97
-
98
-
99
- if __name__ == "__main__":
100
- unittest.main()