letta-client 0.1.233__py3-none-any.whl → 0.1.234__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.

Potentially problematic release.


This version of letta-client might be problematic. Click here for more details.

Files changed (438) hide show
  1. letta_client/__init__.py +2 -0
  2. letta_client/agents/__init__.py +2 -0
  3. letta_client/agents/blocks/__init__.py +2 -0
  4. letta_client/agents/blocks/client.py +72 -313
  5. letta_client/agents/blocks/raw_client.py +654 -0
  6. letta_client/agents/client.py +329 -869
  7. letta_client/agents/context/__init__.py +2 -0
  8. letta_client/agents/context/client.py +31 -66
  9. letta_client/agents/context/raw_client.py +122 -0
  10. letta_client/agents/core_memory/__init__.py +2 -0
  11. letta_client/agents/core_memory/client.py +31 -66
  12. letta_client/agents/core_memory/raw_client.py +124 -0
  13. letta_client/agents/files/__init__.py +2 -0
  14. letta_client/agents/files/client.py +39 -178
  15. letta_client/agents/files/raw_client.py +349 -0
  16. letta_client/agents/folders/__init__.py +2 -0
  17. letta_client/agents/folders/client.py +39 -178
  18. letta_client/agents/folders/raw_client.py +327 -0
  19. letta_client/agents/groups/__init__.py +2 -0
  20. letta_client/agents/groups/client.py +31 -72
  21. letta_client/agents/groups/raw_client.py +142 -0
  22. letta_client/agents/memory_variables/__init__.py +2 -0
  23. letta_client/agents/memory_variables/client.py +31 -65
  24. letta_client/agents/memory_variables/raw_client.py +125 -0
  25. letta_client/agents/memory_variables/types/__init__.py +2 -0
  26. letta_client/agents/memory_variables/types/memory_variables_list_response.py +3 -2
  27. letta_client/agents/messages/__init__.py +2 -0
  28. letta_client/agents/messages/client.py +150 -589
  29. letta_client/agents/messages/raw_client.py +1384 -0
  30. letta_client/agents/messages/types/__init__.py +2 -0
  31. letta_client/agents/messages/types/letta_streaming_response.py +6 -5
  32. letta_client/agents/messages/types/messages_modify_request.py +3 -2
  33. letta_client/agents/messages/types/messages_modify_response.py +5 -4
  34. letta_client/agents/messages/types/messages_preview_raw_payload_request.py +1 -0
  35. letta_client/agents/passages/__init__.py +2 -0
  36. letta_client/agents/passages/client.py +89 -301
  37. letta_client/agents/passages/raw_client.py +678 -0
  38. letta_client/agents/raw_client.py +2068 -0
  39. letta_client/agents/sources/__init__.py +2 -0
  40. letta_client/agents/sources/client.py +39 -178
  41. letta_client/agents/sources/raw_client.py +327 -0
  42. letta_client/agents/templates/__init__.py +2 -0
  43. letta_client/agents/templates/client.py +57 -276
  44. letta_client/agents/templates/raw_client.py +505 -0
  45. letta_client/agents/templates/types/__init__.py +2 -0
  46. letta_client/agents/templates/types/templates_create_response.py +5 -4
  47. letta_client/agents/templates/types/templates_migrate_response.py +3 -2
  48. letta_client/agents/tools/__init__.py +2 -0
  49. letta_client/agents/tools/client.py +40 -179
  50. letta_client/agents/tools/raw_client.py +327 -0
  51. letta_client/agents/types/__init__.py +2 -0
  52. letta_client/agents/types/agents_search_request_search_item.py +4 -3
  53. letta_client/agents/types/agents_search_request_search_item_field.py +4 -3
  54. letta_client/agents/types/agents_search_request_search_item_one.py +4 -3
  55. letta_client/agents/types/agents_search_request_search_item_three.py +3 -2
  56. letta_client/agents/types/agents_search_request_search_item_two.py +3 -2
  57. letta_client/agents/types/agents_search_request_search_item_zero.py +3 -2
  58. letta_client/agents/types/agents_search_response.py +5 -4
  59. letta_client/agents/types/create_agent_request_response_format.py +1 -0
  60. letta_client/agents/types/create_agent_request_tool_rules_item.py +4 -3
  61. letta_client/agents/types/update_agent_response_format.py +1 -0
  62. letta_client/agents/types/update_agent_tool_rules_item.py +4 -3
  63. letta_client/base_client.py +41 -49
  64. letta_client/batches/__init__.py +2 -0
  65. letta_client/batches/client.py +45 -253
  66. letta_client/batches/raw_client.py +457 -0
  67. letta_client/blocks/__init__.py +2 -0
  68. letta_client/blocks/agents/__init__.py +2 -0
  69. letta_client/blocks/agents/client.py +33 -70
  70. letta_client/blocks/agents/raw_client.py +144 -0
  71. letta_client/blocks/client.py +126 -424
  72. letta_client/blocks/raw_client.py +973 -0
  73. letta_client/client_side_access_tokens/__init__.py +2 -0
  74. letta_client/client_side_access_tokens/client.py +45 -216
  75. letta_client/client_side_access_tokens/raw_client.py +435 -0
  76. letta_client/client_side_access_tokens/types/__init__.py +2 -0
  77. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_request_policy_item.py +4 -3
  78. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response.py +6 -5
  79. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy.py +4 -3
  80. letta_client/client_side_access_tokens/types/client_side_access_tokens_create_response_policy_data_item.py +4 -3
  81. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response.py +6 -5
  82. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item.py +6 -5
  83. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy.py +4 -3
  84. letta_client/client_side_access_tokens/types/client_side_access_tokens_list_client_side_access_tokens_response_tokens_item_policy_data_item.py +4 -3
  85. letta_client/core/__init__.py +5 -0
  86. letta_client/core/api_error.py +13 -5
  87. letta_client/core/client_wrapper.py +14 -5
  88. letta_client/core/force_multipart.py +16 -0
  89. letta_client/core/http_client.py +70 -26
  90. letta_client/core/http_response.py +55 -0
  91. letta_client/core/jsonable_encoder.py +0 -1
  92. letta_client/core/pydantic_utilities.py +70 -111
  93. letta_client/core/serialization.py +7 -3
  94. letta_client/core/unchecked_base_model.py +40 -4
  95. letta_client/embedding_models/__init__.py +2 -0
  96. letta_client/embedding_models/client.py +31 -65
  97. letta_client/embedding_models/raw_client.py +117 -0
  98. letta_client/errors/__init__.py +2 -0
  99. letta_client/errors/bad_request_error.py +4 -3
  100. letta_client/errors/conflict_error.py +4 -2
  101. letta_client/errors/internal_server_error.py +4 -3
  102. letta_client/errors/not_found_error.py +4 -3
  103. letta_client/errors/payment_required_error.py +4 -2
  104. letta_client/errors/unprocessable_entity_error.py +4 -2
  105. letta_client/folders/__init__.py +2 -0
  106. letta_client/folders/client.py +100 -564
  107. letta_client/folders/files/__init__.py +2 -0
  108. letta_client/folders/files/client.py +44 -189
  109. letta_client/folders/files/raw_client.py +391 -0
  110. letta_client/folders/passages/__init__.py +2 -0
  111. letta_client/folders/passages/client.py +33 -74
  112. letta_client/folders/passages/raw_client.py +162 -0
  113. letta_client/folders/raw_client.py +1084 -0
  114. letta_client/groups/__init__.py +2 -0
  115. letta_client/groups/client.py +87 -406
  116. letta_client/groups/messages/__init__.py +2 -0
  117. letta_client/groups/messages/client.py +110 -371
  118. letta_client/groups/messages/raw_client.py +881 -0
  119. letta_client/groups/messages/types/__init__.py +2 -0
  120. letta_client/groups/messages/types/letta_streaming_response.py +5 -4
  121. letta_client/groups/messages/types/messages_modify_request.py +3 -2
  122. letta_client/groups/messages/types/messages_modify_response.py +5 -4
  123. letta_client/groups/raw_client.py +807 -0
  124. letta_client/groups/types/__init__.py +2 -0
  125. letta_client/groups/types/group_create_manager_config.py +1 -0
  126. letta_client/groups/types/group_update_manager_config.py +1 -0
  127. letta_client/health/__init__.py +2 -0
  128. letta_client/health/client.py +31 -43
  129. letta_client/health/raw_client.py +85 -0
  130. letta_client/identities/__init__.py +2 -0
  131. letta_client/identities/client.py +115 -498
  132. letta_client/identities/properties/__init__.py +2 -0
  133. letta_client/identities/properties/client.py +32 -76
  134. letta_client/identities/properties/raw_client.py +152 -0
  135. letta_client/identities/raw_client.py +1010 -0
  136. letta_client/jobs/__init__.py +2 -0
  137. letta_client/jobs/client.py +67 -310
  138. letta_client/jobs/raw_client.py +624 -0
  139. letta_client/messages/__init__.py +2 -0
  140. letta_client/messages/client.py +41 -74
  141. letta_client/messages/raw_client.py +186 -0
  142. letta_client/models/__init__.py +2 -0
  143. letta_client/models/client.py +39 -73
  144. letta_client/models/raw_client.py +151 -0
  145. letta_client/projects/__init__.py +2 -0
  146. letta_client/projects/client.py +31 -53
  147. letta_client/projects/raw_client.py +125 -0
  148. letta_client/projects/types/__init__.py +2 -0
  149. letta_client/projects/types/projects_list_response.py +5 -4
  150. letta_client/projects/types/projects_list_response_projects_item.py +3 -2
  151. letta_client/providers/__init__.py +2 -0
  152. letta_client/providers/client.py +62 -335
  153. letta_client/providers/raw_client.py +664 -0
  154. letta_client/runs/__init__.py +2 -0
  155. letta_client/runs/client.py +56 -258
  156. letta_client/runs/messages/__init__.py +2 -0
  157. letta_client/runs/messages/client.py +34 -79
  158. letta_client/runs/messages/raw_client.py +209 -0
  159. letta_client/runs/raw_client.py +440 -0
  160. letta_client/runs/steps/__init__.py +2 -0
  161. letta_client/runs/steps/client.py +33 -76
  162. letta_client/runs/steps/raw_client.py +192 -0
  163. letta_client/runs/usage/__init__.py +2 -0
  164. letta_client/runs/usage/client.py +31 -66
  165. letta_client/runs/usage/raw_client.py +122 -0
  166. letta_client/sources/__init__.py +2 -0
  167. letta_client/sources/client.py +107 -625
  168. letta_client/sources/files/__init__.py +2 -0
  169. letta_client/sources/files/client.py +44 -189
  170. letta_client/sources/files/raw_client.py +391 -0
  171. letta_client/sources/passages/__init__.py +2 -0
  172. letta_client/sources/passages/client.py +33 -74
  173. letta_client/sources/passages/raw_client.py +162 -0
  174. letta_client/sources/raw_client.py +1209 -0
  175. letta_client/steps/__init__.py +2 -0
  176. letta_client/steps/client.py +65 -153
  177. letta_client/steps/feedback/__init__.py +2 -0
  178. letta_client/steps/feedback/client.py +32 -73
  179. letta_client/steps/feedback/raw_client.py +141 -0
  180. letta_client/steps/raw_client.py +355 -0
  181. letta_client/steps/types/__init__.py +2 -0
  182. letta_client/tags/__init__.py +2 -0
  183. letta_client/tags/client.py +33 -73
  184. letta_client/tags/raw_client.py +148 -0
  185. letta_client/telemetry/__init__.py +2 -0
  186. letta_client/telemetry/client.py +31 -66
  187. letta_client/telemetry/raw_client.py +118 -0
  188. letta_client/templates/__init__.py +2 -0
  189. letta_client/templates/agents/__init__.py +2 -0
  190. letta_client/templates/agents/client.py +48 -96
  191. letta_client/templates/agents/raw_client.py +227 -0
  192. letta_client/templates/agents/types/__init__.py +2 -0
  193. letta_client/templates/agents/types/agents_create_request_initial_message_sequence_item.py +4 -3
  194. letta_client/templates/agents/types/agents_create_response.py +4 -3
  195. letta_client/templates/client.py +36 -57
  196. letta_client/templates/raw_client.py +133 -0
  197. letta_client/templates/types/__init__.py +2 -0
  198. letta_client/templates/types/templates_list_response.py +5 -4
  199. letta_client/templates/types/templates_list_response_templates_item.py +3 -2
  200. letta_client/tools/__init__.py +2 -0
  201. letta_client/tools/client.py +195 -1322
  202. letta_client/tools/raw_client.py +2565 -0
  203. letta_client/tools/types/__init__.py +2 -0
  204. letta_client/tools/types/add_mcp_server_request.py +2 -1
  205. letta_client/tools/types/add_mcp_server_response_item.py +2 -1
  206. letta_client/tools/types/connect_mcp_server_request.py +2 -1
  207. letta_client/tools/types/delete_mcp_server_response_item.py +2 -1
  208. letta_client/tools/types/list_mcp_servers_response_value.py +1 -0
  209. letta_client/tools/types/streaming_response.py +5 -4
  210. letta_client/tools/types/test_mcp_server_request.py +2 -1
  211. letta_client/tools/types/update_mcp_server_request.py +2 -1
  212. letta_client/tools/types/update_mcp_server_response.py +2 -1
  213. letta_client/types/__init__.py +2 -0
  214. letta_client/types/action_model.py +6 -5
  215. letta_client/types/action_parameters_model.py +3 -2
  216. letta_client/types/action_response_model.py +3 -2
  217. letta_client/types/agent_environment_variable.py +3 -2
  218. letta_client/types/agent_schema.py +7 -6
  219. letta_client/types/agent_schema_tool_rules_item.py +2 -1
  220. letta_client/types/agent_state.py +9 -8
  221. letta_client/types/agent_state_response_format.py +1 -0
  222. letta_client/types/agent_state_tool_rules_item.py +4 -3
  223. letta_client/types/app_auth_scheme.py +4 -3
  224. letta_client/types/app_model.py +5 -4
  225. letta_client/types/assistant_message.py +3 -2
  226. letta_client/types/assistant_message_content.py +1 -0
  227. letta_client/types/audio.py +3 -2
  228. letta_client/types/auth_request.py +2 -1
  229. letta_client/types/auth_response.py +5 -4
  230. letta_client/types/auth_scheme_field.py +3 -2
  231. letta_client/types/bad_request_error_body.py +3 -2
  232. letta_client/types/base_64_image.py +2 -1
  233. letta_client/types/base_tool_rule_schema.py +3 -2
  234. letta_client/types/batch_job.py +4 -3
  235. letta_client/types/block.py +3 -2
  236. letta_client/types/block_update.py +2 -1
  237. letta_client/types/chat_completion_assistant_message_param.py +5 -4
  238. letta_client/types/chat_completion_assistant_message_param_content.py +1 -0
  239. letta_client/types/chat_completion_assistant_message_param_content_item.py +2 -1
  240. letta_client/types/chat_completion_audio_param.py +4 -3
  241. letta_client/types/chat_completion_content_part_image_param.py +4 -3
  242. letta_client/types/chat_completion_content_part_input_audio_param.py +4 -3
  243. letta_client/types/chat_completion_content_part_refusal_param.py +3 -2
  244. letta_client/types/chat_completion_content_part_text_param.py +3 -2
  245. letta_client/types/chat_completion_developer_message_param.py +4 -3
  246. letta_client/types/chat_completion_developer_message_param_content.py +1 -0
  247. letta_client/types/chat_completion_function_call_option_param.py +3 -2
  248. letta_client/types/chat_completion_function_message_param.py +3 -2
  249. letta_client/types/chat_completion_message_tool_call.py +4 -3
  250. letta_client/types/chat_completion_message_tool_call_param.py +4 -3
  251. letta_client/types/chat_completion_named_tool_choice_param.py +4 -3
  252. letta_client/types/chat_completion_prediction_content_param.py +4 -3
  253. letta_client/types/chat_completion_prediction_content_param_content.py +1 -0
  254. letta_client/types/chat_completion_stream_options_param.py +3 -2
  255. letta_client/types/chat_completion_system_message_param.py +4 -3
  256. letta_client/types/chat_completion_system_message_param_content.py +1 -0
  257. letta_client/types/chat_completion_tool_message_param.py +4 -3
  258. letta_client/types/chat_completion_tool_message_param_content.py +1 -0
  259. letta_client/types/chat_completion_tool_param.py +4 -3
  260. letta_client/types/chat_completion_user_message_param.py +4 -3
  261. letta_client/types/chat_completion_user_message_param_content.py +1 -0
  262. letta_client/types/chat_completion_user_message_param_content_item.py +2 -1
  263. letta_client/types/child_tool_rule.py +3 -2
  264. letta_client/types/child_tool_rule_schema.py +3 -2
  265. letta_client/types/code_input.py +3 -2
  266. letta_client/types/completion_create_params_non_streaming.py +10 -9
  267. letta_client/types/completion_create_params_non_streaming_function_call.py +1 -0
  268. letta_client/types/completion_create_params_non_streaming_messages_item.py +4 -3
  269. letta_client/types/completion_create_params_non_streaming_response_format.py +3 -2
  270. letta_client/types/completion_create_params_non_streaming_tool_choice.py +1 -0
  271. letta_client/types/completion_create_params_streaming.py +10 -9
  272. letta_client/types/completion_create_params_streaming_function_call.py +1 -0
  273. letta_client/types/completion_create_params_streaming_messages_item.py +4 -3
  274. letta_client/types/completion_create_params_streaming_response_format.py +3 -2
  275. letta_client/types/completion_create_params_streaming_tool_choice.py +1 -0
  276. letta_client/types/conditional_tool_rule.py +3 -2
  277. letta_client/types/conditional_tool_rule_schema.py +3 -2
  278. letta_client/types/conflict_error_body.py +3 -2
  279. letta_client/types/context_window_overview.py +4 -3
  280. letta_client/types/continue_tool_rule.py +3 -2
  281. letta_client/types/core_memory_block_schema.py +4 -3
  282. letta_client/types/create_block.py +3 -2
  283. letta_client/types/dynamic_manager.py +2 -1
  284. letta_client/types/dynamic_manager_update.py +2 -1
  285. letta_client/types/e_2_b_sandbox_config.py +2 -1
  286. letta_client/types/embedding_config.py +4 -3
  287. letta_client/types/file.py +4 -3
  288. letta_client/types/file_block.py +4 -3
  289. letta_client/types/file_file.py +3 -2
  290. letta_client/types/file_metadata.py +5 -4
  291. letta_client/types/file_stats.py +3 -2
  292. letta_client/types/folder.py +5 -4
  293. letta_client/types/function_call.py +3 -2
  294. letta_client/types/function_definition_input.py +3 -2
  295. letta_client/types/function_definition_output.py +3 -2
  296. letta_client/types/function_output.py +3 -2
  297. letta_client/types/function_tool.py +4 -3
  298. letta_client/types/generate_tool_input.py +3 -2
  299. letta_client/types/generate_tool_output.py +4 -3
  300. letta_client/types/group.py +4 -3
  301. letta_client/types/health.py +3 -2
  302. letta_client/types/hidden_reasoning_message.py +4 -3
  303. letta_client/types/http_validation_error.py +4 -3
  304. letta_client/types/identity.py +4 -3
  305. letta_client/types/identity_property.py +5 -4
  306. letta_client/types/image_content.py +3 -2
  307. letta_client/types/image_content_source.py +1 -0
  308. letta_client/types/image_url.py +4 -3
  309. letta_client/types/init_tool_rule.py +3 -2
  310. letta_client/types/input_audio.py +4 -3
  311. letta_client/types/internal_server_error_body.py +3 -2
  312. letta_client/types/job.py +4 -3
  313. letta_client/types/json_object_response_format.py +3 -2
  314. letta_client/types/json_schema.py +4 -3
  315. letta_client/types/json_schema_response_format.py +2 -1
  316. letta_client/types/letta_batch_messages.py +4 -3
  317. letta_client/types/letta_batch_request.py +4 -3
  318. letta_client/types/letta_image.py +2 -1
  319. letta_client/types/letta_message_content_union.py +4 -3
  320. letta_client/types/letta_message_union.py +5 -4
  321. letta_client/types/letta_ping.py +2 -1
  322. letta_client/types/letta_request.py +4 -3
  323. letta_client/types/letta_request_config.py +3 -2
  324. letta_client/types/letta_response.py +4 -3
  325. letta_client/types/letta_stop_reason.py +3 -2
  326. letta_client/types/letta_streaming_request.py +9 -3
  327. letta_client/types/letta_usage_statistics.py +3 -2
  328. letta_client/types/letta_user_message_content_union.py +2 -1
  329. letta_client/types/llm_config.py +6 -5
  330. letta_client/types/local_sandbox_config.py +3 -2
  331. letta_client/types/max_count_per_step_tool_rule.py +3 -2
  332. letta_client/types/max_count_per_step_tool_rule_schema.py +3 -2
  333. letta_client/types/mcp_tool.py +4 -3
  334. letta_client/types/memory.py +4 -3
  335. letta_client/types/message.py +6 -5
  336. letta_client/types/message_content_item.py +1 -0
  337. letta_client/types/message_create.py +5 -4
  338. letta_client/types/message_create_content.py +1 -0
  339. letta_client/types/message_schema.py +4 -3
  340. letta_client/types/modal_sandbox_config.py +2 -1
  341. letta_client/types/not_found_error_body.py +3 -2
  342. letta_client/types/omitted_reasoning_content.py +3 -2
  343. letta_client/types/openai_types_chat_chat_completion_message_tool_call_param_function.py +3 -2
  344. letta_client/types/openai_types_chat_chat_completion_named_tool_choice_param_function.py +3 -2
  345. letta_client/types/openai_types_chat_completion_create_params_function.py +3 -2
  346. letta_client/types/organization.py +3 -2
  347. letta_client/types/organization_create.py +2 -1
  348. letta_client/types/organization_sources_stats.py +3 -2
  349. letta_client/types/organization_update.py +2 -1
  350. letta_client/types/parameter_properties.py +3 -2
  351. letta_client/types/parameters_schema.py +4 -3
  352. letta_client/types/parent_tool_rule.py +3 -2
  353. letta_client/types/passage.py +4 -3
  354. letta_client/types/payment_required_error_body.py +3 -2
  355. letta_client/types/pip_requirement.py +3 -2
  356. letta_client/types/provider.py +5 -4
  357. letta_client/types/provider_check.py +4 -3
  358. letta_client/types/provider_trace.py +3 -2
  359. letta_client/types/reasoning_content.py +2 -1
  360. letta_client/types/reasoning_message.py +4 -3
  361. letta_client/types/redacted_reasoning_content.py +2 -1
  362. letta_client/types/required_before_exit_tool_rule.py +3 -2
  363. letta_client/types/response_format_json_object.py +3 -2
  364. letta_client/types/response_format_json_schema.py +4 -3
  365. letta_client/types/response_format_text.py +3 -2
  366. letta_client/types/round_robin_manager.py +2 -1
  367. letta_client/types/round_robin_manager_update.py +2 -1
  368. letta_client/types/run.py +4 -3
  369. letta_client/types/sandbox_config.py +4 -3
  370. letta_client/types/sandbox_config_create.py +4 -3
  371. letta_client/types/sandbox_config_create_config.py +2 -1
  372. letta_client/types/sandbox_config_update.py +3 -2
  373. letta_client/types/sandbox_config_update_config.py +2 -1
  374. letta_client/types/sandbox_environment_variable.py +3 -2
  375. letta_client/types/sandbox_environment_variable_create.py +3 -2
  376. letta_client/types/sandbox_environment_variable_update.py +2 -1
  377. letta_client/types/sleeptime_manager.py +2 -1
  378. letta_client/types/sleeptime_manager_update.py +2 -1
  379. letta_client/types/source.py +5 -4
  380. letta_client/types/source_create.py +4 -3
  381. letta_client/types/source_stats.py +4 -3
  382. letta_client/types/source_update.py +3 -2
  383. letta_client/types/sse_server_config.py +4 -3
  384. letta_client/types/stdio_server_config.py +4 -3
  385. letta_client/types/step.py +5 -4
  386. letta_client/types/streamable_http_server_config.py +4 -3
  387. letta_client/types/supervisor_manager.py +2 -1
  388. letta_client/types/supervisor_manager_update.py +2 -1
  389. letta_client/types/system_message.py +2 -1
  390. letta_client/types/tag_schema.py +3 -2
  391. letta_client/types/terminal_tool_rule.py +3 -2
  392. letta_client/types/text_content.py +2 -1
  393. letta_client/types/text_response_format.py +3 -2
  394. letta_client/types/tool.py +5 -4
  395. letta_client/types/tool_annotations.py +4 -3
  396. letta_client/types/tool_call.py +3 -2
  397. letta_client/types/tool_call_content.py +2 -1
  398. letta_client/types/tool_call_delta.py +3 -2
  399. letta_client/types/tool_call_message.py +4 -3
  400. letta_client/types/tool_call_message_tool_call.py +1 -0
  401. letta_client/types/tool_create.py +3 -2
  402. letta_client/types/tool_env_var_schema.py +3 -2
  403. letta_client/types/tool_json_schema.py +4 -3
  404. letta_client/types/tool_return.py +4 -3
  405. letta_client/types/tool_return_content.py +2 -1
  406. letta_client/types/tool_return_message.py +4 -3
  407. letta_client/types/tool_schema.py +5 -4
  408. letta_client/types/update_assistant_message.py +3 -2
  409. letta_client/types/update_assistant_message_content.py +1 -0
  410. letta_client/types/update_reasoning_message.py +3 -2
  411. letta_client/types/update_ssemcp_server.py +2 -1
  412. letta_client/types/update_stdio_mcp_server.py +3 -2
  413. letta_client/types/update_streamable_httpmcp_server.py +2 -1
  414. letta_client/types/update_system_message.py +2 -1
  415. letta_client/types/update_user_message.py +3 -2
  416. letta_client/types/update_user_message_content.py +1 -0
  417. letta_client/types/url_image.py +2 -1
  418. letta_client/types/usage_statistics.py +5 -4
  419. letta_client/types/usage_statistics_completion_token_details.py +3 -2
  420. letta_client/types/usage_statistics_prompt_token_details.py +3 -2
  421. letta_client/types/user.py +3 -2
  422. letta_client/types/user_create.py +3 -2
  423. letta_client/types/user_message.py +3 -2
  424. letta_client/types/user_message_content.py +1 -0
  425. letta_client/types/user_update.py +3 -2
  426. letta_client/types/validation_error.py +4 -3
  427. letta_client/types/voice_sleeptime_manager.py +2 -1
  428. letta_client/types/voice_sleeptime_manager_update.py +2 -1
  429. letta_client/types/web_search_options.py +4 -3
  430. letta_client/types/web_search_options_user_location.py +4 -3
  431. letta_client/types/web_search_options_user_location_approximate.py +3 -2
  432. letta_client/voice/__init__.py +2 -0
  433. letta_client/voice/client.py +33 -74
  434. letta_client/voice/raw_client.py +154 -0
  435. {letta_client-0.1.233.dist-info → letta_client-0.1.234.dist-info}/METADATA +24 -3
  436. letta_client-0.1.234.dist-info/RECORD +503 -0
  437. letta_client-0.1.233.dist-info/RECORD +0 -455
  438. {letta_client-0.1.233.dist-info → letta_client-0.1.234.dist-info}/WHEEL +0 -0
