melara 0.1.1__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 (442) hide show
  1. melara/__init__.py +13 -0
  2. melara/_hooks/__init__.py +3 -0
  3. melara/_hooks/registration.py +13 -0
  4. melara/_hooks/sdkhooks.py +74 -0
  5. melara/_hooks/types.py +122 -0
  6. melara/_version.py +13 -0
  7. melara/basesdk.py +405 -0
  8. melara/beta.py +21 -0
  9. melara/beta_responses.py +3 -0
  10. melara/chat.py +1912 -0
  11. melara/components/__init__.py +4934 -0
  12. melara/components/additionaltoolsitem.py +281 -0
  13. melara/components/agentmessageitem.py +214 -0
  14. melara/components/alignment.py +19 -0
  15. melara/components/alignmentallowedcallrecord.py +26 -0
  16. melara/components/alignmentblockedcallrecord.py +26 -0
  17. melara/components/alignmentcallrecord.py +66 -0
  18. melara/components/alignmentchataudio.py +40 -0
  19. melara/components/alignmentchatimage.py +26 -0
  20. melara/components/alignmentchatrejected.py +65 -0
  21. melara/components/alignmentchattoolcall.py +32 -0
  22. melara/components/alignmentplugin.py +71 -0
  23. melara/components/alignmentrejected.py +19 -0
  24. melara/components/alignmentresponsesrejected.py +102 -0
  25. melara/components/alignmentrulerecord.py +18 -0
  26. melara/components/alignmentunavailablecallrecord.py +34 -0
  27. melara/components/annotationaddedevent.py +41 -0
  28. melara/components/anthropicadvisormessageusageiteration.py +77 -0
  29. melara/components/anthropiccachecontroldirective.py +40 -0
  30. melara/components/anthropiccachecontrolttl.py +12 -0
  31. melara/components/anthropiccachecreation.py +14 -0
  32. melara/components/anthropiccompactionusageiteration.py +74 -0
  33. melara/components/anthropiciterationcachecreation.py +34 -0
  34. melara/components/anthropicmessageusageiteration.py +78 -0
  35. melara/components/anthropicspeed.py +12 -0
  36. melara/components/anthropicunknownusageiteration.py +71 -0
  37. melara/components/anthropicusageiteration.py +41 -0
  38. melara/components/apierrortype.py +38 -0
  39. melara/components/applypatchcallitem.py +72 -0
  40. melara/components/applypatchcalloperation.py +68 -0
  41. melara/components/applypatchcalloperationdiffdeltaevent.py +33 -0
  42. melara/components/applypatchcalloperationdiffdoneevent.py +33 -0
  43. melara/components/applypatchcalloutputitem.py +73 -0
  44. melara/components/applypatchcallstatus.py +13 -0
  45. melara/components/applypatchcreatefileoperation.py +25 -0
  46. melara/components/applypatchdeletefileoperation.py +22 -0
  47. melara/components/applypatchservertool.py +19 -0
  48. melara/components/applypatchupdatefileoperation.py +25 -0
  49. melara/components/autobetarouterplugin.py +84 -0
  50. melara/components/autorouterplugin.py +90 -0
  51. melara/components/badgatewayresponseerrordata.py +54 -0
  52. melara/components/badrequestresponseerrordata.py +54 -0
  53. melara/components/baseinputs_union.py +242 -0
  54. melara/components/basereasoningconfig.py +60 -0
  55. melara/components/chatassistantimages.py +21 -0
  56. melara/components/chatassistantmessage.py +125 -0
  57. melara/components/chataudiooutput.py +50 -0
  58. melara/components/chatchoice.py +65 -0
  59. melara/components/chatcontentaudio.py +44 -0
  60. melara/components/chatcontentcachecontrol.py +40 -0
  61. melara/components/chatcontentfile.py +59 -0
  62. melara/components/chatcontentimage.py +66 -0
  63. melara/components/chatcontentitems.py +74 -0
  64. melara/components/chatcontenttext.py +69 -0
  65. melara/components/chatcontentvideo.py +25 -0
  66. melara/components/chatcontentvideoinput.py +50 -0
  67. melara/components/chatdebugoptions.py +35 -0
  68. melara/components/chatdevelopermessage.py +101 -0
  69. melara/components/chatdynamicservertool.py +36 -0
  70. melara/components/chatfinishreasonenum.py +15 -0
  71. melara/components/chatformatgrammarconfig.py +24 -0
  72. melara/components/chatformatjsonobjectconfig.py +19 -0
  73. melara/components/chatformatjsonschemaconfig.py +25 -0
  74. melara/components/chatformatpythonconfig.py +19 -0
  75. melara/components/chatformattextconfig.py +19 -0
  76. melara/components/chatfunctiontool.py +149 -0
  77. melara/components/chatjsonschemaconfig.py +72 -0
  78. melara/components/chatmessages.py +36 -0
  79. melara/components/chatnamedtoolchoice.py +32 -0
  80. melara/components/chatreasoningsummaryverbosityenum.py +13 -0
  81. melara/components/chatrequest.py +548 -0
  82. melara/components/chatresult.py +89 -0
  83. melara/components/chatservertoolchoice.py +17 -0
  84. melara/components/chatstreamchoice.py +65 -0
  85. melara/components/chatstreamchunk.py +178 -0
  86. melara/components/chatstreamdelta.py +95 -0
  87. melara/components/chatstreamingresponse.py +14 -0
  88. melara/components/chatstreamoptions.py +35 -0
  89. melara/components/chatstreamtoolcall.py +89 -0
  90. melara/components/chatsystemmessage.py +99 -0
  91. melara/components/chattokenlogprob.py +87 -0
  92. melara/components/chattokenlogprobs.py +56 -0
  93. melara/components/chattoolcall.py +42 -0
  94. melara/components/chattoolchoice.py +40 -0
  95. melara/components/chattoolmessage.py +42 -0
  96. melara/components/chatusage.py +228 -0
  97. melara/components/chatusermessage.py +59 -0
  98. melara/components/chatwebsearchshorthand.py +126 -0
  99. melara/components/codeinterpretercallcodedeltaevent.py +33 -0
  100. melara/components/codeinterpretercallcodedoneevent.py +33 -0
  101. melara/components/codeinterpretercallcompletedevent.py +30 -0
  102. melara/components/codeinterpretercallinprogressevent.py +30 -0
  103. melara/components/codeinterpretercallinterpretingevent.py +30 -0
  104. melara/components/codeinterpreterfileoutput.py +94 -0
  105. melara/components/codeinterpreterimageoutput.py +18 -0
  106. melara/components/codeinterpreterlogsoutput.py +18 -0
  107. melara/components/codeinterpreterservertool.py +91 -0
  108. melara/components/compactionitem.py +74 -0
  109. melara/components/compoundfilter.py +28 -0
  110. melara/components/computeruseservertool.py +40 -0
  111. melara/components/configurationupdateitem.py +63 -0
  112. melara/components/configurationupdatereasoning.py +33 -0
  113. melara/components/contentpartaddedevent.py +90 -0
  114. melara/components/contentpartdoneevent.py +90 -0
  115. melara/components/contentpartimage.py +26 -0
  116. melara/components/contentpartinputaudio.py +19 -0
  117. melara/components/contentpartinputfile.py +19 -0
  118. melara/components/contentpartinputvideo.py +19 -0
  119. melara/components/contextcompactionitem.py +74 -0
  120. melara/components/contextcompressionengine.py +6 -0
  121. melara/components/contextcompressionplugin.py +43 -0
  122. melara/components/costdetails.py +58 -0
  123. melara/components/customtool.py +135 -0
  124. melara/components/customtoolcallinputdeltaevent.py +31 -0
  125. melara/components/customtoolcallinputdoneevent.py +31 -0
  126. melara/components/customtoolcallitem.py +84 -0
  127. melara/components/customtoolcalloutputitem.py +147 -0
  128. melara/components/debugevent.py +78 -0
  129. melara/components/deferredbm25search.py +39 -0
  130. melara/components/deferredcustomsearch.py +45 -0
  131. melara/components/deferredregexsearch.py +39 -0
  132. melara/components/deferredtoolscontrol.py +46 -0
  133. melara/components/deferredtoolssearchstrategy.py +30 -0
  134. melara/components/easyinputmessage.py +213 -0
  135. melara/components/edgenetworktimeoutresponseerrordata.py +54 -0
  136. melara/components/errorevent.py +46 -0
  137. melara/components/failabletoolcallstatus.py +14 -0
  138. melara/components/filecitation.py +24 -0
  139. melara/components/fileparserplugin.py +43 -0
  140. melara/components/filepath.py +21 -0
  141. melara/components/filesearchservertool.py +158 -0
  142. melara/components/forbiddenresponseerrordata.py +54 -0
  143. melara/components/formatjsonobjectconfig.py +19 -0
  144. melara/components/formatjsonschemaconfig.py +70 -0
  145. melara/components/formats.py +62 -0
  146. melara/components/formattextconfig.py +19 -0
  147. melara/components/functioncallargsdeltaevent.py +31 -0
  148. melara/components/functioncallargsdoneevent.py +34 -0
  149. melara/components/functioncallitem.py +119 -0
  150. melara/components/functioncalloutputitem.py +160 -0
  151. melara/components/fusionanalysisresult.py +72 -0
  152. melara/components/fusioncallanalysiscompletedevent.py +36 -0
  153. melara/components/fusioncallanalysisinprogressevent.py +46 -0
  154. melara/components/fusioncallcompletedevent.py +28 -0
  155. melara/components/fusioncallinprogressevent.py +28 -0
  156. melara/components/fusioncallpaneladdedevent.py +31 -0
  157. melara/components/fusioncallpanelcompletedevent.py +34 -0
  158. melara/components/fusioncallpaneldeltaevent.py +34 -0
  159. melara/components/fusioncallpanelfailedevent.py +54 -0
  160. melara/components/fusioncallpanelreasoningdeltaevent.py +36 -0
  161. melara/components/fusionplugin.py +138 -0
  162. melara/components/gatewaytimeoutresponseerrordata.py +54 -0
  163. melara/components/imageconfig.py +11 -0
  164. melara/components/imagegencallcompletedevent.py +28 -0
  165. melara/components/imagegencallgeneratingevent.py +28 -0
  166. melara/components/imagegencallinprogressevent.py +28 -0
  167. melara/components/imagegencallpartialimageevent.py +36 -0
  168. melara/components/imagegencompletedevent.py +60 -0
  169. melara/components/imagegenerationproviderpreferences.py +758 -0
  170. melara/components/imagegenerationrequest.py +224 -0
  171. melara/components/imagegenerationresponse.py +81 -0
  172. melara/components/imagegenerationservertool.py +171 -0
  173. melara/components/imagegenerationstatus.py +14 -0
  174. melara/components/imagegenerationusage.py +318 -0
  175. melara/components/imagegenpartialimageevent.py +32 -0
  176. melara/components/imagegenstreamerrorevent.py +88 -0
  177. melara/components/imagegentextchunkevent.py +43 -0
  178. melara/components/imagestreamingresponse.py +81 -0
  179. melara/components/incompletedetails.py +38 -0
  180. melara/components/inputaudio.py +49 -0
  181. melara/components/inputfile.py +63 -0
  182. melara/components/inputimage.py +72 -0
  183. melara/components/inputmessageitem.py +175 -0
  184. melara/components/inputs_union.py +399 -0
  185. melara/components/inputtext.py +60 -0
  186. melara/components/inputvideo.py +56 -0
  187. melara/components/internalserverresponseerrordata.py +54 -0
  188. melara/components/itemreferenceitem.py +22 -0
  189. melara/components/jevrouterplugin.py +54 -0
  190. melara/components/legacy_chatcontentvideo.py +35 -0
  191. melara/components/legacy_chatcontentvideoinput.py +50 -0
  192. melara/components/legacy_websearchservertool.py +106 -0
  193. melara/components/localshellcallitem.py +90 -0
  194. melara/components/localshellcalloutputitem.py +61 -0
  195. melara/components/localshelltool.py +19 -0
  196. melara/components/mcpapprovalrequestitem.py +31 -0
  197. melara/components/mcpapprovalresponseitem.py +63 -0
  198. melara/components/mcpcallitem.py +72 -0
  199. melara/components/mcphttperror.py +25 -0
  200. melara/components/mcplisttoolsitem.py +105 -0
  201. melara/components/mcpprotocolerror.py +25 -0
  202. melara/components/mcpservertool.py +229 -0
  203. melara/components/mcptoolcallerror.py +25 -0
  204. melara/components/mcptoolexecutionerror.py +39 -0
  205. melara/components/model.py +26 -0
  206. melara/components/modelslistresponse.py +15 -0
  207. melara/components/moderationplugin.py +15 -0
  208. melara/components/multimodalmedia.py +39 -0
  209. melara/components/namespacefunctiontool.py +106 -0
  210. melara/components/namespacetool.py +70 -0
  211. melara/components/notfoundresponseerrordata.py +54 -0
  212. melara/components/openairesponsecustomtoolcall.py +61 -0
  213. melara/components/openairesponsecustomtoolcalloutput.py +101 -0
  214. melara/components/openairesponsefunctiontoolcall.py +100 -0
  215. melara/components/openairesponsefunctiontoolcalloutput.py +120 -0
  216. melara/components/openairesponseinputmessageitem.py +123 -0
  217. melara/components/openairesponsesannotation.py +48 -0
  218. melara/components/openairesponsesrefusalcontent.py +18 -0
  219. melara/components/openairesponsesresponsestatus.py +16 -0
  220. melara/components/openairesponsestoolchoice_union.py +114 -0
  221. melara/components/openairesponsestruncation.py +12 -0
  222. melara/components/openresponsescreatedevent.py +28 -0
  223. melara/components/openresponseserrorfield.py +74 -0
  224. melara/components/openresponseserrormetadata.py +70 -0
  225. melara/components/openresponsesinprogressevent.py +28 -0
  226. melara/components/openresponsesresult.py +605 -0
  227. melara/components/outputapplypatchcallitem.py +40 -0
  228. melara/components/outputcodeinterpretercallitem.py +157 -0
  229. melara/components/outputcomputercallitem.py +71 -0
  230. melara/components/outputcustomtoolcallitem.py +78 -0
  231. melara/components/outputfilesearchcallitem.py +25 -0
  232. melara/components/outputfunctioncallitem.py +126 -0
  233. melara/components/outputimagegenerationcallitem.py +60 -0
  234. melara/components/outputitemapplypatchcall.py +117 -0
  235. melara/components/outputitemcodeinterpretercall.py +153 -0
  236. melara/components/outputitemcustomtoolcall.py +74 -0
  237. melara/components/outputitemfilesearchcall.py +25 -0
  238. melara/components/outputitemfunctioncall.py +93 -0
  239. melara/components/outputitemimagegenerationcall.py +55 -0
  240. melara/components/outputitemreasoning.py +93 -0
  241. melara/components/outputitems.py +136 -0
  242. melara/components/outputitemwebsearchcall.py +207 -0
  243. melara/components/outputmessage.py +162 -0
  244. melara/components/outputmessageitem.py +168 -0
  245. melara/components/outputmodalityenum.py +12 -0
  246. melara/components/outputreasoningitem.py +117 -0
  247. melara/components/outputshellcallitem.py +99 -0
  248. melara/components/outputshellcalloutputitem.py +114 -0
  249. melara/components/outputtoolsearchcallitem.py +55 -0
  250. melara/components/outputwebsearchcallitem.py +207 -0
  251. melara/components/outputwebsearchservertoolitem.py +104 -0
  252. melara/components/paretorouterplugin.py +64 -0
  253. melara/components/payloadtoolargeresponseerrordata.py +54 -0
  254. melara/components/paymentrequiredresponseerrordata.py +54 -0
  255. melara/components/pdfparserengine.py +29 -0
  256. melara/components/pdfparseroptions.py +36 -0
  257. melara/components/percentilelatencycutoffs.py +64 -0
  258. melara/components/percentilethroughputcutoffs.py +64 -0
  259. melara/components/prediction.py +33 -0
  260. melara/components/predictioncontenttext.py +22 -0
  261. melara/components/preferredmaxlatency.py +19 -0
  262. melara/components/preferredminthroughput.py +20 -0
  263. melara/components/preview_20250311_websearchservertool.py +107 -0
  264. melara/components/preview_websearchservertool.py +107 -0
  265. melara/components/preview_websearchuserlocation.py +59 -0
  266. melara/components/promptcachebreakpoint.py +19 -0
  267. melara/components/promptcacheoptions.py +54 -0
  268. melara/components/providername.py +9 -0
  269. melara/components/provideroptions.py +632 -0
  270. melara/components/provideroverloadedresponseerrordata.py +54 -0
  271. melara/components/providerpreferences.py +280 -0
  272. melara/components/providersort.py +15 -0
  273. melara/components/providersortconfig.py +78 -0
  274. melara/components/quantization.py +22 -0
  275. melara/components/reasoningcontext.py +14 -0
  276. melara/components/reasoningdeltaevent.py +34 -0
  277. melara/components/reasoningdetailencrypted.py +73 -0
  278. melara/components/reasoningdetailservertoolcall.py +82 -0
  279. melara/components/reasoningdetailsummary.py +73 -0
  280. melara/components/reasoningdetailtext.py +76 -0
  281. melara/components/reasoningdetailunion.py +72 -0
  282. melara/components/reasoningdoneevent.py +34 -0
  283. melara/components/reasoningeffort.py +17 -0
  284. melara/components/reasoningformat.py +16 -0
  285. melara/components/reasoningitem.py +115 -0
  286. melara/components/reasoningmode.py +13 -0
  287. melara/components/reasoningsummarypartaddedevent.py +35 -0
  288. melara/components/reasoningsummarypartdoneevent.py +35 -0
  289. melara/components/reasoningsummarytext.py +18 -0
  290. melara/components/reasoningsummarytextdeltaevent.py +34 -0
  291. melara/components/reasoningsummarytextdoneevent.py +34 -0
  292. melara/components/reasoningsummaryverbosity.py +13 -0
  293. melara/components/reasoningtextcontent.py +18 -0
  294. melara/components/refusaldeltaevent.py +34 -0
  295. melara/components/refusaldoneevent.py +34 -0
  296. melara/components/requesttimeoutresponseerrordata.py +54 -0
  297. melara/components/responsehealingplugin.py +37 -0
  298. melara/components/responseincludesenum.py +15 -0
  299. melara/components/responseoutputtext.py +87 -0
  300. melara/components/responsesrequest.py +621 -0
  301. melara/components/responsesstreamingresponse.py +14 -0
  302. melara/components/searchcontextsizeenum.py +14 -0
  303. melara/components/searchqualitylevel.py +14 -0
  304. melara/components/security.py +40 -0
  305. melara/components/servertoolusedetails.py +63 -0
  306. melara/components/serviceunavailableresponseerrordata.py +54 -0
  307. melara/components/shellcallitem.py +111 -0
  308. melara/components/shellcalloutputcontent.py +126 -0
  309. melara/components/shellcalloutputitem.py +114 -0
  310. melara/components/shellcallstatus.py +14 -0
  311. melara/components/shellservertool.py +19 -0
  312. melara/components/speechinput.py +14 -0
  313. melara/components/speechinputreference.py +39 -0
  314. melara/components/speechinputreferenceaudio.py +28 -0
  315. melara/components/speechinputreferenceaudioinput.py +52 -0
  316. melara/components/speechinputreferenceimage.py +28 -0
  317. melara/components/speechinputreferenceimageinput.py +17 -0
  318. melara/components/speechinputreferencetext.py +24 -0
  319. melara/components/speechrequest.py +189 -0
  320. melara/components/speechturn.py +41 -0
  321. melara/components/stopservertoolswhencondition.py +51 -0
  322. melara/components/stopservertoolswhenfinishreasonis.py +22 -0
  323. melara/components/stopservertoolswhenhastoolcall.py +22 -0
  324. melara/components/stopservertoolswhenmaxcost.py +22 -0
  325. melara/components/stopservertoolswhenmaxtokensused.py +22 -0
  326. melara/components/stopservertoolswhenstepcountis.py +22 -0
  327. melara/components/storedprompttemplate.py +59 -0
  328. melara/components/streamevents.py +357 -0
  329. melara/components/streameventsresponsecompleted.py +28 -0
  330. melara/components/streameventsresponsefailed.py +28 -0
  331. melara/components/streameventsresponseincomplete.py +28 -0
  332. melara/components/streameventsresponseoutputitemadded.py +31 -0
  333. melara/components/streameventsresponseoutputitemdone.py +31 -0
  334. melara/components/streamlogprob.py +53 -0
  335. melara/components/streamlogprobtoplogprob.py +46 -0
  336. melara/components/sttentity.py +32 -0
  337. melara/components/sttresponse.py +96 -0
  338. melara/components/sttsegment.py +107 -0
  339. melara/components/sttusage.py +57 -0
  340. melara/components/sttword.py +82 -0
  341. melara/components/switchyardrouterplugin.py +56 -0
  342. melara/components/textdeltaevent.py +38 -0
  343. melara/components/textdoneevent.py +38 -0
  344. melara/components/textextendedconfig.py +74 -0
  345. melara/components/toolcallstatus.py +13 -0
  346. melara/components/toolchoiceallowed.py +37 -0
  347. melara/components/toolsearchcallitem.py +86 -0
  348. melara/components/toolsearchoutputitem.py +291 -0
  349. melara/components/toomanyrequestsresponseerrordata.py +54 -0
  350. melara/components/traceconfig.py +64 -0
  351. melara/components/truncation.py +12 -0
  352. melara/components/unauthorizedresponseerrordata.py +54 -0
  353. melara/components/unprocessableentityresponseerrordata.py +54 -0
  354. melara/components/urlcitation.py +47 -0
  355. melara/components/webfetchplugin.py +54 -0
  356. melara/components/websearchcallcompletedevent.py +28 -0
  357. melara/components/websearchcallinprogressevent.py +28 -0
  358. melara/components/websearchcallsearchingevent.py +28 -0
  359. melara/components/websearchconfig.py +103 -0
  360. melara/components/websearchdomainfilter.py +54 -0
  361. melara/components/websearchengine.py +16 -0
  362. melara/components/websearchengineenum.py +17 -0
  363. melara/components/websearchmode.py +20 -0
  364. melara/components/websearchplugin.py +159 -0
  365. melara/components/websearchservertool.py +106 -0
  366. melara/components/websearchsource.py +18 -0
  367. melara/components/websearchstatus.py +14 -0
  368. melara/components/websearchuserlocation.py +63 -0
  369. melara/components/websearchuserlocationservertool.py +63 -0
  370. melara/components/xsearchoptions.py +70 -0
  371. melara/embeddings.py +476 -0
  372. melara/endpoints.json +3 -0
  373. melara/errors/__init__.py +148 -0
  374. melara/errors/badgatewayresponse_error.py +33 -0
  375. melara/errors/badrequestresponse_error.py +33 -0
  376. melara/errors/edgenetworktimeoutresponse_error.py +33 -0
  377. melara/errors/forbiddenresponse_error.py +33 -0
  378. melara/errors/gatewaytimeoutresponse_error.py +33 -0
  379. melara/errors/internalserverresponse_error.py +33 -0
  380. melara/errors/melaradefaulterror.py +14 -0
  381. melara/errors/melaraerror.py +28 -0
  382. melara/errors/no_response_error.py +16 -0
  383. melara/errors/notfoundresponse_error.py +33 -0
  384. melara/errors/payloadtoolargeresponse_error.py +33 -0
  385. melara/errors/paymentrequiredresponse_error.py +33 -0
  386. melara/errors/provideroverloadedresponse_error.py +33 -0
  387. melara/errors/requesttimeoutresponse_error.py +33 -0
  388. melara/errors/responsevalidationerror.py +25 -0
  389. melara/errors/serviceunavailableresponse_error.py +33 -0
  390. melara/errors/toomanyrequestsresponse_error.py +33 -0
  391. melara/errors/unauthorizedresponse_error.py +33 -0
  392. melara/errors/unprocessableentityresponse_error.py +33 -0
  393. melara/httpclient.py +123 -0
  394. melara/images.py +1014 -0
  395. melara/locales/__init__.py +0 -0
  396. melara/locales/en.py +53 -0
  397. melara/models/__init__.py +21 -0
  398. melara/models/internal/__init__.py +23 -0
  399. melara/models/internal/globals.py +57 -0
  400. melara/models_.py +390 -0
  401. melara/operations/__init__.py +269 -0
  402. melara/operations/createaudiospeech.py +114 -0
  403. melara/operations/createaudiotranscriptions_multipart.py +286 -0
  404. melara/operations/createembeddings.py +556 -0
  405. melara/operations/createimages.py +157 -0
  406. melara/operations/createresponses.py +151 -0
  407. melara/operations/getmodels.py +274 -0
  408. melara/operations/sendchatcompletionrequest.py +153 -0
  409. melara/py.typed +1 -0
  410. melara/realtime.py +252 -0
  411. melara/responses.py +1830 -0
  412. melara/sdk.py +219 -0
  413. melara/sdkconfiguration.py +60 -0
  414. melara/stt.py +466 -0
  415. melara/tts.py +517 -0
  416. melara/types/__init__.py +22 -0
  417. melara/types/base64fileinput.py +42 -0
  418. melara/types/basemodel.py +75 -0
  419. melara/utils/__init__.py +179 -0
  420. melara/utils/annotations.py +78 -0
  421. melara/utils/datetimes.py +21 -0
  422. melara/utils/dynamic_imports.py +53 -0
  423. melara/utils/enums.py +132 -0
  424. melara/utils/eventstreaming.py +344 -0
  425. melara/utils/forms.py +238 -0
  426. melara/utils/headers.py +134 -0
  427. melara/utils/logger.py +26 -0
  428. melara/utils/metadata.py +117 -0
  429. melara/utils/queryparams.py +216 -0
  430. melara/utils/requestbodies.py +66 -0
  431. melara/utils/retries.py +355 -0
  432. melara/utils/security.py +214 -0
  433. melara/utils/serializers.py +305 -0
  434. melara/utils/unions.py +40 -0
  435. melara/utils/unmarshal_json_response.py +37 -0
  436. melara/utils/url.py +153 -0
  437. melara/utils/values.py +136 -0
  438. melara-0.1.1.dist-info/METADATA +98 -0
  439. melara-0.1.1.dist-info/RECORD +442 -0
  440. melara-0.1.1.dist-info/WHEEL +5 -0
  441. melara-0.1.1.dist-info/licenses/LICENSE +201 -0
  442. melara-0.1.1.dist-info/top_level.txt +1 -0
