diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 6c26421e1..cb5b659aa 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: "" id: "" management: - docChecksum: 1c2c2889af7163e9938ebf6d60f74d0b + docChecksum: 5b189c8f956d99fc1d2986840126b8ff docVersion: 1.0.0 speakeasyVersion: 1.803.2 generationVersion: 2.950.13 - releaseVersion: 1.5.24 - configChecksum: 2a0cd39651c143896f80786d27ef429e + releaseVersion: 1.5.25 + configChecksum: 0a0c72b6b731724cea556f41a0f262c4 repoURL: https://github.com/OpenRouterTeam/typescript-sdk.git installationURL: https://github.com/OpenRouterTeam/typescript-sdk published: true persistentEdits: - generation_id: 99780355-27d5-4290-8af8-fa1207071da9 - pristine_commit_hash: ce100dce60cde27bdabfbc45adc88036cc1e77f8 - pristine_tree_hash: c9010282a605bf236b60c01df31c360b55bb15ae + generation_id: 53b2511d-58c5-4cce-bc40-ad28c0201320 + pristine_commit_hash: b6d7e2dfcf0edff6ecca12016643a7c716319fec + pristine_tree_hash: 71d068e6860b855eb0b87e586fc032b7ef98f457 features: typescript: acceptHeaders: 2.81.2 @@ -412,10 +412,6 @@ trackedFiles: id: 572268d1df8b last_write_checksum: sha1:8e74ba01a28a20b983c7af9bdbb457b78704b300 pristine_git_object: 51511c33e9117612bd1d1238797178d9bd188fb5 - docs/models/answers.mdx: - id: 40dc1d48c58b - last_write_checksum: sha1:d835d5bd6718bb94c4cdc2f0b7cd8f1b6cfcfc1b - pristine_git_object: 72bf248cc6f2c9f402987d7ddbac0f9cf509866e docs/models/anthropicadvisormessageusageiteration.md: id: 42f357aa06ea last_write_checksum: sha1:3cf3d897195b125f9fbf4e7c512fdc235ef44f32 @@ -1319,8 +1315,8 @@ trackedFiles: deleted: true docs/models/apitype.mdx: id: b92138197dbc - last_write_checksum: sha1:13effa149c014938b760375b111c9b1e7a394eb5 - pristine_git_object: eee0d60927584d1ff4d8e8143445fdd062b3cecc + last_write_checksum: sha1:8b4f27e604c7bade6ecb2dd5c1233c1657c54302 + pristine_git_object: 1db50cc4fcb7d1464bf9eedc5b80ed7b5ae1d6be docs/models/app.mdx: id: a6f931f688d3 last_write_checksum: sha1:4f2049a749bb91fcaf4e07fb5e04d321f251d5a2 @@ -4407,8 +4403,12 @@ trackedFiles: pristine_git_object: cbdebc8cce9ec7cca88071961823b71518d643fc docs/models/decisionsresponse.mdx: id: e2be79e574d8 - last_write_checksum: sha1:8cb15a1c1bc0859c7421dbd9a57fc7ccd87b80b8 - pristine_git_object: 3e712dad6c1f21cc02878b878e00e9c18983dc77 + last_write_checksum: sha1:9e339aaac36f8682ab7717e1619a523241fb45ea + pristine_git_object: df47b99c4bb333e5b328d5a9fa8a15d25391d7b7 + docs/models/decisionsresponseanswers.mdx: + id: 8dc87496ad9f + last_write_checksum: sha1:caf8a3d129e6758be35cfa4e56f7a4c3b788250e + pristine_git_object: eaf154cac1029eb35574a1810d9c286817607517 docs/models/decisionsresponseusage.mdx: id: 4946cd3605c7 last_write_checksum: sha1:c0eb63020df832f0934a051afcf2d656ee88c49c @@ -4895,6 +4895,266 @@ trackedFiles: id: bf7d8c07f485 last_write_checksum: sha1:9b868bacf90d05038dbd591d9e653db428fafe2e pristine_git_object: 409e106a78e27de366425d8d319e8db2ce6dd703 + docs/models/extractiondateanswer.mdx: + id: b98acc10a5a2 + last_write_checksum: sha1:17238f65d6c0addcb4d5353f12217b328ffd8ada + pristine_git_object: 87e7910ba1664eb9805061470a57d74c61f56444 + docs/models/extractiondateanswersource.mdx: + id: dcc45de5c6cd + last_write_checksum: sha1:7af4917428426fbe13200bb1549f6803b677f126 + pristine_git_object: db8476a5f983d592c54db9a86dcf6c307b1f2a04 + docs/models/extractiondatefield.mdx: + id: ed025c68baf7 + last_write_checksum: sha1:57adc7c9f1a9ccb0f46520f5a20eead6ce3454ec + pristine_git_object: fbe90880b90eedd84e67a1ab782a528ce6bb3330 + docs/models/extractiondatetimeanswer.mdx: + id: a656a27dae65 + last_write_checksum: sha1:ee4153c6f29443a058ce4a83cb40665da7cacb20 + pristine_git_object: c7cd38bd62d595074c7fead8c093a73b9e97159e + docs/models/extractiondatetimeanswersource.mdx: + id: 3c601d4771d2 + last_write_checksum: sha1:99f0427b7662b8d6e1fef1eff06680960539aa82 + pristine_git_object: 7d7110b27ecfbd820b7048ad1eb74572206e8637 + docs/models/extractiondatetimefield.mdx: + id: 44a4bb7daeb2 + last_write_checksum: sha1:cdb43e719b4ba87859cfe49132ec4467e3473aa4 + pristine_git_object: d8e2980cb00e957983f0dabd76a134f320c37e3e + docs/models/extractiondurationanswer.mdx: + id: c07ff5efff5c + last_write_checksum: sha1:ed49f78b60042342a70768129010a2f73db0b9ac + pristine_git_object: 86d363db231bce354f75a321a8ea1bca898c200c + docs/models/extractiondurationanswersource.mdx: + id: 803ae0d549da + last_write_checksum: sha1:823f58914b34d587f6252699d66ef3eccfa70da7 + pristine_git_object: b7fa440d6723354e308b5817dc68f7d0a7630e50 + docs/models/extractiondurationfield.mdx: + id: 0b02e31b25d6 + last_write_checksum: sha1:78045111d66d91c4c0089252803f76e40bbaa4ad + pristine_git_object: 82d2456bb3c61942a826e8d800d504e7388e69a0 + docs/models/extractionestimateanswer.mdx: + id: b4e587c5dba5 + last_write_checksum: sha1:5c4673733f2f3759d54106122af333161eace3a4 + pristine_git_object: 9ab7edaaac196bc547029be3eecb68503dd65242 + docs/models/extractionestimateanswerguess.mdx: + id: 2fa6f778a808 + last_write_checksum: sha1:da04189474185a9b42b561feaa9afe9221e0fd01 + pristine_git_object: a17b1e98766890096196f2fb21b0e94018d3a6cc + docs/models/extractionestimateanswermean.mdx: + id: a95c35efc771 + last_write_checksum: sha1:c970452c8224a368141586a26c43eb900c7ea479 + pristine_git_object: aa4b8bb1a1fc8194f33e9b0530224a5e775cf4eb + docs/models/extractionestimateanswermedian.mdx: + id: affec10569a4 + last_write_checksum: sha1:6fed55776e8bc1723305777ac3d80d16052f9549 + pristine_git_object: ac973e95c0a392d54cad436b1fb4728da5398dda + docs/models/extractionestimateanswerp10.mdx: + id: aabb31b8254a + last_write_checksum: sha1:72e8d26858a9458010de37465a8f97cc45333eb0 + pristine_git_object: 278fe7291d71069488c11ad19bb38e563ca5d46d + docs/models/extractionestimateanswerp90.mdx: + id: 67a282acbf21 + last_write_checksum: sha1:27e2d5984efc60e8e5d499aef1c1035c8e136e26 + pristine_git_object: a2623a1fd43a7e42780f3b80cd95c08c1a990390 + docs/models/extractionestimateanswerquantile.mdx: + id: ac75790bca54 + last_write_checksum: sha1:7698c02767830eb2b8b5c86f1b3065d8c05623e7 + pristine_git_object: f7250c08e59135e7eb0a093cefe116ca775e8f54 + docs/models/extractionestimateanswersource.mdx: + id: c312c3eea7e2 + last_write_checksum: sha1:a72b845c974c820ed560911dfb48941651d0c79e + pristine_git_object: 993d5151b72b4112ac04b8440c05a8f86cd957fa + docs/models/extractionestimateanswervalue.mdx: + id: 1e9d307deb74 + last_write_checksum: sha1:dbd16e472105a7127cd3e851514ab2f4468f1b1c + pristine_git_object: 5e4d029f89da265348f4d29b0df847f414588757 + docs/models/extractionestimatefield.mdx: + id: 838f17d0a3d4 + last_write_checksum: sha1:27cc5f32e480591dc0f271711d7bc2a425b1c6c3 + pristine_git_object: 2b9a3d57fcc2df9d5839e94f34d4ac2d64e5379c + docs/models/extractionestimatefieldmax.mdx: + id: 448eed59cab5 + last_write_checksum: sha1:fd1b121c0b609de5c0ce9b7aa788d872b835d3cc + pristine_git_object: f1fd7f234292e6c6c96c5fbaa6c6caad02e217b6 + docs/models/extractionestimatefieldmin.mdx: + id: 523c69d707b1 + last_write_checksum: sha1:f3f69b52de7b77f20dfea27834c432421ef9c0bc + pristine_git_object: 0eccd672280fe7cb45169660ada4b7a391d15ca0 + docs/models/extractionestimatefieldscale.mdx: + id: d6f7beef0d2d + last_write_checksum: sha1:1fb85e3a59d3c0ab35bb4cfdc956430c76b57643 + pristine_git_object: ae1e2363ad477e48da1f92d542d8c48d6a936737 + docs/models/extractionestimatefieldstepmonth.mdx: + id: a7366c856142 + last_write_checksum: sha1:a39c9c50967dd467b653fb3b583e74975a2869bb + pristine_git_object: e7d02aa8fd020f06b3597c4fba1fc90f5f54557a + docs/models/extractionestimatefieldstepunion.mdx: + id: 60f2402cc22e + last_write_checksum: sha1:53b94d28b9e30351001c816317ecb7269f48de20 + pristine_git_object: b26cf7266a4d64efe711e5e1cd97271d5e5f54a3 + docs/models/extractionestimatefieldstepyear.mdx: + id: 2c3a19828a01 + last_write_checksum: sha1:249c40d67f1d0a7f907a265846b9a04f76f0d377 + pristine_git_object: 29c9cef1b072d47e7041e1808193686b83ae761a + docs/models/extractionforecastanswer.mdx: + id: 8233e8ef62f3 + last_write_checksum: sha1:22f92bb6037be1f66b30226715cc070a66144cbf + pristine_git_object: 5269b26f847747a7ebfe38872b3f3623bf67864d + docs/models/extractionforecastanswerguess.mdx: + id: 72441630640f + last_write_checksum: sha1:1825e321630a2122ee9ce8094646bc5def2c313c + pristine_git_object: f23dbc3edb018e34c71bf625723e590f908486fe + docs/models/extractionforecastanswermean.mdx: + id: 998035499f76 + last_write_checksum: sha1:b626d43563d809326c2213c8aad4d3096193ce2e + pristine_git_object: 827ade76d09ce2a749fa6fdc0fc49d41ed46d057 + docs/models/extractionforecastanswermedian.mdx: + id: ec4d9fc47e88 + last_write_checksum: sha1:a33d6907cc295ff5649dd7054cc59179b5e99415 + pristine_git_object: 50e53fb2487ac7945684920afe9702cd7d3ad7a9 + docs/models/extractionforecastanswerp10.mdx: + id: c056a908f40d + last_write_checksum: sha1:6ca2b81b5de9402b1db4279095a98683562a97b4 + pristine_git_object: 7256081210f3d03e846590700a42683dda3edf2a + docs/models/extractionforecastanswerp90.mdx: + id: fddef2ccbc88 + last_write_checksum: sha1:5f52bf593fa187a77d9b99b7e93c04e5ac196ef3 + pristine_git_object: 9aff08396069c4afd7e4d63990d92fd37065c687 + docs/models/extractionforecastanswersource.mdx: + id: 97202a5bd1fd + last_write_checksum: sha1:712cebfc5d0a70e002c49dd6c27ccb6f8dde8469 + pristine_git_object: df7fc7d361ee57a8802859a1ab1288ecd15ab707 + docs/models/extractionforecastanswervalue.mdx: + id: 0970af07f0e9 + last_write_checksum: sha1:f54dfbdc5f8cf460ab36fa0ad80df41c7f000393 + pristine_git_object: 138ba536ebbc68dbf92ddaad2b7bce55062f4a03 + docs/models/extractionforecastfield.mdx: + id: 258554f02337 + last_write_checksum: sha1:250d028d9498cf47e5d26ff4910293a00c4babef + pristine_git_object: 190289ee4f79d20412e46fbd00b8c5b200e66214 + docs/models/extractionforecastfieldmax.mdx: + id: abd626875605 + last_write_checksum: sha1:eba6aeb6937961966dcf363e8957cbffebd60eef + pristine_git_object: 4118c9fb6d481e3fa2b7cab8f9dec2939dd8427a + docs/models/extractionforecastfieldmin.mdx: + id: 3f34a1f665a8 + last_write_checksum: sha1:661046c1cfa21d42af2fce5d5aba159775fb7ef1 + pristine_git_object: a021d8dd3dc584562262fdaaf2afe59613d24be9 + docs/models/extractionforecastfieldscale.mdx: + id: 4fac826040b3 + last_write_checksum: sha1:6a358fdc30322c14243f8e42ee8d600a66dcb276 + pristine_git_object: 2b46efa689b982324b6a3491b87e0d0f76a2b0cd + docs/models/extractionforecastfieldstepmonth.mdx: + id: 8424852b07f4 + last_write_checksum: sha1:9d47a851f47e365df29f141d722d747ef7b1aad2 + pristine_git_object: a8c7c8212f77a164bd2415f4cf1ecb51ae316ffa + docs/models/extractionforecastfieldstepunion.mdx: + id: 3b87c1fa8c5e + last_write_checksum: sha1:1d1d43c23840761bf78891f3759297fe78619e35 + pristine_git_object: dac8dc7614382ce07cd1f6ab005511646c291c80 + docs/models/extractionforecastfieldstepyear.mdx: + id: 5991acb1a71d + last_write_checksum: sha1:efe3f8cc65c1b589d58d41c3fe9e51f723354b15 + pristine_git_object: 0e8b983686546e398a84faedc1866fe0bd7d19ca + docs/models/extractionforecaststep.mdx: + id: e3dbf0cc9b33 + last_write_checksum: sha1:5b7edcd2e3bf13cef1a496fd330d13aa71fed8ee + pristine_git_object: 585e0378b8c5722f96de6a51b887096735e074f6 + docs/models/extractionforecaststepmean.mdx: + id: 2298a247fdfb + last_write_checksum: sha1:3db8547269a292301225f31cb7d1eeae0e3733d6 + pristine_git_object: 7ffe2e516c887273c46ac382863d3efaa351e49f + docs/models/extractionforecaststepmedian.mdx: + id: 3926be9443f6 + last_write_checksum: sha1:c02fcbfa3f7d7f51c83b4e72f6c36b74dc2a840f + pristine_git_object: 41c5742c435f078406f8cb2bf78efd4bc2f9ff08 + docs/models/extractionforecaststepp10.mdx: + id: 614a74a126e1 + last_write_checksum: sha1:6fe0c4717d4bd8c34ea80b85779419865226308d + pristine_git_object: 8bb4e00fee805163e1481020fd0ae0682be3bb16 + docs/models/extractionforecaststepp90.mdx: + id: 2507cfdf9cad + last_write_checksum: sha1:9c5f8a5ad9a172007d50c42507bd7189a5d16eed + pristine_git_object: 3ce8f1b3de99629f85be5bf1cda160143b78bb74 + docs/models/extractionforecaststepquantile.mdx: + id: 9d3086320563 + last_write_checksum: sha1:2eef01f975c3f656f736d7d99542a4544eb3cf01 + pristine_git_object: e9be257bce47f936ddc2f9d3ef2cda9c081391ee + docs/models/extractionforecaststepvalue.mdx: + id: 1f94aca1534f + last_write_checksum: sha1:da90e48da22f579c8450f69845bab49f81871482 + pristine_git_object: 4d6aa9f552791590009fd4e261a3644e5978c234 + docs/models/extractionlistanswer.mdx: + id: 94d89b08fc2a + last_write_checksum: sha1:b5837e5969acd6dc7549e9dd667782bbbcd7bb6a + pristine_git_object: 21ed4b86fb24d896786c95e435b9050e533579e9 + docs/models/extractionlistanswerguess.mdx: + id: 7cdc9f4f3ce4 + last_write_checksum: sha1:72f1951223b8f31ea994452aa1cbfed0f1dad607 + pristine_git_object: eb879adc98686a31c8edf9899fa234731f8f7aae + docs/models/extractionlistanswersource.mdx: + id: dcd88ee75a00 + last_write_checksum: sha1:66c4e71d47373d51a1d7111e6ea9307ed5b0a0ed + pristine_git_object: 1ace28db1263706e72d9af6ab46dc58cdf07a2c0 + docs/models/extractionlistanswervalue.mdx: + id: 553a1986fbea + last_write_checksum: sha1:797af2fd5a92f7babcf197c76ab9cd355b412a8b + pristine_git_object: 6ab3183c1b986d3c00f5cc1e5b309fcbbd850a48 + docs/models/extractionlistfield.mdx: + id: 6740c0edc755 + last_write_checksum: sha1:051011aa7fb8f6ba0ace4ae7339e420bb44d9604 + pristine_git_object: c52a5cbada44e7fd64728352c7b72e20566dd0be + docs/models/extractionnumberanswer.mdx: + id: 68efda120c88 + last_write_checksum: sha1:5b529566dac9ee32214d2b17f9cbadd089c47117 + pristine_git_object: 16690f287ea86500b687c5928f772bb746ac3bf0 + docs/models/extractionnumberanswersource.mdx: + id: 1e97057556f6 + last_write_checksum: sha1:f34cfe0d3555d46628e11ac2563c152665c657fd + pristine_git_object: c74f00106f5d69cc1aa700c81fd95784943c6636 + docs/models/extractionnumberfield.mdx: + id: f8b372cf8c66 + last_write_checksum: sha1:2325dcdc05475ba40eb490ecadbad129e17285f6 + pristine_git_object: a96ecb2c55fe23f3910ab8b0a820a6f33fddd606 + docs/models/extractionsrequest.mdx: + id: a335e8ceb6e4 + last_write_checksum: sha1:2b8c99e7804e180000cd1ff758d21c997d3880e8 + pristine_git_object: c2a1483f84e2998a331f2aae87f9c22ddfedcd9c + docs/models/extractionsresponse.mdx: + id: 4b2384293c9b + last_write_checksum: sha1:18b7784d0ceb59c21649ac3cebc152e0e9caeccf + pristine_git_object: 16ca7fbdb100ea6300b2de0256a3830e14bbf052 + docs/models/extractionsresponseanswers.mdx: + id: 93b31a1b4660 + last_write_checksum: sha1:4518e8863edd74fb2c5cba25eebf816c9cac918e + pristine_git_object: 69128752ed50f34be2490255685426715a549180 + docs/models/extractionsusage.mdx: + id: 4211de3eb384 + last_write_checksum: sha1:e125c005a2aaf78e63909da8f338900d05479f41 + pristine_git_object: 7858c60887c44e9dbb0e1b8d45a6b26828dd0b1e + docs/models/extractiontextanswer.mdx: + id: 02a124cc7d8f + last_write_checksum: sha1:c03cc2b1f76e9193eae3018f9eb0dafea86ff9e4 + pristine_git_object: 39ba36ea0f6754c92f1ecc976e47fdb1d1421643 + docs/models/extractiontextanswersource.mdx: + id: 212961a9f193 + last_write_checksum: sha1:182298b4dccc9a7feb5b2e0feba654fad33f70e0 + pristine_git_object: 32f00552f2cfe9d008dc2e0c5249989d6ea7a0a7 + docs/models/extractiontextfield.mdx: + id: 5ec69ce9846e + last_write_checksum: sha1:a6974703925be9eb9d5f1a3a4eaf131377439226 + pristine_git_object: 495ef7b2d4f2845c23c8f4bc51a0b160495db6c4 + docs/models/extractiontimeanswer.mdx: + id: 0e969504bd32 + last_write_checksum: sha1:8b9dad3862de6e425426b0da84b5661cbb991eeb + pristine_git_object: 33c8034fe95f537b37c3599c7faf3339d8fa81f0 + docs/models/extractiontimeanswersource.mdx: + id: 4c8523fa4dc5 + last_write_checksum: sha1:32e59887fb80ef57e92b1b2115509fc52844e79b + pristine_git_object: dbed36f5c68b3ce2feec3694afb9db5dc696d245 + docs/models/extractiontimefield.mdx: + id: e3912d227d45 + last_write_checksum: sha1:72c47ae7c3c8f36141794252f892ac4e90ef6d14 + pristine_git_object: e15cc617488bf025babbbb436d4401d2b22e3d16 docs/models/failabletoolcallstatus.mdx: id: f44595f5c09a last_write_checksum: sha1:6df525458ab4baebf7191aa748e4bb031b2bff99 @@ -4921,6 +5181,10 @@ trackedFiles: id: 3934aefca34b last_write_checksum: sha1:153cb3f9e5e1336182288488e6967d2fb6694afe pristine_git_object: b3ab9f90602889055a25dd089921465157e652cf + docs/models/fields.mdx: + id: 7864e89fb0b8 + last_write_checksum: sha1:3ace2c5ef3087f2681fb6b96a3e2537f1eb40270 + pristine_git_object: a5b4312ae77c017175dd3e2b38a7d49b4a453fa4 docs/models/filecitation.mdx: id: bd7e56c9bbbe last_write_checksum: sha1:4ac3002188c8aac777c0d9597a7300034bd7814c @@ -6473,6 +6737,10 @@ trackedFiles: id: 5c1d49dbdff6 last_write_checksum: sha1:0bea2d67970f6ad5cec81c4da2b5e10a11df9e8c pristine_git_object: 1d8b021f54c7fb7360c501bf8da6f160f2fe205c + docs/models/interval.mdx: + id: 96607c50bce9 + last_write_checksum: sha1:a0adf9cab709dbdb411ad1e785c421176f6031bf + pristine_git_object: ac22ce69dfa439afb1f347b4c2c3d083f0d75fa4 docs/models/issuedtokentype.mdx: id: 5c03c432ed60 last_write_checksum: sha1:67a5fd7cfde9715b4abac1f9423404379dc89454 @@ -6495,6 +6763,10 @@ trackedFiles: id: e46771e793f7 last_write_checksum: sha1:d434330c0f616d04dd9e56b685c117d83453eb34 pristine_git_object: 0260f3a34a0f977f5f9b1bfc684e8d4b11e8156e + docs/models/items.mdx: + id: fac573a780c2 + last_write_checksum: sha1:6476011f74101790b0e0fcc5fea62020ac1ab78b + pristine_git_object: 4fd66062b73efe211c0a423b691ffa09782fed9e docs/models/jevrouterplugin.mdx: id: 60587647c3a6 last_write_checksum: sha1:a237c30c23b04cbd3ab81a0831fcb2e2c0611d5a @@ -8432,6 +8704,14 @@ trackedFiles: id: 347ab8ddcd14 last_write_checksum: sha1:35a04f7388afcb20c94a717a7446b3d214f65b96 pristine_git_object: a396069ed75323457a12b0273a713684da430161 + docs/models/operations/createapialphaextractionsglobals.mdx: + id: 404bed3bdf88 + last_write_checksum: sha1:f39030ea3bb65e6244697e7a7db15c8357421a71 + pristine_git_object: 8b1d26a354d84a8fed4b879056954a46acd699f7 + docs/models/operations/createapialphaextractionsrequest.mdx: + id: d1f93784dc8b + last_write_checksum: sha1:3513294246668509f8e9994a270d097d1772ab0f + pristine_git_object: 183a8823d8321ceeb64a6bc8954af2c57c2cce29 docs/models/operations/createaudiospeechglobals.md: id: e41ba445c8d8 last_write_checksum: sha1:f689779ae444ea07df1e38642a1fb51d316ff8b5 @@ -15551,6 +15831,10 @@ trackedFiles: id: 16a97e1de35f last_write_checksum: sha1:101282006864f89ff78eccc101678394bd8ea7bd pristine_git_object: cb8b9197bf0bd5c79fb21683626c7605b4bbe6fe + docs/sdks/extractions/README.mdx: + id: 7b1a30cfc1d9 + last_write_checksum: sha1:877c035000349708b788e3ed750dbf1d607f9c71 + pristine_git_object: d7910d525d674d5da7d984913e77be4cc72eeb71 docs/sdks/files/README.md: id: e576d7a117f0 last_write_checksum: sha1:b79bb5f476d0265d6eccb9c139fdbc1861b7488f @@ -15715,12 +15999,12 @@ trackedFiles: pristine_git_object: 410efafd6a7f50d91ccb87131fedbe0c3d47e15a jsr.json: id: 7f6ab7767282 - last_write_checksum: sha1:c0456be8014517c1c5fa34e68c7fdc2c29bb0271 - pristine_git_object: b940dae83d21af888d3a85298a2b819257df37e6 + last_write_checksum: sha1:0f1d650021c1182aed72c387a96b503fd4bee231 + pristine_git_object: a4822565cc1ea28f9972da59d1f43e67cdd1663e package.json: id: 7030d0b2f71b - last_write_checksum: sha1:6e6f1365e8c4d1db917ede44f577fb086d889e55 - pristine_git_object: 38502067b1b07f86f7eead2e7ab2112e0ac1630c + last_write_checksum: sha1:b9b653bd66151d253dd0afe4714dd54277b6a056 + pristine_git_object: 67cb60f4a7fcc5e9a0ecd4bd33a746939e00fd76 src/core.ts: id: f431fdbcd144 last_write_checksum: sha1:5aa66b0b6a5964f3eea7f3098c2eb3c0ee9c0131 @@ -15729,6 +16013,10 @@ trackedFiles: id: f8369846dfed last_write_checksum: sha1:c44db1a02252c647013fdc604c223a06817ab773 pristine_git_object: 37d90093898ed098a995f5166b6bf724f8873efc + src/funcs/alphaExtractionsCreate.ts: + id: 317c66b4f586 + last_write_checksum: sha1:a9905f5f08d41b0b8d62f65a7fc67e76a782ac77 + pristine_git_object: 88db5b8a1ccb086b5843e286e5ea56f1e23e0a52 src/funcs/analyticsGetAnalyticsMeta.ts: id: f7372eee4934 last_write_checksum: sha1:2475e5c898554d7b67e52f9a8e80a543e9edd8a9 @@ -16323,8 +16611,8 @@ trackedFiles: pristine_git_object: a187e58707bdb726ca2aff74941efe7493422d4e src/lib/config.ts: id: 320761608fb3 - last_write_checksum: sha1:b73af6965258ecdaa7c6197c041cc75384f01dfb - pristine_git_object: 8e4e3161490601cc0ecb9fc2e101cc90a75a9644 + last_write_checksum: sha1:d006f94052dc97e09c3ab33959f4d7d1414d14b7 + pristine_git_object: c22e06377b00b34f5ef6c56ec0c586112601271c src/lib/dlv.ts: id: b1988214835a last_write_checksum: sha1:eaac763b22717206a6199104e0403ed17a4e2711 @@ -17621,8 +17909,8 @@ trackedFiles: pristine_git_object: ebd94507435fad3be03dc9157faf13b26f4d4e9a src/models/decisionsresponse.ts: id: 5989c9497b2d - last_write_checksum: sha1:76b985995b79e0da64ed4f93df1df75716717fff - pristine_git_object: ec202dcf2ba30af26f9c73423821da6acf5b0dd2 + last_write_checksum: sha1:d89fac547a65413206c0e9c80cae3e7cb829179b + pristine_git_object: 33c516386bf235b7991a9554dd53003996d119a4 src/models/decisionsscoreanswer.ts: id: 40ca541d040e last_write_checksum: sha1:bc877b7e9a1ef408a0c97c5202d377154eb30226 @@ -17835,6 +18123,94 @@ trackedFiles: id: af27c97975ac last_write_checksum: sha1:ba61b608855304258dbda70ff6628bd3732d0918 pristine_git_object: 7a5e4a5875cda48b5b5a35f05fb146985e1c02e5 + src/models/extractiondateanswer.ts: + id: f956b3a98040 + last_write_checksum: sha1:f11bfb2adefe50f8547d688f894af784062ceb16 + pristine_git_object: 3bd101a74564e88afe6742f5563c5b9e51a6f19a + src/models/extractiondatefield.ts: + id: 1c94ff9c9db3 + last_write_checksum: sha1:8d001d26c01d93222847ef182f3ab99f1b277e54 + pristine_git_object: 98ddf1a5b845922e0feb3ea06144ea797b0277af + src/models/extractiondatetimeanswer.ts: + id: 78957c3e6418 + last_write_checksum: sha1:b296b60188bde9456470f1c8ef3a19ed4e4cb439 + pristine_git_object: 516c58a102dbfdec9d72ec31df38c78ff8a5b2a3 + src/models/extractiondatetimefield.ts: + id: 432acb0eac7e + last_write_checksum: sha1:1e1f5abb151b36f3ebc7138f895f9f3bcec084fa + pristine_git_object: 35ca64f94d94b56ed9ac785a1a83cec8c8cd40ac + src/models/extractiondurationanswer.ts: + id: 807f782479d4 + last_write_checksum: sha1:ef3ed0547374203f75bbaec96953fb882d7e05de + pristine_git_object: 43c04f264da0c70a0193014a0ecacb3467f97b4f + src/models/extractiondurationfield.ts: + id: 235530926c12 + last_write_checksum: sha1:9eea64076e666ee0c79391382246cdb404e3ad63 + pristine_git_object: ac178a4f0c5965caa6e40a23859fe33485f141b0 + src/models/extractionestimateanswer.ts: + id: 48f87e35341d + last_write_checksum: sha1:b427bbe209fd549b4fdcb6be3a268e92a8d1c72e + pristine_git_object: a85a815b428cd54a8b711ddba20db6cf3df7abcb + src/models/extractionestimatefield.ts: + id: 1a1d98c8e726 + last_write_checksum: sha1:22d61574dd3ea77599e1a7edf752934aa765390f + pristine_git_object: 888c2bca7968ab84ee37826d7d24554245a113bf + src/models/extractionforecastanswer.ts: + id: 6bee54876576 + last_write_checksum: sha1:097e7cb48c6b552fd35d08adac28ab48c7dd614b + pristine_git_object: 19cb48b5d51d9abf24df06e692f452a061758497 + src/models/extractionforecastfield.ts: + id: 25643b9662b3 + last_write_checksum: sha1:ad4fe2eb76d225da9405db4b76c368cc648afc68 + pristine_git_object: e20e54d79809b30d4f8b72766af76974753579fa + src/models/extractionforecaststep.ts: + id: 5e3688a043e1 + last_write_checksum: sha1:59d8532d53e741a0a16cd63cdfb8d4b3ebfbaede + pristine_git_object: d29ddddd5c1dd90e693d19ba770be95dd0620a79 + src/models/extractionlistanswer.ts: + id: 26a830a1b9b0 + last_write_checksum: sha1:003c8ca68e94d14b0371233cdad2e442f5160401 + pristine_git_object: 696c254f0b571b2336e3c0675b4a7c14eb26901f + src/models/extractionlistfield.ts: + id: babad368b81e + last_write_checksum: sha1:7d6c126ac83d54c6bbae50039e626ef1d70ed10f + pristine_git_object: 01e65a0f5145d5912319cfdc9dcaa54f89671617 + src/models/extractionnumberanswer.ts: + id: 39bb8411110e + last_write_checksum: sha1:bb06009e41e4ff8b312f09ed8057f9793548ca34 + pristine_git_object: 7b37986ea5e3580f8c81adeb710d12d1ebcab4a5 + src/models/extractionnumberfield.ts: + id: c4c239c1c3f9 + last_write_checksum: sha1:88529b1591b20d45f1c8d2e3209c86d4abf57d7e + pristine_git_object: 0310dd9544590ab36623423c0e3a050687d65523 + src/models/extractionsrequest.ts: + id: 43bff9429754 + last_write_checksum: sha1:d8d8f8574f9bbb9770ff6048164143c7aba67d7f + pristine_git_object: d0b74cbc82d23f17b0627c8543a677316758787d + src/models/extractionsresponse.ts: + id: 2c4d0e7507e5 + last_write_checksum: sha1:5d5a7de70c2863d0a20ddd4a59f89aac749a946f + pristine_git_object: ec120a0aeca0ee75abc506c8763779236c6cb0ad + src/models/extractionsusage.ts: + id: 539fcca69ecb + last_write_checksum: sha1:7f34d4364028a8ccae1d3e8753f6d0decb7c5872 + pristine_git_object: 31c1040bb2ce02ffd8240e6b98afec26f57ce2ba + src/models/extractiontextanswer.ts: + id: 4c006742e2fc + last_write_checksum: sha1:810f894f058f963303b246b81ce9767315809bdb + pristine_git_object: 5b395078a60b8be7bf8f7168832e96818ad40e94 + src/models/extractiontextfield.ts: + id: 601482d94cbe + last_write_checksum: sha1:22e2e367db7e775b21d4b15ba0fd936012681287 + pristine_git_object: 03d93a0d9b2fcf1fc330beef2067bda32e832fd5 + src/models/extractiontimeanswer.ts: + id: bf3ef8199855 + last_write_checksum: sha1:ef93e1ca1b0b226179496afe05615fdee4be1669 + pristine_git_object: 1571f7f2e3b152356522691134bd586391316c31 + src/models/extractiontimefield.ts: + id: 20957cc003d4 + last_write_checksum: sha1:e4d7614fceeaedbb8aaa366a8e7dfef2e2f8d0a5 + pristine_git_object: 1f024a2afb6f57fa97235813d579fdaf063b3cc2 src/models/failabletoolcallstatus.ts: id: 142c03b0af9f last_write_checksum: sha1:0b8338eec685fc6bd2cc1f66037b04618911d25d @@ -18009,8 +18385,8 @@ trackedFiles: pristine_git_object: 32fced537ac9c61153c93a9f93d679ea5f1e2e18 src/models/generationresponse.ts: id: f9109ae06502 - last_write_checksum: sha1:d4242bfa12a05a61f4b1e8c26bfc0f5b2276720d - pristine_git_object: 3cb344000091ef597ab72829192b0c76627e4ac9 + last_write_checksum: sha1:94fe42e14d870b2cb250ff03a845431e2787d031 + pristine_git_object: d164c9988ac491fd1502a12b4cf33547acbbca84 src/models/getbyokkeyresponse.ts: id: c83ed9fbd575 last_write_checksum: sha1:8c270135769e92feab86d649563a5c6f63bdad7b @@ -18181,8 +18557,8 @@ trackedFiles: pristine_git_object: 7abdfe096d3adff317db6837dc689c69db92e127 src/models/index.ts: id: f93644b0f37e - last_write_checksum: sha1:3e3ccf0b0880b7c3f478a0bf0212df2a30997766 - pristine_git_object: c0488bd456cb11b754dc070566a1d60e65a87f66 + last_write_checksum: sha1:0524b206fe0c372b3bbc5df415534c0cabb6a7a3 + pristine_git_object: dfe66783bb7070cf89ee33aed98839606dddd31e src/models/inputaudio.ts: id: 9bdc14c7565f last_write_checksum: sha1:cc3b750b39a3c3563b76930fd2989f9bfdb24c1f @@ -18707,6 +19083,10 @@ trackedFiles: id: 84d520ce3957 last_write_checksum: sha1:a9616e8ada0611537c0f4d76ba477fff7bb04dc5 pristine_git_object: f19780e50bfd78e235ed1986fdcdab0983035322 + src/models/operations/createapialphaextractions.ts: + id: b3543519030d + last_write_checksum: sha1:3ac0e5f51dd297aeedea5b13850a3a08180f40df + pristine_git_object: 2f2100bb7f7eafc9c3bcc066dfaffb25cb819a37 src/models/operations/createaudiospeech.ts: id: 70089adf9736 last_write_checksum: sha1:6bd9af928089632c1679dd6c4d5940ae7fddbd2a @@ -19009,8 +19389,8 @@ trackedFiles: pristine_git_object: a052ed42bd123e79be1f05dc823c808f8c32b383 src/models/operations/index.ts: id: 0d9ffaf774d2 - last_write_checksum: sha1:9f2e3074207316b1d958942f36ae701e677af135 - pristine_git_object: 71664f53947cf5c8be932e45a89e5d7e8c357e95 + last_write_checksum: sha1:ae8828e01859a586f3bfb4daa0431a4f128aea35 + pristine_git_object: a3cef2333b9c158cd090d650d00342c4732d7cda src/models/operations/list.ts: id: ce11386ad30f last_write_checksum: sha1:538b86fd8e5c673750fc206984ab142a8492bcda @@ -20501,8 +20881,8 @@ trackedFiles: pristine_git_object: b5a68ed008fa28d0e43d2fb62a3d195b46cbdd02 src/sdk/alpha.ts: id: 060cb6993048 - last_write_checksum: sha1:35f1f038a45ed145038559279bb793018f334259 - pristine_git_object: c334bf9f8471dbe76cca17918fec55ad9012644b + last_write_checksum: sha1:26865e159bdbc1708d6f4092e67ea40cf16855ed + pristine_git_object: 2eaf304791ac7288bf3743623018753d95cf1fe2 src/sdk/analytics.ts: id: 411d91261be3 last_write_checksum: sha1:f6b1f60a87ded7a426293b7aee1bc3b37e6ea708 @@ -20571,6 +20951,10 @@ trackedFiles: id: 8b2b4b6306c5 last_write_checksum: sha1:89ce3c9fb0a2550b5d4e39a97acf659999506c78 pristine_git_object: 5509865b3fe7a469e042e6067d07f5cfa47aee9c + src/sdk/extractions.ts: + id: 86201a09fb0f + last_write_checksum: sha1:82d7fe18f5560f462e3288ac6582f025d1166a0c + pristine_git_object: c4d0974157555529beea676fee87ede98f04e766 src/sdk/files.ts: id: bb9172f41ecb last_write_checksum: sha1:4a47f4c7367929db50d3d1837b2f2966990e03b8 @@ -25256,5 +25640,39 @@ examples: application/json: {"error": {"code": 500, "message": "Internal Server Error"}} "502": application/json: {"error": {"code": 502, "message": "Provider returned error"}} + createApiAlphaExtractions: + speakeasy-default-create-api-alpha-extractions: + requestBody: + application/json: {"fields": {}, "model": "Grand Cherokee", "state": "Massachusetts"} + responses: + "200": + application/json: {"answers": {}, "model": "Malibu", "usage": {"input_tokens": 125155, "output_tokens": 101104}} + "400": + application/json: {"error": {"code": 400, "message": "Invalid request parameters"}} + "401": + application/json: {"error": {"code": 401, "message": "Missing Authentication header"}} + "402": + application/json: {"error": {"code": 402, "message": "Insufficient credits. Add more using https://openrouter.ai/credits"}} + "403": + application/json: {"error": {"code": 403, "message": "Only management keys can perform this operation"}} + "404": + application/json: {"error": {"code": 404, "message": "Resource not found"}} + "413": + application/json: {"error": {"code": 413, "message": "Request payload too large"}} + "429": + application/json: {"error": {"code": 429, "message": "Rate limit exceeded"}} + "500": + application/json: {"error": {"code": 500, "message": "Internal Server Error"}} + "502": + application/json: {"error": {"code": 502, "message": "Provider returned error"}} + "503": + application/json: {"error": {"code": 503, "message": "Service temporarily unavailable"}} + "524": + application/json: {"error": {"code": 524, "message": "Request timed out. Please try again later."}} + "529": + application/json: {"error": {"code": 529, "message": "Provider returned error"}} examplesVersion: 1.0.2 -releaseNotes: "## Typescript SDK Changes:\n* `openrouter.analytics.queryAnalytics()`: \n * `request.requestBody` **Changed** (Breaking ⚠️)\n" +releaseNotes: | + ## Typescript SDK Changes: + * `openrouter.alpha.extractions.create()`: **Added** + * `openrouter.generations.getGeneration()`: `response.data.apiType.enum(extractions)` **Added** diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 155a7cfe1..c402e686d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -38,7 +38,7 @@ generation: documentation: mintlify preApplyUnionDiscriminators: true typescript: - version: 1.5.24 + version: 1.5.25 acceptHeaderEnum: false additionalDependencies: dependencies: diff --git a/.speakeasy/out.openapi.yaml b/.speakeasy/out.openapi.yaml index 531384da2..f568c90a5 100644 --- a/.speakeasy/out.openapi.yaml +++ b/.speakeasy/out.openapi.yaml @@ -11815,6 +11815,927 @@ components: required: - 'data' type: 'object' + ExtractionDateAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + type: 'string' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'date' + type: 'string' + value: + type: + - 'string' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionDateField: + properties: + instructions: + description: 'What the field should contain.' + type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'date' + type: 'string' + required: + - 'type' + type: 'object' + ExtractionDatetimeAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + type: 'string' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'datetime' + type: 'string' + value: + type: + - 'string' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionDatetimeField: + properties: + instructions: + description: 'What the field should contain.' + type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'datetime' + type: 'string' + required: + - 'type' + type: 'object' + ExtractionDurationAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + format: 'double' + type: 'number' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'duration' + type: 'string' + unit: + description: 'The unit `value` is expressed in.' + type: 'string' + value: + format: 'double' + type: + - 'number' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionDurationField: + properties: + decimals: + description: 'Decimal places kept in `value`.' + maximum: 6 + minimum: 0 + type: 'integer' + instructions: + description: 'What the field should contain.' + type: 'string' + integer: + type: 'boolean' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'duration' + type: 'string' + unit: + description: 'seconds, minutes, hours, days, weeks, months or years.' + type: 'string' + required: + - 'type' + type: 'object' + ExtractionEstimateAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + mean: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + median: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + p_above: + description: 'Probability mass above `max`.' + format: 'double' + type: 'number' + p_below: + description: 'Probability mass below `min`.' + format: 'double' + type: 'number' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + p10: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + p90: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + quantiles: + description: '99 percentiles, present when the provider is asked for quantiles.' + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'estimate' + type: 'string' + value: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + - type: 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionEstimateField: + properties: + instructions: + description: 'What the field should contain.' + type: 'string' + max: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + min: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + scale: + enum: + - 'linear' + - 'log' + type: 'string' + x-speakeasy-unknown-values: allow + step: + anyOf: + - exclusiveMinimum: 0 + format: 'double' + type: 'number' + - enum: + - 'month' + type: 'string' + - enum: + - 'year' + type: 'string' + type: + enum: + - 'estimate' + type: 'string' + unit: + type: 'string' + required: + - 'type' + - 'min' + - 'max' + type: 'object' + ExtractionForecastAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + mean: + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + median: + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + p10: + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + p90: + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + steps: + items: + $ref: '#/components/schemas/ExtractionForecastStep' + type: 'array' + type: + enum: + - 'forecast' + type: 'string' + value: + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: + - 'array' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionForecastField: + properties: + horizon: + description: 'Number of forecast steps.' + maximum: 64 + minimum: 1 + type: 'integer' + instructions: + description: 'What the field should contain.' + type: 'string' + interval: + enum: + - 'step' + - 'minute' + - 'hour' + - 'day' + - 'week' + - 'month' + - 'quarter' + - 'year' + type: 'string' + x-speakeasy-unknown-values: allow + max: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + min: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + scale: + enum: + - 'linear' + - 'log' + type: 'string' + x-speakeasy-unknown-values: allow + step: + anyOf: + - exclusiveMinimum: 0 + format: 'double' + type: 'number' + - enum: + - 'month' + type: 'string' + - enum: + - 'year' + type: 'string' + type: + enum: + - 'forecast' + type: 'string' + unit: + type: 'string' + required: + - 'type' + - 'min' + - 'max' + - 'horizon' + - 'interval' + type: 'object' + ExtractionForecastStep: + properties: + mean: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + median: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + p_above: + description: 'Probability mass above `max`.' + format: 'double' + type: 'number' + p_below: + description: 'Probability mass below `min`.' + format: 'double' + type: 'number' + p10: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + p90: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + quantiles: + description: '99 percentiles, present when the provider is asked for quantiles.' + items: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + type: 'array' + value: + anyOf: + - format: 'double' + type: 'number' + - type: 'string' + - type: 'null' + required: + - 'value' + type: 'object' + ExtractionListAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + items: + anyOf: + - type: 'string' + - format: 'double' + type: 'number' + type: 'array' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + spans: + items: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'list' + type: 'string' + value: + items: + anyOf: + - type: 'string' + - format: 'double' + type: 'number' + type: + - 'array' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionListField: + properties: + decimals: + description: 'Decimal places kept in `value`.' + maximum: 6 + minimum: 0 + type: 'integer' + instructions: + description: 'What the field should contain.' + type: 'string' + items: + enum: + - 'text' + - 'number' + - 'date' + type: 'string' + x-speakeasy-unknown-values: allow + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'list' + type: 'string' + required: + - 'type' + - 'items' + type: 'object' + ExtractionNumberAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + format: 'double' + type: 'number' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'number' + type: 'string' + value: + format: 'double' + type: + - 'number' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionNumberField: + properties: + decimals: + description: 'Decimal places kept in `value`.' + maximum: 6 + minimum: 0 + type: 'integer' + instructions: + description: 'What the field should contain.' + type: 'string' + integer: + type: 'boolean' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'number' + type: 'string' + unit: + type: 'string' + required: + - 'type' + type: 'object' + ExtractionsRequest: + properties: + assets: + additionalProperties: + $ref: '#/components/schemas/DecisionsImageAsset' + description: 'Images keyed by reference string, as in TypeSafe''s API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text.' + type: 'object' + fields: + additionalProperties: + description: 'A typed field to extract, compute, estimate or forecast from the state. Which types a model answers is model-specific; unsupported types are rejected with 400.' + discriminator: + mapping: + date: '#/components/schemas/ExtractionDateField' + datetime: '#/components/schemas/ExtractionDatetimeField' + duration: '#/components/schemas/ExtractionDurationField' + estimate: '#/components/schemas/ExtractionEstimateField' + forecast: '#/components/schemas/ExtractionForecastField' + list: '#/components/schemas/ExtractionListField' + number: '#/components/schemas/ExtractionNumberField' + text: '#/components/schemas/ExtractionTextField' + time: '#/components/schemas/ExtractionTimeField' + propertyName: 'type' + oneOf: + - $ref: '#/components/schemas/ExtractionTextField' + - $ref: '#/components/schemas/ExtractionNumberField' + - $ref: '#/components/schemas/ExtractionDateField' + - $ref: '#/components/schemas/ExtractionTimeField' + - $ref: '#/components/schemas/ExtractionDatetimeField' + - $ref: '#/components/schemas/ExtractionDurationField' + - $ref: '#/components/schemas/ExtractionListField' + - $ref: '#/components/schemas/ExtractionEstimateField' + - $ref: '#/components/schemas/ExtractionForecastField' + description: 'Map of field name to typed field spec.' + type: 'object' + model: + type: 'string' + provider: + allOf: + - $ref: '#/components/schemas/ProviderPreferences' + - description: 'Provider routing preferences for the request.' + reference_date: + description: 'ISO date that anchors dates written without a year.' + pattern: '^\d{4}-\d{2}-\d{2}$' + type: 'string' + session_id: + description: 'A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.' + example: 'session-1234' + maxLength: 256 + type: 'string' + state: + description: 'The text to read from. May be empty only when the request carries image assets.' + type: 'string' + trace: + $ref: '#/components/schemas/TraceConfig' + user: + maxLength: 256 + type: 'string' + required: + - 'model' + - 'state' + - 'fields' + type: 'object' + ExtractionsResponse: + properties: + answers: + additionalProperties: + description: 'One answer per requested field. `value` is null when the state does not determine it.' + discriminator: + mapping: + date: '#/components/schemas/ExtractionDateAnswer' + datetime: '#/components/schemas/ExtractionDatetimeAnswer' + duration: '#/components/schemas/ExtractionDurationAnswer' + estimate: '#/components/schemas/ExtractionEstimateAnswer' + forecast: '#/components/schemas/ExtractionForecastAnswer' + list: '#/components/schemas/ExtractionListAnswer' + number: '#/components/schemas/ExtractionNumberAnswer' + text: '#/components/schemas/ExtractionTextAnswer' + time: '#/components/schemas/ExtractionTimeAnswer' + propertyName: 'type' + oneOf: + - $ref: '#/components/schemas/ExtractionTextAnswer' + - $ref: '#/components/schemas/ExtractionNumberAnswer' + - $ref: '#/components/schemas/ExtractionDateAnswer' + - $ref: '#/components/schemas/ExtractionTimeAnswer' + - $ref: '#/components/schemas/ExtractionDatetimeAnswer' + - $ref: '#/components/schemas/ExtractionDurationAnswer' + - $ref: '#/components/schemas/ExtractionListAnswer' + - $ref: '#/components/schemas/ExtractionEstimateAnswer' + - $ref: '#/components/schemas/ExtractionForecastAnswer' + type: 'object' + id: + type: 'string' + model: + type: 'string' + provider: + type: 'string' + state_text: + description: 'The text that spans index into, when requested through provider options.' + type: + - 'string' + - 'null' + truncated: + description: 'True when the provider read only a prefix of the state.' + type: 'boolean' + usage: + $ref: '#/components/schemas/ExtractionsUsage' + required: + - 'model' + - 'answers' + - 'usage' + type: 'object' + ExtractionsUsage: + properties: + cost: + format: 'double' + type: 'number' + image_tokens: + type: 'integer' + input_tokens: + type: 'integer' + output_tokens: + type: 'integer' + passes: + description: 'Number of upstream passes when the fields did not fit in one.' + type: 'integer' + schema_tokens: + type: 'integer' + state_tokens: + type: 'integer' + required: + - 'input_tokens' + - 'output_tokens' + type: 'object' + ExtractionTextAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + type: 'string' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'text' + type: 'string' + value: + type: + - 'string' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionTextField: + properties: + instructions: + description: 'What the field should contain.' + type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'text' + type: 'string' + required: + - 'type' + type: 'object' + ExtractionTimeAnswer: + properties: + confidence: + format: 'double' + type: 'number' + guess: + description: 'The most likely value even when `value` is null because `p_null` crossed the threshold.' + type: 'string' + p_null: + description: 'Probability that the state contains nothing for this field.' + format: 'double' + type: 'number' + source: + description: 'Set to `image` when the answer was read from an image rather than the state text.' + enum: + - 'state' + - 'image' + type: 'string' + x-speakeasy-unknown-values: allow + span: + description: 'Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once.' + items: + type: 'integer' + maxItems: 2 + minItems: 2 + type: 'array' + spell_confidence: + description: 'Confidence in the spelling of text read from an image.' + format: 'double' + type: 'number' + type: + enum: + - 'time' + type: 'string' + value: + type: + - 'string' + - 'null' + required: + - 'type' + - 'value' + type: 'object' + ExtractionTimeField: + properties: + instructions: + description: 'What the field should contain.' + type: 'string' + null_threshold: + description: 'Probability of null above which `value` is null. Default 0.5.' + format: 'double' + maximum: 1 + minimum: 0 + type: 'number' + type: + enum: + - 'time' + type: 'string' + required: + - 'type' + type: 'object' FailableToolCallStatus: enum: - 'in_progress' @@ -13236,6 +14157,7 @@ components: - 'embeddings' - 'rerank' - 'decisions' + - 'extractions' - 'video' - 'tts' - 'stt' @@ -35956,6 +36878,227 @@ paths: - $ref: "#/components/parameters/AppIdentifier" - $ref: "#/components/parameters/AppDisplayName" - $ref: "#/components/parameters/AppCategories" + /api/alpha/extractions: + post: + description: 'Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable.' + operationId: 'createApiAlphaExtractions' + requestBody: + content: + application/json: + example: + fields: + contacts: + items: 'text' + type: 'list' + days_to_pay: + max: 120 + min: 0 + step: 1 + type: 'estimate' + due_date: + instructions: 'Issue date plus the net payment days' + type: 'date' + invoice_number: + type: 'text' + total: + decimals: 2 + type: 'number' + unit: 'USD' + model: 'cloudflare/clairic' + reference_date: '2026-10-28' + state: 'Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.' + schema: + $ref: '#/components/schemas/ExtractionsRequest' + required: true + responses: + '200': + content: + application/json: + example: + answers: + contacts: + confidence: 0.9999 + spans: + - - 53 + - 62 + - - 64 + - 74 + type: 'list' + value: + - 'Dana Ruiz' + - 'Priya Shah' + days_to_pay: + mean: 29.5 + median: 30 + p10: 21 + p90: 38 + type: 'estimate' + value: 30 + due_date: + guess: '2026-10-02' + p_null: 1.9e-8 + type: 'date' + value: '2026-10-02' + invoice_number: + confidence: 1 + guess: 'INV-2291' + p_null: 3.8e-10 + span: + - 8 + - 16 + type: 'text' + value: 'INV-2291' + total: + confidence: 0.9999 + guess: 1080 + p_null: 2.3e-8 + type: 'number' + value: 1080 + id: 'gen-dec-1793251006-X5e5eKGQdvR9rblyX250' + model: 'cloudflare/clairic' + provider: 'Cloudflare' + truncated: false + usage: + cost: 0.0000655 + image_tokens: 0 + input_tokens: 655 + output_tokens: 0 + passes: 3 + schema_tokens: 472 + state_tokens: 61 + schema: + $ref: '#/components/schemas/ExtractionsResponse' + description: 'Extractions response' + '400': + content: + application/json: + example: + error: + code: 400 + message: 'Invalid request parameters' + schema: + $ref: '#/components/schemas/BadRequestResponse' + description: 'Bad Request - Invalid request parameters or malformed input' + '401': + content: + application/json: + example: + error: + code: 401 + message: 'Missing Authentication header' + schema: + $ref: '#/components/schemas/UnauthorizedResponse' + description: 'Unauthorized - Authentication required or invalid credentials' + '402': + content: + application/json: + example: + error: + code: 402 + message: 'Insufficient credits. Add more using https://openrouter.ai/credits' + schema: + $ref: '#/components/schemas/PaymentRequiredResponse' + description: 'Payment Required - Insufficient credits or quota to complete request' + '403': + content: + application/json: + example: + error: + code: 403 + message: 'Only management keys can perform this operation' + schema: + $ref: '#/components/schemas/ForbiddenResponse' + description: 'Forbidden - Authentication successful but insufficient permissions' + '404': + content: + application/json: + example: + error: + code: 404 + message: 'Resource not found' + schema: + $ref: '#/components/schemas/NotFoundResponse' + description: 'Not Found - Resource does not exist' + '413': + content: + application/json: + example: + error: + code: 413 + message: 'Request payload too large' + schema: + $ref: '#/components/schemas/PayloadTooLargeResponse' + description: 'Payload Too Large - Request payload exceeds size limits' + '429': + content: + application/json: + example: + error: + code: 429 + message: 'Rate limit exceeded' + schema: + $ref: '#/components/schemas/TooManyRequestsResponse' + description: 'Too Many Requests - Rate limit exceeded' + '500': + content: + application/json: + example: + error: + code: 500 + message: 'Internal Server Error' + schema: + $ref: '#/components/schemas/InternalServerResponse' + description: 'Internal Server Error - Unexpected server error' + '502': + content: + application/json: + example: + error: + code: 502 + message: 'Provider returned error' + schema: + $ref: '#/components/schemas/BadGatewayResponse' + description: 'Bad Gateway - Provider/upstream API failure' + '503': + content: + application/json: + example: + error: + code: 503 + message: 'Service temporarily unavailable' + schema: + $ref: '#/components/schemas/ServiceUnavailableResponse' + description: 'Service Unavailable - Service temporarily unavailable' + '524': + content: + application/json: + example: + error: + code: 524 + message: 'Request timed out. Please try again later.' + schema: + $ref: '#/components/schemas/EdgeNetworkTimeoutResponse' + description: 'Infrastructure Timeout - Provider request timed out at edge network' + '529': + content: + application/json: + example: + error: + code: 529 + message: 'Provider returned error' + schema: + $ref: '#/components/schemas/ProviderOverloadedResponse' + description: 'Provider Overloaded - Provider is temporarily overloaded' + servers: + - url: 'https://openrouter.ai' + summary: 'Submit an Extractions request' + tags: + - 'alpha.extractions' + x-speakeasy-name-override: 'create' + parameters: + - $ref: "#/components/parameters/AppIdentifier" + - $ref: "#/components/parameters/AppDisplayName" + - $ref: "#/components/parameters/AppCategories" /audio/speech: post: description: 'Synthesizes audio from the input text. Returns a raw audio bytestream in the requested format (e.g. mp3, pcm, wav).' @@ -55414,6 +56557,8 @@ tags: name: 'Workspaces' - description: 'Alpha feature endpoints for Decisions requests' name: 'alpha.decisions' + - description: 'Alpha feature endpoints for Extractions requests' + name: 'alpha.extractions' - name: beta.responses description: 'Deprecated alias of responses. Use responses instead; scheduled for removal (sunset date TBD).' - name: End Users diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 167b3928b..37b896196 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,8 +2,8 @@ speakeasyVersion: 1.803.2 sources: OpenRouter API: sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b2d2f69115fcb752600b15c9c586fff9b4e8327dbfd18114c0202a093195cf48 - sourceBlobDigest: sha256:93060b7230c5d09a311da4ba08ab92b2e20f6208a7f2999167ef20cc70ea8704 + sourceRevisionDigest: sha256:c2cf65558cc104774a79bbbf2e08e005dbdb56ae7314c994fd77c0768becaeab + sourceBlobDigest: sha256:6168231c44e2421f55415938b559b90426a70479adf65d7a4a50f98fded97be5 tags: - latest - 1.0.0 @@ -11,10 +11,10 @@ targets: openrouter: source: OpenRouter API sourceNamespace: open-router-chat-completions-api - sourceRevisionDigest: sha256:b2d2f69115fcb752600b15c9c586fff9b4e8327dbfd18114c0202a093195cf48 - sourceBlobDigest: sha256:93060b7230c5d09a311da4ba08ab92b2e20f6208a7f2999167ef20cc70ea8704 + sourceRevisionDigest: sha256:c2cf65558cc104774a79bbbf2e08e005dbdb56ae7314c994fd77c0768becaeab + sourceBlobDigest: sha256:6168231c44e2421f55415938b559b90426a70479adf65d7a4a50f98fded97be5 codeSamplesNamespace: open-router-chat-completions-api-typescript-code-samples - codeSamplesRevisionDigest: sha256:dd9d4a8e137fd81535d5a12a550fcaeda4dd87145f8d9009f329242e9d48bcff + codeSamplesRevisionDigest: sha256:d688073bf3d2494071ce9b3cc52536abf96a4d95be66ba985e849993e7e0c4e6 workflow: workflowVersion: 1.0.0 speakeasyVersion: 1.803.2 diff --git a/RELEASES.md b/RELEASES.md index ca3b3469a..e5830b8ef 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4626,4 +4626,14 @@ Based on: ### Generated - [typescript v1.5.24] . ### Releases -- [NPM v1.5.24] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.24 - . \ No newline at end of file +- [NPM v1.5.24] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.24 - . + +## 2026-10-30 01:43:47 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.803.2 (2.950.13) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.5.25] . +### Releases +- [NPM v1.5.25] https://www.npmjs.com/package/@openrouter/sdk/v/1.5.25 - . \ No newline at end of file diff --git a/docs/docs.json b/docs/docs.json index 12c913d4f..d628d1aad 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -26,6 +26,7 @@ "sdks/endpoints/README", "sdks/endusers/README", "sdks/externalusers/README", + "sdks/extractions/README", "sdks/files/README", "sdks/generations/README", "sdks/guardrails/README", diff --git a/docs/models/apitype.mdx b/docs/models/apitype.mdx index eee0d6092..1db50cc4f 100644 --- a/docs/models/apitype.mdx +++ b/docs/models/apitype.mdx @@ -9,7 +9,7 @@ Type of API used for the generation ```typescript import { ApiType } from "@openrouter/sdk/models"; -let value: ApiType = "video"; +let value: ApiType = "extractions"; // Open enum: unrecognized values are captured as Unrecognized ``` @@ -17,5 +17,5 @@ let value: ApiType = "video"; ## Values ```typescript -"completions" | "embeddings" | "rerank" | "decisions" | "video" | "tts" | "stt" | "image" | Unrecognized +"completions" | "embeddings" | "rerank" | "decisions" | "extractions" | "video" | "tts" | "stt" | "image" | Unrecognized ``` \ No newline at end of file diff --git a/docs/models/decisionsresponse.mdx b/docs/models/decisionsresponse.mdx index 3e712dad6..df47b99c4 100644 --- a/docs/models/decisionsresponse.mdx +++ b/docs/models/decisionsresponse.mdx @@ -21,7 +21,7 @@ let value: DecisionsResponse = { | Field | Type | Required | Description | | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -| `answers` | Record\ | ✔️ | N/A | +| `answers` | Record\ | ✔️ | N/A | | `id` | *string* | ➖ | N/A | | `model` | *string* | ✔️ | N/A | | `provider` | *string* | ➖ | N/A | diff --git a/docs/models/answers.mdx b/docs/models/decisionsresponseanswers.mdx similarity index 95% rename from docs/models/answers.mdx rename to docs/models/decisionsresponseanswers.mdx index 72bf248cc..eaf154cac 100644 --- a/docs/models/answers.mdx +++ b/docs/models/decisionsresponseanswers.mdx @@ -1,5 +1,5 @@ --- -title: "Answers" +title: "DecisionsResponseAnswers" --- A Decisions answer using a boolean, choice, score, or image bounding-box evaluation. diff --git a/docs/models/extractiondateanswer.mdx b/docs/models/extractiondateanswer.mdx new file mode 100644 index 000000000..87e7910ba --- /dev/null +++ b/docs/models/extractiondateanswer.mdx @@ -0,0 +1,27 @@ +--- +title: "ExtractionDateAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionDateAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionDateAnswer = { + type: "date", + value: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *string* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionDateAnswerSource](../models/extractiondateanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"date"* | ✔️ | N/A | +| `value` | *string* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiondateanswersource.mdx b/docs/models/extractiondateanswersource.mdx new file mode 100644 index 000000000..db8476a5f --- /dev/null +++ b/docs/models/extractiondateanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionDateAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionDateAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionDateAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractiondatefield.mdx b/docs/models/extractiondatefield.mdx new file mode 100644 index 000000000..fbe90880b --- /dev/null +++ b/docs/models/extractiondatefield.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionDateField" +--- + +## Example Usage + +```typescript +import { ExtractionDateField } from "@openrouter/sdk/models"; + +let value: ExtractionDateField = { + type: "date", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `instructions` | *string* | ➖ | What the field should contain. | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"date"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiondatetimeanswer.mdx b/docs/models/extractiondatetimeanswer.mdx new file mode 100644 index 000000000..c7cd38bd6 --- /dev/null +++ b/docs/models/extractiondatetimeanswer.mdx @@ -0,0 +1,27 @@ +--- +title: "ExtractionDatetimeAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionDatetimeAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionDatetimeAnswer = { + type: "datetime", + value: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *string* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionDatetimeAnswerSource](../models/extractiondatetimeanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"datetime"* | ✔️ | N/A | +| `value` | *string* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiondatetimeanswersource.mdx b/docs/models/extractiondatetimeanswersource.mdx new file mode 100644 index 000000000..7d7110b27 --- /dev/null +++ b/docs/models/extractiondatetimeanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionDatetimeAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionDatetimeAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionDatetimeAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractiondatetimefield.mdx b/docs/models/extractiondatetimefield.mdx new file mode 100644 index 000000000..d8e2980cb --- /dev/null +++ b/docs/models/extractiondatetimefield.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionDatetimeField" +--- + +## Example Usage + +```typescript +import { ExtractionDatetimeField } from "@openrouter/sdk/models"; + +let value: ExtractionDatetimeField = { + type: "datetime", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `instructions` | *string* | ➖ | What the field should contain. | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"datetime"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiondurationanswer.mdx b/docs/models/extractiondurationanswer.mdx new file mode 100644 index 000000000..86d363db2 --- /dev/null +++ b/docs/models/extractiondurationanswer.mdx @@ -0,0 +1,28 @@ +--- +title: "ExtractionDurationAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionDurationAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionDurationAnswer = { + type: "duration", + value: 1203.6, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *number* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionDurationAnswerSource](../models/extractiondurationanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"duration"* | ✔️ | N/A | +| `unit` | *string* | ➖ | The unit `value` is expressed in. | +| `value` | *number* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiondurationanswersource.mdx b/docs/models/extractiondurationanswersource.mdx new file mode 100644 index 000000000..b7fa440d6 --- /dev/null +++ b/docs/models/extractiondurationanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionDurationAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionDurationAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionDurationAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractiondurationfield.mdx b/docs/models/extractiondurationfield.mdx new file mode 100644 index 000000000..82d2456bb --- /dev/null +++ b/docs/models/extractiondurationfield.mdx @@ -0,0 +1,24 @@ +--- +title: "ExtractionDurationField" +--- + +## Example Usage + +```typescript +import { ExtractionDurationField } from "@openrouter/sdk/models"; + +let value: ExtractionDurationField = { + type: "duration", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `decimals` | *number* | ➖ | Decimal places kept in `value`. | +| `instructions` | *string* | ➖ | What the field should contain. | +| `integer` | *boolean* | ➖ | N/A | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"duration"* | ✔️ | N/A | +| `unit` | *string* | ➖ | seconds, minutes, hours, days, weeks, months or years. | \ No newline at end of file diff --git a/docs/models/extractionestimateanswer.mdx b/docs/models/extractionestimateanswer.mdx new file mode 100644 index 000000000..9ab7edaaa --- /dev/null +++ b/docs/models/extractionestimateanswer.mdx @@ -0,0 +1,33 @@ +--- +title: "ExtractionEstimateAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionEstimateAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateAnswer = { + type: "estimate", + value: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *models.ExtractionEstimateAnswerGuess* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `mean` | *models.ExtractionEstimateAnswerMean* | ➖ | N/A | +| `median` | *models.ExtractionEstimateAnswerMedian* | ➖ | N/A | +| `pAbove` | *number* | ➖ | Probability mass above `max`. | +| `pBelow` | *number* | ➖ | Probability mass below `min`. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `p10` | *models.ExtractionEstimateAnswerP10* | ➖ | N/A | +| `p90` | *models.ExtractionEstimateAnswerP90* | ➖ | N/A | +| `quantiles` | *models.ExtractionEstimateAnswerQuantile*[] | ➖ | 99 percentiles, present when the provider is asked for quantiles. | +| `source` | [models.ExtractionEstimateAnswerSource](../models/extractionestimateanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"estimate"* | ✔️ | N/A | +| `value` | *models.ExtractionEstimateAnswerValue* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionestimateanswerguess.mdx b/docs/models/extractionestimateanswerguess.mdx new file mode 100644 index 000000000..a17b1e987 --- /dev/null +++ b/docs/models/extractionestimateanswerguess.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionEstimateAnswerGuess" +--- + +The most likely value even when `value` is null because `p_null` crossed the threshold. + + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswermean.mdx b/docs/models/extractionestimateanswermean.mdx new file mode 100644 index 000000000..aa4b8bb1a --- /dev/null +++ b/docs/models/extractionestimateanswermean.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerMean" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswermedian.mdx b/docs/models/extractionestimateanswermedian.mdx new file mode 100644 index 000000000..ac973e95c --- /dev/null +++ b/docs/models/extractionestimateanswermedian.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerMedian" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswerp10.mdx b/docs/models/extractionestimateanswerp10.mdx new file mode 100644 index 000000000..278fe7291 --- /dev/null +++ b/docs/models/extractionestimateanswerp10.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerP10" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswerp90.mdx b/docs/models/extractionestimateanswerp90.mdx new file mode 100644 index 000000000..a2623a1fd --- /dev/null +++ b/docs/models/extractionestimateanswerp90.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerP90" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswerquantile.mdx b/docs/models/extractionestimateanswerquantile.mdx new file mode 100644 index 000000000..f7250c08e --- /dev/null +++ b/docs/models/extractionestimateanswerquantile.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerQuantile" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimateanswersource.mdx b/docs/models/extractionestimateanswersource.mdx new file mode 100644 index 000000000..993d5151b --- /dev/null +++ b/docs/models/extractionestimateanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionEstimateAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionEstimateAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateAnswerSource = "image"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionestimateanswervalue.mdx b/docs/models/extractionestimateanswervalue.mdx new file mode 100644 index 000000000..5e4d029f8 --- /dev/null +++ b/docs/models/extractionestimateanswervalue.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateAnswerValue" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimatefield.mdx b/docs/models/extractionestimatefield.mdx new file mode 100644 index 000000000..2b9a3d57f --- /dev/null +++ b/docs/models/extractionestimatefield.mdx @@ -0,0 +1,28 @@ +--- +title: "ExtractionEstimateField" +--- + +## Example Usage + +```typescript +import { ExtractionEstimateField } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateField = { + max: 7670.28, + min: 9139.4, + type: "estimate", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `instructions` | *string* | ➖ | What the field should contain. | +| `max` | *models.ExtractionEstimateFieldMax* | ✔️ | N/A | +| `min` | *models.ExtractionEstimateFieldMin* | ✔️ | N/A | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `scale` | [models.ExtractionEstimateFieldScale](../models/extractionestimatefieldscale.mdx) | ➖ | N/A | +| `step` | *models.ExtractionEstimateFieldStepUnion* | ➖ | N/A | +| `type` | *"estimate"* | ✔️ | N/A | +| `unit` | *string* | ➖ | N/A | \ No newline at end of file diff --git a/docs/models/extractionestimatefieldmax.mdx b/docs/models/extractionestimatefieldmax.mdx new file mode 100644 index 000000000..f1fd7f234 --- /dev/null +++ b/docs/models/extractionestimatefieldmax.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateFieldMax" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimatefieldmin.mdx b/docs/models/extractionestimatefieldmin.mdx new file mode 100644 index 000000000..0eccd6722 --- /dev/null +++ b/docs/models/extractionestimatefieldmin.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionEstimateFieldMin" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionestimatefieldscale.mdx b/docs/models/extractionestimatefieldscale.mdx new file mode 100644 index 000000000..ae1e2363a --- /dev/null +++ b/docs/models/extractionestimatefieldscale.mdx @@ -0,0 +1,19 @@ +--- +title: "ExtractionEstimateFieldScale" +--- + +## Example Usage + +```typescript +import { ExtractionEstimateFieldScale } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateFieldScale = "log"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"linear" | "log" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionestimatefieldstepmonth.mdx b/docs/models/extractionestimatefieldstepmonth.mdx new file mode 100644 index 000000000..e7d02aa8f --- /dev/null +++ b/docs/models/extractionestimatefieldstepmonth.mdx @@ -0,0 +1,17 @@ +--- +title: "ExtractionEstimateFieldStepMonth" +--- + +## Example Usage + +```typescript +import { ExtractionEstimateFieldStepMonth } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateFieldStepMonth = "month"; +``` + +## Values + +```typescript +"month" +``` \ No newline at end of file diff --git a/docs/models/extractionestimatefieldstepunion.mdx b/docs/models/extractionestimatefieldstepunion.mdx new file mode 100644 index 000000000..b26cf7266 --- /dev/null +++ b/docs/models/extractionestimatefieldstepunion.mdx @@ -0,0 +1,24 @@ +--- +title: "ExtractionEstimateFieldStepUnion" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `models.ExtractionEstimateFieldStepMonth` + +```typescript +const value: models.ExtractionEstimateFieldStepMonth = "month"; +``` + +### `models.ExtractionEstimateFieldStepYear` + +```typescript +const value: models.ExtractionEstimateFieldStepYear = "year"; +``` + diff --git a/docs/models/extractionestimatefieldstepyear.mdx b/docs/models/extractionestimatefieldstepyear.mdx new file mode 100644 index 000000000..29c9cef1b --- /dev/null +++ b/docs/models/extractionestimatefieldstepyear.mdx @@ -0,0 +1,17 @@ +--- +title: "ExtractionEstimateFieldStepYear" +--- + +## Example Usage + +```typescript +import { ExtractionEstimateFieldStepYear } from "@openrouter/sdk/models"; + +let value: ExtractionEstimateFieldStepYear = "year"; +``` + +## Values + +```typescript +"year" +``` \ No newline at end of file diff --git a/docs/models/extractionforecastanswer.mdx b/docs/models/extractionforecastanswer.mdx new file mode 100644 index 000000000..5269b26f8 --- /dev/null +++ b/docs/models/extractionforecastanswer.mdx @@ -0,0 +1,31 @@ +--- +title: "ExtractionForecastAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionForecastAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionForecastAnswer = { + type: "forecast", + value: [], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *models.ExtractionForecastAnswerGuess*[] | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `mean` | *models.ExtractionForecastAnswerMean*[] | ➖ | N/A | +| `median` | *models.ExtractionForecastAnswerMedian*[] | ➖ | N/A | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `p10` | *models.ExtractionForecastAnswerP10*[] | ➖ | N/A | +| `p90` | *models.ExtractionForecastAnswerP90*[] | ➖ | N/A | +| `source` | [models.ExtractionForecastAnswerSource](../models/extractionforecastanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `steps` | [models.ExtractionForecastStep](../models/extractionforecaststep.mdx)[] | ➖ | N/A | +| `type` | *"forecast"* | ✔️ | N/A | +| `value` | *models.ExtractionForecastAnswerValue*[] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionforecastanswerguess.mdx b/docs/models/extractionforecastanswerguess.mdx new file mode 100644 index 000000000..f23dbc3ed --- /dev/null +++ b/docs/models/extractionforecastanswerguess.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerGuess" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastanswermean.mdx b/docs/models/extractionforecastanswermean.mdx new file mode 100644 index 000000000..827ade76d --- /dev/null +++ b/docs/models/extractionforecastanswermean.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerMean" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastanswermedian.mdx b/docs/models/extractionforecastanswermedian.mdx new file mode 100644 index 000000000..50e53fb24 --- /dev/null +++ b/docs/models/extractionforecastanswermedian.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerMedian" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastanswerp10.mdx b/docs/models/extractionforecastanswerp10.mdx new file mode 100644 index 000000000..725608121 --- /dev/null +++ b/docs/models/extractionforecastanswerp10.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerP10" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastanswerp90.mdx b/docs/models/extractionforecastanswerp90.mdx new file mode 100644 index 000000000..9aff08396 --- /dev/null +++ b/docs/models/extractionforecastanswerp90.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerP90" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastanswersource.mdx b/docs/models/extractionforecastanswersource.mdx new file mode 100644 index 000000000..df7fc7d36 --- /dev/null +++ b/docs/models/extractionforecastanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionForecastAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionForecastAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionForecastAnswerSource = "image"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionforecastanswervalue.mdx b/docs/models/extractionforecastanswervalue.mdx new file mode 100644 index 000000000..138ba536e --- /dev/null +++ b/docs/models/extractionforecastanswervalue.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastAnswerValue" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastfield.mdx b/docs/models/extractionforecastfield.mdx new file mode 100644 index 000000000..190289ee4 --- /dev/null +++ b/docs/models/extractionforecastfield.mdx @@ -0,0 +1,32 @@ +--- +title: "ExtractionForecastField" +--- + +## Example Usage + +```typescript +import { ExtractionForecastField } from "@openrouter/sdk/models"; + +let value: ExtractionForecastField = { + horizon: 607770, + interval: "day", + max: "", + min: 8431.08, + type: "forecast", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `horizon` | *number* | ✔️ | Number of forecast steps. | +| `instructions` | *string* | ➖ | What the field should contain. | +| `interval` | [models.Interval](../models/interval.mdx) | ✔️ | N/A | +| `max` | *models.ExtractionForecastFieldMax* | ✔️ | N/A | +| `min` | *models.ExtractionForecastFieldMin* | ✔️ | N/A | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `scale` | [models.ExtractionForecastFieldScale](../models/extractionforecastfieldscale.mdx) | ➖ | N/A | +| `step` | *models.ExtractionForecastFieldStepUnion* | ➖ | N/A | +| `type` | *"forecast"* | ✔️ | N/A | +| `unit` | *string* | ➖ | N/A | \ No newline at end of file diff --git a/docs/models/extractionforecastfieldmax.mdx b/docs/models/extractionforecastfieldmax.mdx new file mode 100644 index 000000000..4118c9fb6 --- /dev/null +++ b/docs/models/extractionforecastfieldmax.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastFieldMax" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastfieldmin.mdx b/docs/models/extractionforecastfieldmin.mdx new file mode 100644 index 000000000..a021d8dd3 --- /dev/null +++ b/docs/models/extractionforecastfieldmin.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastFieldMin" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecastfieldscale.mdx b/docs/models/extractionforecastfieldscale.mdx new file mode 100644 index 000000000..2b46efa68 --- /dev/null +++ b/docs/models/extractionforecastfieldscale.mdx @@ -0,0 +1,19 @@ +--- +title: "ExtractionForecastFieldScale" +--- + +## Example Usage + +```typescript +import { ExtractionForecastFieldScale } from "@openrouter/sdk/models"; + +let value: ExtractionForecastFieldScale = "log"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"linear" | "log" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionforecastfieldstepmonth.mdx b/docs/models/extractionforecastfieldstepmonth.mdx new file mode 100644 index 000000000..a8c7c8212 --- /dev/null +++ b/docs/models/extractionforecastfieldstepmonth.mdx @@ -0,0 +1,17 @@ +--- +title: "ExtractionForecastFieldStepMonth" +--- + +## Example Usage + +```typescript +import { ExtractionForecastFieldStepMonth } from "@openrouter/sdk/models"; + +let value: ExtractionForecastFieldStepMonth = "month"; +``` + +## Values + +```typescript +"month" +``` \ No newline at end of file diff --git a/docs/models/extractionforecastfieldstepunion.mdx b/docs/models/extractionforecastfieldstepunion.mdx new file mode 100644 index 000000000..dac8dc761 --- /dev/null +++ b/docs/models/extractionforecastfieldstepunion.mdx @@ -0,0 +1,24 @@ +--- +title: "ExtractionForecastFieldStepUnion" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `models.ExtractionForecastFieldStepMonth` + +```typescript +const value: models.ExtractionForecastFieldStepMonth = "month"; +``` + +### `models.ExtractionForecastFieldStepYear` + +```typescript +const value: models.ExtractionForecastFieldStepYear = "year"; +``` + diff --git a/docs/models/extractionforecastfieldstepyear.mdx b/docs/models/extractionforecastfieldstepyear.mdx new file mode 100644 index 000000000..0e8b98368 --- /dev/null +++ b/docs/models/extractionforecastfieldstepyear.mdx @@ -0,0 +1,17 @@ +--- +title: "ExtractionForecastFieldStepYear" +--- + +## Example Usage + +```typescript +import { ExtractionForecastFieldStepYear } from "@openrouter/sdk/models"; + +let value: ExtractionForecastFieldStepYear = "year"; +``` + +## Values + +```typescript +"year" +``` \ No newline at end of file diff --git a/docs/models/extractionforecaststep.mdx b/docs/models/extractionforecaststep.mdx new file mode 100644 index 000000000..585e0378b --- /dev/null +++ b/docs/models/extractionforecaststep.mdx @@ -0,0 +1,26 @@ +--- +title: "ExtractionForecastStep" +--- + +## Example Usage + +```typescript +import { ExtractionForecastStep } from "@openrouter/sdk/models"; + +let value: ExtractionForecastStep = { + value: null, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | +| `mean` | *models.ExtractionForecastStepMean* | ➖ | N/A | +| `median` | *models.ExtractionForecastStepMedian* | ➖ | N/A | +| `pAbove` | *number* | ➖ | Probability mass above `max`. | +| `pBelow` | *number* | ➖ | Probability mass below `min`. | +| `p10` | *models.ExtractionForecastStepP10* | ➖ | N/A | +| `p90` | *models.ExtractionForecastStepP90* | ➖ | N/A | +| `quantiles` | *models.ExtractionForecastStepQuantile*[] | ➖ | 99 percentiles, present when the provider is asked for quantiles. | +| `value` | *models.ExtractionForecastStepValue* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionforecaststepmean.mdx b/docs/models/extractionforecaststepmean.mdx new file mode 100644 index 000000000..7ffe2e516 --- /dev/null +++ b/docs/models/extractionforecaststepmean.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepMean" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecaststepmedian.mdx b/docs/models/extractionforecaststepmedian.mdx new file mode 100644 index 000000000..41c5742c4 --- /dev/null +++ b/docs/models/extractionforecaststepmedian.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepMedian" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecaststepp10.mdx b/docs/models/extractionforecaststepp10.mdx new file mode 100644 index 000000000..8bb4e00fe --- /dev/null +++ b/docs/models/extractionforecaststepp10.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepP10" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecaststepp90.mdx b/docs/models/extractionforecaststepp90.mdx new file mode 100644 index 000000000..3ce8f1b3d --- /dev/null +++ b/docs/models/extractionforecaststepp90.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepP90" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecaststepquantile.mdx b/docs/models/extractionforecaststepquantile.mdx new file mode 100644 index 000000000..e9be257bc --- /dev/null +++ b/docs/models/extractionforecaststepquantile.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepQuantile" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionforecaststepvalue.mdx b/docs/models/extractionforecaststepvalue.mdx new file mode 100644 index 000000000..4d6aa9f55 --- /dev/null +++ b/docs/models/extractionforecaststepvalue.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionForecastStepValue" +--- + +## Supported Types + +### `number` + +```typescript +const value: number = 1284.03; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/extractionlistanswer.mdx b/docs/models/extractionlistanswer.mdx new file mode 100644 index 000000000..21ed4b86f --- /dev/null +++ b/docs/models/extractionlistanswer.mdx @@ -0,0 +1,29 @@ +--- +title: "ExtractionListAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionListAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionListAnswer = { + type: "list", + value: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *models.ExtractionListAnswerGuess*[] | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionListAnswerSource](../models/extractionlistanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `spans` | *number*[][] | ➖ | N/A | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"list"* | ✔️ | N/A | +| `value` | *models.ExtractionListAnswerValue*[] | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionlistanswerguess.mdx b/docs/models/extractionlistanswerguess.mdx new file mode 100644 index 000000000..eb879adc9 --- /dev/null +++ b/docs/models/extractionlistanswerguess.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionListAnswerGuess" +--- + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `number` + +```typescript +const value: number = 1284.03; +``` + diff --git a/docs/models/extractionlistanswersource.mdx b/docs/models/extractionlistanswersource.mdx new file mode 100644 index 000000000..1ace28db1 --- /dev/null +++ b/docs/models/extractionlistanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionListAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionListAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionListAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionlistanswervalue.mdx b/docs/models/extractionlistanswervalue.mdx new file mode 100644 index 000000000..6ab3183c1 --- /dev/null +++ b/docs/models/extractionlistanswervalue.mdx @@ -0,0 +1,18 @@ +--- +title: "ExtractionListAnswerValue" +--- + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `number` + +```typescript +const value: number = 1284.03; +``` + diff --git a/docs/models/extractionlistfield.mdx b/docs/models/extractionlistfield.mdx new file mode 100644 index 000000000..c52a5cbad --- /dev/null +++ b/docs/models/extractionlistfield.mdx @@ -0,0 +1,24 @@ +--- +title: "ExtractionListField" +--- + +## Example Usage + +```typescript +import { ExtractionListField } from "@openrouter/sdk/models"; + +let value: ExtractionListField = { + items: "date", + type: "list", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `decimals` | *number* | ➖ | Decimal places kept in `value`. | +| `instructions` | *string* | ➖ | What the field should contain. | +| `items` | [models.Items](../models/items.mdx) | ✔️ | N/A | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"list"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionnumberanswer.mdx b/docs/models/extractionnumberanswer.mdx new file mode 100644 index 000000000..16690f287 --- /dev/null +++ b/docs/models/extractionnumberanswer.mdx @@ -0,0 +1,27 @@ +--- +title: "ExtractionNumberAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionNumberAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionNumberAnswer = { + type: "number", + value: 2185.97, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *number* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionNumberAnswerSource](../models/extractionnumberanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"number"* | ✔️ | N/A | +| `value` | *number* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionnumberanswersource.mdx b/docs/models/extractionnumberanswersource.mdx new file mode 100644 index 000000000..c74f00106 --- /dev/null +++ b/docs/models/extractionnumberanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionNumberAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionNumberAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionNumberAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractionnumberfield.mdx b/docs/models/extractionnumberfield.mdx new file mode 100644 index 000000000..a96ecb2c5 --- /dev/null +++ b/docs/models/extractionnumberfield.mdx @@ -0,0 +1,24 @@ +--- +title: "ExtractionNumberField" +--- + +## Example Usage + +```typescript +import { ExtractionNumberField } from "@openrouter/sdk/models"; + +let value: ExtractionNumberField = { + type: "number", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `decimals` | *number* | ➖ | Decimal places kept in `value`. | +| `instructions` | *string* | ➖ | What the field should contain. | +| `integer` | *boolean* | ➖ | N/A | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"number"* | ✔️ | N/A | +| `unit` | *string* | ➖ | N/A | \ No newline at end of file diff --git a/docs/models/extractionsrequest.mdx b/docs/models/extractionsrequest.mdx new file mode 100644 index 000000000..c2a1483f8 --- /dev/null +++ b/docs/models/extractionsrequest.mdx @@ -0,0 +1,29 @@ +--- +title: "ExtractionsRequest" +--- + +## Example Usage + +```typescript +import { ExtractionsRequest } from "@openrouter/sdk/models"; + +let value: ExtractionsRequest = { + fields: {}, + model: "Camaro", + state: "Arizona", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `assets` | Record\ | ➖ | Images keyed by reference string, as in TypeSafe's API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text. | | +| `fields` | Record\ | ✔️ | Map of field name to typed field spec. | | +| `model` | *string* | ✔️ | N/A | | +| `provider` | [models.ProviderPreferences](../models/providerpreferences.mdx) | ➖ | N/A | \{
"allow_fallbacks": true
} | +| `referenceDate` | *string* | ➖ | ISO date that anchors dates written without a year. | | +| `sessionId` | *string* | ➖ | A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. | session-1234 | +| `state` | *string* | ✔️ | The text to read from. May be empty only when the request carries image assets. | | +| `trace` | [models.TraceConfig](../models/traceconfig.mdx) | ➖ | Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. | \{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
} | +| `user` | *string* | ➖ | N/A | | \ No newline at end of file diff --git a/docs/models/extractionsresponse.mdx b/docs/models/extractionsresponse.mdx new file mode 100644 index 000000000..16ca7fbdb --- /dev/null +++ b/docs/models/extractionsresponse.mdx @@ -0,0 +1,30 @@ +--- +title: "ExtractionsResponse" +--- + +## Example Usage + +```typescript +import { ExtractionsResponse } from "@openrouter/sdk/models"; + +let value: ExtractionsResponse = { + answers: {}, + model: "Taurus", + usage: { + inputTokens: 732971, + outputTokens: 947246, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| `answers` | Record\ | ✔️ | N/A | +| `id` | *string* | ➖ | N/A | +| `model` | *string* | ✔️ | N/A | +| `provider` | *string* | ➖ | N/A | +| `stateText` | *string* | ➖ | The text that spans index into, when requested through provider options. | +| `truncated` | *boolean* | ➖ | True when the provider read only a prefix of the state. | +| `usage` | [models.ExtractionsUsage](../models/extractionsusage.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractionsresponseanswers.mdx b/docs/models/extractionsresponseanswers.mdx new file mode 100644 index 000000000..69128752e --- /dev/null +++ b/docs/models/extractionsresponseanswers.mdx @@ -0,0 +1,92 @@ +--- +title: "ExtractionsResponseAnswers" +--- + +One answer per requested field. `value` is null when the state does not determine it. + + +## Supported Types + +### `models.ExtractionDateAnswer` + +```typescript +const value: models.ExtractionDateAnswer = { + type: "date", + value: "", +}; +``` + +### `models.ExtractionDatetimeAnswer` + +```typescript +const value: models.ExtractionDatetimeAnswer = { + type: "datetime", + value: "", +}; +``` + +### `models.ExtractionDurationAnswer` + +```typescript +const value: models.ExtractionDurationAnswer = { + type: "duration", + value: 1203.6, +}; +``` + +### `models.ExtractionEstimateAnswer` + +```typescript +const value: models.ExtractionEstimateAnswer = { + type: "estimate", + value: "", +}; +``` + +### `models.ExtractionForecastAnswer` + +```typescript +const value: models.ExtractionForecastAnswer = { + type: "forecast", + value: [], +}; +``` + +### `models.ExtractionListAnswer` + +```typescript +const value: models.ExtractionListAnswer = { + type: "list", + value: [ + "", + ], +}; +``` + +### `models.ExtractionNumberAnswer` + +```typescript +const value: models.ExtractionNumberAnswer = { + type: "number", + value: 2185.97, +}; +``` + +### `models.ExtractionTextAnswer` + +```typescript +const value: models.ExtractionTextAnswer = { + type: "text", + value: "", +}; +``` + +### `models.ExtractionTimeAnswer` + +```typescript +const value: models.ExtractionTimeAnswer = { + type: "time", + value: "", +}; +``` + diff --git a/docs/models/extractionsusage.mdx b/docs/models/extractionsusage.mdx new file mode 100644 index 000000000..7858c6088 --- /dev/null +++ b/docs/models/extractionsusage.mdx @@ -0,0 +1,26 @@ +--- +title: "ExtractionsUsage" +--- + +## Example Usage + +```typescript +import { ExtractionsUsage } from "@openrouter/sdk/models"; + +let value: ExtractionsUsage = { + inputTokens: 603173, + outputTokens: 185544, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `cost` | *number* | ➖ | N/A | +| `imageTokens` | *number* | ➖ | N/A | +| `inputTokens` | *number* | ✔️ | N/A | +| `outputTokens` | *number* | ✔️ | N/A | +| `passes` | *number* | ➖ | Number of upstream passes when the fields did not fit in one. | +| `schemaTokens` | *number* | ➖ | N/A | +| `stateTokens` | *number* | ➖ | N/A | \ No newline at end of file diff --git a/docs/models/extractiontextanswer.mdx b/docs/models/extractiontextanswer.mdx new file mode 100644 index 000000000..39ba36ea0 --- /dev/null +++ b/docs/models/extractiontextanswer.mdx @@ -0,0 +1,27 @@ +--- +title: "ExtractionTextAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionTextAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionTextAnswer = { + type: "text", + value: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *string* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionTextAnswerSource](../models/extractiontextanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"text"* | ✔️ | N/A | +| `value` | *string* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiontextanswersource.mdx b/docs/models/extractiontextanswersource.mdx new file mode 100644 index 000000000..32f00552f --- /dev/null +++ b/docs/models/extractiontextanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionTextAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionTextAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionTextAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractiontextfield.mdx b/docs/models/extractiontextfield.mdx new file mode 100644 index 000000000..495ef7b2d --- /dev/null +++ b/docs/models/extractiontextfield.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionTextField" +--- + +## Example Usage + +```typescript +import { ExtractionTextField } from "@openrouter/sdk/models"; + +let value: ExtractionTextField = { + type: "text", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `instructions` | *string* | ➖ | What the field should contain. | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"text"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiontimeanswer.mdx b/docs/models/extractiontimeanswer.mdx new file mode 100644 index 000000000..33c8034fe --- /dev/null +++ b/docs/models/extractiontimeanswer.mdx @@ -0,0 +1,27 @@ +--- +title: "ExtractionTimeAnswer" +--- + +## Example Usage + +```typescript +import { ExtractionTimeAnswer } from "@openrouter/sdk/models"; + +let value: ExtractionTimeAnswer = { + type: "time", + value: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `confidence` | *number* | ➖ | N/A | +| `guess` | *string* | ➖ | The most likely value even when `value` is null because `p_null` crossed the threshold. | +| `pNull` | *number* | ➖ | Probability that the state contains nothing for this field. | +| `source` | [models.ExtractionTimeAnswerSource](../models/extractiontimeanswersource.mdx) | ➖ | Set to `image` when the answer was read from an image rather than the state text. | +| `span` | *number*[] | ➖ | Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. | +| `spellConfidence` | *number* | ➖ | Confidence in the spelling of text read from an image. | +| `type` | *"time"* | ✔️ | N/A | +| `value` | *string* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/extractiontimeanswersource.mdx b/docs/models/extractiontimeanswersource.mdx new file mode 100644 index 000000000..dbed36f5c --- /dev/null +++ b/docs/models/extractiontimeanswersource.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionTimeAnswerSource" +--- + +Set to `image` when the answer was read from an image rather than the state text. + +## Example Usage + +```typescript +import { ExtractionTimeAnswerSource } from "@openrouter/sdk/models"; + +let value: ExtractionTimeAnswerSource = "state"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"state" | "image" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/extractiontimefield.mdx b/docs/models/extractiontimefield.mdx new file mode 100644 index 000000000..e15cc6174 --- /dev/null +++ b/docs/models/extractiontimefield.mdx @@ -0,0 +1,21 @@ +--- +title: "ExtractionTimeField" +--- + +## Example Usage + +```typescript +import { ExtractionTimeField } from "@openrouter/sdk/models"; + +let value: ExtractionTimeField = { + type: "time", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `instructions` | *string* | ➖ | What the field should contain. | +| `nullThreshold` | *number* | ➖ | Probability of null above which `value` is null. Default 0.5. | +| `type` | *"time"* | ✔️ | N/A | \ No newline at end of file diff --git a/docs/models/fields.mdx b/docs/models/fields.mdx new file mode 100644 index 000000000..a5b4312ae --- /dev/null +++ b/docs/models/fields.mdx @@ -0,0 +1,88 @@ +--- +title: "Fields" +--- + +A typed field to extract, compute, estimate or forecast from the state. Which types a model answers is model-specific; unsupported types are rejected with 400. + + +## Supported Types + +### `models.ExtractionDateField` + +```typescript +const value: models.ExtractionDateField = { + type: "date", +}; +``` + +### `models.ExtractionDatetimeField` + +```typescript +const value: models.ExtractionDatetimeField = { + type: "datetime", +}; +``` + +### `models.ExtractionDurationField` + +```typescript +const value: models.ExtractionDurationField = { + type: "duration", +}; +``` + +### `models.ExtractionEstimateField` + +```typescript +const value: models.ExtractionEstimateField = { + max: 7670.28, + min: 9139.4, + type: "estimate", +}; +``` + +### `models.ExtractionForecastField` + +```typescript +const value: models.ExtractionForecastField = { + horizon: 607770, + interval: "day", + max: "", + min: 8431.08, + type: "forecast", +}; +``` + +### `models.ExtractionListField` + +```typescript +const value: models.ExtractionListField = { + items: "date", + type: "list", +}; +``` + +### `models.ExtractionNumberField` + +```typescript +const value: models.ExtractionNumberField = { + type: "number", +}; +``` + +### `models.ExtractionTextField` + +```typescript +const value: models.ExtractionTextField = { + type: "text", +}; +``` + +### `models.ExtractionTimeField` + +```typescript +const value: models.ExtractionTimeField = { + type: "time", +}; +``` + diff --git a/docs/models/interval.mdx b/docs/models/interval.mdx new file mode 100644 index 000000000..ac22ce69d --- /dev/null +++ b/docs/models/interval.mdx @@ -0,0 +1,19 @@ +--- +title: "Interval" +--- + +## Example Usage + +```typescript +import { Interval } from "@openrouter/sdk/models"; + +let value: Interval = "year"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"step" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "year" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/items.mdx b/docs/models/items.mdx new file mode 100644 index 000000000..4fd66062b --- /dev/null +++ b/docs/models/items.mdx @@ -0,0 +1,19 @@ +--- +title: "Items" +--- + +## Example Usage + +```typescript +import { Items } from "@openrouter/sdk/models"; + +let value: Items = "number"; + +// Open enum: unrecognized values are captured as Unrecognized +``` + +## Values + +```typescript +"text" | "number" | "date" | Unrecognized +``` \ No newline at end of file diff --git a/docs/models/operations/createapialphaextractionsglobals.mdx b/docs/models/operations/createapialphaextractionsglobals.mdx new file mode 100644 index 000000000..8b1d26a35 --- /dev/null +++ b/docs/models/operations/createapialphaextractionsglobals.mdx @@ -0,0 +1,19 @@ +--- +title: "CreateApiAlphaExtractionsGlobals" +--- + +## Example Usage + +```typescript +import { CreateApiAlphaExtractionsGlobals } from "@openrouter/sdk/models/operations"; + +let value: CreateApiAlphaExtractionsGlobals = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `appTitle` | *string* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| \ No newline at end of file diff --git a/docs/models/operations/createapialphaextractionsrequest.mdx b/docs/models/operations/createapialphaextractionsrequest.mdx new file mode 100644 index 000000000..183a8823d --- /dev/null +++ b/docs/models/operations/createapialphaextractionsrequest.mdx @@ -0,0 +1,26 @@ +--- +title: "CreateApiAlphaExtractionsRequest" +--- + +## Example Usage + +```typescript +import { CreateApiAlphaExtractionsRequest } from "@openrouter/sdk/models/operations"; + +let value: CreateApiAlphaExtractionsRequest = { + extractionsRequest: { + fields: {}, + model: "El Camino", + state: "South Dakota", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| `httpReferer` | *string* | ➖ | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| +| `appTitle` | *string* | ➖ | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| +| `appCategories` | *string* | ➖ | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| +| `extractionsRequest` | [models.ExtractionsRequest](../../models/extractionsrequest.mdx) | ✔️ | N/A | \ No newline at end of file diff --git a/docs/sdks/extractions/README.mdx b/docs/sdks/extractions/README.mdx new file mode 100644 index 000000000..d7910d525 --- /dev/null +++ b/docs/sdks/extractions/README.mdx @@ -0,0 +1,159 @@ +--- +title: "Alpha.Extractions" +description: "Alpha feature endpoints for Extractions requests" +--- + +## Overview + +Alpha feature endpoints for Extractions requests + +### Available Operations + +* [create](#create) - Submit an Extractions request + +## create + +Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable. + +### Example Usage + +```typescript +import { OpenRouter } from "@openrouter/sdk"; + +const openRouter = new OpenRouter({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const result = await openRouter.alpha.extractions.create({ + extractionsRequest: { + fields: { + "contacts": { + items: "text", + type: "list", + }, + "days_to_pay": { + max: 120, + min: 0, + step: 1, + type: "estimate", + }, + "due_date": { + instructions: "Issue date plus the net payment days", + type: "date", + }, + "invoice_number": { + type: "text", + }, + "total": { + decimals: 2, + type: "number", + unit: "USD", + }, + }, + model: "cloudflare/clairic", + referenceDate: "2026-10-28", + state: "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.", + }, + }); + + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { OpenRouterCore } from "@openrouter/sdk/core.js"; +import { alphaExtractionsCreate } from "@openrouter/sdk/funcs/alphaExtractionsCreate.js"; + +// Use `OpenRouterCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const openRouter = new OpenRouterCore({ + httpReferer: "", + appTitle: "", + appCategories: "", + apiKey: process.env["OPENROUTER_API_KEY"] ?? "", +}); + +async function run() { + const res = await alphaExtractionsCreate(openRouter, { + extractionsRequest: { + fields: { + "contacts": { + items: "text", + type: "list", + }, + "days_to_pay": { + max: 120, + min: 0, + step: 1, + type: "estimate", + }, + "due_date": { + instructions: "Issue date plus the net payment days", + type: "date", + }, + "invoice_number": { + type: "text", + }, + "total": { + decimals: 2, + type: "number", + unit: "USD", + }, + }, + model: "cloudflare/clairic", + referenceDate: "2026-10-28", + state: "Invoice INV-2291 issued 2026-09-02, net 30. Contacts: Dana Ruiz, Priya Shah. Total $1080.", + }, + }); + if (res.ok) { + const { value: result } = res; + console.log(result); + } else { + console.log("alphaExtractionsCreate failed:", res.error); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.CreateApiAlphaExtractionsRequest](../../models/operations/createapialphaextractionsrequest.mdx) | ✔️ | The request object to use for the request. | +| `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. | +| `options.serverURL` | *string* | ➖ | An optional server URL to use. | + +### Response + +**Promise\<[models.ExtractionsResponse](../../models/extractionsresponse.mdx)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| errors.BadRequestResponseError | 400 | application/json | +| errors.UnauthorizedResponseError | 401 | application/json | +| errors.PaymentRequiredResponseError | 402 | application/json | +| errors.ForbiddenResponseError | 403 | application/json | +| errors.NotFoundResponseError | 404 | application/json | +| errors.PayloadTooLargeResponseError | 413 | application/json | +| errors.TooManyRequestsResponseError | 429 | application/json | +| errors.InternalServerResponseError | 500 | application/json | +| errors.BadGatewayResponseError | 502 | application/json | +| errors.ServiceUnavailableResponseError | 503 | application/json | +| errors.EdgeNetworkTimeoutResponseError | 524 | application/json | +| errors.ProviderOverloadedResponseError | 529 | application/json | +| errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/jsr.json b/jsr.json index b940dae83..a4822565c 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@openrouter/sdk", - "version": "1.5.24", + "version": "1.5.25", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package.json b/package.json index 38502067b..67cb60f4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/sdk", - "version": "1.5.24", + "version": "1.5.25", "author": "OpenRouter", "description": "The OpenRouter TypeScript SDK is a type-safe toolkit for building AI applications with access to 400+ language models through a unified API.", "keywords": [ @@ -73,15 +73,15 @@ "lint": "eslint --cache --max-warnings=0 src", "build": "tsc && node scripts/unbarrel-imports.js", "prepublishOnly": "npm run build", - "compile": "tsc && node scripts/unbarrel-imports.js", - "test:transit": "exit 0", - "test:watch": "vitest --watch --project unit", - "typecheck": "tsc --noEmit", "postinstall": "node scripts/check-types.js || true", + "test:e2e": "vitest --run --project e2e", + "typecheck:transit": "exit 0", + "compile": "tsc && node scripts/unbarrel-imports.js", "prepare": "npm run build", "test": "vitest --run --project unit", - "test:e2e": "vitest --run --project e2e", - "typecheck:transit": "exit 0" + "test:transit": "exit 0", + "test:watch": "vitest --watch --project unit", + "typecheck": "tsc --noEmit" }, "peerDependencies": { diff --git a/src/funcs/alphaExtractionsCreate.ts b/src/funcs/alphaExtractionsCreate.ts new file mode 100644 index 000000000..88db5b8a1 --- /dev/null +++ b/src/funcs/alphaExtractionsCreate.ts @@ -0,0 +1,251 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 317c66b4f586 + */ + +import { OpenRouterCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import { matchStatusCode } from "../lib/http.js"; +import * as M from "../lib/matchers.js"; +import { compactMap } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import * as errors from "../models/errors/index.js"; +import { OpenRouterError } from "../models/errors/openroutererror.js"; +import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as models from "../models/index.js"; +import { CreateApiAlphaExtractionsServerList } from "../models/operations/createapialphaextractions.js"; +import * as operations from "../models/operations/index.js"; +import { APICall, APIPromise } from "../types/async.js"; +import { Result } from "../types/fp.js"; + +/** + * Submit an Extractions request + * + * @remarks + * Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable. + */ +export function alphaExtractionsCreate( + client: OpenRouterCore, + request: operations.CreateApiAlphaExtractionsRequest, + options?: RequestOptions, +): APIPromise< + Result< + models.ExtractionsResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.PaymentRequiredResponseError + | errors.ForbiddenResponseError + | errors.NotFoundResponseError + | errors.PayloadTooLargeResponseError + | errors.TooManyRequestsResponseError + | errors.InternalServerResponseError + | errors.BadGatewayResponseError + | errors.ServiceUnavailableResponseError + | errors.EdgeNetworkTimeoutResponseError + | errors.ProviderOverloadedResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + > +> { + return new APIPromise($do( + client, + request, + options, + )); +} + +async function $do( + client: OpenRouterCore, + request: operations.CreateApiAlphaExtractionsRequest, + options?: RequestOptions, +): Promise< + [ + Result< + models.ExtractionsResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.PaymentRequiredResponseError + | errors.ForbiddenResponseError + | errors.NotFoundResponseError + | errors.PayloadTooLargeResponseError + | errors.TooManyRequestsResponseError + | errors.InternalServerResponseError + | errors.BadGatewayResponseError + | errors.ServiceUnavailableResponseError + | errors.EdgeNetworkTimeoutResponseError + | errors.ProviderOverloadedResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >, + APICall, + ] +> { + const parsed = safeParse( + request, + (value) => + operations.CreateApiAlphaExtractionsRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return [parsed, { status: "invalid" }]; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.ExtractionsRequest, { + explode: true, + }); + + const baseURL = options?.serverURL + || pathToFunc(CreateApiAlphaExtractionsServerList[0], { + charEncoding: "percent", + })(); + + const path = pathToFunc("/api/alpha/extractions")(); + + const headers = new Headers(compactMap({ + "Content-Type": "application/json", + Accept: "application/json", + "HTTP-Referer": encodeSimple( + "HTTP-Referer", + payload["HTTP-Referer"] ?? client._options.httpReferer, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Categories": encodeSimple( + "X-OpenRouter-Categories", + payload.appCategories ?? client._options.appCategories, + { explode: false, charEncoding: "none" }, + ), + "X-OpenRouter-Title": encodeSimple( + "X-OpenRouter-Title", + payload.appTitle ?? client._options.appTitle, + { explode: false, charEncoding: "none" }, + ), + })); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + options: client._options, + baseURL: baseURL ?? "", + operationID: "createApiAlphaExtractions", + oAuth2Scopes: null, + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + baseURL: baseURL, + path: path, + headers: headers, + body: body, + userAgent: client._options.userAgent, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return [requestRes, { status: "invalid" }]; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + isErrorStatusCode: (statusCode: number) => + matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]), + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return [doResult, { status: "request-error", request: req }]; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + models.ExtractionsResponse, + | errors.BadRequestResponseError + | errors.UnauthorizedResponseError + | errors.PaymentRequiredResponseError + | errors.ForbiddenResponseError + | errors.NotFoundResponseError + | errors.PayloadTooLargeResponseError + | errors.TooManyRequestsResponseError + | errors.InternalServerResponseError + | errors.BadGatewayResponseError + | errors.ServiceUnavailableResponseError + | errors.EdgeNetworkTimeoutResponseError + | errors.ProviderOverloadedResponseError + | OpenRouterError + | ResponseValidationError + | ConnectionError + | RequestAbortedError + | RequestTimeoutError + | InvalidRequestError + | UnexpectedClientError + | SDKValidationError + >( + M.json(200, models.ExtractionsResponse$inboundSchema), + M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), + M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), + M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), + M.jsonErr(403, errors.ForbiddenResponseError$inboundSchema), + M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), + M.jsonErr(413, errors.PayloadTooLargeResponseError$inboundSchema), + M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), + M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), + M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), + M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), + M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), + M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), + M.fail("4XX"), + M.fail("5XX"), + )(response, req, { extraFields: responseFields }); + if (!result.ok) { + return [result, { status: "complete", request: req, response }]; + } + + return [result, { status: "complete", request: req, response }]; +} diff --git a/src/lib/config.ts b/src/lib/config.ts index 6033784e1..1a4e52435 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -79,7 +79,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "1.0.0", - sdkVersion: "1.5.24", + sdkVersion: "1.5.25", genVersion: "2.950.13", - userAgent: "speakeasy-sdk/typescript 1.5.24 2.950.13 1.0.0 @openrouter/sdk", + userAgent: "speakeasy-sdk/typescript 1.5.25 2.950.13 1.0.0 @openrouter/sdk", } as const; diff --git a/src/models/decisionsresponse.ts b/src/models/decisionsresponse.ts index ec202dcf2..33c516386 100644 --- a/src/models/decisionsresponse.ts +++ b/src/models/decisionsresponse.ts @@ -30,7 +30,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js"; /** * A Decisions answer using a boolean, choice, score, or image bounding-box evaluation. */ -export type Answers = +export type DecisionsResponseAnswers = | DecisionsBoxAnswer | DecisionsChoiceAnswer | DecisionsNoulAnswer @@ -59,21 +59,23 @@ export type DecisionsResponse = { }; /** @internal */ -export const Answers$inboundSchema: z.ZodType = - discriminatedUnion("type", { - box: DecisionsBoxAnswer$inboundSchema, - choice: DecisionsChoiceAnswer$inboundSchema, - noul: DecisionsNoulAnswer$inboundSchema, - score: DecisionsScoreAnswer$inboundSchema, - }); +export const DecisionsResponseAnswers$inboundSchema: z.ZodType< + DecisionsResponseAnswers, + unknown +> = discriminatedUnion("type", { + box: DecisionsBoxAnswer$inboundSchema, + choice: DecisionsChoiceAnswer$inboundSchema, + noul: DecisionsNoulAnswer$inboundSchema, + score: DecisionsScoreAnswer$inboundSchema, +}); -export function answersFromJSON( +export function decisionsResponseAnswersFromJSON( jsonString: string, -): SafeParseResult { +): SafeParseResult { return safeParse( jsonString, - (x) => Answers$inboundSchema.parse(JSON.parse(x)), - `Failed to parse 'Answers' from JSON`, + (x) => DecisionsResponseAnswers$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DecisionsResponseAnswers' from JSON`, ); } diff --git a/src/models/extractiondateanswer.ts b/src/models/extractiondateanswer.ts new file mode 100644 index 000000000..3bd101a74 --- /dev/null +++ b/src/models/extractiondateanswer.ts @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: f956b3a98040 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionDateAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionDateAnswerSource = OpenEnum< + typeof ExtractionDateAnswerSource +>; + +export type ExtractionDateAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: string | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionDateAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "date"; + value: string | null; +}; + +/** @internal */ +export const ExtractionDateAnswerSource$inboundSchema: z.ZodType< + ExtractionDateAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionDateAnswerSource); + +/** @internal */ +export const ExtractionDateAnswer$inboundSchema: z.ZodType< + ExtractionDateAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.string().optional(), + p_null: z.number().optional(), + source: ExtractionDateAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("date"), + value: z.nullable(z.string()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionDateAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionDateAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionDateAnswer' from JSON`, + ); +} diff --git a/src/models/extractiondatefield.ts b/src/models/extractiondatefield.ts new file mode 100644 index 000000000..98ddf1a5b --- /dev/null +++ b/src/models/extractiondatefield.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 1c94ff9c9db3 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionDateField = { + /** + * What the field should contain. + */ + instructions?: string | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "date"; +}; + +/** @internal */ +export type ExtractionDateField$Outbound = { + instructions?: string | undefined; + null_threshold?: number | undefined; + type: "date"; +}; + +/** @internal */ +export const ExtractionDateField$outboundSchema: z.ZodType< + ExtractionDateField$Outbound, + ExtractionDateField +> = z.object({ + instructions: z.string().optional(), + nullThreshold: z.number().optional(), + type: z.literal("date"), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionDateFieldToJSON( + extractionDateField: ExtractionDateField, +): string { + return JSON.stringify( + ExtractionDateField$outboundSchema.parse(extractionDateField), + ); +} diff --git a/src/models/extractiondatetimeanswer.ts b/src/models/extractiondatetimeanswer.ts new file mode 100644 index 000000000..516c58a10 --- /dev/null +++ b/src/models/extractiondatetimeanswer.ts @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 78957c3e6418 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionDatetimeAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionDatetimeAnswerSource = OpenEnum< + typeof ExtractionDatetimeAnswerSource +>; + +export type ExtractionDatetimeAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: string | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionDatetimeAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "datetime"; + value: string | null; +}; + +/** @internal */ +export const ExtractionDatetimeAnswerSource$inboundSchema: z.ZodType< + ExtractionDatetimeAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionDatetimeAnswerSource); + +/** @internal */ +export const ExtractionDatetimeAnswer$inboundSchema: z.ZodType< + ExtractionDatetimeAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.string().optional(), + p_null: z.number().optional(), + source: ExtractionDatetimeAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("datetime"), + value: z.nullable(z.string()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionDatetimeAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionDatetimeAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionDatetimeAnswer' from JSON`, + ); +} diff --git a/src/models/extractiondatetimefield.ts b/src/models/extractiondatetimefield.ts new file mode 100644 index 000000000..35ca64f94 --- /dev/null +++ b/src/models/extractiondatetimefield.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 432acb0eac7e + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionDatetimeField = { + /** + * What the field should contain. + */ + instructions?: string | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "datetime"; +}; + +/** @internal */ +export type ExtractionDatetimeField$Outbound = { + instructions?: string | undefined; + null_threshold?: number | undefined; + type: "datetime"; +}; + +/** @internal */ +export const ExtractionDatetimeField$outboundSchema: z.ZodType< + ExtractionDatetimeField$Outbound, + ExtractionDatetimeField +> = z.object({ + instructions: z.string().optional(), + nullThreshold: z.number().optional(), + type: z.literal("datetime"), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionDatetimeFieldToJSON( + extractionDatetimeField: ExtractionDatetimeField, +): string { + return JSON.stringify( + ExtractionDatetimeField$outboundSchema.parse(extractionDatetimeField), + ); +} diff --git a/src/models/extractiondurationanswer.ts b/src/models/extractiondurationanswer.ts new file mode 100644 index 000000000..43c04f264 --- /dev/null +++ b/src/models/extractiondurationanswer.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 807f782479d4 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionDurationAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionDurationAnswerSource = OpenEnum< + typeof ExtractionDurationAnswerSource +>; + +export type ExtractionDurationAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: number | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionDurationAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "duration"; + /** + * The unit `value` is expressed in. + */ + unit?: string | undefined; + value: number | null; +}; + +/** @internal */ +export const ExtractionDurationAnswerSource$inboundSchema: z.ZodType< + ExtractionDurationAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionDurationAnswerSource); + +/** @internal */ +export const ExtractionDurationAnswer$inboundSchema: z.ZodType< + ExtractionDurationAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.number().optional(), + p_null: z.number().optional(), + source: ExtractionDurationAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("duration"), + unit: z.string().optional(), + value: z.nullable(z.number()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionDurationAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionDurationAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionDurationAnswer' from JSON`, + ); +} diff --git a/src/models/extractiondurationfield.ts b/src/models/extractiondurationfield.ts new file mode 100644 index 000000000..ac178a4f0 --- /dev/null +++ b/src/models/extractiondurationfield.ts @@ -0,0 +1,63 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 235530926c12 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionDurationField = { + /** + * Decimal places kept in `value`. + */ + decimals?: number | undefined; + /** + * What the field should contain. + */ + instructions?: string | undefined; + integer?: boolean | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "duration"; + /** + * seconds, minutes, hours, days, weeks, months or years. + */ + unit?: string | undefined; +}; + +/** @internal */ +export type ExtractionDurationField$Outbound = { + decimals?: number | undefined; + instructions?: string | undefined; + integer?: boolean | undefined; + null_threshold?: number | undefined; + type: "duration"; + unit?: string | undefined; +}; + +/** @internal */ +export const ExtractionDurationField$outboundSchema: z.ZodType< + ExtractionDurationField$Outbound, + ExtractionDurationField +> = z.object({ + decimals: z.int().optional(), + instructions: z.string().optional(), + integer: z.boolean().optional(), + nullThreshold: z.number().optional(), + type: z.literal("duration"), + unit: z.string().optional(), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionDurationFieldToJSON( + extractionDurationField: ExtractionDurationField, +): string { + return JSON.stringify( + ExtractionDurationField$outboundSchema.parse(extractionDurationField), + ); +} diff --git a/src/models/extractionestimateanswer.ts b/src/models/extractionestimateanswer.ts new file mode 100644 index 000000000..a85a815b4 --- /dev/null +++ b/src/models/extractionestimateanswer.ts @@ -0,0 +1,237 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 48f87e35341d + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ +export type ExtractionEstimateAnswerGuess = number | string; + +export type ExtractionEstimateAnswerMean = number | string; + +export type ExtractionEstimateAnswerMedian = number | string; + +export type ExtractionEstimateAnswerP10 = number | string; + +export type ExtractionEstimateAnswerP90 = number | string; + +export type ExtractionEstimateAnswerQuantile = number | string; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionEstimateAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionEstimateAnswerSource = OpenEnum< + typeof ExtractionEstimateAnswerSource +>; + +export type ExtractionEstimateAnswerValue = number | string; + +export type ExtractionEstimateAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: number | string | undefined; + mean?: number | string | undefined; + median?: number | string | undefined; + /** + * Probability mass above `max`. + */ + pAbove?: number | undefined; + /** + * Probability mass below `min`. + */ + pBelow?: number | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + p10?: number | string | undefined; + p90?: number | string | undefined; + /** + * 99 percentiles, present when the provider is asked for quantiles. + */ + quantiles?: Array | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionEstimateAnswerSource | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "estimate"; + value: number | string | null; +}; + +/** @internal */ +export const ExtractionEstimateAnswerGuess$inboundSchema: z.ZodType< + ExtractionEstimateAnswerGuess, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerGuessFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerGuess$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerGuess' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerMean$inboundSchema: z.ZodType< + ExtractionEstimateAnswerMean, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerMeanFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerMean$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerMean' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerMedian$inboundSchema: z.ZodType< + ExtractionEstimateAnswerMedian, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerMedianFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerMedian$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerMedian' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerP10$inboundSchema: z.ZodType< + ExtractionEstimateAnswerP10, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerP10FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerP10$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerP10' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerP90$inboundSchema: z.ZodType< + ExtractionEstimateAnswerP90, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerP90FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerP90$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerP90' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerQuantile$inboundSchema: z.ZodType< + ExtractionEstimateAnswerQuantile, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerQuantileFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerQuantile$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerQuantile' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswerSource$inboundSchema: z.ZodType< + ExtractionEstimateAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionEstimateAnswerSource); + +/** @internal */ +export const ExtractionEstimateAnswerValue$inboundSchema: z.ZodType< + ExtractionEstimateAnswerValue, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionEstimateAnswerValueFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswerValue$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswerValue' from JSON`, + ); +} + +/** @internal */ +export const ExtractionEstimateAnswer$inboundSchema: z.ZodType< + ExtractionEstimateAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.union([z.number(), z.string()]).optional(), + mean: z.union([z.number(), z.string()]).optional(), + median: z.union([z.number(), z.string()]).optional(), + p_above: z.number().optional(), + p_below: z.number().optional(), + p_null: z.number().optional(), + p10: z.union([z.number(), z.string()]).optional(), + p90: z.union([z.number(), z.string()]).optional(), + quantiles: z.array(z.union([z.number(), z.string()])).optional(), + source: ExtractionEstimateAnswerSource$inboundSchema.optional(), + spell_confidence: z.number().optional(), + type: z.literal("estimate"), + value: z.nullable(z.union([z.number(), z.string()])), +}).transform((v) => { + return remap$(v, { + "p_above": "pAbove", + "p_below": "pBelow", + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionEstimateAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionEstimateAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionEstimateAnswer' from JSON`, + ); +} diff --git a/src/models/extractionestimatefield.ts b/src/models/extractionestimatefield.ts new file mode 100644 index 000000000..888c2bca7 --- /dev/null +++ b/src/models/extractionestimatefield.ts @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 1a1d98c8e726 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; + +export type ExtractionEstimateFieldMax = number | string; + +export type ExtractionEstimateFieldMin = number | string; + +export const ExtractionEstimateFieldScale = { + Linear: "linear", + Log: "log", +} as const; +export type ExtractionEstimateFieldScale = OpenEnum< + typeof ExtractionEstimateFieldScale +>; + +export const ExtractionEstimateFieldStepYear = { + Year: "year", +} as const; +export type ExtractionEstimateFieldStepYear = ClosedEnum< + typeof ExtractionEstimateFieldStepYear +>; + +export const ExtractionEstimateFieldStepMonth = { + Month: "month", +} as const; +export type ExtractionEstimateFieldStepMonth = ClosedEnum< + typeof ExtractionEstimateFieldStepMonth +>; + +export type ExtractionEstimateFieldStepUnion = + | number + | ExtractionEstimateFieldStepMonth + | ExtractionEstimateFieldStepYear; + +export type ExtractionEstimateField = { + /** + * What the field should contain. + */ + instructions?: string | undefined; + max: number | string; + min: number | string; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + scale?: ExtractionEstimateFieldScale | undefined; + step?: + | number + | ExtractionEstimateFieldStepMonth + | ExtractionEstimateFieldStepYear + | undefined; + type: "estimate"; + unit?: string | undefined; +}; + +/** @internal */ +export type ExtractionEstimateFieldMax$Outbound = number | string; + +/** @internal */ +export const ExtractionEstimateFieldMax$outboundSchema: z.ZodType< + ExtractionEstimateFieldMax$Outbound, + ExtractionEstimateFieldMax +> = z.union([z.number(), z.string()]); + +export function extractionEstimateFieldMaxToJSON( + extractionEstimateFieldMax: ExtractionEstimateFieldMax, +): string { + return JSON.stringify( + ExtractionEstimateFieldMax$outboundSchema.parse(extractionEstimateFieldMax), + ); +} + +/** @internal */ +export type ExtractionEstimateFieldMin$Outbound = number | string; + +/** @internal */ +export const ExtractionEstimateFieldMin$outboundSchema: z.ZodType< + ExtractionEstimateFieldMin$Outbound, + ExtractionEstimateFieldMin +> = z.union([z.number(), z.string()]); + +export function extractionEstimateFieldMinToJSON( + extractionEstimateFieldMin: ExtractionEstimateFieldMin, +): string { + return JSON.stringify( + ExtractionEstimateFieldMin$outboundSchema.parse(extractionEstimateFieldMin), + ); +} + +/** @internal */ +export const ExtractionEstimateFieldScale$outboundSchema: z.ZodType< + string, + ExtractionEstimateFieldScale +> = openEnums.outboundSchema(ExtractionEstimateFieldScale); + +/** @internal */ +export const ExtractionEstimateFieldStepYear$outboundSchema: z.ZodEnum< + typeof ExtractionEstimateFieldStepYear +> = z.enum(ExtractionEstimateFieldStepYear); + +/** @internal */ +export const ExtractionEstimateFieldStepMonth$outboundSchema: z.ZodEnum< + typeof ExtractionEstimateFieldStepMonth +> = z.enum(ExtractionEstimateFieldStepMonth); + +/** @internal */ +export type ExtractionEstimateFieldStepUnion$Outbound = + | number + | string + | string; + +/** @internal */ +export const ExtractionEstimateFieldStepUnion$outboundSchema: z.ZodType< + ExtractionEstimateFieldStepUnion$Outbound, + ExtractionEstimateFieldStepUnion +> = z.union([ + z.number(), + ExtractionEstimateFieldStepMonth$outboundSchema, + ExtractionEstimateFieldStepYear$outboundSchema, +]); + +export function extractionEstimateFieldStepUnionToJSON( + extractionEstimateFieldStepUnion: ExtractionEstimateFieldStepUnion, +): string { + return JSON.stringify( + ExtractionEstimateFieldStepUnion$outboundSchema.parse( + extractionEstimateFieldStepUnion, + ), + ); +} + +/** @internal */ +export type ExtractionEstimateField$Outbound = { + instructions?: string | undefined; + max: number | string; + min: number | string; + null_threshold?: number | undefined; + scale?: string | undefined; + step?: number | string | string | undefined; + type: "estimate"; + unit?: string | undefined; +}; + +/** @internal */ +export const ExtractionEstimateField$outboundSchema: z.ZodType< + ExtractionEstimateField$Outbound, + ExtractionEstimateField +> = z.object({ + instructions: z.string().optional(), + max: z.union([z.number(), z.string()]), + min: z.union([z.number(), z.string()]), + nullThreshold: z.number().optional(), + scale: ExtractionEstimateFieldScale$outboundSchema.optional(), + step: z.union([ + z.number(), + ExtractionEstimateFieldStepMonth$outboundSchema, + ExtractionEstimateFieldStepYear$outboundSchema, + ]).optional(), + type: z.literal("estimate"), + unit: z.string().optional(), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionEstimateFieldToJSON( + extractionEstimateField: ExtractionEstimateField, +): string { + return JSON.stringify( + ExtractionEstimateField$outboundSchema.parse(extractionEstimateField), + ); +} diff --git a/src/models/extractionforecastanswer.ts b/src/models/extractionforecastanswer.ts new file mode 100644 index 000000000..19cb48b5d --- /dev/null +++ b/src/models/extractionforecastanswer.ts @@ -0,0 +1,205 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 6bee54876576 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; +import { + ExtractionForecastStep, + ExtractionForecastStep$inboundSchema, +} from "./extractionforecaststep.js"; + +export type ExtractionForecastAnswerGuess = number | string; + +export type ExtractionForecastAnswerMean = number | string; + +export type ExtractionForecastAnswerMedian = number | string; + +export type ExtractionForecastAnswerP10 = number | string; + +export type ExtractionForecastAnswerP90 = number | string; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionForecastAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionForecastAnswerSource = OpenEnum< + typeof ExtractionForecastAnswerSource +>; + +export type ExtractionForecastAnswerValue = number | string; + +export type ExtractionForecastAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: Array | undefined; + mean?: Array | undefined; + median?: Array | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + p10?: Array | undefined; + p90?: Array | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionForecastAnswerSource | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + steps?: Array | undefined; + type: "forecast"; + value: Array | null; +}; + +/** @internal */ +export const ExtractionForecastAnswerGuess$inboundSchema: z.ZodType< + ExtractionForecastAnswerGuess, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerGuessFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerGuess$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerGuess' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswerMean$inboundSchema: z.ZodType< + ExtractionForecastAnswerMean, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerMeanFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerMean$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerMean' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswerMedian$inboundSchema: z.ZodType< + ExtractionForecastAnswerMedian, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerMedianFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerMedian$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerMedian' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswerP10$inboundSchema: z.ZodType< + ExtractionForecastAnswerP10, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerP10FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerP10$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerP10' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswerP90$inboundSchema: z.ZodType< + ExtractionForecastAnswerP90, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerP90FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerP90$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerP90' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswerSource$inboundSchema: z.ZodType< + ExtractionForecastAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionForecastAnswerSource); + +/** @internal */ +export const ExtractionForecastAnswerValue$inboundSchema: z.ZodType< + ExtractionForecastAnswerValue, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastAnswerValueFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswerValue$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswerValue' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastAnswer$inboundSchema: z.ZodType< + ExtractionForecastAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.array(z.union([z.number(), z.string()])).optional(), + mean: z.array(z.union([z.number(), z.string()])).optional(), + median: z.array(z.union([z.number(), z.string()])).optional(), + p_null: z.number().optional(), + p10: z.array(z.union([z.number(), z.string()])).optional(), + p90: z.array(z.union([z.number(), z.string()])).optional(), + source: ExtractionForecastAnswerSource$inboundSchema.optional(), + spell_confidence: z.number().optional(), + steps: z.array(ExtractionForecastStep$inboundSchema).optional(), + type: z.literal("forecast"), + value: z.nullable(z.array(z.union([z.number(), z.string()]))), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionForecastAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastAnswer' from JSON`, + ); +} diff --git a/src/models/extractionforecastfield.ts b/src/models/extractionforecastfield.ts new file mode 100644 index 000000000..e20e54d79 --- /dev/null +++ b/src/models/extractionforecastfield.ts @@ -0,0 +1,205 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 25643b9662b3 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import * as openEnums from "../types/enums.js"; +import { ClosedEnum, OpenEnum } from "../types/enums.js"; + +export const Interval = { + Step: "step", + Minute: "minute", + Hour: "hour", + Day: "day", + Week: "week", + Month: "month", + Quarter: "quarter", + Year: "year", +} as const; +export type Interval = OpenEnum; + +export type ExtractionForecastFieldMax = number | string; + +export type ExtractionForecastFieldMin = number | string; + +export const ExtractionForecastFieldScale = { + Linear: "linear", + Log: "log", +} as const; +export type ExtractionForecastFieldScale = OpenEnum< + typeof ExtractionForecastFieldScale +>; + +export const ExtractionForecastFieldStepYear = { + Year: "year", +} as const; +export type ExtractionForecastFieldStepYear = ClosedEnum< + typeof ExtractionForecastFieldStepYear +>; + +export const ExtractionForecastFieldStepMonth = { + Month: "month", +} as const; +export type ExtractionForecastFieldStepMonth = ClosedEnum< + typeof ExtractionForecastFieldStepMonth +>; + +export type ExtractionForecastFieldStepUnion = + | number + | ExtractionForecastFieldStepMonth + | ExtractionForecastFieldStepYear; + +export type ExtractionForecastField = { + /** + * Number of forecast steps. + */ + horizon: number; + /** + * What the field should contain. + */ + instructions?: string | undefined; + interval: Interval; + max: number | string; + min: number | string; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + scale?: ExtractionForecastFieldScale | undefined; + step?: + | number + | ExtractionForecastFieldStepMonth + | ExtractionForecastFieldStepYear + | undefined; + type: "forecast"; + unit?: string | undefined; +}; + +/** @internal */ +export const Interval$outboundSchema: z.ZodType = openEnums + .outboundSchema(Interval); + +/** @internal */ +export type ExtractionForecastFieldMax$Outbound = number | string; + +/** @internal */ +export const ExtractionForecastFieldMax$outboundSchema: z.ZodType< + ExtractionForecastFieldMax$Outbound, + ExtractionForecastFieldMax +> = z.union([z.number(), z.string()]); + +export function extractionForecastFieldMaxToJSON( + extractionForecastFieldMax: ExtractionForecastFieldMax, +): string { + return JSON.stringify( + ExtractionForecastFieldMax$outboundSchema.parse(extractionForecastFieldMax), + ); +} + +/** @internal */ +export type ExtractionForecastFieldMin$Outbound = number | string; + +/** @internal */ +export const ExtractionForecastFieldMin$outboundSchema: z.ZodType< + ExtractionForecastFieldMin$Outbound, + ExtractionForecastFieldMin +> = z.union([z.number(), z.string()]); + +export function extractionForecastFieldMinToJSON( + extractionForecastFieldMin: ExtractionForecastFieldMin, +): string { + return JSON.stringify( + ExtractionForecastFieldMin$outboundSchema.parse(extractionForecastFieldMin), + ); +} + +/** @internal */ +export const ExtractionForecastFieldScale$outboundSchema: z.ZodType< + string, + ExtractionForecastFieldScale +> = openEnums.outboundSchema(ExtractionForecastFieldScale); + +/** @internal */ +export const ExtractionForecastFieldStepYear$outboundSchema: z.ZodEnum< + typeof ExtractionForecastFieldStepYear +> = z.enum(ExtractionForecastFieldStepYear); + +/** @internal */ +export const ExtractionForecastFieldStepMonth$outboundSchema: z.ZodEnum< + typeof ExtractionForecastFieldStepMonth +> = z.enum(ExtractionForecastFieldStepMonth); + +/** @internal */ +export type ExtractionForecastFieldStepUnion$Outbound = + | number + | string + | string; + +/** @internal */ +export const ExtractionForecastFieldStepUnion$outboundSchema: z.ZodType< + ExtractionForecastFieldStepUnion$Outbound, + ExtractionForecastFieldStepUnion +> = z.union([ + z.number(), + ExtractionForecastFieldStepMonth$outboundSchema, + ExtractionForecastFieldStepYear$outboundSchema, +]); + +export function extractionForecastFieldStepUnionToJSON( + extractionForecastFieldStepUnion: ExtractionForecastFieldStepUnion, +): string { + return JSON.stringify( + ExtractionForecastFieldStepUnion$outboundSchema.parse( + extractionForecastFieldStepUnion, + ), + ); +} + +/** @internal */ +export type ExtractionForecastField$Outbound = { + horizon: number; + instructions?: string | undefined; + interval: string; + max: number | string; + min: number | string; + null_threshold?: number | undefined; + scale?: string | undefined; + step?: number | string | string | undefined; + type: "forecast"; + unit?: string | undefined; +}; + +/** @internal */ +export const ExtractionForecastField$outboundSchema: z.ZodType< + ExtractionForecastField$Outbound, + ExtractionForecastField +> = z.object({ + horizon: z.int(), + instructions: z.string().optional(), + interval: Interval$outboundSchema, + max: z.union([z.number(), z.string()]), + min: z.union([z.number(), z.string()]), + nullThreshold: z.number().optional(), + scale: ExtractionForecastFieldScale$outboundSchema.optional(), + step: z.union([ + z.number(), + ExtractionForecastFieldStepMonth$outboundSchema, + ExtractionForecastFieldStepYear$outboundSchema, + ]).optional(), + type: z.literal("forecast"), + unit: z.string().optional(), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionForecastFieldToJSON( + extractionForecastField: ExtractionForecastField, +): string { + return JSON.stringify( + ExtractionForecastField$outboundSchema.parse(extractionForecastField), + ); +} diff --git a/src/models/extractionforecaststep.ts b/src/models/extractionforecaststep.ts new file mode 100644 index 000000000..d29ddddd5 --- /dev/null +++ b/src/models/extractionforecaststep.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 5e3688a043e1 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type ExtractionForecastStepMean = number | string; + +export type ExtractionForecastStepMedian = number | string; + +export type ExtractionForecastStepP10 = number | string; + +export type ExtractionForecastStepP90 = number | string; + +export type ExtractionForecastStepQuantile = number | string; + +export type ExtractionForecastStepValue = number | string; + +export type ExtractionForecastStep = { + mean?: number | string | undefined; + median?: number | string | undefined; + /** + * Probability mass above `max`. + */ + pAbove?: number | undefined; + /** + * Probability mass below `min`. + */ + pBelow?: number | undefined; + p10?: number | string | undefined; + p90?: number | string | undefined; + /** + * 99 percentiles, present when the provider is asked for quantiles. + */ + quantiles?: Array | undefined; + value: number | string | null; +}; + +/** @internal */ +export const ExtractionForecastStepMean$inboundSchema: z.ZodType< + ExtractionForecastStepMean, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepMeanFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepMean$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepMean' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStepMedian$inboundSchema: z.ZodType< + ExtractionForecastStepMedian, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepMedianFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepMedian$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepMedian' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStepP10$inboundSchema: z.ZodType< + ExtractionForecastStepP10, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepP10FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepP10$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepP10' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStepP90$inboundSchema: z.ZodType< + ExtractionForecastStepP90, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepP90FromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepP90$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepP90' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStepQuantile$inboundSchema: z.ZodType< + ExtractionForecastStepQuantile, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepQuantileFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepQuantile$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepQuantile' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStepValue$inboundSchema: z.ZodType< + ExtractionForecastStepValue, + unknown +> = z.union([z.number(), z.string()]); + +export function extractionForecastStepValueFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStepValue$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStepValue' from JSON`, + ); +} + +/** @internal */ +export const ExtractionForecastStep$inboundSchema: z.ZodType< + ExtractionForecastStep, + unknown +> = z.object({ + mean: z.union([z.number(), z.string()]).optional(), + median: z.union([z.number(), z.string()]).optional(), + p_above: z.number().optional(), + p_below: z.number().optional(), + p10: z.union([z.number(), z.string()]).optional(), + p90: z.union([z.number(), z.string()]).optional(), + quantiles: z.array(z.union([z.number(), z.string()])).optional(), + value: z.nullable(z.union([z.number(), z.string()])), +}).transform((v) => { + return remap$(v, { + "p_above": "pAbove", + "p_below": "pBelow", + }); +}); + +export function extractionForecastStepFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionForecastStep$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionForecastStep' from JSON`, + ); +} diff --git a/src/models/extractionlistanswer.ts b/src/models/extractionlistanswer.ts new file mode 100644 index 000000000..696c254f0 --- /dev/null +++ b/src/models/extractionlistanswer.ts @@ -0,0 +1,121 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 26a830a1b9b0 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type ExtractionListAnswerGuess = string | number; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionListAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionListAnswerSource = OpenEnum< + typeof ExtractionListAnswerSource +>; + +export type ExtractionListAnswerValue = string | number; + +export type ExtractionListAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: Array | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionListAnswerSource | undefined; + spans?: Array> | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "list"; + value: Array | null; +}; + +/** @internal */ +export const ExtractionListAnswerGuess$inboundSchema: z.ZodType< + ExtractionListAnswerGuess, + unknown +> = z.union([z.string(), z.number()]); + +export function extractionListAnswerGuessFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionListAnswerGuess$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionListAnswerGuess' from JSON`, + ); +} + +/** @internal */ +export const ExtractionListAnswerSource$inboundSchema: z.ZodType< + ExtractionListAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionListAnswerSource); + +/** @internal */ +export const ExtractionListAnswerValue$inboundSchema: z.ZodType< + ExtractionListAnswerValue, + unknown +> = z.union([z.string(), z.number()]); + +export function extractionListAnswerValueFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionListAnswerValue$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionListAnswerValue' from JSON`, + ); +} + +/** @internal */ +export const ExtractionListAnswer$inboundSchema: z.ZodType< + ExtractionListAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.array(z.union([z.string(), z.number()])).optional(), + p_null: z.number().optional(), + source: ExtractionListAnswerSource$inboundSchema.optional(), + spans: z.array(z.array(z.int())).optional(), + spell_confidence: z.number().optional(), + type: z.literal("list"), + value: z.nullable(z.array(z.union([z.string(), z.number()]))), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionListAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionListAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionListAnswer' from JSON`, + ); +} diff --git a/src/models/extractionlistfield.ts b/src/models/extractionlistfield.ts new file mode 100644 index 000000000..01e65a0f5 --- /dev/null +++ b/src/models/extractionlistfield.ts @@ -0,0 +1,70 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: babad368b81e + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; + +export const Items = { + Text: "text", + Number: "number", + Date: "date", +} as const; +export type Items = OpenEnum; + +export type ExtractionListField = { + /** + * Decimal places kept in `value`. + */ + decimals?: number | undefined; + /** + * What the field should contain. + */ + instructions?: string | undefined; + items: Items; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "list"; +}; + +/** @internal */ +export const Items$outboundSchema: z.ZodType = openEnums + .outboundSchema(Items); + +/** @internal */ +export type ExtractionListField$Outbound = { + decimals?: number | undefined; + instructions?: string | undefined; + items: string; + null_threshold?: number | undefined; + type: "list"; +}; + +/** @internal */ +export const ExtractionListField$outboundSchema: z.ZodType< + ExtractionListField$Outbound, + ExtractionListField +> = z.object({ + decimals: z.int().optional(), + instructions: z.string().optional(), + items: Items$outboundSchema, + nullThreshold: z.number().optional(), + type: z.literal("list"), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionListFieldToJSON( + extractionListField: ExtractionListField, +): string { + return JSON.stringify( + ExtractionListField$outboundSchema.parse(extractionListField), + ); +} diff --git a/src/models/extractionnumberanswer.ts b/src/models/extractionnumberanswer.ts new file mode 100644 index 000000000..7b37986ea --- /dev/null +++ b/src/models/extractionnumberanswer.ts @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 39bb8411110e + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionNumberAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionNumberAnswerSource = OpenEnum< + typeof ExtractionNumberAnswerSource +>; + +export type ExtractionNumberAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: number | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionNumberAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "number"; + value: number | null; +}; + +/** @internal */ +export const ExtractionNumberAnswerSource$inboundSchema: z.ZodType< + ExtractionNumberAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionNumberAnswerSource); + +/** @internal */ +export const ExtractionNumberAnswer$inboundSchema: z.ZodType< + ExtractionNumberAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.number().optional(), + p_null: z.number().optional(), + source: ExtractionNumberAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("number"), + value: z.nullable(z.number()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionNumberAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionNumberAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionNumberAnswer' from JSON`, + ); +} diff --git a/src/models/extractionnumberfield.ts b/src/models/extractionnumberfield.ts new file mode 100644 index 000000000..0310dd954 --- /dev/null +++ b/src/models/extractionnumberfield.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: c4c239c1c3f9 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionNumberField = { + /** + * Decimal places kept in `value`. + */ + decimals?: number | undefined; + /** + * What the field should contain. + */ + instructions?: string | undefined; + integer?: boolean | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "number"; + unit?: string | undefined; +}; + +/** @internal */ +export type ExtractionNumberField$Outbound = { + decimals?: number | undefined; + instructions?: string | undefined; + integer?: boolean | undefined; + null_threshold?: number | undefined; + type: "number"; + unit?: string | undefined; +}; + +/** @internal */ +export const ExtractionNumberField$outboundSchema: z.ZodType< + ExtractionNumberField$Outbound, + ExtractionNumberField +> = z.object({ + decimals: z.int().optional(), + instructions: z.string().optional(), + integer: z.boolean().optional(), + nullThreshold: z.number().optional(), + type: z.literal("number"), + unit: z.string().optional(), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionNumberFieldToJSON( + extractionNumberField: ExtractionNumberField, +): string { + return JSON.stringify( + ExtractionNumberField$outboundSchema.parse(extractionNumberField), + ); +} diff --git a/src/models/extractionsrequest.ts b/src/models/extractionsrequest.ts new file mode 100644 index 000000000..d0b74cbc8 --- /dev/null +++ b/src/models/extractionsrequest.ts @@ -0,0 +1,218 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 43bff9429754 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { + DecisionsImageAsset, + DecisionsImageAsset$Outbound, + DecisionsImageAsset$outboundSchema, +} from "./decisionsimageasset.js"; +import { + ExtractionDateField, + ExtractionDateField$Outbound, + ExtractionDateField$outboundSchema, +} from "./extractiondatefield.js"; +import { + ExtractionDatetimeField, + ExtractionDatetimeField$Outbound, + ExtractionDatetimeField$outboundSchema, +} from "./extractiondatetimefield.js"; +import { + ExtractionDurationField, + ExtractionDurationField$Outbound, + ExtractionDurationField$outboundSchema, +} from "./extractiondurationfield.js"; +import { + ExtractionEstimateField, + ExtractionEstimateField$Outbound, + ExtractionEstimateField$outboundSchema, +} from "./extractionestimatefield.js"; +import { + ExtractionForecastField, + ExtractionForecastField$Outbound, + ExtractionForecastField$outboundSchema, +} from "./extractionforecastfield.js"; +import { + ExtractionListField, + ExtractionListField$Outbound, + ExtractionListField$outboundSchema, +} from "./extractionlistfield.js"; +import { + ExtractionNumberField, + ExtractionNumberField$Outbound, + ExtractionNumberField$outboundSchema, +} from "./extractionnumberfield.js"; +import { + ExtractionTextField, + ExtractionTextField$Outbound, + ExtractionTextField$outboundSchema, +} from "./extractiontextfield.js"; +import { + ExtractionTimeField, + ExtractionTimeField$Outbound, + ExtractionTimeField$outboundSchema, +} from "./extractiontimefield.js"; +import { + ProviderPreferences, + ProviderPreferences$Outbound, + ProviderPreferences$outboundSchema, +} from "./providerpreferences.js"; +import { + TraceConfig, + TraceConfig$Outbound, + TraceConfig$outboundSchema, +} from "./traceconfig.js"; + +/** + * A typed field to extract, compute, estimate or forecast from the state. Which types a model answers is model-specific; unsupported types are rejected with 400. + */ +export type Fields = + | ExtractionDateField + | ExtractionDatetimeField + | ExtractionDurationField + | ExtractionEstimateField + | ExtractionForecastField + | ExtractionListField + | ExtractionNumberField + | ExtractionTextField + | ExtractionTimeField; + +export type ExtractionsRequest = { + /** + * Images keyed by reference string, as in TypeSafe's API. Write a reference wherever the image belongs in `state`, `instructions`, or `criteria`; every asset must be referenced at least once. Jev reads a reference as a whole string value or inside longer text. Other Decisions models read a whole-string reference wherever they read an `image_url` part and reject a reference inside longer text. + */ + assets?: { [k: string]: DecisionsImageAsset } | undefined; + /** + * Map of field name to typed field spec. + */ + fields: { + [k: string]: + | ExtractionDateField + | ExtractionDatetimeField + | ExtractionDurationField + | ExtractionEstimateField + | ExtractionForecastField + | ExtractionListField + | ExtractionNumberField + | ExtractionTextField + | ExtractionTimeField; + }; + model: string; + provider?: ProviderPreferences | null | undefined; + /** + * ISO date that anchors dates written without a year. + */ + referenceDate?: string | undefined; + /** + * A unique identifier for grouping related requests (e.g., a conversation or agent workflow). Used for observability grouping in Broadcast and private logging; never sent to the provider. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters. + */ + sessionId?: string | undefined; + /** + * The text to read from. May be empty only when the request carries image assets. + */ + state: string; + /** + * Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations. + */ + trace?: TraceConfig | undefined; + user?: string | undefined; +}; + +/** @internal */ +export type Fields$Outbound = + | ExtractionDateField$Outbound + | ExtractionDatetimeField$Outbound + | ExtractionDurationField$Outbound + | ExtractionEstimateField$Outbound + | ExtractionForecastField$Outbound + | ExtractionListField$Outbound + | ExtractionNumberField$Outbound + | ExtractionTextField$Outbound + | ExtractionTimeField$Outbound; + +/** @internal */ +export const Fields$outboundSchema: z.ZodType = z + .union([ + ExtractionDateField$outboundSchema, + ExtractionDatetimeField$outboundSchema, + ExtractionDurationField$outboundSchema, + ExtractionEstimateField$outboundSchema, + ExtractionForecastField$outboundSchema, + ExtractionListField$outboundSchema, + ExtractionNumberField$outboundSchema, + ExtractionTextField$outboundSchema, + ExtractionTimeField$outboundSchema, + ]); + +export function fieldsToJSON(fields: Fields): string { + return JSON.stringify(Fields$outboundSchema.parse(fields)); +} + +/** @internal */ +export type ExtractionsRequest$Outbound = { + assets?: { [k: string]: DecisionsImageAsset$Outbound } | undefined; + fields: { + [k: string]: + | ExtractionDateField$Outbound + | ExtractionDatetimeField$Outbound + | ExtractionDurationField$Outbound + | ExtractionEstimateField$Outbound + | ExtractionForecastField$Outbound + | ExtractionListField$Outbound + | ExtractionNumberField$Outbound + | ExtractionTextField$Outbound + | ExtractionTimeField$Outbound; + }; + model: string; + provider?: ProviderPreferences$Outbound | null | undefined; + reference_date?: string | undefined; + session_id?: string | undefined; + state: string; + trace?: TraceConfig$Outbound | undefined; + user?: string | undefined; +}; + +/** @internal */ +export const ExtractionsRequest$outboundSchema: z.ZodType< + ExtractionsRequest$Outbound, + ExtractionsRequest +> = z.object({ + assets: z.record(z.string(), DecisionsImageAsset$outboundSchema).optional(), + fields: z.record( + z.string(), + z.union([ + ExtractionDateField$outboundSchema, + ExtractionDatetimeField$outboundSchema, + ExtractionDurationField$outboundSchema, + ExtractionEstimateField$outboundSchema, + ExtractionForecastField$outboundSchema, + ExtractionListField$outboundSchema, + ExtractionNumberField$outboundSchema, + ExtractionTextField$outboundSchema, + ExtractionTimeField$outboundSchema, + ]), + ), + model: z.string(), + provider: z.nullable(ProviderPreferences$outboundSchema).optional(), + referenceDate: z.string().optional(), + sessionId: z.string().optional(), + state: z.string(), + trace: TraceConfig$outboundSchema.optional(), + user: z.string().optional(), +}).transform((v) => { + return remap$(v, { + referenceDate: "reference_date", + sessionId: "session_id", + }); +}); + +export function extractionsRequestToJSON( + extractionsRequest: ExtractionsRequest, +): string { + return JSON.stringify( + ExtractionsRequest$outboundSchema.parse(extractionsRequest), + ); +} diff --git a/src/models/extractionsresponse.ts b/src/models/extractionsresponse.ts new file mode 100644 index 000000000..ec120a0ae --- /dev/null +++ b/src/models/extractionsresponse.ts @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 2c4d0e7507e5 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as discriminatedUnionTypes from "../types/discriminatedUnion.js"; +import { discriminatedUnion } from "../types/discriminatedUnion.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; +import { + ExtractionDateAnswer, + ExtractionDateAnswer$inboundSchema, +} from "./extractiondateanswer.js"; +import { + ExtractionDatetimeAnswer, + ExtractionDatetimeAnswer$inboundSchema, +} from "./extractiondatetimeanswer.js"; +import { + ExtractionDurationAnswer, + ExtractionDurationAnswer$inboundSchema, +} from "./extractiondurationanswer.js"; +import { + ExtractionEstimateAnswer, + ExtractionEstimateAnswer$inboundSchema, +} from "./extractionestimateanswer.js"; +import { + ExtractionForecastAnswer, + ExtractionForecastAnswer$inboundSchema, +} from "./extractionforecastanswer.js"; +import { + ExtractionListAnswer, + ExtractionListAnswer$inboundSchema, +} from "./extractionlistanswer.js"; +import { + ExtractionNumberAnswer, + ExtractionNumberAnswer$inboundSchema, +} from "./extractionnumberanswer.js"; +import { + ExtractionsUsage, + ExtractionsUsage$inboundSchema, +} from "./extractionsusage.js"; +import { + ExtractionTextAnswer, + ExtractionTextAnswer$inboundSchema, +} from "./extractiontextanswer.js"; +import { + ExtractionTimeAnswer, + ExtractionTimeAnswer$inboundSchema, +} from "./extractiontimeanswer.js"; + +/** + * One answer per requested field. `value` is null when the state does not determine it. + */ +export type ExtractionsResponseAnswers = + | ExtractionDateAnswer + | ExtractionDatetimeAnswer + | ExtractionDurationAnswer + | ExtractionEstimateAnswer + | ExtractionForecastAnswer + | ExtractionListAnswer + | ExtractionNumberAnswer + | ExtractionTextAnswer + | ExtractionTimeAnswer + | discriminatedUnionTypes.Unknown<"type">; + +export type ExtractionsResponse = { + answers: { + [k: string]: + | ExtractionDateAnswer + | ExtractionDatetimeAnswer + | ExtractionDurationAnswer + | ExtractionEstimateAnswer + | ExtractionForecastAnswer + | ExtractionListAnswer + | ExtractionNumberAnswer + | ExtractionTextAnswer + | ExtractionTimeAnswer + | discriminatedUnionTypes.Unknown<"type">; + }; + id?: string | undefined; + model: string; + provider?: string | undefined; + /** + * The text that spans index into, when requested through provider options. + */ + stateText?: string | null | undefined; + /** + * True when the provider read only a prefix of the state. + */ + truncated?: boolean | undefined; + usage: ExtractionsUsage; +}; + +/** @internal */ +export const ExtractionsResponseAnswers$inboundSchema: z.ZodType< + ExtractionsResponseAnswers, + unknown +> = discriminatedUnion("type", { + date: ExtractionDateAnswer$inboundSchema, + datetime: ExtractionDatetimeAnswer$inboundSchema, + duration: ExtractionDurationAnswer$inboundSchema, + estimate: ExtractionEstimateAnswer$inboundSchema, + forecast: ExtractionForecastAnswer$inboundSchema, + list: ExtractionListAnswer$inboundSchema, + number: ExtractionNumberAnswer$inboundSchema, + text: ExtractionTextAnswer$inboundSchema, + time: ExtractionTimeAnswer$inboundSchema, +}); + +export function extractionsResponseAnswersFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionsResponseAnswers$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionsResponseAnswers' from JSON`, + ); +} + +/** @internal */ +export const ExtractionsResponse$inboundSchema: z.ZodType< + ExtractionsResponse, + unknown +> = z.object({ + answers: z.record( + z.string(), + discriminatedUnion("type", { + date: ExtractionDateAnswer$inboundSchema, + datetime: ExtractionDatetimeAnswer$inboundSchema, + duration: ExtractionDurationAnswer$inboundSchema, + estimate: ExtractionEstimateAnswer$inboundSchema, + forecast: ExtractionForecastAnswer$inboundSchema, + list: ExtractionListAnswer$inboundSchema, + number: ExtractionNumberAnswer$inboundSchema, + text: ExtractionTextAnswer$inboundSchema, + time: ExtractionTimeAnswer$inboundSchema, + }), + ), + id: z.string().optional(), + model: z.string(), + provider: z.string().optional(), + state_text: z.nullable(z.string()).optional(), + truncated: z.boolean().optional(), + usage: ExtractionsUsage$inboundSchema, +}).transform((v) => { + return remap$(v, { + "state_text": "stateText", + }); +}); + +export function extractionsResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionsResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionsResponse' from JSON`, + ); +} diff --git a/src/models/extractionsusage.ts b/src/models/extractionsusage.ts new file mode 100644 index 000000000..31c1040bb --- /dev/null +++ b/src/models/extractionsusage.ts @@ -0,0 +1,55 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 539fcca69ecb + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +export type ExtractionsUsage = { + cost?: number | undefined; + imageTokens?: number | undefined; + inputTokens: number; + outputTokens: number; + /** + * Number of upstream passes when the fields did not fit in one. + */ + passes?: number | undefined; + schemaTokens?: number | undefined; + stateTokens?: number | undefined; +}; + +/** @internal */ +export const ExtractionsUsage$inboundSchema: z.ZodType< + ExtractionsUsage, + unknown +> = z.object({ + cost: z.number().optional(), + image_tokens: z.int().optional(), + input_tokens: z.int(), + output_tokens: z.int(), + passes: z.int().optional(), + schema_tokens: z.int().optional(), + state_tokens: z.int().optional(), +}).transform((v) => { + return remap$(v, { + "image_tokens": "imageTokens", + "input_tokens": "inputTokens", + "output_tokens": "outputTokens", + "schema_tokens": "schemaTokens", + "state_tokens": "stateTokens", + }); +}); + +export function extractionsUsageFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionsUsage$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionsUsage' from JSON`, + ); +} diff --git a/src/models/extractiontextanswer.ts b/src/models/extractiontextanswer.ts new file mode 100644 index 000000000..5b395078a --- /dev/null +++ b/src/models/extractiontextanswer.ts @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 4c006742e2fc + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionTextAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionTextAnswerSource = OpenEnum< + typeof ExtractionTextAnswerSource +>; + +export type ExtractionTextAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: string | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionTextAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "text"; + value: string | null; +}; + +/** @internal */ +export const ExtractionTextAnswerSource$inboundSchema: z.ZodType< + ExtractionTextAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionTextAnswerSource); + +/** @internal */ +export const ExtractionTextAnswer$inboundSchema: z.ZodType< + ExtractionTextAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.string().optional(), + p_null: z.number().optional(), + source: ExtractionTextAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("text"), + value: z.nullable(z.string()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionTextAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionTextAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionTextAnswer' from JSON`, + ); +} diff --git a/src/models/extractiontextfield.ts b/src/models/extractiontextfield.ts new file mode 100644 index 000000000..03d93a0d9 --- /dev/null +++ b/src/models/extractiontextfield.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 601482d94cbe + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionTextField = { + /** + * What the field should contain. + */ + instructions?: string | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "text"; +}; + +/** @internal */ +export type ExtractionTextField$Outbound = { + instructions?: string | undefined; + null_threshold?: number | undefined; + type: "text"; +}; + +/** @internal */ +export const ExtractionTextField$outboundSchema: z.ZodType< + ExtractionTextField$Outbound, + ExtractionTextField +> = z.object({ + instructions: z.string().optional(), + nullThreshold: z.number().optional(), + type: z.literal("text"), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionTextFieldToJSON( + extractionTextField: ExtractionTextField, +): string { + return JSON.stringify( + ExtractionTextField$outboundSchema.parse(extractionTextField), + ); +} diff --git a/src/models/extractiontimeanswer.ts b/src/models/extractiontimeanswer.ts new file mode 100644 index 000000000..1571f7f2e --- /dev/null +++ b/src/models/extractiontimeanswer.ts @@ -0,0 +1,88 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: bf3ef8199855 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; +import { safeParse } from "../lib/schemas.js"; +import * as openEnums from "../types/enums.js"; +import { OpenEnum } from "../types/enums.js"; +import { Result as SafeParseResult } from "../types/fp.js"; +import { SDKValidationError } from "./errors/sdkvalidationerror.js"; + +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export const ExtractionTimeAnswerSource = { + State: "state", + Image: "image", +} as const; +/** + * Set to `image` when the answer was read from an image rather than the state text. + */ +export type ExtractionTimeAnswerSource = OpenEnum< + typeof ExtractionTimeAnswerSource +>; + +export type ExtractionTimeAnswer = { + confidence?: number | undefined; + /** + * The most likely value even when `value` is null because `p_null` crossed the threshold. + */ + guess?: string | undefined; + /** + * Probability that the state contains nothing for this field. + */ + pNull?: number | undefined; + /** + * Set to `image` when the answer was read from an image rather than the state text. + */ + source?: ExtractionTimeAnswerSource | undefined; + /** + * Unicode code point offsets [start, end) into the state text: index code points (not UTF-16 code units or UTF-8 bytes), so an emoji or accented letter counts once. + */ + span?: Array | undefined; + /** + * Confidence in the spelling of text read from an image. + */ + spellConfidence?: number | undefined; + type: "time"; + value: string | null; +}; + +/** @internal */ +export const ExtractionTimeAnswerSource$inboundSchema: z.ZodType< + ExtractionTimeAnswerSource, + unknown +> = openEnums.inboundSchema(ExtractionTimeAnswerSource); + +/** @internal */ +export const ExtractionTimeAnswer$inboundSchema: z.ZodType< + ExtractionTimeAnswer, + unknown +> = z.object({ + confidence: z.number().optional(), + guess: z.string().optional(), + p_null: z.number().optional(), + source: ExtractionTimeAnswerSource$inboundSchema.optional(), + span: z.array(z.int()).optional(), + spell_confidence: z.number().optional(), + type: z.literal("time"), + value: z.nullable(z.string()), +}).transform((v) => { + return remap$(v, { + "p_null": "pNull", + "spell_confidence": "spellConfidence", + }); +}); + +export function extractionTimeAnswerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExtractionTimeAnswer$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExtractionTimeAnswer' from JSON`, + ); +} diff --git a/src/models/extractiontimefield.ts b/src/models/extractiontimefield.ts new file mode 100644 index 000000000..1f024a2af --- /dev/null +++ b/src/models/extractiontimefield.ts @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 20957cc003d4 + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../lib/primitives.js"; + +export type ExtractionTimeField = { + /** + * What the field should contain. + */ + instructions?: string | undefined; + /** + * Probability of null above which `value` is null. Default 0.5. + */ + nullThreshold?: number | undefined; + type: "time"; +}; + +/** @internal */ +export type ExtractionTimeField$Outbound = { + instructions?: string | undefined; + null_threshold?: number | undefined; + type: "time"; +}; + +/** @internal */ +export const ExtractionTimeField$outboundSchema: z.ZodType< + ExtractionTimeField$Outbound, + ExtractionTimeField +> = z.object({ + instructions: z.string().optional(), + nullThreshold: z.number().optional(), + type: z.literal("time"), +}).transform((v) => { + return remap$(v, { + nullThreshold: "null_threshold", + }); +}); + +export function extractionTimeFieldToJSON( + extractionTimeField: ExtractionTimeField, +): string { + return JSON.stringify( + ExtractionTimeField$outboundSchema.parse(extractionTimeField), + ); +} diff --git a/src/models/generationresponse.ts b/src/models/generationresponse.ts index 3cb344000..d164c9988 100644 --- a/src/models/generationresponse.ts +++ b/src/models/generationresponse.ts @@ -23,6 +23,7 @@ export const ApiType = { Embeddings: "embeddings", Rerank: "rerank", Decisions: "decisions", + Extractions: "extractions", Video: "video", TTS: "tts", STT: "stt", diff --git a/src/models/index.ts b/src/models/index.ts index c0488bd45..dfe66783b 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -336,6 +336,28 @@ export * from "./enumcapability.js"; export * from "./errorevent.js"; export * from "./externaluser.js"; export * from "./externaluserresponse.js"; +export * from "./extractiondateanswer.js"; +export * from "./extractiondatefield.js"; +export * from "./extractiondatetimeanswer.js"; +export * from "./extractiondatetimefield.js"; +export * from "./extractiondurationanswer.js"; +export * from "./extractiondurationfield.js"; +export * from "./extractionestimateanswer.js"; +export * from "./extractionestimatefield.js"; +export * from "./extractionforecastanswer.js"; +export * from "./extractionforecastfield.js"; +export * from "./extractionforecaststep.js"; +export * from "./extractionlistanswer.js"; +export * from "./extractionlistfield.js"; +export * from "./extractionnumberanswer.js"; +export * from "./extractionnumberfield.js"; +export * from "./extractionsrequest.js"; +export * from "./extractionsresponse.js"; +export * from "./extractionsusage.js"; +export * from "./extractiontextanswer.js"; +export * from "./extractiontextfield.js"; +export * from "./extractiontimeanswer.js"; +export * from "./extractiontimefield.js"; export * from "./failabletoolcallstatus.js"; export * from "./filecitation.js"; export * from "./filedeleteresponse.js"; diff --git a/src/models/operations/createapialphaextractions.ts b/src/models/operations/createapialphaextractions.ts new file mode 100644 index 000000000..2f2100bb7 --- /dev/null +++ b/src/models/operations/createapialphaextractions.ts @@ -0,0 +1,91 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: b3543519030d + */ + +import * as z from "zod/v4"; +import { remap as remap$ } from "../../lib/primitives.js"; +import * as models from "../index.js"; + +export const CreateApiAlphaExtractionsServerList = [ + "https://openrouter.ai", +] as const; + +export type CreateApiAlphaExtractionsGlobals = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; +}; + +export type CreateApiAlphaExtractionsRequest = { + /** + * The app identifier should be your app's URL and is used as the primary identifier for rankings. + * + * @remarks + * This is used to track API usage per application. + */ + httpReferer?: string | undefined; + /** + * The app display name allows you to customize how your app appears in OpenRouter's dashboard. + * + * @remarks + */ + appTitle?: string | undefined; + /** + * Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings. + * + * @remarks + */ + appCategories?: string | undefined; + extractionsRequest: models.ExtractionsRequest; +}; + +/** @internal */ +export type CreateApiAlphaExtractionsRequest$Outbound = { + "HTTP-Referer"?: string | undefined; + appTitle?: string | undefined; + appCategories?: string | undefined; + ExtractionsRequest: models.ExtractionsRequest$Outbound; +}; + +/** @internal */ +export const CreateApiAlphaExtractionsRequest$outboundSchema: z.ZodType< + CreateApiAlphaExtractionsRequest$Outbound, + CreateApiAlphaExtractionsRequest +> = z.object({ + httpReferer: z.string().optional(), + appTitle: z.string().optional(), + appCategories: z.string().optional(), + extractionsRequest: models.ExtractionsRequest$outboundSchema, +}).transform((v) => { + return remap$(v, { + httpReferer: "HTTP-Referer", + extractionsRequest: "ExtractionsRequest", + }); +}); + +export function createApiAlphaExtractionsRequestToJSON( + createApiAlphaExtractionsRequest: CreateApiAlphaExtractionsRequest, +): string { + return JSON.stringify( + CreateApiAlphaExtractionsRequest$outboundSchema.parse( + createApiAlphaExtractionsRequest, + ), + ); +} diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts index 71664f539..a3cef2333 100644 --- a/src/models/operations/index.ts +++ b/src/models/operations/index.ts @@ -12,6 +12,7 @@ export * from "./bulkunassignkeysfromguardrail.js"; export * from "./bulkunassignmembersfromguardrail.js"; export * from "./copyvaultsecretstointern.js"; export * from "./createapialphadecisions.js"; +export * from "./createapialphaextractions.js"; export * from "./createaudiospeech.js"; export * from "./createaudiotranscriptions.js"; export * from "./createaudiotranscriptionsmultipart.js"; diff --git a/src/sdk/alpha.ts b/src/sdk/alpha.ts index c334bf9f8..2eaf30479 100644 --- a/src/sdk/alpha.ts +++ b/src/sdk/alpha.ts @@ -5,10 +5,16 @@ import { ClientSDK } from "../lib/sdks.js"; import { Decisions } from "./decisions.js"; +import { Extractions } from "./extractions.js"; export class Alpha extends ClientSDK { private _decisions?: Decisions; get decisions(): Decisions { return (this._decisions ??= new Decisions(this._options)); } + + private _extractions?: Extractions; + get extractions(): Extractions { + return (this._extractions ??= new Extractions(this._options)); + } } diff --git a/src/sdk/extractions.ts b/src/sdk/extractions.ts new file mode 100644 index 000000000..c4d097415 --- /dev/null +++ b/src/sdk/extractions.ts @@ -0,0 +1,29 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + * @generated-id: 86201a09fb0f + */ + +import { alphaExtractionsCreate } from "../funcs/alphaExtractionsCreate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as models from "../models/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Extractions extends ClientSDK { + /** + * Submit an Extractions request + * + * @remarks + * Extracts, computes, estimates or forecasts typed fields from a state string and image assets using an extraction-style System One model. Alpha: the shape is not stable. + */ + async create( + request: operations.CreateApiAlphaExtractionsRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(alphaExtractionsCreate( + this, + request, + options, + )); + } +}