@@ -2,90 +2,66 @@
2
2
 
3
3
  # nopycln: file
4
4
  import datetime as dt
5
- import typing
6
5
  from collections import defaultdict
7
-
8
- import typing_extensions
6
+ from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Set, Tuple, Type, TypeVar, Union, cast
9
7
 
10
8
  import pydantic
11
9
 
12
- from .datetime_utils import serialize_datetime
13
- from .serialization import convert_and_respect_annotation_metadata
14
-
15
10
  IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
16
11
 
17
12
  if IS_PYDANTIC_V2:
18
- # isort will try to reformat the comments on these imports, which breaks mypy
19
- # isort: off
20
- from pydantic.v1.datetime_parse import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
21
- parse_date as parse_date,
22
- )
23
- from pydantic.v1.datetime_parse import ( # pyright: ignore[reportMissingImports] # Pydantic v2
24
- parse_datetime as parse_datetime,
25
- )
26
- from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
27
- ENCODERS_BY_TYPE as encoders_by_type,
28
- )
29
- from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
30
- get_args as get_args,
31
- )
32
- from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
33
- get_origin as get_origin,
34
- )
35
- from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
36
- is_literal_type as is_literal_type,
37
- )
38
- from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
39
- is_union as is_union,
40
- )
41
- from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
13
+ from pydantic.v1.datetime_parse import parse_date as parse_date
14
+ from pydantic.v1.datetime_parse import parse_datetime as parse_datetime
15
+ from pydantic.v1.fields import ModelField as ModelField
16
+ from pydantic.v1.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[attr-defined]
17
+ from pydantic.v1.typing import get_args as get_args
18
+ from pydantic.v1.typing import get_origin as get_origin
19
+ from pydantic.v1.typing import is_literal_type as is_literal_type
20
+ from pydantic.v1.typing import is_union as is_union
42
21
  else:
43
- from pydantic.datetime_parse import parse_date as parse_date # type: ignore # Pydantic v1
44
- from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore # Pydantic v1
45
- from pydantic.fields import ModelField as ModelField # type: ignore # Pydantic v1
46
- from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore # Pydantic v1
47
- from pydantic.typing import get_args as get_args # type: ignore # Pydantic v1
48
- from pydantic.typing import get_origin as get_origin # type: ignore # Pydantic v1
49
- from pydantic.typing import is_literal_type as is_literal_type # type: ignore # Pydantic v1
50
- from pydantic.typing import is_union as is_union # type: ignore # Pydantic v1
51
-
52
- # isort: on
22
+ from pydantic.datetime_parse import parse_date as parse_date # type: ignore[no-redef]
23
+ from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore[no-redef]
24
+ from pydantic.fields import ModelField as ModelField # type: ignore[attr-defined, no-redef]
25
+ from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[no-redef]
26
+ from pydantic.typing import get_args as get_args # type: ignore[no-redef]
27
+ from pydantic.typing import get_origin as get_origin # type: ignore[no-redef]
28
+ from pydantic.typing import is_literal_type as is_literal_type # type: ignore[no-redef]
29
+ from pydantic.typing import is_union as is_union # type: ignore[no-redef]
53
30
 