melara/__init__.py ADDED
@@ -0,0 +1,13 @@
1
+ from ._version import (
2
+ __title__,
3
+ __version__,
4
+ __openapi_doc_version__,
5
+ __user_agent__,
6
+ )
7
+ from .sdk import *
8
+ from .sdkconfiguration import *
9
+
10
+
11
+ VERSION: str = __version__
12
+ OPENAPI_DOC_VERSION = __openapi_doc_version__
13
+ USER_AGENT = __user_agent__
@@ -0,0 +1,3 @@
1
+ from .sdkhooks import *
2
+ from .types import *
3
+ from .registration import *
@@ -0,0 +1,13 @@
1
+ from .types import Hooks
2
+
3
+
4
+ # This file is only ever generated once on the first generation and then is free to be modified.
5
+ # Any hooks you wish to add should be registered in the init_hooks function. Feel free to define them
6
+ # in this file or in separate files in the hooks folder.
7
+
8
+
9
+ def init_hooks(hooks: Hooks):
10
+ # pylint: disable=unused-argument
11
+ """Add hooks by calling hooks.register{sdk_init/before_request/after_success/after_error}Hook
12
+ with an instance of a hook that implements that specific Hook interface
13
+ Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance"""
@@ -0,0 +1,74 @@
1
+ import httpx
2
+ from .types import (
3
+ SDKInitHook,
4
+ BeforeRequestContext,
5
+ BeforeRequestHook,
6
+ AfterSuccessContext,
7
+ AfterSuccessHook,
8
+ AfterErrorContext,
9
+ AfterErrorHook,
10
+ Hooks,
11
+ )
12
+ from .registration import init_hooks
13
+ from typing import List, Optional, Tuple
14
+ from melara.sdkconfiguration import SDKConfiguration
15
+
16
+
17
+ class SDKHooks(Hooks):
18
+ def __init__(self) -> None:
19
+ self.sdk_init_hooks: List[SDKInitHook] = []
20
+ self.before_request_hooks: List[BeforeRequestHook] = []
21
+ self.after_success_hooks: List[AfterSuccessHook] = []
22
+ self.after_error_hooks: List[AfterErrorHook] = []
23
+ init_hooks(self)
24
+
25
+ def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
26
+ self.sdk_init_hooks.append(hook)
27
+
28
+ def register_before_request_hook(self, hook: BeforeRequestHook) -> None:
29
+ self.before_request_hooks.append(hook)
30
+
31
+ def register_after_success_hook(self, hook: AfterSuccessHook) -> None:
32
+ self.after_success_hooks.append(hook)
33
+
34
+ def register_after_error_hook(self, hook: AfterErrorHook) -> None:
35
+ self.after_error_hooks.append(hook)
36
+
37
+ def sdk_init(self, config: SDKConfiguration) -> SDKConfiguration:
38
+ for hook in self.sdk_init_hooks:
39
+ config = hook.sdk_init(config)
40
+ return config
41
+
42
+ def before_request(
43
+ self, hook_ctx: BeforeRequestContext, request: httpx.Request
44
+ ) -> httpx.Request:
45
+ for hook in self.before_request_hooks:
46
+ out = hook.before_request(hook_ctx, request)
47
+ if isinstance(out, Exception):
48
+ raise out
49
+ request = out
50
+
51
+ return request
52
+
53
+ def after_success(
54
+ self, hook_ctx: AfterSuccessContext, response: httpx.Response
55
+ ) -> httpx.Response:
56
+ for hook in self.after_success_hooks:
57
+ out = hook.after_success(hook_ctx, response)
58
+ if isinstance(out, Exception):
59
+ raise out
60
+ response = out
61
+ return response
62
+
63
+ def after_error(
64
+ self,
65
+ hook_ctx: AfterErrorContext,
66
+ response: Optional[httpx.Response],
67
+ error: Optional[Exception],
68
+ ) -> Tuple[Optional[httpx.Response], Optional[Exception]]:
69
+ for hook in self.after_error_hooks:
70
+ result = hook.after_error(hook_ctx, response, error)
71
+ if isinstance(result, Exception):
72
+ raise result
73
+ response, error = result
74
+ return response, error
melara/_hooks/types.py ADDED
@@ -0,0 +1,122 @@
1
+ from abc import ABC, abstractmethod
2
+ import httpx
3
+ from melara.sdkconfiguration import SDKConfiguration
4
+ from typing import Any, Callable, Dict, List, Optional, Tuple, Union
5
+
6
+
7
+ class HookContext:
8
+ config: SDKConfiguration
9
+ base_url: str
10
+ operation_id: str
11
+ oauth2_scopes: Optional[List[str]] = None
12
+ security_source: Optional[Union[Any, Callable[[], Any]]] = None
13
+ tags: Optional[List[str]] = None
14
+ extensions: Optional[Dict[str, Any]] = None
15
+
16
+ def __init__(
17
+ self,
18
+ config: SDKConfiguration,
19
+ base_url: str,
20
+ operation_id: str,
21
+ oauth2_scopes: Optional[List[str]],
22
+ security_source: Optional[Union[Any, Callable[[], Any]]],
23
+ tags: Optional[List[str]],
24
+ extensions: Optional[Dict[str, Any]],
25
+ ):
26
+ self.config = config
27
+ self.base_url = base_url
28
+ self.operation_id = operation_id
29
+ self.oauth2_scopes = oauth2_scopes
30
+ self.security_source = security_source
31
+ self.tags = tags
32
+ self.extensions = extensions
33
+
34
+
35
+ class BeforeRequestContext(HookContext):
36
+ def __init__(self, hook_ctx: HookContext):
37
+ super().__init__(
38
+ hook_ctx.config,
39
+ hook_ctx.base_url,
40
+ hook_ctx.operation_id,
41
+ hook_ctx.oauth2_scopes,
42
+ hook_ctx.security_source,
43
+ hook_ctx.tags,
44
+ hook_ctx.extensions,
45
+ )
46
+
47
+
48
+ class AfterSuccessContext(HookContext):
49
+ def __init__(self, hook_ctx: HookContext):
50
+ super().__init__(
51
+ hook_ctx.config,
52
+ hook_ctx.base_url,
53
+ hook_ctx.operation_id,
54
+ hook_ctx.oauth2_scopes,
55
+ hook_ctx.security_source,
56
+ hook_ctx.tags,
57
+ hook_ctx.extensions,
58
+ )
59
+
60
+
61
+ class AfterErrorContext(HookContext):
62
+ def __init__(self, hook_ctx: HookContext):
63
+ super().__init__(
64
+ hook_ctx.config,
65
+ hook_ctx.base_url,
66
+ hook_ctx.operation_id,
67
+ hook_ctx.oauth2_scopes,
68
+ hook_ctx.security_source,
69
+ hook_ctx.tags,
70
+ hook_ctx.extensions,
71
+ )
72
+
73
+
74
+ class SDKInitHook(ABC):
75
+ @abstractmethod
76
+ def sdk_init(self, config: SDKConfiguration) -> SDKConfiguration:
77
+ pass
78
+
79
+
80
+ class BeforeRequestHook(ABC):
81
+ @abstractmethod
82
+ def before_request(
83
+ self, hook_ctx: BeforeRequestContext, request: httpx.Request
84
+ ) -> Union[httpx.Request, Exception]:
85
+ pass
86
+
87
+
88
+ class AfterSuccessHook(ABC):
89
+ @abstractmethod
90
+ def after_success(
91
+ self, hook_ctx: AfterSuccessContext, response: httpx.Response
92
+ ) -> Union[httpx.Response, Exception]:
93
+ pass
94
+
95
+
96
+ class AfterErrorHook(ABC):
97
+ @abstractmethod
98
+ def after_error(
99
+ self,
100
+ hook_ctx: AfterErrorContext,
101
+ response: Optional[httpx.Response],
102
+ error: Optional[Exception],
103
+ ) -> Union[Tuple[Optional[httpx.Response], Optional[Exception]], Exception]:
104
+ pass
105
+
106
+
107
+ class Hooks(ABC):
108
+ @abstractmethod
109
+ def register_sdk_init_hook(self, hook: SDKInitHook):
110
+ pass
111
+
112
+ @abstractmethod
113
+ def register_before_request_hook(self, hook: BeforeRequestHook):
114
+ pass
115
+
116
+ @abstractmethod
117
+ def register_after_success_hook(self, hook: AfterSuccessHook):
118
+ pass
119
+
120
+ @abstractmethod
121
+ def register_after_error_hook(self, hook: AfterErrorHook):
122
+ pass
melara/_version.py ADDED
@@ -0,0 +1,13 @@
1
+ import importlib.metadata
2
+
3
+ __title__: str = "melara"
4
+ __version__: str = "0.1.1"
5
+ __openapi_doc_version__: str = "1.0.0"
6
+ __gen_version__: str = "2.914.0"
7
+ __user_agent__: str = "melara-python/0.1.1"
8
+
9
+ try:
10
+ if __package__ is not None:
11
+ __version__ = importlib.metadata.version(__package__)
12
+ except importlib.metadata.PackageNotFoundError:
13
+ pass
melara/basesdk.py ADDED
@@ -0,0 +1,405 @@
1
+ from .sdkconfiguration import SDKConfiguration
2
+ import httpx
3
+ from melara.locales import en as messages
4
+ from melara import components, errors, utils
5
+ from melara._hooks import (
6
+ AfterErrorContext,
7
+ AfterSuccessContext,
8
+ BeforeRequestContext,
9
+ HookContext,
10
+ )
11
+ from melara.utils import (
12
+ RetryConfig,
13
+ SerializedRequestBody,
14
+ get_body_content,
15
+ run_sync_in_thread,
16
+ )
17
+ from typing import Callable, List, Mapping, Optional, Tuple
18
+ from urllib.parse import parse_qs, urlparse
19
+
20
+
21
+ class BaseSDK:
22
+ sdk_configuration: SDKConfiguration
23
+ parent_ref: Optional[object] = None
24
+ """
25
+ Reference to the root SDK instance, if any. This will prevent it from
26
+ being garbage collected while there are active streams.
27
+ """
28
+
29
+ def __init__(
30
+ self,
31
+ sdk_config: SDKConfiguration,
32
+ parent_ref: Optional[object] = None,
33
+ ) -> None:
34
+ self.sdk_configuration = sdk_config
35
+ self.parent_ref = parent_ref
36
+
37
+ def _get_url(self, base_url, url_variables):
38
+ sdk_url, sdk_variables = self.sdk_configuration.get_server_details()
39
+
40
+ if base_url is None:
41
+ base_url = sdk_url
42
+
43
+ if url_variables is None:
44
+ url_variables = sdk_variables
45
+
46
+ return utils.template_url(base_url, url_variables)
47
+
48
+ def _build_request_async(
49
+ self,
50
+ method,
51
+ path,
52
+ base_url,
53
+ url_variables,
54
+ request,
55
+ request_body_required,
56
+ request_has_path_params,
57
+ request_has_query_params,
58
+ user_agent_header,
59
+ accept_header_value,
60
+ _globals=None,
61
+ security=None,
62
+ timeout_ms: Optional[int] = None,
63
+ get_serialized_body: Optional[
64
+ Callable[[], Optional[SerializedRequestBody]]
65
+ ] = None,
66
+ url_override: Optional[str] = None,
67
+ http_headers: Optional[Mapping[str, str]] = None,
68
+ allow_empty_value: Optional[List[str]] = None,
69
+ allowed_fields: Optional[List[str]] = None,
70
+ ) -> httpx.Request:
71
+ client = self.sdk_configuration.async_client
72
+ return self._build_request_with_client(
73
+ client,
74
+ method,
75
+ path,
76
+ base_url,
77
+ url_variables,
78
+ request,
79
+ request_body_required,
80
+ request_has_path_params,
81
+ request_has_query_params,
82
+ user_agent_header,
83
+ accept_header_value,
84
+ _globals,
85
+ security,
86
+ timeout_ms,
87
+ get_serialized_body,
88
+ url_override,
89
+ http_headers,
90
+ allow_empty_value,
91
+ allowed_fields,
92
+ )
93
+
94
+ def _build_request(
95
+ self,
96
+ method,
97
+ path,
98
+ base_url,
99
+ url_variables,
100
+ request,
101
+ request_body_required,
102
+ request_has_path_params,
103
+ request_has_query_params,
104
+ user_agent_header,
105
+ accept_header_value,
106
+ _globals=None,
107
+ security=None,
108
+ timeout_ms: Optional[int] = None,
109
+ get_serialized_body: Optional[
110
+ Callable[[], Optional[SerializedRequestBody]]
111
+ ] = None,
112
+ url_override: Optional[str] = None,
113
+ http_headers: Optional[Mapping[str, str]] = None,
114
+ allow_empty_value: Optional[List[str]] = None,
115
+ allowed_fields: Optional[List[str]] = None,
116
+ ) -> httpx.Request:
117
+ client = self.sdk_configuration.client
118
+ return self._build_request_with_client(
119
+ client,
120
+ method,
121
+ path,
122
+ base_url,
123
+ url_variables,
124
+ request,
125
+ request_body_required,
126
+ request_has_path_params,
127
+ request_has_query_params,
128
+ user_agent_header,
129
+ accept_header_value,
130
+ _globals,
131
+ security,
132
+ timeout_ms,
133
+ get_serialized_body,
134
+ url_override,
135
+ http_headers,
136
+ allow_empty_value,
137
+ allowed_fields,
138
+ )
139
+
140
+ def _build_request_with_client(
141
+ self,
142
+ client,
143
+ method,
144
+ path,
145
+ base_url,
146
+ url_variables,
147
+ request,
148
+ request_body_required,
149
+ request_has_path_params,
150
+ request_has_query_params,
151
+ user_agent_header,
152
+ accept_header_value,
153
+ _globals=None,
154
+ security=None,
155
+ timeout_ms: Optional[int] = None,
156
+ get_serialized_body: Optional[
157
+ Callable[[], Optional[SerializedRequestBody]]
158
+ ] = None,
159
+ url_override: Optional[str] = None,
160
+ http_headers: Optional[Mapping[str, str]] = None,
161
+ allow_empty_value: Optional[List[str]] = None,
162
+ allowed_fields: Optional[List[str]] = None,
163
+ ) -> httpx.Request:
164
+ query_params = {}
165
+
166
+ url = url_override
167
+ if url is None:
168
+ url = utils.generate_url(
169
+ self._get_url(base_url, url_variables),
170
+ path,
171
+ request if request_has_path_params else None,
172
+ _globals if request_has_path_params else None,
173
+ )
174
+
175
+ query_params = utils.get_query_params(
176
+ request if request_has_query_params else None,
177
+ _globals if request_has_query_params else None,
178
+ allow_empty_value,
179
+ )
180
+ else:
181
+ # Pick up the query parameter from the override so they can be
182
+ # preserved when building the request later on (necessary as of
183
+ # httpx 0.28).
184
+ parsed_override = urlparse(str(url_override))
185
+ query_params = parse_qs(parsed_override.query, keep_blank_values=True)
186
+
187
+ headers = utils.get_headers(request, _globals)
188
+ headers["Accept"] = accept_header_value
189
+ headers[user_agent_header] = self.sdk_configuration.user_agent
190
+
191
+ if security is not None:
192
+ if callable(security):
193
+ security = security()
194
+ security = utils.get_security_from_env(security, components.Security)
195
+ if security is not None:
196
+ security_headers, security_query_params = utils.get_security(
197
+ security, allowed_fields
198
+ )
199
+ headers = {**headers, **security_headers}
200
+ query_params = {**query_params, **security_query_params}
201
+
202
+ serialized_request_body = SerializedRequestBody()
203
+ if get_serialized_body is not None:
204
+ rb = get_serialized_body()
205
+ if request_body_required and rb is None:
206
+ raise ValueError(messages.REQUEST_BODY_IS_REQUIRED)
207
+
208
+ if rb is not None:
209
+ serialized_request_body = rb
210
+
211
+ if (
212
+ serialized_request_body.media_type is not None
213
+ and serialized_request_body.media_type
214
+ not in (
215
+ "multipart/form-data",
216
+ "multipart/mixed",
217
+ )
218
+ ):
219
+ headers["content-type"] = serialized_request_body.media_type
220
+
221
+ # Normalize attribution at the shared sync and async request boundary.
222
+ attribution = {
223
+ "http-referer": "X-Melara-App-Url",
224
+ "x-title": "X-Melara-App-Name",
225
+ }
226
+ request_headers = httpx.Headers(headers)
227
+ if http_headers is not None:
228
+ explicit_headers = {header.lower() for header in http_headers}
229
+ for header, value in http_headers.items():
230
+ canonical = attribution.get(header.lower())
231
+ if canonical is not None and canonical.lower() in explicit_headers:
232
+ continue
233
+ request_headers[canonical or header] = value
234
+
235
+ timeout = timeout_ms / 1000 if timeout_ms is not None else None
236
+
237
+ return client.build_request(
238
+ method,
239
+ url,
240
+ params=query_params,
241
+ content=serialized_request_body.content,
242
+ data=serialized_request_body.data,
243
+ files=serialized_request_body.files,
244
+ headers=request_headers,
245
+ timeout=timeout if timeout is not None else httpx.USE_CLIENT_DEFAULT,
246
+ )
247
+
248
+ def do_request(
249
+ self,
250
+ hook_ctx: HookContext,
251
+ request: httpx.Request,
252
+ is_error_status_code: Callable[[int], bool],
253
+ stream: bool = False,
254
+ retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
255
+ ) -> httpx.Response:
256
+ client = self.sdk_configuration.client
257
+ logger = self.sdk_configuration.debug_logger
258
+
259
+ hooks = self.sdk_configuration.__dict__["_hooks"]
260
+
261
+ def do():
262
+ http_res = None
263
+ try:
264
+ req = hooks.before_request(BeforeRequestContext(hook_ctx), request)
265
+ if "timeout" in request.extensions and "timeout" not in req.extensions:
266
+ req.extensions["timeout"] = request.extensions["timeout"]
267
+ logger.debug(
268
+ messages.REQUEST_METHOD_S_URL_S_HEADERS_S_BODY_S,
269
+ req.method,
270
+ req.url,
271
+ req.headers,
272
+ get_body_content(req),
273
+ )
274
+
275
+ if client is None:
276
+ raise ValueError(messages.CLIENT_IS_REQUIRED)
277
+
278
+ http_res = client.send(req, stream=stream)
279
+ except Exception as e:
280
+ _, e = hooks.after_error(AfterErrorContext(hook_ctx), None, e)
281
+ if e is not None:
282
+ logger.debug(messages.REQUEST_EXCEPTION, exc_info=True)
283
+ raise e
284
+
285
+ if http_res is None:
286
+ logger.debug(messages.RAISING_NO_RESPONSE_SDK_ERROR)
287
+ raise errors.NoResponseError(messages.NO_RESPONSE_RECEIVED)
288
+
289
+ logger.debug(
290
+ messages.RESPONSE_STATUS_CODE_S_URL_S_HEADERS_S_BODY,
291
+ http_res.status_code,
292
+ http_res.url,
293
+ http_res.headers,
294
+ messages.STREAMING_RESPONSE if stream else http_res.text,
295
+ )
296
+
297
+ return http_res
298
+
299
+ if retry_config is not None:
300
+ http_res = utils.retry(do, utils.Retries(retry_config[0], retry_config[1]))
301
+ else:
302
+ http_res = do()
303
+
304
+ if is_error_status_code(http_res.status_code):
305
+ result, err = hooks.after_error(AfterErrorContext(hook_ctx), http_res, None)
306
+ if err is not None:
307
+ logger.debug(messages.REQUEST_EXCEPTION, exc_info=True)
308
+ raise err
309
+ if result is not None:
310
+ http_res = result
311
+ else:
312
+ logger.debug(messages.RAISING_UNEXPECTED_SDK_ERROR)
313
+ raise errors.MelaraDefaultError(
314
+ messages.UNEXPECTED_ERROR_OCCURRED, http_res
315
+ )
316
+ else:
317
+ http_res = hooks.after_success(AfterSuccessContext(hook_ctx), http_res)
318
+
319
+ return http_res
320
+
321
+ async def do_request_async(
322
+ self,
323
+ hook_ctx: HookContext,
324
+ request: httpx.Request,
325
+ is_error_status_code: Callable[[int], bool],
326
+ stream: bool = False,
327
+ retry_config: Optional[Tuple[RetryConfig, List[str]]] = None,
328
+ ) -> httpx.Response:
329
+ client = self.sdk_configuration.async_client
330
+ logger = self.sdk_configuration.debug_logger
331
+
332
+ hooks = self.sdk_configuration.__dict__["_hooks"]
333
+
334
+ async def do():
335
+ http_res = None
336
+ try:
337
+ req = await run_sync_in_thread(
338
+ hooks.before_request, BeforeRequestContext(hook_ctx), request
339
+ )
340
+
341
+ if "timeout" in request.extensions and "timeout" not in req.extensions:
342
+ req.extensions["timeout"] = request.extensions["timeout"]
343
+ logger.debug(
344
+ messages.REQUEST_METHOD_S_URL_S_HEADERS_S_BODY_S,
345
+ req.method,
346
+ req.url,
347
+ req.headers,
348
+ get_body_content(req),
349
+ )
350
+
351
+ if client is None:
352
+ raise ValueError(messages.CLIENT_IS_REQUIRED)
353
+
354
+ http_res = await client.send(req, stream=stream)
355
+ except Exception as e:
356
+ _, e = await run_sync_in_thread(
357
+ hooks.after_error, AfterErrorContext(hook_ctx), None, e
358
+ )
359
+
360
+ if e is not None:
361
+ logger.debug(messages.REQUEST_EXCEPTION, exc_info=True)
362
+ raise e
363
+
364
+ if http_res is None:
365
+ logger.debug(messages.RAISING_NO_RESPONSE_SDK_ERROR)
366
+ raise errors.NoResponseError(messages.NO_RESPONSE_RECEIVED)
367
+
368
+ logger.debug(
369
+ messages.RESPONSE_STATUS_CODE_S_URL_S_HEADERS_S_BODY,
370
+ http_res.status_code,
371
+ http_res.url,
372
+ http_res.headers,
373
+ messages.STREAMING_RESPONSE if stream else http_res.text,
374
+ )
375
+
376
+ return http_res
377
+
378
+ if retry_config is not None:
379
+ http_res = await utils.retry_async(
380
+ do, utils.Retries(retry_config[0], retry_config[1])
381
+ )
382
+ else:
383
+ http_res = await do()
384
+
385
+ if is_error_status_code(http_res.status_code):
386
+ result, err = await run_sync_in_thread(
387
+ hooks.after_error, AfterErrorContext(hook_ctx), http_res, None
388
+ )
389
+
390
+ if err is not None:
391
+ logger.debug(messages.REQUEST_EXCEPTION, exc_info=True)
392
+ raise err
393
+ if result is not None:
394
+ http_res = result
395
+ else:
396
+ logger.debug(messages.RAISING_UNEXPECTED_SDK_ERROR)
397
+ raise errors.MelaraDefaultError(
398
+ messages.UNEXPECTED_ERROR_OCCURRED, http_res
399
+ )
400
+ else:
401
+ http_res = await run_sync_in_thread(
402
+ hooks.after_success, AfterSuccessContext(hook_ctx), http_res
403
+ )
404
+
405
+ return http_res
melara/beta.py ADDED
@@ -0,0 +1,21 @@
1
+ from .basesdk import BaseSDK
2
+ from .sdkconfiguration import SDKConfiguration
3
+ from melara.beta_responses import BetaResponses
4
+ from typing import Optional
5
+
6
+
7
+ class Beta(BaseSDK):
8
+ responses: BetaResponses
9
+ r"""Deprecated alias for responses endpoints. Use responses instead. Scheduled for removal (sunset date TBD)."""
10
+
11
+ def __init__(
12
+ self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
13
+ ) -> None:
14
+ BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref)
15
+ self.sdk_configuration = sdk_config
16
+ self._init_sdks()
17
+
18
+ def _init_sdks(self):
19
+ self.responses = BetaResponses(
20
+ self.sdk_configuration, parent_ref=self.parent_ref
21
+ )
@@ -0,0 +1,3 @@
1
+ from .responses import Responses as BetaResponses
2
+
3
+ __all__ = ["BetaResponses"]