31
+ from .datetime_utils import serialize_datetime
32
+ from .serialization import convert_and_respect_annotation_metadata
33
+ from typing_extensions import TypeAlias
54
34
 
55
- T = typing.TypeVar("T")
56
- Model = typing.TypeVar("Model", bound=pydantic.BaseModel)
35
+ T = TypeVar("T")
36
+ Model = TypeVar("Model", bound=pydantic.BaseModel)
57
37
 
58
38
 
59
- def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T:
39
+ def parse_obj_as(type_: Type[T], object_: Any) -> T:
60
40
  dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read")
61
41
  if IS_PYDANTIC_V2:
62
- adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2
42
+ adapter = pydantic.TypeAdapter(type_) # type: ignore[attr-defined]
63
43
  return adapter.validate_python(dealiased_object)
64
- else:
65
- return pydantic.parse_obj_as(type_, dealiased_object)
44
+ return pydantic.parse_obj_as(type_, dealiased_object)
66
45
 
67
46
 
68
- def to_jsonable_with_fallback(
69
- obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any]
70
- ) -> typing.Any:
47
+ def to_jsonable_with_fallback(obj: Any, fallback_serializer: Callable[[Any], Any]) -> Any:
71
48
  if IS_PYDANTIC_V2:
72
49
  from pydantic_core import to_jsonable_python
73
50
 
74
51
  return to_jsonable_python(obj, fallback=fallback_serializer)
75
- else:
76
- return fallback_serializer(obj)
52
+ return fallback_serializer(obj)
77
53
 
78
54
 
79
55
  class UniversalBaseModel(pydantic.BaseModel):
80
56
  if IS_PYDANTIC_V2:
81
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
57
+ model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( # type: ignore[typeddict-unknown-key]
82
58
  # Allow fields beginning with `model_` to be used in the model
83
59
  protected_namespaces=(),
84
- ) # type: ignore # Pydantic v2
60
+ )
85
61
 
86
- @pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore # Pydantic v2
87
- def serialize_model(self, handler: pydantic.SerializerFunctionWrapHandler) -> typing.Any: # type: ignore # Pydantic v2
88
- serialized = handler(self)
62
+ @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined]
63
+ def serialize_model(self) -> Any: # type: ignore[name-defined]
64
+ serialized = self.model_dump()
89
65
  data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()}
90
66
  return data
91
67
 
@@ -96,34 +72,28 @@ class UniversalBaseModel(pydantic.BaseModel):
96
72
  json_encoders = {dt.datetime: serialize_datetime}
97
73
 
98
74
  @classmethod
99
- def model_construct(
100
- cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
101
- ) -> "Model":
75
+ def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
102
76
  dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
103
77
  return cls.construct(_fields_set, **dealiased_object)
104
78
 
105
79
  @classmethod
106
- def construct(
107
- cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
108
- ) -> "Model":
80
+ def construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
109
81
  dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
110
82
  if IS_PYDANTIC_V2:
111
- return super().model_construct(_fields_set, **dealiased_object) # type: ignore # Pydantic v2
112
- else:
113
- return super().construct(_fields_set, **dealiased_object)
83
+ return super().model_construct(_fields_set, **dealiased_object) # type: ignore[misc]
84
+ return super().construct(_fields_set, **dealiased_object)
114
85
 
115
- def json(self, **kwargs: typing.Any) -> str:
116
- kwargs_with_defaults: typing.Any = {
86
+ def json(self, **kwargs: Any) -> str:
87
+ kwargs_with_defaults = {
117
88
  "by_alias": True,
118
89
  "exclude_unset": True,
119
90
  **kwargs,
120
91
  }
121
92
  if IS_PYDANTIC_V2:
122
- return super().model_dump_json(**kwargs_with_defaults) # type: ignore # Pydantic v2
123
- else:
124
- return super().json(**kwargs_with_defaults)
93
+ return super().model_dump_json(**kwargs_with_defaults) # type: ignore[misc]
94
+ return super().json(**kwargs_with_defaults)
125
95
 
126
- def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
96
+ def dict(self, **kwargs: Any) -> Dict[str, Any]:
127
97
  """
128
98
  Override the default dict method to `exclude_unset` by default. This function patches
129
99
  `exclude_unset` to work include fields within non-None default values.
@@ -134,21 +104,21 @@ class UniversalBaseModel(pydantic.BaseModel):
134
104
  # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
135
105
  # that we have less control over, and this is less intrusive than custom serializers for now.
136
106
  if IS_PYDANTIC_V2:
137
- kwargs_with_defaults_exclude_unset: typing.Any = {
107
+ kwargs_with_defaults_exclude_unset = {
138
108
  **kwargs,
139
109
  "by_alias": True,
140
110
  "exclude_unset": True,
141
111
  "exclude_none": False,
142
112
  }
143
- kwargs_with_defaults_exclude_none: typing.Any = {
113
+ kwargs_with_defaults_exclude_none = {
144
114
  **kwargs,
145
115
  "by_alias": True,
146
116
  "exclude_none": True,
147
117
  "exclude_unset": False,
148
118
  }
149
119
  dict_dump = deep_union_pydantic_dicts(
150
- super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore # Pydantic v2
151
- super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore # Pydantic v2
120
+ super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc]
121
+ super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc]
152
122
  )
153
123
 
154
124
  else:
@@ -168,7 +138,7 @@ class UniversalBaseModel(pydantic.BaseModel):
168
138
  if default is not None:
169
139
  self.__fields_set__.add(name)
170
140
 
171
- kwargs_with_defaults_exclude_unset_include_fields: typing.Any = {
141
+ kwargs_with_defaults_exclude_unset_include_fields = {
172
142
  "by_alias": True,
173
143
  "exclude_unset": True,
174
144
  "include": _fields_set,
@@ -180,12 +150,10 @@ class UniversalBaseModel(pydantic.BaseModel):
180
150
  return convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write")
181
151
 
182
152
 
183
- def _union_list_of_pydantic_dicts(
184
- source: typing.List[typing.Any], destination: typing.List[typing.Any]
185
- ) -> typing.List[typing.Any]:
186
- converted_list: typing.List[typing.Any] = []
153
+ def _union_list_of_pydantic_dicts(source: List[Any], destination: List[Any]) -> List[Any]:
154
+ converted_list: List[Any] = []
187
155
  for i, item in enumerate(source):
188
- destination_value = destination[i] # type: ignore
156
+ destination_value = destination[i]
189
157
  if isinstance(item, dict):
190
158
  converted_list.append(deep_union_pydantic_dicts(item, destination_value))
191
159
  elif isinstance(item, list):
@@ -195,9 +163,7 @@ def _union_list_of_pydantic_dicts(
195
163
  return converted_list
196
164
 
197
165
 
198
- def deep_union_pydantic_dicts(
199
- source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any]
200
- ) -> typing.Dict[str, typing.Any]:
166
+ def deep_union_pydantic_dicts(source: Dict[str, Any], destination: Dict[str, Any]) -> Dict[str, Any]:
201
167
  for key, value in source.items():
202
168
  node = destination.setdefault(key, {})
203
169
  if isinstance(value, dict):
@@ -215,18 +181,16 @@ def deep_union_pydantic_dicts(
215
181
 
216
182
  if IS_PYDANTIC_V2:
217
183
 
218
- class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore # Pydantic v2
184
+ class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore[misc, name-defined, type-arg]
219
185
  pass
220
186
 
221
- UniversalRootModel: typing_extensions.TypeAlias = V2RootModel # type: ignore
187
+ UniversalRootModel: TypeAlias = V2RootModel # type: ignore[misc]
222
188
  else:
223
- UniversalRootModel: typing_extensions.TypeAlias = UniversalBaseModel # type: ignore
189
+ UniversalRootModel: TypeAlias = UniversalBaseModel # type: ignore[misc, no-redef]
224
190
 
225
191
 
226
- def encode_by_type(o: typing.Any) -> typing.Any:
227
- encoders_by_class_tuples: typing.Dict[typing.Callable[[typing.Any], typing.Any], typing.Tuple[typing.Any, ...]] = (
228
- defaultdict(tuple)
229
- )
192
+ def encode_by_type(o: Any) -> Any:
193
+ encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple)
230
194
  for type_, encoder in encoders_by_type.items():
231
195
  encoders_by_class_tuples[encoder] += (type_,)
232
196
 
@@ -237,54 +201,49 @@ def encode_by_type(o: typing.Any) -> typing.Any:
237
201
  return encoder(o)
238
202
 
239
203
 
240
- def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> None:
204
+ def update_forward_refs(model: Type["Model"], **localns: Any) -> None:
241
205
  if IS_PYDANTIC_V2:
242
- model.model_rebuild(raise_errors=False) # type: ignore # Pydantic v2
206
+ model.model_rebuild(raise_errors=False) # type: ignore[attr-defined]
243
207
  else:
244
208
  model.update_forward_refs(**localns)
245
209
 
246
210
 
247
211
  # Mirrors Pydantic's internal typing
248
- AnyCallable = typing.Callable[..., typing.Any]
212
+ AnyCallable = Callable[..., Any]
249
213
 
250
214
 
251
215
  def universal_root_validator(
252
216
  pre: bool = False,
253
- ) -> typing.Callable[[AnyCallable], AnyCallable]:
217
+ ) -> Callable[[AnyCallable], AnyCallable]:
254
218
  def decorator(func: AnyCallable) -> AnyCallable:
255
219
  if IS_PYDANTIC_V2:
256
- return pydantic.model_validator(mode="before" if pre else "after")(func) # type: ignore # Pydantic v2
257
- else:
258
- return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1
220
+ return cast(AnyCallable, pydantic.model_validator(mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
221
+ return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
259
222
 
260
223
  return decorator
261
224
 
262
225
 
263
- def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]:
226
+ def universal_field_validator(field_name: str, pre: bool = False) -> Callable[[AnyCallable], AnyCallable]:
264
227
  def decorator(func: AnyCallable) -> AnyCallable:
265
228
  if IS_PYDANTIC_V2:
266
- return pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore # Pydantic v2
267
- else:
268
- return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1
229
+ return cast(AnyCallable, pydantic.field_validator(field_name, mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
230
+ return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func))
269
231
 
270
232
  return decorator
271
233
 
272
234
 
273
- PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo]
235
+ PydanticField = Union[ModelField, pydantic.fields.FieldInfo]
274
236
 
275
237
 
276
- def _get_model_fields(
277
- model: typing.Type["Model"],
278
- ) -> typing.Mapping[str, PydanticField]:
238
+ def _get_model_fields(model: Type["Model"]) -> Mapping[str, PydanticField]:
279
239
  if IS_PYDANTIC_V2:
280
- return model.model_fields # type: ignore # Pydantic v2
281
- else:
282
- return model.__fields__ # type: ignore # Pydantic v1
240
+ return cast(Mapping[str, PydanticField], model.model_fields) # type: ignore[attr-defined]
241
+ return cast(Mapping[str, PydanticField], model.__fields__)
283
242
 
284
243
 
285
- def _get_field_default(field: PydanticField) -> typing.Any:
244
+ def _get_field_default(field: PydanticField) -> Any:
286
245
  try:
287
- value = field.get_default() # type: ignore # Pydantic < v1.10.15
246
+ value = field.get_default() # type: ignore[union-attr]
288
247
  except:
289
248
  value = field.default
290
249
  if IS_PYDANTIC_V2:
@@ -4,9 +4,8 @@ import collections
4
4
  import inspect
5
5
  import typing
6
6
 
7
- import typing_extensions
8
-
9
7
  import pydantic
8
+ import typing_extensions
10
9
 
11
10
 
12
11
  class FieldMetadata:
@@ -161,7 +160,12 @@ def _convert_mapping(
161
160
  direction: typing.Literal["read", "write"],
162
161
  ) -> typing.Mapping[str, object]:
163
162
  converted_object: typing.Dict[str, object] = {}
164
- annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
163
+ try:
164
+ annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
165
+ except NameError:
166
+ # The TypedDict contains a circular reference, so
167
+ # we use the __annotations__ attribute directly.
168
+ annotations = getattr(expected_type, "__annotations__", {})
165
169
  aliases_to_field_names = _get_alias_to_field_name(annotations)
166
170
  for key, value in object_.items():
167
171
  if direction == "read" and key in aliases_to_field_names:
@@ -5,11 +5,8 @@ import inspect
5
5
  import typing
6
6
  import uuid
7
7
 
8
- import typing_extensions
9
- from pydantic_core import PydanticUndefined
10
-
11
8
  import pydantic
12
-
9
+ import typing_extensions
13
10
  from .pydantic_utilities import (
14
11
  IS_PYDANTIC_V2,
15
12
  ModelField,
@@ -23,6 +20,7 @@ from .pydantic_utilities import (
23
20
  parse_obj_as,
24
21
  )
25
22
  from .serialization import get_field_to_alias_mapping
23
+ from pydantic_core import PydanticUndefined
26
24
 
27
25
 
28
26
  class UnionMetadata:
@@ -126,12 +124,50 @@ class UncheckedBaseModel(UniversalBaseModel):
126
124
  return m
127
125
 
128
126
 
127
+ def _validate_collection_items_compatible(collection: typing.Any, target_type: typing.Type[typing.Any]) -> bool:
128
+ """
129
+ Validate that all items in a collection are compatible with the target type.
130
+
131
+ Args:
132
+ collection: The collection to validate (list, set, or dict values)
133
+ target_type: The target type to validate against
134
+
135
+ Returns:
136
+ True if all items are compatible, False otherwise
137
+ """
138
+ if inspect.isclass(target_type) and issubclass(target_type, pydantic.BaseModel):
139
+ for item in collection:
140
+ try:
141
+ # Try to validate the item against the target type
142
+ if isinstance(item, dict):
143
+ parse_obj_as(target_type, item)
144
+ else:
145
+ # If it's not a dict, it might already be the right type
146
+ if not isinstance(item, target_type):
147
+ return False
148
+ except Exception:
149
+ return False
150
+ return True
151
+
152
+
129
153
  def _convert_undiscriminated_union_type(union_type: typing.Type[typing.Any], object_: typing.Any) -> typing.Any:
130
154
  inner_types = get_args(union_type)
131
155
  if typing.Any in inner_types:
132
156
  return object_
133
157
 
134
158
  for inner_type in inner_types:
159
+ # Handle lists of objects that need parsing
160
+ if get_origin(inner_type) is list and isinstance(object_, list):
161
+ list_inner_type = get_args(inner_type)[0]
162
+ try:
163
+ if inspect.isclass(list_inner_type) and issubclass(list_inner_type, pydantic.BaseModel):
164
+ # Validate that all items in the list are compatible with the target type
165
+ if _validate_collection_items_compatible(object_, list_inner_type):
166
+ parsed_list = [parse_obj_as(object_=item, type_=list_inner_type) for item in object_]
167
+ return parsed_list
168
+ except Exception:
169
+ pass
170
+
135
171
  try:
136
172
  if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel):
137
173
  # Attempt a validated parse until one works
@@ -1,2 +1,4 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ # isort: skip_file
4
+
@@ -1,20 +1,27 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ..core.client_wrapper import SyncClientWrapper
4
3
  import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
5
6
  from ..core.request_options import RequestOptions
6
7
  from ..types.embedding_config import EmbeddingConfig
7
- from ..core.unchecked_base_model import construct_type
8
- from ..errors.unprocessable_entity_error import UnprocessableEntityError
9
- from ..types.http_validation_error import HttpValidationError
10
- from json.decoder import JSONDecodeError
11
- from ..core.api_error import ApiError
12
- from ..core.client_wrapper import AsyncClientWrapper
8
+ from .raw_client import AsyncRawEmbeddingModelsClient, RawEmbeddingModelsClient
13
9
 
14
10
 
15
11
  class EmbeddingModelsClient:
16
12
  def __init__(self, *, client_wrapper: SyncClientWrapper):
17
- self._client_wrapper = client_wrapper
13
+ self._raw_client = RawEmbeddingModelsClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawEmbeddingModelsClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawEmbeddingModelsClient
23
+ """
24
+ return self._raw_client
18
25
 
19
26
  def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[EmbeddingConfig]:
20
27
  """
@@ -40,39 +47,24 @@ class EmbeddingModelsClient:
40
47
  )
41
48
  client.embedding_models.list()
42
49
  """
43
- _response = self._client_wrapper.httpx_client.request(
44
- "v1/models/embedding",
45
- method="GET",
46
- request_options=request_options,
47
- )
48
- try:
49
- if 200 <= _response.status_code < 300:
50
- return typing.cast(
51
- typing.List[EmbeddingConfig],
52
- construct_type(
53
- type_=typing.List[EmbeddingConfig], # type: ignore
54
- object_=_response.json(),
55
- ),
56
- )
57
- if _response.status_code == 422:
58
- raise UnprocessableEntityError(
59
- typing.cast(
60
- HttpValidationError,
61
- construct_type(
62
- type_=HttpValidationError, # type: ignore
63
- object_=_response.json(),
64
- ),
65
- )
66
- )
67
- _response_json = _response.json()
68
- except JSONDecodeError:
69
- raise ApiError(status_code=_response.status_code, body=_response.text)
70
- raise ApiError(status_code=_response.status_code, body=_response_json)
50
+ _response = self._raw_client.list(request_options=request_options)
51
+ return _response.data
71
52
 
72
53
 
73
54
  class AsyncEmbeddingModelsClient:
74
55
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
75
- self._client_wrapper = client_wrapper
56
+ self._raw_client = AsyncRawEmbeddingModelsClient(client_wrapper=client_wrapper)
57
+
58
+ @property
59
+ def with_raw_response(self) -> AsyncRawEmbeddingModelsClient:
60
+ """
61
+ Retrieves a raw implementation of this client that returns raw responses.
62
+
63
+ Returns
64
+ -------
65
+ AsyncRawEmbeddingModelsClient
66
+ """
67
+ return self._raw_client
76
68
 
77
69
  async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[EmbeddingConfig]:
78
70
  """
@@ -106,31 +98,5 @@ class AsyncEmbeddingModelsClient:
106
98
 
107
99
  asyncio.run(main())
108
100
  """
109
- _response = await self._client_wrapper.httpx_client.request(
110
- "v1/models/embedding",
111
- method="GET",
112
- request_options=request_options,
113
- )
114
- try:
115
- if 200 <= _response.status_code < 300:
116
- return typing.cast(
117
- typing.List[EmbeddingConfig],
118
- construct_type(
119
- type_=typing.List[EmbeddingConfig], # type: ignore
120
- object_=_response.json(),
121
- ),
122
- )
123
- if _response.status_code == 422:
124
- raise UnprocessableEntityError(
125
- typing.cast(
126
- HttpValidationError,
127
- construct_type(
128
- type_=HttpValidationError, # type: ignore
129
- object_=_response.json(),
130
- ),
131
- )
132
- )
133
- _response_json = _response.json()
134
- except JSONDecodeError:
135
- raise ApiError(status_code=_response.status_code, body=_response.text)
136
- raise ApiError(status_code=_response.status_code, body=_response_json)
101
+ _response = await self._raw_client.list(request_options=request_options)
102
+ return _response.data
@@ -0,0 +1,117 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.request_options import RequestOptions
10
+ from ..core.unchecked_base_model import construct_type
11
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ..types.embedding_config import EmbeddingConfig
13
+ from ..types.http_validation_error import HttpValidationError
14
+
15
+
16
+ class RawEmbeddingModelsClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def list(
21
+ self, *, request_options: typing.Optional[RequestOptions] = None
22
+ ) -> HttpResponse[typing.List[EmbeddingConfig]]:
23
+ """
24
+ List available embedding models using the asynchronous implementation for improved performance
25
+
26
+ Parameters
27
+ ----------
28
+ request_options : typing.Optional[RequestOptions]
29
+ Request-specific configuration.
30
+
31
+ Returns
32
+ -------
33
+ HttpResponse[typing.List[EmbeddingConfig]]
34
+ Successful Response
35
+ """
36
+ _response = self._client_wrapper.httpx_client.request(
37
+ "v1/models/embedding",
38
+ method="GET",
39
+ request_options=request_options,
40
+ )
41
+ try:
42
+ if 200 <= _response.status_code < 300:
43
+ _data = typing.cast(
44
+ typing.List[EmbeddingConfig],
45
+ construct_type(
46
+ type_=typing.List[EmbeddingConfig], # type: ignore
47
+ object_=_response.json(),
48
+ ),
49
+ )
50
+ return HttpResponse(response=_response, data=_data)
51
+ if _response.status_code == 422:
52
+ raise UnprocessableEntityError(
53
+ headers=dict(_response.headers),
54
+ body=typing.cast(
55
+ HttpValidationError,
56
+ construct_type(
57
+ type_=HttpValidationError, # type: ignore
58
+ object_=_response.json(),
59
+ ),
60
+ ),
61
+ )
62
+ _response_json = _response.json()
63
+ except JSONDecodeError:
64
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
65
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
66
+
67
+
68
+ class AsyncRawEmbeddingModelsClient:
69
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
70
+ self._client_wrapper = client_wrapper
71
+
72
+ async def list(
73
+ self, *, request_options: typing.Optional[RequestOptions] = None
74
+ ) -> AsyncHttpResponse[typing.List[EmbeddingConfig]]:
75
+ """
76
+ List available embedding models using the asynchronous implementation for improved performance
77
+
78
+ Parameters
79
+ ----------
80
+ request_options : typing.Optional[RequestOptions]
81
+ Request-specific configuration.
82
+
83
+ Returns
84
+ -------
85
+ AsyncHttpResponse[typing.List[EmbeddingConfig]]
86
+ Successful Response
87
+ """
88
+ _response = await self._client_wrapper.httpx_client.request(
89
+ "v1/models/embedding",
90
+ method="GET",
91
+ request_options=request_options,
92
+ )
93
+ try:
94
+ if 200 <= _response.status_code < 300:
95
+ _data = typing.cast(
96
+ typing.List[EmbeddingConfig],
97
+ construct_type(
98
+ type_=typing.List[EmbeddingConfig], # type: ignore
99
+ object_=_response.json(),
100
+ ),
101
+ )
102
+ return AsyncHttpResponse(response=_response, data=_data)
103
+ if _response.status_code == 422:
104
+ raise UnprocessableEntityError(
105
+ headers=dict(_response.headers),
106
+ body=typing.cast(
107
+ HttpValidationError,
108
+ construct_type(
109
+ type_=HttpValidationError, # type: ignore
110
+ object_=_response.json(),
111
+ ),
112
+ ),
113
+ )
114
+ _response_json = _response.json()
115
+ except JSONDecodeError:
116
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
117
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -1,5 +1,7 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ # isort: skip_file
4
+
3
5
  from .bad_request_error import BadRequestError
4
6
  from .conflict_error import ConflictError
5
7
  from .internal_server_error import InternalServerError