diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index fe5bc566..113c31c9 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,19 +1,19 @@ lockVersion: 2.0.0 id: 3e3290ca-0ee8-4981-b1bc-14536048fa63 management: - docChecksum: 6c50d3df7af689ff921a7b236aa524a5 + docChecksum: 98e7b904ec3f57d545ed3b2286972ee5 docVersion: 0.9.0 - speakeasyVersion: 1.797.0 - generationVersion: 2.937.18 - releaseVersion: 0.17.14 - configChecksum: e7d16589fea449f13b5c916e3b7884a6 + speakeasyVersion: 1.798.0 + generationVersion: 2.938.0 + releaseVersion: 0.17.15 + configChecksum: 1eb09757dc51c042e574b3e04826405c repoURL: https://github.com/gleanwork/api-client-python.git installationURL: https://github.com/gleanwork/api-client-python.git published: true persistentEdits: - generation_id: e096375a-646e-4fd0-81c4-55efcbfda47f - pristine_commit_hash: 299fa282fab309cfb9dcf2999bcc4179015e1cb9 - pristine_tree_hash: 4c0295eda3bb3c0d350e0332b1b12911ce8e0c1a + generation_id: 9abaee86-04c0-4139-a64f-1d41c66cd810 + pristine_commit_hash: 7ef2879267d9c8f17bd862867d4370be20618287 + pristine_tree_hash: 322e2bdf25614730f497eef9961bd76e3863eba5 features: python: acceptHeaders: 3.0.0 @@ -1474,8 +1474,8 @@ trackedFiles: pristine_git_object: a851a7f13eb25d515fa9b9244c5dfdc98fa14e2c docs/models/feedrequestcategory.md: id: 31a02f3064c7 - last_write_checksum: sha1:88334249125c3dca934c9adab500ae1b30bee4ae - pristine_git_object: 659067097afa1b9f6f30ba835d72e7a8c2cedac6 + last_write_checksum: sha1:6c058c44c4c9cc02dd16dbf222a4576348789c0f + pristine_git_object: 662a836bc9b99d7fe65d08ba4280adcacf0aa096 docs/models/feedrequestoptions.md: id: 58eb26b19e77 last_write_checksum: sha1:fd2ab08736cef8156169b0cfee8c52e7aed1accf @@ -1494,8 +1494,8 @@ trackedFiles: pristine_git_object: f6f92abf16b61f88b527e1c906f605e98306878e docs/models/feedresultcategory.md: id: a5f77f38d0a7 - last_write_checksum: sha1:c42683288d7fc9def7cd7ec3b22a128ddaff6daf - pristine_git_object: 86b5a71fb3f09f75f8c7314dd2222ccb20ee4e9f + last_write_checksum: sha1:3defded05526cfd53ff95f819046e9cebaddd2b0 + pristine_git_object: b1ed34c83753598c152bc76c41196860f036262e docs/models/fieldscope.md: id: e6b52bcb22a6 last_write_checksum: sha1:13a1492ce39d2f89a01d626996a345a1339a1873 @@ -1938,8 +1938,8 @@ trackedFiles: pristine_git_object: 647f9bb67a6af30d7fd71c8ddb3c5e1bf40bb938 docs/models/justificationtype.md: id: 8286affacee4 - last_write_checksum: sha1:5a0d77fbd2f34cb813482ea62b5e0ca29a8da3a7 - pristine_git_object: 71c24af0e73a4a64b150c60e499338e02a971685 + last_write_checksum: sha1:3cd9f468ee470bfe137224e72c46b03501e33905 + pristine_git_object: 7764769f62ea15ddd762c89e561431c2490b3edb docs/models/knowledgetype.md: id: 1e0c90679228 last_write_checksum: sha1:0030a7539b9362bbb59e0bbd36580676058b3540 @@ -2304,6 +2304,26 @@ trackedFiles: id: c1b58ab047ae last_write_checksum: sha1:4ee8bc479e4cb19b7846c0e27dcef6d09ecda294 pristine_git_object: 8fff9f30b2380cb75cc1367a4491b28185e95de4 + docs/models/platformagentrunerror.md: + id: 6e1f79d46287 + last_write_checksum: sha1:3837082422cf37c2d69464a2fc113a661cca6b9b + pristine_git_object: 9ef838b7dca1aeb2445da25b3db928be9b31487c + docs/models/platformagentrunresponse.md: + id: be99b7d57a06 + last_write_checksum: sha1:72f82b38a718a3a60a9dcf729e7f6d6ba0c85ff4 + pristine_git_object: 29594895b7ba54b2d25aef70dba06cbc4db28031 + docs/models/platformagentrunstate.md: + id: 38926be15f45 + last_write_checksum: sha1:5d178150084e171d2c07e8414a7f624a58715c2f + pristine_git_object: 4880387aa45afc07692acb4e9ef4675de141d493 + docs/models/platformagentruntoolapproval.md: + id: 74dbc64873cb + last_write_checksum: sha1:f383ae27bdade853cfd0111ad6655206e06d5c83 + pristine_git_object: 441521eee5aef3676d33afb1dd09b4b7955ff1ca + docs/models/platformagentruntoolapprovaltype.md: + id: 9942c102fe44 + last_write_checksum: sha1:3dec0ca4cb8b1c02acf560e2b0d32724dc90d4e7 + pristine_git_object: 7ffe0f37e35921bac19ab037e79027e82190c1e9 docs/models/platformagentrunwaitresponse.md: id: 216b0600404e last_write_checksum: sha1:af98dfbf6f900d7fa891640a5ad5259919062f55 @@ -2324,6 +2344,10 @@ trackedFiles: id: a51f3665418a last_write_checksum: sha1:34c8865c924c12194975f0a8cf1f98addb134b9d pristine_git_object: 615a5fc0c2249da985738ffb23bb598730e464d0 + docs/models/platformagentsgetrunrequest.md: + id: 1ab6f3c85f7c + last_write_checksum: sha1:8a1a81ce074bfa94304e6d15bdcc3bf2a0c1de01 + pristine_git_object: 9c849b538e739769bcf5584145c2b3e3ff616f59 docs/models/platformagentsgetschemasrequest.md: id: 3591800143f3 last_write_checksum: sha1:27a8e74a3fc50f378ed596e5c1a8bd3adb6fe0ea @@ -2368,22 +2392,38 @@ trackedFiles: id: f52ac98c71f7 last_write_checksum: sha1:08119b0731b552212f11f6f657a933cd06d9daec pristine_git_object: 8bed3e0696e7a1665d1fc1ef77e883aa51affcb1 + docs/models/platformchatcreateformat.md: + id: 53f6779cbcc1 + last_write_checksum: sha1:d2b68def8f3f46964b40e23908b228dae2655976 + pristine_git_object: 25911073b669c1dd17a2c5eaf013ce2b4e5a658d docs/models/platformchatcreateinput.md: id: b5ef80519bcf last_write_checksum: sha1:923de319896bc8dbb4af15eae03baae730fd3042 pristine_git_object: 9ee0df259532723cb625e145c48c0daf7d7a0d8e docs/models/platformchatcreaterequest.md: id: cd33a9dfda85 - last_write_checksum: sha1:0e26aaf39478d21d6bcf3730943323ff34b2a710 - pristine_git_object: 82808d05f9f69e0885883471aac9783c67801d62 + last_write_checksum: sha1:f91b8d077e108c2443046cd352c0e0b61088c20f + pristine_git_object: a100754d2fdfb6f0f3e2b5d3159821af7940a599 + docs/models/platformchatcreatestreamformat.md: + id: ccb1551a8c8e + last_write_checksum: sha1:57dfe924da40ac64e9f79e0c71581f77d6df3928 + pristine_git_object: cc3cd2a27c473e4f1cefd06b11d62422ff99a2ca docs/models/platformchatcreatestreaminput.md: id: 8db5acf6cc48 last_write_checksum: sha1:26e70a3ce28592c6059c62370d882f66f28e1387 pristine_git_object: 250ba3f9e5482057896cf121968d834590649a3f docs/models/platformchatcreatestreamrequest.md: id: 2f7f30973ec2 - last_write_checksum: sha1:6e27a56cbd02cb01db44a93d1758245221c2897d - pristine_git_object: 484d017f9d5e02aeae6539c1a354644b4c1b9436 + last_write_checksum: sha1:c1446ea9c05c4dfd89c358f5dcca1239a0fa7872 + pristine_git_object: aec04e2f76921921e815343430d1092e1c59bcbc + docs/models/platformchatcreatestreamtext.md: + id: a52a018a9526 + last_write_checksum: sha1:3e9e6bae9fefd9b98013439548d486e4beb2f239 + pristine_git_object: 7430aa9b3f62d0ba505d24f7d5d103f992182964 + docs/models/platformchatcreatetext.md: + id: 12feab50ab5f + last_write_checksum: sha1:4f98b57804261f0fc9731fab7b4d4050539d333b + pristine_git_object: c478436a86c79fa8d90a49a78fdef9b7b8d562d0 docs/models/platformchatcustomentitysource.md: id: 6e12deaeb23d last_write_checksum: sha1:b8ef7e1c92d45a3a3329a88b57361ba9553f28b3 @@ -2440,6 +2480,14 @@ trackedFiles: id: 0b46bce28b93 last_write_checksum: sha1:f48e66526e0a2167b36ca51042ccd0df50b1c59c pristine_git_object: cdf92876978850841d258d07db48586891089897 + docs/models/platformchatjsonschemaformat.md: + id: 29557ecc1f88 + last_write_checksum: sha1:b197e839c292086859672655aec3ad11fc4b0225 + pristine_git_object: 3e3ca482c1a6e8e541186a2c11ed9357173dec8f + docs/models/platformchatjsonschemaformattype.md: + id: e4b29294992e + last_write_checksum: sha1:39db49a6c9769940dfedd5c91242023fc29d9f9c + pristine_git_object: 392a76942323c44d896f2234f90aa09765f265c5 docs/models/platformchatoutputmessage.md: id: d236a3fe09a2 last_write_checksum: sha1:be7029860368e4db9a914916e2e2617f233f24aa @@ -2454,8 +2502,8 @@ trackedFiles: pristine_git_object: c14068505b05003de4e946a3418828950b15479a docs/models/platformchatoutputtextcontent.md: id: fd2f6a03da55 - last_write_checksum: sha1:c72902588f7531a39f1783e29433709cfe157a7a - pristine_git_object: 1ea074b5e646042d60c921c8d3351e31bc0ccde2 + last_write_checksum: sha1:816d395dc42172fdb4095d8dae2d444d9d7aa2f4 + pristine_git_object: 36632e3d967a901c9b5b1b79eb2281194f13c947 docs/models/platformchatoutputtextcontenttype.md: id: 2eca715382a5 last_write_checksum: sha1:89991c8d41e18cda29836b95477f9d6fc9919f58 @@ -2548,6 +2596,14 @@ trackedFiles: id: c6a5277b7a47 last_write_checksum: sha1:71c8bed820b7b848be51e3bff787a8de38f69e5a pristine_git_object: d878152e2e4f6647625177367828b3089c1b7688 + docs/models/platformchattextformat.md: + id: a4833ce90d4b + last_write_checksum: sha1:42528858a22ad1cca3768b7288f087a2537a7935 + pristine_git_object: 12f678b7a178b7302a0b88a3def5841eeb36d950 + docs/models/platformchattextformattype.md: + id: 9e6fcfac780d + last_write_checksum: sha1:2798b71f71f95463c94a66dd13fb46ed2c771030 + pristine_git_object: 9dca496f3bd03eecee4196bf3bc511881540242f docs/models/platformcontentschedulewebhookevent.md: id: 7cf591a2907e last_write_checksum: sha1:3df88866a52033aa4555602e8b7128abdb1f6d14 @@ -2564,6 +2620,10 @@ trackedFiles: id: 6a7d5eaea3c5 last_write_checksum: sha1:980bca6d1b189a0a14969236485ffdd8a6673f6b pristine_git_object: 926494c10c4e191a01e7fc879c0888742c8b593d + docs/models/platformdurableagentrun.md: + id: 9afb4bdaa146 + last_write_checksum: sha1:bc97ffd5e89973049ab0cc2c9073ade21221a2dd + pristine_git_object: fede41af609d3320ebdd62cee1465f7a6a620d10 docs/models/platformfilter.md: id: 4e97760ae8b9 last_write_checksum: sha1:c331962f750f8e583ea3f50d70027a2a23225ad3 @@ -3360,6 +3420,10 @@ trackedFiles: id: 794ea7f6265f last_write_checksum: sha1:7bee77ab7e9a46141d09a5a5980d3136ae34ac10 pristine_git_object: 9da32f0e7841e87099fbe94de2e2e025f62070c2 + docs/models/structuredoutput.md: + id: f2e447188759 + last_write_checksum: sha1:0fefd8718435f3a6ea2372819a35db97ec6927a3 + pristine_git_object: 45e8ab02d1f563d01c5045ae21340c61bd259a2d docs/models/structuredresult.md: id: 64daefd6d356 last_write_checksum: sha1:ae2a47158f5495406f756eabceab6bb523faabf3 @@ -3766,8 +3830,8 @@ trackedFiles: pristine_git_object: 61dd41f0319201cc105e29174ab1cc0018cecbce docs/sdks/agents/README.md: id: 5965d8232fd8 - last_write_checksum: sha1:977d88ddf87ce7b29b8f61e7b77d967061628b08 - pristine_git_object: f05a4d5990ac529b1af76f716cce568ce33285f7 + last_write_checksum: sha1:1da0dca5f89eed147c5f79d5b1cf5ff5014b239d + pristine_git_object: 765472cd3dc66a38569ad4fd5d05c5c2613ee881 docs/sdks/announcements/README.md: id: 3d2e130a217c last_write_checksum: sha1:ecfa655bb27dee6890656542cfafda0aa6ed1ab9 @@ -3778,8 +3842,8 @@ trackedFiles: pristine_git_object: 85153af7ec594c2dbd1e4a8c2eba5ce713796265 docs/sdks/chatsdk/README.md: id: 83b4ee321663 - last_write_checksum: sha1:6c25689a8771f1ba40b4badf390c0b2d42911502 - pristine_git_object: 4ccddf5196dda92a3b9e62efb1031e1d0c4e976f + last_write_checksum: sha1:bc0aaa0a6744cbd8d2f3fe67b09a1790c8cd9797 + pristine_git_object: a6bdce514d78f2e59ae88641ce246b2f766bfbb1 docs/sdks/clientactivity/README.md: id: a309613986a5 last_write_checksum: sha1:d9737458d891593ba2fb3372ab6e60ea728fe9a5 @@ -3914,8 +3978,8 @@ trackedFiles: pristine_git_object: 79e388be87446ab6a4064b372bad0e8376d0cb5e pyproject.toml: id: 5d07e7d72637 - last_write_checksum: sha1:99d21663bbe69e903d52e6af936915a4e61eae46 - pristine_git_object: 47df73c31b9b71aac2f687d754fff2e18d7312aa + last_write_checksum: sha1:50549d323659a35ab0a59c8c19451dc2d0aeba56 + pristine_git_object: b7cb0276a9bf207ec590dcac01947fd965245496 scripts/prepare_readme.py: id: e0c5957a6035 last_write_checksum: sha1:c2c83f71dea61eb50c9e05da83b16d18b4da8794 @@ -3942,12 +4006,12 @@ trackedFiles: pristine_git_object: 55f23c1feabfedeb7e8cd5bea8b910f0ae0b77d9 src/glean/api_client/_version.py: id: 0ce22b26136b - last_write_checksum: sha1:1bee0a78c745386143585f3a1bfeb8c1ee164211 - pristine_git_object: baf219c0556adcfb313b1d21660cf2f18d738bb4 + last_write_checksum: sha1:6c63f673880e68be2815c4272eb4f4360d15423c + pristine_git_object: 4af11e8ed077223e781737633b6fd821ee561c3d src/glean/api_client/agents.py: id: b925701a9217 - last_write_checksum: sha1:1520d795d519aba795c8edbce2f833c99b8a4fa5 - pristine_git_object: 68817cd017a63a1ce88ff1154a0f04a99c682be1 + last_write_checksum: sha1:2ca8eeef8eaa24bf38c80f755b9968c1b55a282b + pristine_git_object: d4ccd10c0949f7e2ce0886ca2a1921e280f53956 src/glean/api_client/announcements.py: id: 452f3d593912 last_write_checksum: sha1:4b9f4ff97fb9754b5da3a36c1cc8edb02318ed7a @@ -3962,8 +4026,8 @@ trackedFiles: pristine_git_object: bf7b1b3b25ce6530403b0dd9f60599d236c780ce src/glean/api_client/chat_sdk.py: id: f2f30e13ca42 - last_write_checksum: sha1:acdaeec3c4f12f543112a53120066de155f5cba9 - pristine_git_object: 9a48f24ace4767119e7dce70e87ad8c9f0344c94 + last_write_checksum: sha1:106d956665429a3966b36f0a7cf70c35a9b39356 + pristine_git_object: b37457a825c6f8f7dd5a1183acf376b0bb187718 src/glean/api_client/client.py: id: c0c188098f10 last_write_checksum: sha1:bfadba5dfdc64280fd9c7bdbf96a0651e5db429f @@ -4126,8 +4190,8 @@ trackedFiles: pristine_git_object: 77016bfff6209866592fd8b42f2f3527f900992b src/glean/api_client/models/__init__.py: id: d5f6ea5efcbe - last_write_checksum: sha1:e64af386979758264547b1d79da56e038b789f6b - pristine_git_object: f428e57aa5e5ce47e679e1090f6ff0946ac92493 + last_write_checksum: sha1:45d685edd657c30bf12a2ade2a257f8bc5708108 + pristine_git_object: 804db53b4389387bcdf8d18a5c3a2f587fa90404 src/glean/api_client/models/accessrequestpermissiondeniedresponse_error.py: id: 22a2fa0d5899 last_write_checksum: sha1:f7dd6f906a4dd7433992f77395f9fb491fa5ac5c @@ -5206,16 +5270,16 @@ trackedFiles: pristine_git_object: 44041cb376d89949c815ea1e7813505940605855 src/glean/api_client/models/feedentry.py: id: 023eb6c10ae1 - last_write_checksum: sha1:bad47b3f46b621a302ef187b25cdece3774a0bc8 - pristine_git_object: c0d16f3e7b7287b7d047552d70a797e696f86177 + last_write_checksum: sha1:803bdce57dc5815add1ac47744ecfb35ec26b3b8 + pristine_git_object: 83e2c6f0abadf1a67f849ff34c9ec825be039bd4 src/glean/api_client/models/feedop.py: id: b8067ac0a127 last_write_checksum: sha1:c58cb0a3a01925eb14d84176c5c6e9d8f4d84cf1 pristine_git_object: f39626285f84630e5a9233736d652914b759d44b src/glean/api_client/models/feedrequest.py: id: 33496b6a5bab - last_write_checksum: sha1:f13f3978c3edf1105b389e48f8116dc5488d61b5 - pristine_git_object: 363ac76d73ca89155bb071fbb83068ac478a0551 + last_write_checksum: sha1:5d2d1b1a5b9cca934cd4d1a91b24b1a78a5afe3a + pristine_git_object: 75cd4b1bd2b9eb2508887a6e83485136713adef4 src/glean/api_client/models/feedrequestoptions.py: id: b99003fbf522 last_write_checksum: sha1:d5ffee29242075cbe6d2dd5ec916b0c3d40acf54 @@ -5226,8 +5290,8 @@ trackedFiles: pristine_git_object: 683438c837601f483526ec18756fadc7222edb24 src/glean/api_client/models/feedresult.py: id: ae187332b37a - last_write_checksum: sha1:08ef5b972d1ad12881eaafe29413128836e39ae1 - pristine_git_object: a3f149b990f63df3d29c8e3b66c4330d6c6f6759 + last_write_checksum: sha1:d0e0236236965e4d5f2b3dd8776849e5e0bc36fc + pristine_git_object: f450760d9e50554270028662971d013df801cbd6 src/glean/api_client/models/followupaction.py: id: e2de5c4c8524 last_write_checksum: sha1:49e1a826449081fecfcd828c940604db949a8533 @@ -5840,6 +5904,10 @@ trackedFiles: id: f17d1b61b15b last_write_checksum: sha1:6792547db343d9d6f264962866cadb1ae3338d52 pristine_git_object: e99e8d10f23df59ac1a044369784acf521c747ab + src/glean/api_client/models/platform_agents_get_runop.py: + id: d0d53e3d4a09 + last_write_checksum: sha1:a9757d1e5e80c4610e7fc7591a4a816d6bb0a194 + pristine_git_object: 01a8e34febfc748e2c1a51455b3ad070d4736d8c src/glean/api_client/models/platform_agents_get_schemasop.py: id: 54795e674f69 last_write_checksum: sha1:2179f25a466baab76de315e6e736876ba97b60f1 @@ -5850,12 +5918,12 @@ trackedFiles: pristine_git_object: 880c65c1e74dd49543d650516f29141c6cdd486d src/glean/api_client/models/platform_chat_create_streamop.py: id: 6950e1c0b047 - last_write_checksum: sha1:9e15087313982499851cfb3ba3f63090f5711ba8 - pristine_git_object: 7e6268b7f8f3855c2f5b1a422db02f4d9e06fc4b + last_write_checksum: sha1:489939715defc6fa1f52fc4664326dd4f582aa97 + pristine_git_object: 10c83a83983658fceef0fe3066ef939145035157 src/glean/api_client/models/platform_chat_createop.py: id: 6f911817c878 - last_write_checksum: sha1:8190a133a530c4a765fd42025a364220e65dcff1 - pristine_git_object: 4069a99089cae96228982f98a9a45cd8e1e0c9de + last_write_checksum: sha1:4133f592f181982f11cc9199ce9a9b7af60dce6a + pristine_git_object: 1812a49682ddc269112ef551e55660b821b15612 src/glean/api_client/models/platform_search_filtersop.py: id: 3876ec8f6e5b last_write_checksum: sha1:0551a1836339a7b0f5dea4cf8946e001384d3146 @@ -5972,6 +6040,22 @@ trackedFiles: id: fc8dc50abaee last_write_checksum: sha1:a86106b88394793f38020e509ecb22a3a7c56c27 pristine_git_object: fe723996349ce9181f4b5bbf25eec3604a992b62 + src/glean/api_client/models/platformagentrunerror.py: + id: a415b46071c5 + last_write_checksum: sha1:2ff1839f6e55e7992ecc086c228466471a81a9d0 + pristine_git_object: bc6da9431de29c294d57a3ff1e02965c95eb1c2b + src/glean/api_client/models/platformagentrunresponse.py: + id: 2a470b92b531 + last_write_checksum: sha1:46b1415eb828502439abb0e2c081747dd17761a5 + pristine_git_object: 7c02b1cae6d89db4d0ee5236633be25c77425154 + src/glean/api_client/models/platformagentrunstate.py: + id: de5f902c89fb + last_write_checksum: sha1:6cb219241a6cf9614dfcbf910639fbf2ea577e6b + pristine_git_object: dc860898c5a2a5837168fb26654e5aaeb6feb50e + src/glean/api_client/models/platformagentruntoolapproval.py: + id: 914f1fbb5e0d + last_write_checksum: sha1:73b36d78d4eb9aa89234b08062226f2d68a4d5f1 + pristine_git_object: c51c46ed4490f4eb072cf3a30a8d704e58e51307 src/glean/api_client/models/platformagentrunwaitresponse.py: id: 3498df9c1961 last_write_checksum: sha1:3f8f7707d02ded94a0021b99c00e3df4223b772b @@ -6028,14 +6112,18 @@ trackedFiles: id: e32871fda394 last_write_checksum: sha1:1ddb82a8dcac6a1943b99fb2cdfb2c464e8eab07 pristine_git_object: 9d21d2a18e6de246b38312c05fafc8698635ac6a + src/glean/api_client/models/platformchatjsonschemaformat.py: + id: 322d59bf877b + last_write_checksum: sha1:d0425f69e2957aec73d75171a4f7a0d0971ae6df + pristine_git_object: c22174e07d47e011f182bbdbbac05355996b67e2 src/glean/api_client/models/platformchatoutputmessage.py: id: 15c8512d3810 last_write_checksum: sha1:1f0846a6e9bf7c2a1b9f5ea870cb0c4f6896c449 pristine_git_object: 9082277a0bb6b75d23c5fef7eead2aa13d8147cf src/glean/api_client/models/platformchatoutputtextcontent.py: id: 91b9987e8b98 - last_write_checksum: sha1:a24b36ff3c3d310f82183fd5d0c39a0182bef73a - pristine_git_object: d37425276eb8efbdd22c199f76b5448f8c9cb0b4 + last_write_checksum: sha1:901d84ef8719d7d7dbff8c7c0af9a6ee5eef538a + pristine_git_object: eb56d9a116b6a3ff747db32b2ffcd5cf57dd794a src/glean/api_client/models/platformchatpersonsource.py: id: 617b816c747b last_write_checksum: sha1:1068fde6d156f689d9f93b799dd8b5a2fa399315 @@ -6096,6 +6184,10 @@ trackedFiles: id: aa2699dde615 last_write_checksum: sha1:82061a27d94f683de9be3c439c45e5aa075cb2bf pristine_git_object: c4c16ab8bdbddd7554803c73557c31f474df4be8 + src/glean/api_client/models/platformchattextformat.py: + id: 4436e4437556 + last_write_checksum: sha1:ecc4be5d35513e1210ebe1b1e0bc3e05994392c0 + pristine_git_object: aa54c4dc3c2b0ee6258485830b0686c67dde1024 src/glean/api_client/models/platformcontentschedulewebhookevent.py: id: 9967e953a04e last_write_checksum: sha1:c4967523e69ff60285e770e785059a415498409f @@ -6112,6 +6204,10 @@ trackedFiles: id: 9fcc235e9237 last_write_checksum: sha1:b3b267d4ea3fcd6b46dc447e2e0dae3fda859ff7 pristine_git_object: a1eb453df5bc9f744651211e88c82dc25a7037d6 + src/glean/api_client/models/platformdurableagentrun.py: + id: 9183fd1b5740 + last_write_checksum: sha1:5e19454934cb4e186b75fb44aa081785eff50bf9 + pristine_git_object: 842b5cb8128b114784a2c11cc1cb319b47501099 src/glean/api_client/models/platformfilter.py: id: e0719ea40cc5 last_write_checksum: sha1:a56bda496c9eb473d9aaa08426e077e2694216d9 @@ -7210,8 +7306,8 @@ trackedFiles: pristine_git_object: 929558ef2e1165f7e09da6d0a64f016c90971655 tests/mockserver/internal/handler/generated_handlers.go: id: 61ac4f7cce9e - last_write_checksum: sha1:6b77f36c3b3dc12b960b49941ee55263a0a6c05f - pristine_git_object: 8e541a71eba67ec8fd003759038b2b1ec43d6ab9 + last_write_checksum: sha1:f2a3c37d033d6cab2eb3ac11ea7305fb2ef8c352 + pristine_git_object: 7e24dd75947f41771c18ce39c079aa6614e84b10 tests/mockserver/internal/handler/pathdeleterestapiindexcustommetadataschemagroupname.go: id: 979e4583765b last_write_checksum: sha1:b1d4edb259d907c7a88b634bf16f0cf152321693 @@ -7224,6 +7320,10 @@ trackedFiles: id: 118e0c46ba00 last_write_checksum: sha1:8ad0cc0ad413e34c3d950ee07ccd13ce861a261b pristine_git_object: 821cdaf9e7e105e44baf2fb6c2352df5c5bd20f7 + tests/mockserver/internal/handler/pathgetapiagentsagentidrunsrunid.go: + id: 475b833c9801 + last_write_checksum: sha1:2d7a9ed6338061ad7eb2f9e2e309024d30adbbeb + pristine_git_object: ef533289ca2dda616beb7d43c16b5f6bc93f070e tests/mockserver/internal/handler/pathgetapiagentsagentidschemas.go: id: a3a921765081 last_write_checksum: sha1:41dfbc3d70153e24cc2a898336d7d2a9c6e3d3df @@ -7642,8 +7742,8 @@ trackedFiles: pristine_git_object: abb763ddc8504b28c0cb6fdf8d25237d46e21bab tests/mockserver/internal/handler/pathpostrestapiv1getchat.go: id: a0ec7bafa599 - last_write_checksum: sha1:b48e2313407814ee4f8ed181b8e5299a84960c44 - pristine_git_object: 96d4127e0455272a9842e2d1954e5fcefa3278cc + last_write_checksum: sha1:2267292ba8173cf8df70ddbc6ac02ff3439cb879 + pristine_git_object: 8740195860b6c08e036caae19aab8e7374350960 tests/mockserver/internal/handler/pathpostrestapiv1getchatapplication.go: id: 7d101c69d4bc last_write_checksum: sha1:7b81898137fdb3a89b4dcfa318b9b5b92e8860c0 @@ -8750,12 +8850,12 @@ trackedFiles: pristine_git_object: 04cc3a93272ac70933b0485bee31b335e05ab623 tests/mockserver/internal/sdk/models/components/feedentry.go: id: d25fd66fcf7a - last_write_checksum: sha1:5c737e067de0426319bf913fed08aa7ce31df6ec - pristine_git_object: e84bac4d71b95d2ddc00e376a419422a7f2dd4f9 + last_write_checksum: sha1:f0a0c2321e2aff01b51b21b61df68d95f5ba979f + pristine_git_object: 44f5dfe7632e9ca462176445542fe70166921464 tests/mockserver/internal/sdk/models/components/feedrequest.go: id: b06bc4cef0cf - last_write_checksum: sha1:a33f5163423670d804e9ac093380cd39d2037d84 - pristine_git_object: ea9a683c0d79a52d131d08d5231e438cefde4030 + last_write_checksum: sha1:dba9418e46ca3f7d4fddec08c66623f9771d590d + pristine_git_object: 9489bdd527389d50e3826ebbeedc8de805528e57 tests/mockserver/internal/sdk/models/components/feedrequestoptions.go: id: fd9245fe1bf2 last_write_checksum: sha1:fa30b7fd6ee3e45896d7bbe36e33e7c0cb9000ba @@ -8766,8 +8866,8 @@ trackedFiles: pristine_git_object: 54f9d1a8997983156c84e69f888c59a80d06c2b1 tests/mockserver/internal/sdk/models/components/feedresult.go: id: 47411573e67a - last_write_checksum: sha1:c82f576ebad4b8367fbb6b41492ac30d3e6b202a - pristine_git_object: 6e4408b5a7fc07cebe91bd117fd1b1228878193e + last_write_checksum: sha1:ecef21a7754d70942718bf1dc156a8222c8fa36d + pristine_git_object: 4d9a33d3f245e67bb3d7ace1b5396672c73e236d tests/mockserver/internal/sdk/models/components/followupaction.go: id: 38179fec19b1 last_write_checksum: sha1:32a31f7af77a58ce6f3284e8550d01fcf0d3bddd @@ -9260,6 +9360,22 @@ trackedFiles: id: 77a686bb0b6e last_write_checksum: sha1:c2becf7b5aea9541b963fd98b364c2825c731f27 pristine_git_object: dfce10e1e21abb00331b48528dd419203790fe99 + tests/mockserver/internal/sdk/models/components/platformagentrunerror.go: + id: 5d83a49f0204 + last_write_checksum: sha1:82e4ff51195529c2d3c991c1ce522666a42e886f + pristine_git_object: da40549acc2e6a75110936f36326b5db2f50d04d + tests/mockserver/internal/sdk/models/components/platformagentrunresponse.go: + id: 365272d4200e + last_write_checksum: sha1:48919051b1f5dd3c2c73cf8bb1ae865c9de00558 + pristine_git_object: 829fc7280a96ddea7f7197e79b73c58a046c2aaa + tests/mockserver/internal/sdk/models/components/platformagentrunstate.go: + id: 71c3a486e299 + last_write_checksum: sha1:ceec60790319ece420bc6698c00e746b452b7c7d + pristine_git_object: 76009fe707d99c7bb7c011a6fcf823b3a327ed7a + tests/mockserver/internal/sdk/models/components/platformagentruntoolapproval.go: + id: 616c170e0960 + last_write_checksum: sha1:adf20c65ada399a54ae182e59c60d335eb93b446 + pristine_git_object: 9037db212f8e4e29c57870811de7dba0ec0f559d tests/mockserver/internal/sdk/models/components/platformagentrunwaitresponse.go: id: 368b82c238d0 last_write_checksum: sha1:77ffebf146f2f6f671f10a8ad893f672ee8c67a5 @@ -9316,14 +9432,18 @@ trackedFiles: id: 56818bc51e4c last_write_checksum: sha1:42af3af208da28f93f0f2201e3daa8b46a7e1dba pristine_git_object: 97c1e067fb5ecb6b2f97606419d967243488f520 + tests/mockserver/internal/sdk/models/components/platformchatjsonschemaformat.go: + id: cc1306c208a9 + last_write_checksum: sha1:527ce820f2fb0f577db45b4e8606a75e30972a35 + pristine_git_object: c4d9b0045f3e0a8916c241e2eb5c74ad087d369e tests/mockserver/internal/sdk/models/components/platformchatoutputmessage.go: id: 7ca1fc5cc683 last_write_checksum: sha1:bf719da0350fbfafdb9b2459c45ec90fdeff26be pristine_git_object: e8c6012073e865db79260a12e8b831b0bdc61be0 tests/mockserver/internal/sdk/models/components/platformchatoutputtextcontent.go: id: b5d5f31f9886 - last_write_checksum: sha1:54300f2566d258c2125b840e17a7697051c02dfa - pristine_git_object: f3be4768043133e7909aca58d1c7f863c74bcecf + last_write_checksum: sha1:fea1f3e8d5792e1a177da5c0daa1d9a345327a4a + pristine_git_object: 098822c3050a5e4b1f4491cfd5a79b4abc982653 tests/mockserver/internal/sdk/models/components/platformchatpersonsource.go: id: b44852860bd9 last_write_checksum: sha1:ae83c0e9521f08d5818d9aa5cff33ca7233239a7 @@ -9384,6 +9504,10 @@ trackedFiles: id: cb4b807c5c50 last_write_checksum: sha1:6cc1fb47210182778dd6dd3a302a118d8c23b73a pristine_git_object: 8aeae90099849c9ecb918ad377780b2d6e8a7b0c + tests/mockserver/internal/sdk/models/components/platformchattextformat.go: + id: 14602a472dd8 + last_write_checksum: sha1:826eb39a034b76967e29dfe3f70f4bec9e0e8135 + pristine_git_object: 2549e7933847138506f468b7a25b926e41956ed5 tests/mockserver/internal/sdk/models/components/platformcontentschedulewebhookevent.go: id: aa997737c72e last_write_checksum: sha1:cf082854fbef3c2fb99b4415f333e65a3e97950a @@ -9400,6 +9524,10 @@ trackedFiles: id: 14cae8b8b46f last_write_checksum: sha1:eeef00ef9e08df054c9f0b37881495b3ddc400c6 pristine_git_object: 790da9be746c8ffb31da4ddd45e70435cae25c20 + tests/mockserver/internal/sdk/models/components/platformdurableagentrun.go: + id: c5a46edb6f15 + last_write_checksum: sha1:458ce005910afe9a31b5d4768d399c7c308ec921 + pristine_git_object: 0e838da68a2022cc3289e7a047b06fd366a35ba4 tests/mockserver/internal/sdk/models/components/platformfilter.go: id: 1762bf95c464 last_write_checksum: sha1:9a4357e8b4ccf75dd97072960321efb36dcf13a1 @@ -10556,6 +10684,10 @@ trackedFiles: id: e74910e78a17 last_write_checksum: sha1:56851bbd3fbefcf411fff643accc8124be24b7d2 pristine_git_object: 9b2282ad03704136d35901a9d908e7f554310534 + tests/mockserver/internal/sdk/models/operations/platformagentsgetrun.go: + id: f9201af53484 + last_write_checksum: sha1:5d7ed6d664f5469277666e731cc3597b6c87b637 + pristine_git_object: 51427bc45d662a72c28cb7173da4520958b4b610 tests/mockserver/internal/sdk/models/operations/platformagentsgetschemas.go: id: bf409518e189 last_write_checksum: sha1:767ce5c40fc319d756445283490a4a043213ef84 @@ -10566,12 +10698,12 @@ trackedFiles: pristine_git_object: cdbc9f550e7d2339b0946fe4783a3b79a851f39d tests/mockserver/internal/sdk/models/operations/platformchatcreate.go: id: 38da4ead08a1 - last_write_checksum: sha1:19b0801c6aea2f64707c910040ce0abe0abf0007 - pristine_git_object: c9dbd053cf81d79d52e8f61733224a1b98bbf3c1 + last_write_checksum: sha1:132487da1ca61b58f81bd20d939ffedd7109bb3f + pristine_git_object: 58f6721f458a1908990afc4e4fd18729ac8cfbd4 tests/mockserver/internal/sdk/models/operations/platformchatcreatestream.go: id: 32e8d932ca7e - last_write_checksum: sha1:828c8e37232571f5737fed9c01bcbde3dc856068 - pristine_git_object: d94a54b7ed3d227a61ab2b41f443a8aca9adf755 + last_write_checksum: sha1:1a6315bfac761b2d944e618ecfd6f1cb188b5184 + pristine_git_object: 72e44e52569b6b6fb2337c2652105791315952bf tests/mockserver/internal/sdk/models/operations/platformsearch.go: id: d990791ac101 last_write_checksum: sha1:9da9b49850375b74bf6296fcec336ba9ad1e1eea @@ -11022,8 +11154,8 @@ trackedFiles: pristine_git_object: db4221c9f5953adc8f8219979060f1248ae5c342 tests/test_agents.py: id: 2eb70a860f3a - last_write_checksum: sha1:78899739204e9e80aae4337c6396a57ab816a4e0 - pristine_git_object: 39a3f77bf4a5c99d3def7a0bb99493a9ef83e95c + last_write_checksum: sha1:d0ce2d7a77dda4023a5b1f6f04b0c889fafdd94b + pristine_git_object: e0b97e2a1a4da3112c48d6d420c47d70e8c425c4 tests/test_announcements.py: id: 720cc07fca06 last_write_checksum: sha1:1d0dcab6446633bc6809bc67e14b6cc1755aa319 @@ -11038,8 +11170,8 @@ trackedFiles: pristine_git_object: d2b02f269ac418b9a9240772f28ab1bd3cfa4997 tests/test_chat_sdk.py: id: d6e6d5c5a1b2 - last_write_checksum: sha1:55b3a1b8bff0873ec0804da755fda550158e7d03 - pristine_git_object: 80a927281e7f1800c50cdf1eaaad0c72f057523c + last_write_checksum: sha1:69a50e3e45fd00c1ad528a68939e264bff809fc1 + pristine_git_object: cfc1294c86dd149b7825f7dffd95f0f19052f079 tests/test_client.py: id: 6b61d4b06ccc last_write_checksum: sha1:df970d19cdb9f9e057722699dc73965b6f9b1758 @@ -11126,8 +11258,8 @@ trackedFiles: pristine_git_object: 6cc8aeec3c52329d389081db0a27f10f53f214b9 tests/test_messages.py: id: be23089b1f8b - last_write_checksum: sha1:2404e23964ef6a1f5ddc900402b34e597d2d9617 - pristine_git_object: 132005ec7d1e35f805b6a8c28e07e043bce22f0a + last_write_checksum: sha1:bef200db8e7fff0aa33ef17846f5054a2d035a88 + pristine_git_object: 36643db35a2d2a3cf9d327379ee7a6cb30da51d0 tests/test_people.py: id: 37c243940039 last_write_checksum: sha1:2b78b1c5ea17f267895188b1b48ff9fe2bc19f17 @@ -11154,8 +11286,8 @@ trackedFiles: pristine_git_object: 63587d5a9e7b7e506ce9daf00d51ce92afb56035 tests/test_summarize.py: id: a255d8a6f627 - last_write_checksum: sha1:a327189497f3a2b98c2e277757da4e4ba22cf768 - pristine_git_object: 072b3207b89ff92c8a22b828c32ce23e2ae0ba88 + last_write_checksum: sha1:884caf9e9ba6ac6d6577682c45419d3fd6312dd9 + pristine_git_object: df71d57de672c7e6967ba36b3671d957ef075d55 tests/test_tools.py: id: 70889bdf7321 last_write_checksum: sha1:e9e37efd6a65d805c02d70d548df9c87dd062b0e @@ -12310,7 +12442,7 @@ examples: platform-chat-create: speakeasy-default-platform-chat-create: requestBody: - application/json: {"input": "What is our parental leave policy?", "stream": false, "store": true} + application/json: {"input": "Summarize our parental leave policy as JSON.", "stream": false, "store": true, "text": {"format": {"type": "JSON_SCHEMA", "name": "policy_summary", "schema": {"type": "object", "properties": {"eligible_employees": {"type": "string"}, "duration_weeks": {"type": "integer"}}, "required": ["eligible_employees", "duration_weeks"]}, "strict": true}}} responses: "200": application/json: {"id": "", "object": "RESPONSE", "created_at": "2026-05-19T05:32:52.505Z", "status": "COMPLETED", "output": [{"type": "MESSAGE", "role": "ASSISTANT", "content": [{"type": "OUTPUT_TEXT", "text": ""}]}], "store": false, "request_id": ""} @@ -12537,12 +12669,25 @@ examples: platform-chat-create-stream: speakeasy-default-platform-chat-create-stream: requestBody: - application/json: {"input": "What is our parental leave policy?", "stream": true, "store": true} + application/json: {"input": "Summarize our parental leave policy as JSON.", "stream": true, "store": true, "text": {"format": {"type": "JSON_SCHEMA", "name": "policy_summary", "schema": {"type": "object", "properties": {"eligible_employees": {"type": "string"}, "duration_weeks": {"type": "integer"}}, "required": ["eligible_employees", "duration_weeks"]}, "strict": true}}} responses: "400": application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} "500": application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} + platform-agents-get-run: + speakeasy-default-platform-agents-get-run: + parameters: + path: + agent_id: "{agent_id}" + run_id: "{run_id}" + responses: + "200": + application/json: {"run": {"run_id": "", "agent_id": "", "state": "CANCELLING", "created_at": "2025-02-20T06:37:06.101Z", "updated_at": "2025-06-13T07:24:18.599Z", "pending_interactions": []}, "request_id": ""} + "400": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} + "500": + application/problem+json: {"type": "https://developers.glean.com/errors/invalid-cursor", "title": "Invalid Pagination Cursor", "status": 400, "detail": "The provided cursor has expired. Start a new search to get a fresh cursor.\n", "code": "invalid_cursor", "documentation_url": "https://developers.glean.com/errors/invalid-cursor", "request_id": "req_7f8a9b0c1d2e", "errors": [{"pointer": "/messages/0/role", "detail": "Must be one of: USER, GLEAN_AI.", "code": "invalid_cursor"}]} examplesVersion: 1.0.2 generatedTests: activity: "2025-04-28T22:05:12+01:00" @@ -12743,7 +12888,8 @@ generatedTests: platform-trigger-presets-get: "2026-08-21T02:33:03Z" platform-trigger-presets-input-values-list: "2026-08-21T02:33:03Z" platform-trigger-presets-events-search: "2026-08-21T02:33:03Z" -releaseNotes: "## Python SDK Changes:\n* `glean.agents.create_run()`: `response.run.messages[].content[].annotations` **Added**\n* `glean.client.agents.import()`: `request` **Changed**\n* `glean.client.agents.run()`: `response.run.messages[].content[].annotations` **Added**\n* `glean.client.search.retrieve_feed()`: \n * `request.categories[]` **Changed**\n * `response.results[]` **Changed**\n" + platform-agents-get-run: "2026-09-22T03:56:59Z" +releaseNotes: "## Python SDK Changes:\n* `glean.agents.get_run()`: **Added**\n* `glean.chat.create()`: \n * `request.text` **Added**\n * `response.output[].content[].structured_output` **Added**\n* `glean.client.search.retrieve_feed()`: \n * `request.categories[]` **Changed**\n * `response.results[]` **Changed**\n" generatedFiles: - .devcontainer/README.md - .devcontainer/devcontainer.json diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index e449cccd..7b5f20a3 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -34,7 +34,7 @@ generation: generateNewTests: true skipResponseBodyAssertions: true python: - version: 0.17.14 + version: 0.17.15 additionalDependencies: dev: {} main: {} diff --git a/.speakeasy/glean-merged-spec.yaml b/.speakeasy/glean-merged-spec.yaml index 7ee55ac5..7429a383 100644 --- a/.speakeasy/glean-merged-spec.yaml +++ b/.speakeasy/glean-merged-spec.yaml @@ -2,8 +2,8 @@ openapi: 3.1.0 info: version: "0.9.0" title: Glean API - x-source-commit-sha: 5f1d873383438dc574c1075f9476915610e56875 - x-open-api-commit-sha: 6a8c8e16bbbca13a130766a72f307fb373b8256a + x-source-commit-sha: 717c039c2fd74cbe81fc6a9c0b1e690e4e1f55af + x-open-api-commit-sha: 33b9c3f1c98d9d8365a25ef3a884dff3007cd759 description: | # Introduction In addition to the data sources that Glean has built-in support for, Glean also provides a REST API that enables customers to put arbitrary content in the search index. This is useful, for example, for doing permissions-aware search over content in internal tools that reside on-prem as well as for searching over applications that Glean does not currently support first class. In addition these APIs allow the customer to push organization data (people info, organization structure etc) into Glean. @@ -214,7 +214,6 @@ paths: id: 1 event: message data: {"messages":[{"role":"GLEAN_AI","content":[{"text":"Hello","type":"text"}]}]} - id: 2 event: message data: {"messages":[{"role":"GLEAN_AI","content":[{"text":", I can help with HR policy questions.","type":"text"}]}]} @@ -252,6 +251,61 @@ paths: x-speakeasy-name-override: createRun security: - APIToken: [] + /api/agents/{agent_id}/runs/{run_id}: + get: + tags: + - Agents + summary: Get agent run + description: | + Retrieve a persisted workflow execution owned by the authenticated user. The run must belong to the specified agent, and the user must still have access to that agent. Unknown runs, runs owned by another user, and mismatched agent/run identifiers return 404. Requires the agents.run scope. Executions without a persisted workflow record are not available through this endpoint. + operationId: platform-agents-get-run + x-visibility: Public + parameters: + - in: path + name: agent_id + description: ID of the agent that owns the run. + required: true + example: "{agent_id}" + schema: + type: string + minLength: 1 + maxLength: 256 + - in: path + name: run_id + description: ID of the durable run to retrieve. + required: true + example: "{run_id}" + schema: + type: string + minLength: 1 + maxLength: 256 + responses: + "200": + description: Current persisted run snapshot. A failed execution is still a successful retrieval. + content: + application/json: + schema: + $ref: "#/components/schemas/PlatformAgentRunResponse" + "400": + $ref: "#/components/responses/PlatformBadRequest" + "401": + $ref: "#/components/responses/PlatformUnauthorized" + "403": + $ref: "#/components/responses/PlatformForbidden" + "404": + $ref: "#/components/responses/PlatformNotFound" + "408": + $ref: "#/components/responses/PlatformRequestTimeout" + "429": + $ref: "#/components/responses/PlatformTooManyRequests" + "500": + $ref: "#/components/responses/PlatformInternalServerError" + "503": + $ref: "#/components/responses/PlatformServiceUnavailable" + x-speakeasy-group: agents + x-speakeasy-name-override: getRun + security: + - APIToken: [] /api/chat: post: tags: @@ -7429,6 +7483,124 @@ components: description: One entry per tool the caller must authorize. items: $ref: "#/components/schemas/PlatformAuthenticationSuggestion" + PlatformAgentRunState: + type: string + enum: + - QUEUED + - RUNNING + - REQUIRES_INPUT + - SUCCEEDED + - FAILED + - CANCELLING + - CANCELLED + - EXPIRED + description: State of the persisted workflow execution. REQUIRES_INPUT is nonterminal. + PlatformAgentRunToolApproval: + type: object + description: Pending approval for a specific persisted tool invocation and its arguments. + required: + - interaction_id + - type + - display_name + - description + - arguments + properties: + interaction_id: + type: string + description: Identifies this specific invocation approval, not the tool definition. + type: + type: string + enum: + - TOOL_APPROVAL + description: Interaction type identifying a tool execution approval request. + tool_id: + type: string + description: Platform tool identifier when recorded. Omitted for requests without one, such as some MCP tools. + display_name: + type: string + description: Display name of the tool requesting approval. + description: + type: string + description: Description of the tool associated with this approval request. + arguments: + type: object + additionalProperties: true + description: Arguments from the persisted approval request. Older platform tools use flattened parameters. + expires_at: + type: string + format: date-time + description: Approval deadline, when one is set. Omitted when the approval has no expiration. + PlatformAgentRunError: + type: object + description: Caller-safe details of an agent run execution failure. + required: + - code + - message + properties: + code: + type: string + description: Machine-readable execution failure code. + message: + type: string + description: Caller-safe execution failure description. + PlatformDurableAgentRun: + type: object + description: Agent run state, pending tool approvals, and output available independently of the creation request. + required: + - run_id + - agent_id + - state + - created_at + - updated_at + - pending_interactions + properties: + run_id: + type: string + description: ID of the run, preserved across approval continuations. + agent_id: + type: string + description: ID of the agent that owns the run. + state: + $ref: "#/components/schemas/PlatformAgentRunState" + description: Current lifecycle state of the run. + created_at: + type: string + format: date-time + description: Timestamp when the run was first persisted. + updated_at: + type: string + format: date-time + description: | + Latest persisted activity timestamp across the execution and its messages, including checkpoint messages. This is not a worker heartbeat or an exact state-transition timestamp. + expires_at: + type: string + format: date-time + description: Execution deadline, when one is set. Not the run history retention deadline. + pending_interactions: + type: array + description: Unanswered tool approvals when the run is in REQUIRES_INPUT. Empty in other states. + items: + $ref: "#/components/schemas/PlatformAgentRunToolApproval" + output: + type: object + additionalProperties: true + description: Accumulated text-only agent output under the messages key, when available. + error: + $ref: "#/components/schemas/PlatformAgentRunError" + description: Caller-safe failure details when the run is in FAILED. + PlatformAgentRunResponse: + type: object + description: Persisted agent run snapshot with a request ID for support correlation. + required: + - run + - request_id + properties: + run: + $ref: "#/components/schemas/PlatformDurableAgentRun" + description: Current persisted snapshot of the requested agent run. + request_id: + type: string + description: Platform-generated request ID for support correlation. PlatformChatInputMessage: type: object additionalProperties: false @@ -7444,13 +7616,72 @@ components: content: type: string minLength: 1 + PlatformChatTextFormat: + type: object + additionalProperties: false + description: Unconstrained plain-text assistant output. + required: + - type + properties: + type: + type: string + description: Discriminator. Must be TEXT. + enum: + - TEXT + PlatformChatJsonSchemaFormat: + type: object + additionalProperties: false + description: Constrains the assistant response to a caller-supplied JSON Schema. + required: + - type + - name + - schema + properties: + type: + type: string + description: Discriminator. Must be JSON_SCHEMA. + enum: + - JSON_SCHEMA + name: + type: string + minLength: 1 + maxLength: 64 + description: A stable identifier for the schema. + description: + type: string + maxLength: 1024 + description: An optional human-readable description of the schema. + schema: + type: object + additionalProperties: true + description: A JSON Schema object describing the desired output shape. + strict: + type: boolean + default: true + description: | + When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true. PlatformChatCreateRequest: type: object additionalProperties: false required: - input example: - input: What is our parental leave policy? + input: Summarize our parental leave policy as JSON. + text: + format: + type: JSON_SCHEMA + name: policy_summary + schema: + type: object + properties: + eligible_employees: + type: string + duration_weeks: + type: integer + required: + - eligible_employees + - duration_weeks + strict: true properties: input: description: | @@ -7477,6 +7708,18 @@ components: minLength: 1 description: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. + text: + type: object + additionalProperties: false + description: | + Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + properties: + format: + description: | + Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + oneOf: + - $ref: "#/components/schemas/PlatformChatTextFormat" + - $ref: "#/components/schemas/PlatformChatJsonSchemaFormat" PlatformChatStreamResponseId: type: string minLength: 1 @@ -7496,6 +7739,12 @@ components: - OUTPUT_TEXT text: type: string + structured_output: + type: + - object + - "null" + description: | + Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. annotations: type: array items: @@ -16128,6 +16377,8 @@ components: - EDIT_DOC - CHAT_TO_ARTIFACT - SHARE_ARTIFACT + - CREATE_AGENT + - MANAGER_INVITE description: Categories of content requested. An allowlist gives flexibility to request content separately or together. requestOptions: $ref: '#/components/schemas/FeedRequestOptions' @@ -16603,6 +16854,8 @@ components: - EDIT_DOC - CHAT_TO_ARTIFACT - SHARE_ARTIFACT + - CREATE_AGENT + - MANAGER_INVITE description: Type of the justification. justification: type: string @@ -16701,6 +16954,8 @@ components: - EDIT_DOC - CHAT_TO_ARTIFACT - SHARE_ARTIFACT + - CREATE_AGENT + - MANAGER_INVITE description: Category of the result, one of the requested categories in incoming request. primaryEntry: $ref: '#/components/schemas/FeedEntry' diff --git a/.speakeasy/tests.arazzo.yaml b/.speakeasy/tests.arazzo.yaml index a0c16dd3..89e61923 100644 --- a/.speakeasy/tests.arazzo.yaml +++ b/.speakeasy/tests.arazzo.yaml @@ -159049,9 +159049,24 @@ workflows: requestBody: contentType: application/json payload: - input: What is our parental leave policy? + input: Summarize our parental leave policy as JSON. store: true stream: false + text: + format: + name: policy_summary + schema: + properties: + duration_weeks: + type: integer + eligible_employees: + type: string + required: + - eligible_employees + - duration_weeks + type: object + strict: true + type: JSON_SCHEMA successCriteria: - condition: $statusCode == 200 - condition: $response.header.Content-Type == application/json @@ -159458,3 +159473,23 @@ workflows: type: simple x-speakeasy-test-group: triggers x-speakeasy-test-rebuild: true + - workflowId: platform-agents-get-run + steps: + - stepId: test + operationId: platform-agents-get-run + parameters: + - name: agent_id + in: path + value: '{agent_id}' + - name: run_id + in: path + value: '{run_id}' + successCriteria: + - condition: $statusCode == 200 + - condition: $response.header.Content-Type == application/json + - context: $response.body + condition: | + {"run":{"run_id":"","agent_id":"","state":"CANCELLING","created_at":"2025-02-20T06:37:06.101Z","updated_at":"2025-06-13T07:24:18.599Z","pending_interactions":[]},"request_id":""} + type: simple + x-speakeasy-test-group: agents + x-speakeasy-test-rebuild: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b09477b0..52457372 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.797.0 +speakeasyVersion: 1.798.0 sources: Glean API: sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:1f470e422d6b202bf6bb80cc2e4b73077b7dab6d476cda804245fc0402ea42f1 - sourceBlobDigest: sha256:8919e7ffe50c1ca78844cd89c216e8ab3c54a8e0003bd5072e7fe3cd35fb192c + sourceRevisionDigest: sha256:2dd7ca4544e59f28584d5400b85ef3f15f60f15db9cc38d801e60f502374ee3f + sourceBlobDigest: sha256:04f931c80f06d00cedb6557775b1239fa53dd8cacab635db739da30a3cdaf36b tags: - latest Glean Client API: @@ -16,10 +16,10 @@ targets: glean: source: Glean API sourceNamespace: glean-api-specs - sourceRevisionDigest: sha256:1f470e422d6b202bf6bb80cc2e4b73077b7dab6d476cda804245fc0402ea42f1 - sourceBlobDigest: sha256:8919e7ffe50c1ca78844cd89c216e8ab3c54a8e0003bd5072e7fe3cd35fb192c + sourceRevisionDigest: sha256:2dd7ca4544e59f28584d5400b85ef3f15f60f15db9cc38d801e60f502374ee3f + sourceBlobDigest: sha256:04f931c80f06d00cedb6557775b1239fa53dd8cacab635db739da30a3cdaf36b codeSamplesNamespace: glean-api-specs-python-code-samples - codeSamplesRevisionDigest: sha256:07e63ad12522c0ccf6dc9dab0943696972a489679ebc077bb6bfd23d25a123b8 + codeSamplesRevisionDigest: sha256:6f688bd767126c63a2119e3ce164ac4f91896383c5dbe1b99345a89be806df7c workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 1322a150..23fe9dca 100644 --- a/README.md +++ b/README.md @@ -321,6 +321,7 @@ For more information on obtaining the appropriate token type, please contact you * [get](docs/sdks/agents/README.md#get) - Get agent * [get_schemas](docs/sdks/agents/README.md#get_schemas) - Get agent schemas * [create_run](docs/sdks/agents/README.md#create_run) - Create agent run +* [get_run](docs/sdks/agents/README.md#get_run) - Get agent run ### [Chat](docs/sdks/chatsdk/README.md) @@ -605,7 +606,7 @@ The stream is also a [Context Manager][context-manager] and can be used with the underlying connection when the context is exited. ```python -from glean.api_client import Glean +from glean.api_client import Glean, models import os @@ -613,7 +614,28 @@ with Glean( api_token=os.getenv("GLEAN_API_TOKEN", ""), ) as glean: - res = glean.chat.create_stream(input="What is our parental leave policy?", store=True) + res = glean.chat.create_stream(input="Summarize our parental leave policy as JSON.", store=True, text={ + "format_": { + "type": models.PlatformChatJSONSchemaFormatType.JSON_SCHEMA, + "name": "policy_summary", + "schema_": { + "type": "object", + "properties": { + "eligible_employees": { + "type": "string", + }, + "duration_weeks": { + "type": "integer", + }, + }, + "required": [ + "eligible_employees", + "duration_weeks", + ], + }, + "strict": True, + }, + }) with res as event_stream: for event in event_stream: diff --git a/RELEASES.md b/RELEASES.md index 5d10ffd7..9b8f56d1 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -998,4 +998,14 @@ Based on: ### Generated - [python v0.17.14] . ### Releases -- [PyPI v0.17.14] https://pypi.org/project/glean-api-client/0.17.14 - . \ No newline at end of file +- [PyPI v0.17.14] https://pypi.org/project/glean-api-client/0.17.14 - . + +## 2026-09-22 03:56:01 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.798.0 (2.938.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [python v0.17.15] . +### Releases +- [PyPI v0.17.15] https://pypi.org/project/glean-api-client/0.17.15 - . \ No newline at end of file diff --git a/docs/models/feedrequestcategory.md b/docs/models/feedrequestcategory.md index 65906709..662a836b 100644 --- a/docs/models/feedrequestcategory.md +++ b/docs/models/feedrequestcategory.md @@ -64,4 +64,6 @@ value = FeedRequestCategory.DOCUMENT_SUGGESTION | `ARTIFACT_CREATION` | ARTIFACT_CREATION | | `EDIT_DOC` | EDIT_DOC | | `CHAT_TO_ARTIFACT` | CHAT_TO_ARTIFACT | -| `SHARE_ARTIFACT` | SHARE_ARTIFACT | \ No newline at end of file +| `SHARE_ARTIFACT` | SHARE_ARTIFACT | +| `CREATE_AGENT` | CREATE_AGENT | +| `MANAGER_INVITE` | MANAGER_INVITE | \ No newline at end of file diff --git a/docs/models/feedresultcategory.md b/docs/models/feedresultcategory.md index 86b5a71f..b1ed34c8 100644 --- a/docs/models/feedresultcategory.md +++ b/docs/models/feedresultcategory.md @@ -68,4 +68,6 @@ value = FeedResultCategory.DOCUMENT_SUGGESTION | `ARTIFACT_CREATION` | ARTIFACT_CREATION | | `EDIT_DOC` | EDIT_DOC | | `CHAT_TO_ARTIFACT` | CHAT_TO_ARTIFACT | -| `SHARE_ARTIFACT` | SHARE_ARTIFACT | \ No newline at end of file +| `SHARE_ARTIFACT` | SHARE_ARTIFACT | +| `CREATE_AGENT` | CREATE_AGENT | +| `MANAGER_INVITE` | MANAGER_INVITE | \ No newline at end of file diff --git a/docs/models/justificationtype.md b/docs/models/justificationtype.md index 71c24af0..7764769f 100644 --- a/docs/models/justificationtype.md +++ b/docs/models/justificationtype.md @@ -82,4 +82,6 @@ value = JustificationType.FREQUENTLY_ACCESSED | `ARTIFACT_CREATION` | ARTIFACT_CREATION | | `EDIT_DOC` | EDIT_DOC | | `CHAT_TO_ARTIFACT` | CHAT_TO_ARTIFACT | -| `SHARE_ARTIFACT` | SHARE_ARTIFACT | \ No newline at end of file +| `SHARE_ARTIFACT` | SHARE_ARTIFACT | +| `CREATE_AGENT` | CREATE_AGENT | +| `MANAGER_INVITE` | MANAGER_INVITE | \ No newline at end of file diff --git a/docs/models/platformagentrunerror.md b/docs/models/platformagentrunerror.md new file mode 100644 index 00000000..9ef838b7 --- /dev/null +++ b/docs/models/platformagentrunerror.md @@ -0,0 +1,11 @@ +# PlatformAgentRunError + +Caller-safe details of an agent run execution failure. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| `code` | *str* | :heavy_check_mark: | Machine-readable execution failure code. | +| `message` | *str* | :heavy_check_mark: | Caller-safe execution failure description. | \ No newline at end of file diff --git a/docs/models/platformagentrunresponse.md b/docs/models/platformagentrunresponse.md new file mode 100644 index 00000000..29594895 --- /dev/null +++ b/docs/models/platformagentrunresponse.md @@ -0,0 +1,11 @@ +# PlatformAgentRunResponse + +Persisted agent run snapshot with a request ID for support correlation. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `run` | [models.PlatformDurableAgentRun](../models/platformdurableagentrun.md) | :heavy_check_mark: | Agent run state, pending tool approvals, and output available independently of the creation request. | +| `request_id` | *str* | :heavy_check_mark: | Platform-generated request ID for support correlation. | \ No newline at end of file diff --git a/docs/models/platformagentrunstate.md b/docs/models/platformagentrunstate.md new file mode 100644 index 00000000..4880387a --- /dev/null +++ b/docs/models/platformagentrunstate.md @@ -0,0 +1,27 @@ +# PlatformAgentRunState + +State of the persisted workflow execution. REQUIRES_INPUT is nonterminal. + +## Example Usage + +```python +from glean.api_client.models import PlatformAgentRunState + +value = PlatformAgentRunState.QUEUED + +# Open enum: unrecognized values are captured as UnrecognizedStr +``` + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `QUEUED` | QUEUED | +| `RUNNING` | RUNNING | +| `REQUIRES_INPUT` | REQUIRES_INPUT | +| `SUCCEEDED` | SUCCEEDED | +| `FAILED` | FAILED | +| `CANCELLING` | CANCELLING | +| `CANCELLED` | CANCELLED | +| `EXPIRED` | EXPIRED | \ No newline at end of file diff --git a/docs/models/platformagentruntoolapproval.md b/docs/models/platformagentruntoolapproval.md new file mode 100644 index 00000000..441521ee --- /dev/null +++ b/docs/models/platformagentruntoolapproval.md @@ -0,0 +1,16 @@ +# PlatformAgentRunToolApproval + +Pending approval for a specific persisted tool invocation and its arguments. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `interaction_id` | *str* | :heavy_check_mark: | Identifies this specific invocation approval, not the tool definition. | +| `type` | [models.PlatformAgentRunToolApprovalType](../models/platformagentruntoolapprovaltype.md) | :heavy_check_mark: | Interaction type identifying a tool execution approval request. | +| `tool_id` | *Optional[str]* | :heavy_minus_sign: | Platform tool identifier when recorded. Omitted for requests without one, such as some MCP tools. | +| `display_name` | *str* | :heavy_check_mark: | Display name of the tool requesting approval. | +| `description` | *str* | :heavy_check_mark: | Description of the tool associated with this approval request. | +| `arguments` | Dict[str, *Any*] | :heavy_check_mark: | Arguments from the persisted approval request. Older platform tools use flattened parameters. | +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Approval deadline, when one is set. Omitted when the approval has no expiration. | \ No newline at end of file diff --git a/docs/models/platformagentruntoolapprovaltype.md b/docs/models/platformagentruntoolapprovaltype.md new file mode 100644 index 00000000..7ffe0f37 --- /dev/null +++ b/docs/models/platformagentruntoolapprovaltype.md @@ -0,0 +1,18 @@ +# PlatformAgentRunToolApprovalType + +Interaction type identifying a tool execution approval request. + +## Example Usage + +```python +from glean.api_client.models import PlatformAgentRunToolApprovalType + +value = PlatformAgentRunToolApprovalType.TOOL_APPROVAL +``` + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `TOOL_APPROVAL` | TOOL_APPROVAL | \ No newline at end of file diff --git a/docs/models/platformagentsgetrunrequest.md b/docs/models/platformagentsgetrunrequest.md new file mode 100644 index 00000000..9c849b53 --- /dev/null +++ b/docs/models/platformagentsgetrunrequest.md @@ -0,0 +1,9 @@ +# PlatformAgentsGetRunRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | ---------------------------------- | +| `agent_id` | *str* | :heavy_check_mark: | ID of the agent that owns the run. | {agent_id} | +| `run_id` | *str* | :heavy_check_mark: | ID of the durable run to retrieve. | {run_id} | \ No newline at end of file diff --git a/docs/models/platformchatcreateformat.md b/docs/models/platformchatcreateformat.md new file mode 100644 index 00000000..25911073 --- /dev/null +++ b/docs/models/platformchatcreateformat.md @@ -0,0 +1,20 @@ +# PlatformChatCreateFormat + +Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + + +## Supported Types + +### `models.PlatformChatTextFormat` + +```python +value: models.PlatformChatTextFormat = /* values here */ +``` + +### `models.PlatformChatJSONSchemaFormat` + +```python +value: models.PlatformChatJSONSchemaFormat = /* values here */ +``` + diff --git a/docs/models/platformchatcreaterequest.md b/docs/models/platformchatcreaterequest.md index 82808d05..a100754d 100644 --- a/docs/models/platformchatcreaterequest.md +++ b/docs/models/platformchatcreaterequest.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `input` | [models.PlatformChatCreateInput](../models/platformchatcreateinput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| -| `stream` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | -| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| -| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [models.PlatformChatCreateInput](../models/platformchatcreateinput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| +| `stream` | *Optional[Literal[False]]* | :heavy_minus_sign: | N/A | +| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| +| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| +| `text` | [Optional[models.PlatformChatCreateText]](../models/platformchatcreatetext.md) | :heavy_minus_sign: | Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.
| \ No newline at end of file diff --git a/docs/models/platformchatcreatestreamformat.md b/docs/models/platformchatcreatestreamformat.md new file mode 100644 index 00000000..cc3cd2a2 --- /dev/null +++ b/docs/models/platformchatcreatestreamformat.md @@ -0,0 +1,20 @@ +# PlatformChatCreateStreamFormat + +Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + + +## Supported Types + +### `models.PlatformChatTextFormat` + +```python +value: models.PlatformChatTextFormat = /* values here */ +``` + +### `models.PlatformChatJSONSchemaFormat` + +```python +value: models.PlatformChatJSONSchemaFormat = /* values here */ +``` + diff --git a/docs/models/platformchatcreatestreamrequest.md b/docs/models/platformchatcreatestreamrequest.md index 484d017f..aec04e2f 100644 --- a/docs/models/platformchatcreatestreamrequest.md +++ b/docs/models/platformchatcreatestreamrequest.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `input` | [models.PlatformChatCreateStreamInput](../models/platformchatcreatestreaminput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| -| `stream` | *Optional[Literal[True]]* | :heavy_minus_sign: | N/A | -| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| -| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [models.PlatformChatCreateStreamInput](../models/platformchatcreatestreaminput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| +| `stream` | *Optional[Literal[True]]* | :heavy_minus_sign: | N/A | +| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| +| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| +| `text` | [Optional[models.PlatformChatCreateStreamText]](../models/platformchatcreatestreamtext.md) | :heavy_minus_sign: | Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.
| \ No newline at end of file diff --git a/docs/models/platformchatcreatestreamtext.md b/docs/models/platformchatcreatestreamtext.md new file mode 100644 index 00000000..7430aa9b --- /dev/null +++ b/docs/models/platformchatcreatestreamtext.md @@ -0,0 +1,11 @@ +# PlatformChatCreateStreamText + +Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `format_` | [Optional[models.PlatformChatCreateStreamFormat]](../models/platformchatcreatestreamformat.md) | :heavy_minus_sign: | Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema.
| \ No newline at end of file diff --git a/docs/models/platformchatcreatetext.md b/docs/models/platformchatcreatetext.md new file mode 100644 index 00000000..c478436a --- /dev/null +++ b/docs/models/platformchatcreatetext.md @@ -0,0 +1,11 @@ +# PlatformChatCreateText + +Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `format_` | [Optional[models.PlatformChatCreateFormat]](../models/platformchatcreateformat.md) | :heavy_minus_sign: | Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema.
| \ No newline at end of file diff --git a/docs/models/platformchatjsonschemaformat.md b/docs/models/platformchatjsonschemaformat.md new file mode 100644 index 00000000..3e3ca482 --- /dev/null +++ b/docs/models/platformchatjsonschemaformat.md @@ -0,0 +1,14 @@ +# PlatformChatJSONSchemaFormat + +Constrains the assistant response to a caller-supplied JSON Schema. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `type` | [models.PlatformChatJSONSchemaFormatType](../models/platformchatjsonschemaformattype.md) | :heavy_check_mark: | Discriminator. Must be JSON_SCHEMA. | +| `name` | *str* | :heavy_check_mark: | A stable identifier for the schema. | +| `description` | *Optional[str]* | :heavy_minus_sign: | An optional human-readable description of the schema. | +| `schema_` | Dict[str, *Any*] | :heavy_check_mark: | A JSON Schema object describing the desired output shape. | +| `strict` | *Optional[bool]* | :heavy_minus_sign: | When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true.
| \ No newline at end of file diff --git a/docs/models/platformchatjsonschemaformattype.md b/docs/models/platformchatjsonschemaformattype.md new file mode 100644 index 00000000..392a7694 --- /dev/null +++ b/docs/models/platformchatjsonschemaformattype.md @@ -0,0 +1,18 @@ +# PlatformChatJSONSchemaFormatType + +Discriminator. Must be JSON_SCHEMA. + +## Example Usage + +```python +from glean.api_client.models import PlatformChatJSONSchemaFormatType + +value = PlatformChatJSONSchemaFormatType.JSON_SCHEMA +``` + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `JSON_SCHEMA` | JSON_SCHEMA | \ No newline at end of file diff --git a/docs/models/platformchatoutputtextcontent.md b/docs/models/platformchatoutputtextcontent.md index 1ea074b5..36632e3d 100644 --- a/docs/models/platformchatoutputtextcontent.md +++ b/docs/models/platformchatoutputtextcontent.md @@ -3,8 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | -| `type` | [models.PlatformChatOutputTextContentType](../models/platformchatoutputtextcontenttype.md) | :heavy_check_mark: | N/A | -| `text` | *str* | :heavy_check_mark: | N/A | -| `annotations` | List[[models.PlatformChatCitationAnnotation](../models/platformchatcitationannotation.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| `type` | [models.PlatformChatOutputTextContentType](../models/platformchatoutputtextcontenttype.md) | :heavy_check_mark: | N/A | +| `text` | *str* | :heavy_check_mark: | N/A | +| `structured_output` | [OptionalNullable[models.StructuredOutput]](../models/structuredoutput.md) | :heavy_minus_sign: | Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`.
| +| `annotations` | List[[models.PlatformChatCitationAnnotation](../models/platformchatcitationannotation.md)] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/platformchattextformat.md b/docs/models/platformchattextformat.md new file mode 100644 index 00000000..12f678b7 --- /dev/null +++ b/docs/models/platformchattextformat.md @@ -0,0 +1,10 @@ +# PlatformChatTextFormat + +Unconstrained plain-text assistant output. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `type` | [models.PlatformChatTextFormatType](../models/platformchattextformattype.md) | :heavy_check_mark: | Discriminator. Must be TEXT. | \ No newline at end of file diff --git a/docs/models/platformchattextformattype.md b/docs/models/platformchattextformattype.md new file mode 100644 index 00000000..9dca496f --- /dev/null +++ b/docs/models/platformchattextformattype.md @@ -0,0 +1,18 @@ +# PlatformChatTextFormatType + +Discriminator. Must be TEXT. + +## Example Usage + +```python +from glean.api_client.models import PlatformChatTextFormatType + +value = PlatformChatTextFormatType.TEXT +``` + + +## Values + +| Name | Value | +| ------ | ------ | +| `TEXT` | TEXT | \ No newline at end of file diff --git a/docs/models/platformdurableagentrun.md b/docs/models/platformdurableagentrun.md new file mode 100644 index 00000000..fede41af --- /dev/null +++ b/docs/models/platformdurableagentrun.md @@ -0,0 +1,18 @@ +# PlatformDurableAgentRun + +Agent run state, pending tool approvals, and output available independently of the creation request. + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `run_id` | *str* | :heavy_check_mark: | ID of the run, preserved across approval continuations. | +| `agent_id` | *str* | :heavy_check_mark: | ID of the agent that owns the run. | +| `state` | [models.PlatformAgentRunState](../models/platformagentrunstate.md) | :heavy_check_mark: | State of the persisted workflow execution. REQUIRES_INPUT is nonterminal. | +| `created_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Timestamp when the run was first persisted. | +| `updated_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_check_mark: | Latest persisted activity timestamp across the execution and its messages, including checkpoint messages. This is not a worker heartbeat or an exact state-transition timestamp.
| +| `expires_at` | [date](https://docs.python.org/3/library/datetime.html#date-objects) | :heavy_minus_sign: | Execution deadline, when one is set. Not the run history retention deadline. | +| `pending_interactions` | List[[models.PlatformAgentRunToolApproval](../models/platformagentruntoolapproval.md)] | :heavy_check_mark: | Unanswered tool approvals when the run is in REQUIRES_INPUT. Empty in other states. | +| `output` | Dict[str, *Any*] | :heavy_minus_sign: | Accumulated text-only agent output under the messages key, when available. | +| `error` | [Optional[models.PlatformAgentRunError]](../models/platformagentrunerror.md) | :heavy_minus_sign: | Caller-safe details of an agent run execution failure. | \ No newline at end of file diff --git a/docs/models/structuredoutput.md b/docs/models/structuredoutput.md new file mode 100644 index 00000000..45e8ab02 --- /dev/null +++ b/docs/models/structuredoutput.md @@ -0,0 +1,10 @@ +# StructuredOutput + +Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. + + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/sdks/agents/README.md b/docs/sdks/agents/README.md index f05a4d59..765472cd 100644 --- a/docs/sdks/agents/README.md +++ b/docs/sdks/agents/README.md @@ -8,6 +8,7 @@ * [get](#get) - Get agent * [get_schemas](#get_schemas) - Get agent schemas * [create_run](#create_run) - Create agent run +* [get_run](#get_run) - Get agent run ## search @@ -195,4 +196,48 @@ with Glean( | errors.PlatformUnauthorizedAgentToolsProblemError | 422 | application/problem+json | | errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 409, 413, 429 | application/problem+json | | errors.PlatformProblemDetailError | 500, 503 | application/problem+json | -| errors.GleanError | 4XX, 5XX | \*/\* | \ No newline at end of file +| errors.GleanError | 4XX, 5XX | \*/\* | + +## get_run + +Retrieve a persisted workflow execution owned by the authenticated user. The run must belong to the specified agent, and the user must still have access to that agent. Unknown runs, runs owned by another user, and mismatched agent/run identifiers return 404. Requires the agents.run scope. Executions without a persisted workflow record are not available through this endpoint. + + +### Example Usage + + +```python +from glean.api_client import Glean +import os + + +with Glean( + api_token=os.getenv("GLEAN_API_TOKEN", ""), +) as glean: + + res = glean.agents.get_run(agent_id="{agent_id}", run_id="{run_id}") + + # Handle response + print(res) + +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `agent_id` | *str* | :heavy_check_mark: | ID of the agent that owns the run. | {agent_id} | +| `run_id` | *str* | :heavy_check_mark: | ID of the durable run to retrieve. | {run_id} | +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | | + +### Response + +**[models.PlatformAgentRunResponse](../../models/platformagentrunresponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| errors.PlatformProblemDetailError | 400, 401, 403, 404, 408, 429 | application/problem+json | +| errors.PlatformProblemDetailError | 500, 503 | application/problem+json | +| errors.GleanError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/chatsdk/README.md b/docs/sdks/chatsdk/README.md index 4ccddf51..a6bdce51 100644 --- a/docs/sdks/chatsdk/README.md +++ b/docs/sdks/chatsdk/README.md @@ -16,7 +16,7 @@ Run an assistant turn. The default response is JSON. HTTP clients request server ```python -from glean.api_client import Glean +from glean.api_client import Glean, models import os @@ -24,7 +24,28 @@ with Glean( api_token=os.getenv("GLEAN_API_TOKEN", ""), ) as glean: - res = glean.chat.create(input="What is our parental leave policy?", store=True) + res = glean.chat.create(input="Summarize our parental leave policy as JSON.", store=True, text={ + "format_": { + "type": models.PlatformChatJSONSchemaFormatType.JSON_SCHEMA, + "name": "policy_summary", + "schema_": { + "type": "object", + "properties": { + "eligible_employees": { + "type": "string", + }, + "duration_weeks": { + "type": "integer", + }, + }, + "required": [ + "eligible_employees", + "duration_weeks", + ], + }, + "strict": True, + }, + }) # Handle response print(res) @@ -33,12 +54,13 @@ with Glean( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `input` | [models.PlatformChatCreateInput](../../models/platformchatcreateinput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| -| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| -| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [models.PlatformChatCreateInput](../../models/platformchatcreateinput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| +| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| +| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| +| `text` | [Optional[models.PlatformChatCreateText]](../../models/platformchatcreatetext.md) | :heavy_minus_sign: | Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response @@ -61,7 +83,7 @@ SDK-only logical operation. HTTP clients must call the base path; the URL fragme ```python -from glean.api_client import Glean +from glean.api_client import Glean, models import os @@ -69,7 +91,28 @@ with Glean( api_token=os.getenv("GLEAN_API_TOKEN", ""), ) as glean: - res = glean.chat.create_stream(input="What is our parental leave policy?", store=True) + res = glean.chat.create_stream(input="Summarize our parental leave policy as JSON.", store=True, text={ + "format_": { + "type": models.PlatformChatJSONSchemaFormatType.JSON_SCHEMA, + "name": "policy_summary", + "schema_": { + "type": "object", + "properties": { + "eligible_employees": { + "type": "string", + }, + "duration_weeks": { + "type": "integer", + }, + }, + "required": [ + "eligible_employees", + "duration_weeks", + ], + }, + "strict": True, + }, + }) with res as event_stream: for event in event_stream: @@ -80,12 +123,13 @@ with Glean( ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | -| `input` | [models.PlatformChatCreateStreamInput](../../models/platformchatcreatestreaminput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| -| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| -| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| -| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `input` | [models.PlatformChatCreateStreamInput](../../models/platformchatcreatestreaminput.md) | :heavy_check_mark: | Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`.
| +| `store` | *Optional[bool]* | :heavy_minus_sign: | When true (default), persist the interaction and return a `conversation_id`. When false, run ephemerally with no persistence.
| +| `conversation_id` | *Optional[str]* | :heavy_minus_sign: | Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`.
| +| `text` | [Optional[models.PlatformChatCreateStreamText]](../../models/platformchatcreatestreamtext.md) | :heavy_minus_sign: | Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.
| +| `retries` | [Optional[utils.RetryConfig]](../../models/utils/retryconfig.md) | :heavy_minus_sign: | Configuration to override the default retry behavior of the client. | ### Response diff --git a/pyproject.toml b/pyproject.toml index 47df73c3..b7cb0276 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "glean-api-client" -version = "0.17.14" +version = "0.17.15" description = "Python Client SDK Generated by Speakeasy." authors = [{ name = "Glean Technologies, Inc." },] readme = "README-PYPI.md" diff --git a/src/glean/api_client/_version.py b/src/glean/api_client/_version.py index baf219c0..4af11e8e 100644 --- a/src/glean/api_client/_version.py +++ b/src/glean/api_client/_version.py @@ -3,10 +3,10 @@ import importlib.metadata __title__: str = "glean-api-client" -__version__: str = "0.17.14" +__version__: str = "0.17.15" __openapi_doc_version__: str = "0.9.0" -__gen_version__: str = "2.937.18" -__user_agent__: str = "speakeasy-sdk/python 0.17.14 2.937.18 0.9.0 glean-api-client" +__gen_version__: str = "2.938.0" +__user_agent__: str = "speakeasy-sdk/python 0.17.15 2.938.0 0.9.0 glean-api-client" try: if __package__ is not None: diff --git a/src/glean/api_client/agents.py b/src/glean/api_client/agents.py index 68817cd0..d4ccd10c 100644 --- a/src/glean/api_client/agents.py +++ b/src/glean/api_client/agents.py @@ -951,3 +951,213 @@ async def create_run_async( raise errors.GleanError("API error occurred", http_res, http_res_text) raise errors.GleanError("Unexpected response received", http_res) + + def get_run( + self, + *, + agent_id: str, + run_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.PlatformAgentRunResponse: + r"""Get agent run + + Retrieve a persisted workflow execution owned by the authenticated user. The run must belong to the specified agent, and the user must still have access to that agent. Unknown runs, runs owned by another user, and mismatched agent/run identifiers return 404. Requires the agents.run scope. Executions without a persisted workflow record are not available through this endpoint. + + + :param agent_id: ID of the agent that owns the run. + :param run_id: ID of the durable run to retrieve. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.PlatformAgentsGetRunRequest( + agent_id=agent_id, + run_id=run_id, + ) + + req = self._build_request( + method="GET", + path="/api/agents/{agent_id}/runs/{run_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = self.do_request( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="platform-agents-get-run", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["Agents"], + extensions={"x-visibility": "Public"}, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.PlatformAgentRunResponse, http_res) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "408", "429"], + "application/problem+json", + ): + response_data = unmarshal_json_response( + errors.PlatformProblemDetailErrorData, http_res + ) + raise errors.PlatformProblemDetailError(response_data, http_res) + if utils.match_response(http_res, ["500", "503"], "application/problem+json"): + response_data = unmarshal_json_response( + errors.PlatformProblemDetailErrorData, http_res + ) + raise errors.PlatformProblemDetailError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = utils.stream_to_text(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) + + async def get_run_async( + self, + *, + agent_id: str, + run_id: str, + retries: OptionalNullable[utils.RetryConfig] = UNSET, + server_url: Optional[str] = None, + timeout_ms: Optional[int] = None, + http_headers: Optional[Mapping[str, str]] = None, + ) -> models.PlatformAgentRunResponse: + r"""Get agent run + + Retrieve a persisted workflow execution owned by the authenticated user. The run must belong to the specified agent, and the user must still have access to that agent. Unknown runs, runs owned by another user, and mismatched agent/run identifiers return 404. Requires the agents.run scope. Executions without a persisted workflow record are not available through this endpoint. + + + :param agent_id: ID of the agent that owns the run. + :param run_id: ID of the durable run to retrieve. + :param retries: Override the default retry configuration for this method + :param server_url: Override the default server URL for this method + :param timeout_ms: Override the default request timeout configuration for this method in milliseconds + :param http_headers: Additional headers to set or replace on requests. + """ + base_url = None + url_variables = None + if timeout_ms is None: + timeout_ms = self.sdk_configuration.timeout_ms + + if server_url is not None: + base_url = server_url + else: + base_url = self._get_url(base_url, url_variables) + + request = models.PlatformAgentsGetRunRequest( + agent_id=agent_id, + run_id=run_id, + ) + + req = self._build_request_async( + method="GET", + path="/api/agents/{agent_id}/runs/{run_id}", + base_url=base_url, + url_variables=url_variables, + request=request, + request_body_required=False, + request_has_path_params=True, + request_has_query_params=True, + user_agent_header="user-agent", + accept_header_value="application/json", + http_headers=http_headers, + security=self.sdk_configuration.security, + allow_empty_value=None, + timeout_ms=timeout_ms, + ) + + if retries == UNSET: + if self.sdk_configuration.retry_config is not UNSET: + retries = self.sdk_configuration.retry_config + + retry_config = None + if isinstance(retries, utils.RetryConfig): + retry_config = (retries, ["429", "500", "502", "503", "504"]) + + http_res = await self.do_request_async( + hook_ctx=HookContext( + config=self.sdk_configuration, + base_url=base_url or "", + operation_id="platform-agents-get-run", + oauth2_scopes=None, + security_source=get_security_from_env( + self.sdk_configuration.security, models.Security + ), + tags=["Agents"], + extensions={"x-visibility": "Public"}, + ), + request=req, + is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c), + retry_config=retry_config, + ) + + response_data: Any = None + if utils.match_response(http_res, "200", "application/json"): + return unmarshal_json_response(models.PlatformAgentRunResponse, http_res) + if utils.match_response( + http_res, + ["400", "401", "403", "404", "408", "429"], + "application/problem+json", + ): + response_data = unmarshal_json_response( + errors.PlatformProblemDetailErrorData, http_res + ) + raise errors.PlatformProblemDetailError(response_data, http_res) + if utils.match_response(http_res, ["500", "503"], "application/problem+json"): + response_data = unmarshal_json_response( + errors.PlatformProblemDetailErrorData, http_res + ) + raise errors.PlatformProblemDetailError(response_data, http_res) + if utils.match_response(http_res, "4XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + if utils.match_response(http_res, "5XX", "*"): + http_res_text = await utils.stream_to_text_async(http_res) + raise errors.GleanError("API error occurred", http_res, http_res_text) + + raise errors.GleanError("Unexpected response received", http_res) diff --git a/src/glean/api_client/chat_sdk.py b/src/glean/api_client/chat_sdk.py index 9a48f24a..b37457a8 100644 --- a/src/glean/api_client/chat_sdk.py +++ b/src/glean/api_client/chat_sdk.py @@ -18,6 +18,9 @@ def create( ], store: Optional[bool] = True, conversation_id: Optional[str] = None, + text: Optional[ + Union[models.PlatformChatCreateText, models.PlatformChatCreateTextTypedDict] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -34,6 +37,8 @@ def create( :param conversation_id: Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. + :param text: Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -53,6 +58,9 @@ def create( input=utils.get_pydantic_model(input, models.PlatformChatCreateInput), store=store, conversation_id=conversation_id, + text=utils.get_pydantic_model( + text, Optional[models.PlatformChatCreateText] + ), ) req = self._build_request( @@ -139,6 +147,9 @@ async def create_async( ], store: Optional[bool] = True, conversation_id: Optional[str] = None, + text: Optional[ + Union[models.PlatformChatCreateText, models.PlatformChatCreateTextTypedDict] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -155,6 +166,8 @@ async def create_async( :param conversation_id: Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. + :param text: Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -174,6 +187,9 @@ async def create_async( input=utils.get_pydantic_model(input, models.PlatformChatCreateInput), store=store, conversation_id=conversation_id, + text=utils.get_pydantic_model( + text, Optional[models.PlatformChatCreateText] + ), ) req = self._build_request_async( @@ -261,6 +277,12 @@ def create_stream( ], store: Optional[bool] = True, conversation_id: Optional[str] = None, + text: Optional[ + Union[ + models.PlatformChatCreateStreamText, + models.PlatformChatCreateStreamTextTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -277,6 +299,8 @@ def create_stream( :param conversation_id: Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. + :param text: Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -296,6 +320,9 @@ def create_stream( input=utils.get_pydantic_model(input, models.PlatformChatCreateStreamInput), store=store, conversation_id=conversation_id, + text=utils.get_pydantic_model( + text, Optional[models.PlatformChatCreateStreamText] + ), ) req = self._build_request( @@ -395,6 +422,12 @@ async def create_stream_async( ], store: Optional[bool] = True, conversation_id: Optional[str] = None, + text: Optional[ + Union[ + models.PlatformChatCreateStreamText, + models.PlatformChatCreateStreamTextTypedDict, + ] + ] = None, retries: OptionalNullable[utils.RetryConfig] = UNSET, server_url: Optional[str] = None, timeout_ms: Optional[int] = None, @@ -411,6 +444,8 @@ async def create_stream_async( :param conversation_id: Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. + :param text: Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + :param retries: Override the default retry configuration for this method :param server_url: Override the default server URL for this method :param timeout_ms: Override the default request timeout configuration for this method in milliseconds @@ -430,6 +465,9 @@ async def create_stream_async( input=utils.get_pydantic_model(input, models.PlatformChatCreateStreamInput), store=store, conversation_id=conversation_id, + text=utils.get_pydantic_model( + text, Optional[models.PlatformChatCreateStreamText] + ), ) req = self._build_request_async( diff --git a/src/glean/api_client/models/__init__.py b/src/glean/api_client/models/__init__.py index f428e57a..804db53b 100644 --- a/src/glean/api_client/models/__init__.py +++ b/src/glean/api_client/models/__init__.py @@ -1285,6 +1285,10 @@ PlatformAgentsCreateRunResponse, PlatformAgentsCreateRunResponseTypedDict, ) + from .platform_agents_get_runop import ( + PlatformAgentsGetRunRequest, + PlatformAgentsGetRunRequestTypedDict, + ) from .platform_agents_get_schemasop import ( PlatformAgentsGetSchemasRequest, PlatformAgentsGetSchemasRequestTypedDict, @@ -1294,16 +1298,24 @@ PlatformAgentsGetRequestTypedDict, ) from .platform_chat_create_streamop import ( + PlatformChatCreateStreamFormat, + PlatformChatCreateStreamFormatTypedDict, PlatformChatCreateStreamInput, PlatformChatCreateStreamInputTypedDict, PlatformChatCreateStreamRequest, PlatformChatCreateStreamRequestTypedDict, + PlatformChatCreateStreamText, + PlatformChatCreateStreamTextTypedDict, ) from .platform_chat_createop import ( + PlatformChatCreateFormat, + PlatformChatCreateFormatTypedDict, PlatformChatCreateInput, PlatformChatCreateInputTypedDict, PlatformChatCreateRequest, PlatformChatCreateRequestTypedDict, + PlatformChatCreateText, + PlatformChatCreateTextTypedDict, ) from .platform_search_filtersop import ( PlatformSearchFiltersRequest, @@ -1418,6 +1430,20 @@ PlatformAgentRunCreateRequest, PlatformAgentRunCreateRequestTypedDict, ) + from .platformagentrunerror import ( + PlatformAgentRunError, + PlatformAgentRunErrorTypedDict, + ) + from .platformagentrunresponse import ( + PlatformAgentRunResponse, + PlatformAgentRunResponseTypedDict, + ) + from .platformagentrunstate import PlatformAgentRunState + from .platformagentruntoolapproval import ( + PlatformAgentRunToolApproval, + PlatformAgentRunToolApprovalType, + PlatformAgentRunToolApprovalTypedDict, + ) from .platformagentrunwaitresponse import ( PlatformAgentRunWaitResponse, PlatformAgentRunWaitResponseTypedDict, @@ -1488,6 +1514,11 @@ PlatformChatInputMessageRole, PlatformChatInputMessageTypedDict, ) + from .platformchatjsonschemaformat import ( + PlatformChatJSONSchemaFormat, + PlatformChatJSONSchemaFormatType, + PlatformChatJSONSchemaFormatTypedDict, + ) from .platformchatoutputmessage import ( PlatformChatOutputMessage, PlatformChatOutputMessageRole, @@ -1498,6 +1529,8 @@ PlatformChatOutputTextContent, PlatformChatOutputTextContentType, PlatformChatOutputTextContentTypedDict, + StructuredOutput, + StructuredOutputTypedDict, ) from .platformchatpersonsource import ( PlatformChatPersonSource, @@ -1566,6 +1599,11 @@ PlatformChatStreamResponseFailedServerSentEvent, PlatformChatStreamResponseFailedServerSentEventTypedDict, ) + from .platformchattextformat import ( + PlatformChatTextFormat, + PlatformChatTextFormatType, + PlatformChatTextFormatTypedDict, + ) from .platformcontentschedulewebhookevent import ( PlatformContentScheduleWebhookEvent, PlatformContentScheduleWebhookEventTypedDict, @@ -1579,6 +1617,10 @@ PlatformDocumentChangeWebhookEvent, PlatformDocumentChangeWebhookEventTypedDict, ) + from .platformdurableagentrun import ( + PlatformDurableAgentRun, + PlatformDurableAgentRunTypedDict, + ) from .platformfilter import PlatformFilter, PlatformFilterTypedDict from .platformfilterfieldinfo import ( PlatformFilterFieldInfo, @@ -3221,6 +3263,14 @@ "PlatformAgentRun", "PlatformAgentRunCreateRequest", "PlatformAgentRunCreateRequestTypedDict", + "PlatformAgentRunError", + "PlatformAgentRunErrorTypedDict", + "PlatformAgentRunResponse", + "PlatformAgentRunResponseTypedDict", + "PlatformAgentRunState", + "PlatformAgentRunToolApproval", + "PlatformAgentRunToolApprovalType", + "PlatformAgentRunToolApprovalTypedDict", "PlatformAgentRunTypedDict", "PlatformAgentRunWaitResponse", "PlatformAgentRunWaitResponseTypedDict", @@ -3233,6 +3283,8 @@ "PlatformAgentsCreateRunResponseTypedDict", "PlatformAgentsGetRequest", "PlatformAgentsGetRequestTypedDict", + "PlatformAgentsGetRunRequest", + "PlatformAgentsGetRunRequestTypedDict", "PlatformAgentsGetSchemasRequest", "PlatformAgentsGetSchemasRequestTypedDict", "PlatformAgentsSearchRequest", @@ -3252,14 +3304,22 @@ "PlatformChatCompletedResponseObject", "PlatformChatCompletedResponseStatus", "PlatformChatCompletedResponseTypedDict", + "PlatformChatCreateFormat", + "PlatformChatCreateFormatTypedDict", "PlatformChatCreateInput", "PlatformChatCreateInputTypedDict", "PlatformChatCreateRequest", "PlatformChatCreateRequestTypedDict", + "PlatformChatCreateStreamFormat", + "PlatformChatCreateStreamFormatTypedDict", "PlatformChatCreateStreamInput", "PlatformChatCreateStreamInputTypedDict", "PlatformChatCreateStreamRequest", "PlatformChatCreateStreamRequestTypedDict", + "PlatformChatCreateStreamText", + "PlatformChatCreateStreamTextTypedDict", + "PlatformChatCreateText", + "PlatformChatCreateTextTypedDict", "PlatformChatCustomEntitySource", "PlatformChatCustomEntitySourceType", "PlatformChatCustomEntitySourceTypedDict", @@ -3281,6 +3341,9 @@ "PlatformChatInputMessage", "PlatformChatInputMessageRole", "PlatformChatInputMessageTypedDict", + "PlatformChatJSONSchemaFormat", + "PlatformChatJSONSchemaFormatType", + "PlatformChatJSONSchemaFormatTypedDict", "PlatformChatOutputMessage", "PlatformChatOutputMessageRole", "PlatformChatOutputMessageType", @@ -3325,6 +3388,9 @@ "PlatformChatStreamResponseFailedServerSentEventTypedDict", "PlatformChatStreamResponseFailedType", "PlatformChatStreamResponseFailedTypedDict", + "PlatformChatTextFormat", + "PlatformChatTextFormatType", + "PlatformChatTextFormatTypedDict", "PlatformContentScheduleWebhookEvent", "PlatformContentScheduleWebhookEventTypedDict", "PlatformContentType", @@ -3332,6 +3398,8 @@ "PlatformDatasourceFilterInfoTypedDict", "PlatformDocumentChangeWebhookEvent", "PlatformDocumentChangeWebhookEventTypedDict", + "PlatformDurableAgentRun", + "PlatformDurableAgentRunTypedDict", "PlatformFilter", "PlatformFilterFieldInfo", "PlatformFilterFieldInfoTypedDict", @@ -3698,6 +3766,8 @@ "StructuredLinkTypedDict", "StructuredLocation", "StructuredLocationTypedDict", + "StructuredOutput", + "StructuredOutputTypedDict", "StructuredResult", "StructuredResultSource", "StructuredResultTypedDict", @@ -4797,18 +4867,28 @@ "PlatformAgentsCreateRunRequestTypedDict": ".platform_agents_create_runop", "PlatformAgentsCreateRunResponse": ".platform_agents_create_runop", "PlatformAgentsCreateRunResponseTypedDict": ".platform_agents_create_runop", + "PlatformAgentsGetRunRequest": ".platform_agents_get_runop", + "PlatformAgentsGetRunRequestTypedDict": ".platform_agents_get_runop", "PlatformAgentsGetSchemasRequest": ".platform_agents_get_schemasop", "PlatformAgentsGetSchemasRequestTypedDict": ".platform_agents_get_schemasop", "PlatformAgentsGetRequest": ".platform_agents_getop", "PlatformAgentsGetRequestTypedDict": ".platform_agents_getop", + "PlatformChatCreateStreamFormat": ".platform_chat_create_streamop", + "PlatformChatCreateStreamFormatTypedDict": ".platform_chat_create_streamop", "PlatformChatCreateStreamInput": ".platform_chat_create_streamop", "PlatformChatCreateStreamInputTypedDict": ".platform_chat_create_streamop", "PlatformChatCreateStreamRequest": ".platform_chat_create_streamop", "PlatformChatCreateStreamRequestTypedDict": ".platform_chat_create_streamop", + "PlatformChatCreateStreamText": ".platform_chat_create_streamop", + "PlatformChatCreateStreamTextTypedDict": ".platform_chat_create_streamop", + "PlatformChatCreateFormat": ".platform_chat_createop", + "PlatformChatCreateFormatTypedDict": ".platform_chat_createop", "PlatformChatCreateInput": ".platform_chat_createop", "PlatformChatCreateInputTypedDict": ".platform_chat_createop", "PlatformChatCreateRequest": ".platform_chat_createop", "PlatformChatCreateRequestTypedDict": ".platform_chat_createop", + "PlatformChatCreateText": ".platform_chat_createop", + "PlatformChatCreateTextTypedDict": ".platform_chat_createop", "PlatformSearchFiltersRequest": ".platform_search_filtersop", "PlatformSearchFiltersRequestTypedDict": ".platform_search_filtersop", "PlatformSearchFiltersResponseResponse": ".platform_search_filtersop", @@ -4872,6 +4952,14 @@ "PlatformAgentRunTypedDict": ".platformagentrun", "PlatformAgentRunCreateRequest": ".platformagentruncreaterequest", "PlatformAgentRunCreateRequestTypedDict": ".platformagentruncreaterequest", + "PlatformAgentRunError": ".platformagentrunerror", + "PlatformAgentRunErrorTypedDict": ".platformagentrunerror", + "PlatformAgentRunResponse": ".platformagentrunresponse", + "PlatformAgentRunResponseTypedDict": ".platformagentrunresponse", + "PlatformAgentRunState": ".platformagentrunstate", + "PlatformAgentRunToolApproval": ".platformagentruntoolapproval", + "PlatformAgentRunToolApprovalType": ".platformagentruntoolapproval", + "PlatformAgentRunToolApprovalTypedDict": ".platformagentruntoolapproval", "PlatformAgentRunWaitResponse": ".platformagentrunwaitresponse", "PlatformAgentRunWaitResponseTypedDict": ".platformagentrunwaitresponse", "PlatformAgentSchemasResponse": ".platformagentschemasresponse", @@ -4914,6 +5002,9 @@ "PlatformChatInputMessage": ".platformchatinputmessage", "PlatformChatInputMessageRole": ".platformchatinputmessage", "PlatformChatInputMessageTypedDict": ".platformchatinputmessage", + "PlatformChatJSONSchemaFormat": ".platformchatjsonschemaformat", + "PlatformChatJSONSchemaFormatType": ".platformchatjsonschemaformat", + "PlatformChatJSONSchemaFormatTypedDict": ".platformchatjsonschemaformat", "PlatformChatOutputMessage": ".platformchatoutputmessage", "PlatformChatOutputMessageRole": ".platformchatoutputmessage", "PlatformChatOutputMessageType": ".platformchatoutputmessage", @@ -4921,6 +5012,8 @@ "PlatformChatOutputTextContent": ".platformchatoutputtextcontent", "PlatformChatOutputTextContentType": ".platformchatoutputtextcontent", "PlatformChatOutputTextContentTypedDict": ".platformchatoutputtextcontent", + "StructuredOutput": ".platformchatoutputtextcontent", + "StructuredOutputTypedDict": ".platformchatoutputtextcontent", "PlatformChatPersonSource": ".platformchatpersonsource", "PlatformChatPersonSourceType": ".platformchatpersonsource", "PlatformChatPersonSourceTypedDict": ".platformchatpersonsource", @@ -4958,6 +5051,9 @@ "PlatformChatStreamResponseFailedTypedDict": ".platformchatstreamresponsefailed", "PlatformChatStreamResponseFailedServerSentEvent": ".platformchatstreamresponsefailedserversentevent", "PlatformChatStreamResponseFailedServerSentEventTypedDict": ".platformchatstreamresponsefailedserversentevent", + "PlatformChatTextFormat": ".platformchattextformat", + "PlatformChatTextFormatType": ".platformchattextformat", + "PlatformChatTextFormatTypedDict": ".platformchattextformat", "PlatformContentScheduleWebhookEvent": ".platformcontentschedulewebhookevent", "PlatformContentScheduleWebhookEventTypedDict": ".platformcontentschedulewebhookevent", "PlatformContentType": ".platformcontenttype", @@ -4965,6 +5061,8 @@ "PlatformDatasourceFilterInfoTypedDict": ".platformdatasourcefilterinfo", "PlatformDocumentChangeWebhookEvent": ".platformdocumentchangewebhookevent", "PlatformDocumentChangeWebhookEventTypedDict": ".platformdocumentchangewebhookevent", + "PlatformDurableAgentRun": ".platformdurableagentrun", + "PlatformDurableAgentRunTypedDict": ".platformdurableagentrun", "PlatformFilter": ".platformfilter", "PlatformFilterTypedDict": ".platformfilter", "PlatformFilterFieldInfo": ".platformfilterfieldinfo", diff --git a/src/glean/api_client/models/feedentry.py b/src/glean/api_client/models/feedentry.py index c0d16f3e..83e2c6f0 100644 --- a/src/glean/api_client/models/feedentry.py +++ b/src/glean/api_client/models/feedentry.py @@ -136,6 +136,8 @@ class JustificationType(str, Enum, metaclass=utils.OpenEnumMeta): EDIT_DOC = "EDIT_DOC" CHAT_TO_ARTIFACT = "CHAT_TO_ARTIFACT" SHARE_ARTIFACT = "SHARE_ARTIFACT" + CREATE_AGENT = "CREATE_AGENT" + MANAGER_INVITE = "MANAGER_INVITE" class FeedEntryTypedDict(TypedDict): diff --git a/src/glean/api_client/models/feedrequest.py b/src/glean/api_client/models/feedrequest.py index 363ac76d..75cd4b1b 100644 --- a/src/glean/api_client/models/feedrequest.py +++ b/src/glean/api_client/models/feedrequest.py @@ -64,6 +64,8 @@ class FeedRequestCategory(str, Enum): EDIT_DOC = "EDIT_DOC" CHAT_TO_ARTIFACT = "CHAT_TO_ARTIFACT" SHARE_ARTIFACT = "SHARE_ARTIFACT" + CREATE_AGENT = "CREATE_AGENT" + MANAGER_INVITE = "MANAGER_INVITE" class FeedRequestTypedDict(TypedDict): diff --git a/src/glean/api_client/models/feedresult.py b/src/glean/api_client/models/feedresult.py index a3f149b9..f450760d 100644 --- a/src/glean/api_client/models/feedresult.py +++ b/src/glean/api_client/models/feedresult.py @@ -66,6 +66,8 @@ class FeedResultCategory(str, Enum, metaclass=utils.OpenEnumMeta): EDIT_DOC = "EDIT_DOC" CHAT_TO_ARTIFACT = "CHAT_TO_ARTIFACT" SHARE_ARTIFACT = "SHARE_ARTIFACT" + CREATE_AGENT = "CREATE_AGENT" + MANAGER_INVITE = "MANAGER_INVITE" class PlacementReason(str, Enum, metaclass=utils.OpenEnumMeta): diff --git a/src/glean/api_client/models/platform_agents_get_runop.py b/src/glean/api_client/models/platform_agents_get_runop.py new file mode 100644 index 00000000..01a8e34f --- /dev/null +++ b/src/glean/api_client/models/platform_agents_get_runop.py @@ -0,0 +1,25 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from glean.api_client.types import BaseModel +from glean.api_client.utils import FieldMetadata, PathParamMetadata +from typing_extensions import Annotated, TypedDict + + +class PlatformAgentsGetRunRequestTypedDict(TypedDict): + agent_id: str + r"""ID of the agent that owns the run.""" + run_id: str + r"""ID of the durable run to retrieve.""" + + +class PlatformAgentsGetRunRequest(BaseModel): + agent_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""ID of the agent that owns the run.""" + + run_id: Annotated[ + str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False)) + ] + r"""ID of the durable run to retrieve.""" diff --git a/src/glean/api_client/models/platform_chat_create_streamop.py b/src/glean/api_client/models/platform_chat_create_streamop.py index 7e6268b7..10c83a83 100644 --- a/src/glean/api_client/models/platform_chat_create_streamop.py +++ b/src/glean/api_client/models/platform_chat_create_streamop.py @@ -5,10 +5,18 @@ PlatformChatInputMessage, PlatformChatInputMessageTypedDict, ) +from .platformchatjsonschemaformat import ( + PlatformChatJSONSchemaFormat, + PlatformChatJSONSchemaFormatTypedDict, +) +from .platformchattextformat import ( + PlatformChatTextFormat, + PlatformChatTextFormatTypedDict, +) from glean.api_client.types import BaseModel, UNSET_SENTINEL -from glean.api_client.utils import validate_const +from glean.api_client.utils import get_discriminator, validate_const import pydantic -from pydantic import model_serializer +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -31,6 +39,63 @@ """ +PlatformChatCreateStreamFormatTypedDict = TypeAliasType( + "PlatformChatCreateStreamFormatTypedDict", + Union[PlatformChatTextFormatTypedDict, PlatformChatJSONSchemaFormatTypedDict], +) +r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + +""" + + +PlatformChatCreateStreamFormat = Annotated[ + Union[ + Annotated[PlatformChatTextFormat, Tag("TEXT")], + Annotated[PlatformChatJSONSchemaFormat, Tag("JSON_SCHEMA")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] +r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + +""" + + +class PlatformChatCreateStreamTextTypedDict(TypedDict): + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.""" + + format_: NotRequired[PlatformChatCreateStreamFormatTypedDict] + r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + """ + + +class PlatformChatCreateStreamText(BaseModel): + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.""" + + format_: Annotated[ + Optional[PlatformChatCreateStreamFormat], pydantic.Field(alias="format") + ] = None + r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["format"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + class PlatformChatCreateStreamRequestTypedDict(TypedDict): input: PlatformChatCreateStreamInputTypedDict r"""Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`. @@ -45,6 +110,10 @@ class PlatformChatCreateStreamRequestTypedDict(TypedDict): r"""Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. """ + text: NotRequired[PlatformChatCreateStreamTextTypedDict] + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + """ class PlatformChatCreateStreamRequest(BaseModel): @@ -68,9 +137,14 @@ class PlatformChatCreateStreamRequest(BaseModel): """ + text: Optional[PlatformChatCreateStreamText] = None + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + """ + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["stream", "store", "conversation_id"]) + optional_fields = set(["stream", "store", "conversation_id", "text"]) serialized = handler(self) m = {} @@ -85,6 +159,10 @@ def serialize_model(self, handler): return m +try: + PlatformChatCreateStreamText.model_rebuild() +except NameError: + pass try: PlatformChatCreateStreamRequest.model_rebuild() except NameError: diff --git a/src/glean/api_client/models/platform_chat_createop.py b/src/glean/api_client/models/platform_chat_createop.py index 4069a990..1812a496 100644 --- a/src/glean/api_client/models/platform_chat_createop.py +++ b/src/glean/api_client/models/platform_chat_createop.py @@ -5,10 +5,18 @@ PlatformChatInputMessage, PlatformChatInputMessageTypedDict, ) +from .platformchatjsonschemaformat import ( + PlatformChatJSONSchemaFormat, + PlatformChatJSONSchemaFormatTypedDict, +) +from .platformchattextformat import ( + PlatformChatTextFormat, + PlatformChatTextFormatTypedDict, +) from glean.api_client.types import BaseModel, UNSET_SENTINEL -from glean.api_client.utils import validate_const +from glean.api_client.utils import get_discriminator, validate_const import pydantic -from pydantic import model_serializer +from pydantic import Discriminator, Tag, model_serializer from pydantic.functional_validators import AfterValidator from typing import List, Literal, Optional, Union from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict @@ -31,6 +39,63 @@ """ +PlatformChatCreateFormatTypedDict = TypeAliasType( + "PlatformChatCreateFormatTypedDict", + Union[PlatformChatTextFormatTypedDict, PlatformChatJSONSchemaFormatTypedDict], +) +r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + +""" + + +PlatformChatCreateFormat = Annotated[ + Union[ + Annotated[PlatformChatTextFormat, Tag("TEXT")], + Annotated[PlatformChatJSONSchemaFormat, Tag("JSON_SCHEMA")], + ], + Discriminator(lambda m: get_discriminator(m, "type", "type")), +] +r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + +""" + + +class PlatformChatCreateTextTypedDict(TypedDict): + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.""" + + format_: NotRequired[PlatformChatCreateFormatTypedDict] + r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + """ + + +class PlatformChatCreateText(BaseModel): + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true.""" + + format_: Annotated[ + Optional[PlatformChatCreateFormat], pydantic.Field(alias="format") + ] = None + r"""Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["format"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + class PlatformChatCreateRequestTypedDict(TypedDict): input: PlatformChatCreateInputTypedDict r"""Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`. @@ -45,6 +110,10 @@ class PlatformChatCreateRequestTypedDict(TypedDict): r"""Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. """ + text: NotRequired[PlatformChatCreateTextTypedDict] + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + """ class PlatformChatCreateRequest(BaseModel): @@ -68,9 +137,14 @@ class PlatformChatCreateRequest(BaseModel): """ + text: Optional[PlatformChatCreateText] = None + r"""Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + + """ + @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["stream", "store", "conversation_id"]) + optional_fields = set(["stream", "store", "conversation_id", "text"]) serialized = handler(self) m = {} @@ -85,6 +159,10 @@ def serialize_model(self, handler): return m +try: + PlatformChatCreateText.model_rebuild() +except NameError: + pass try: PlatformChatCreateRequest.model_rebuild() except NameError: diff --git a/src/glean/api_client/models/platformagentrunerror.py b/src/glean/api_client/models/platformagentrunerror.py new file mode 100644 index 00000000..bc6da943 --- /dev/null +++ b/src/glean/api_client/models/platformagentrunerror.py @@ -0,0 +1,24 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from glean.api_client.types import BaseModel +from typing_extensions import TypedDict + + +class PlatformAgentRunErrorTypedDict(TypedDict): + r"""Caller-safe details of an agent run execution failure.""" + + code: str + r"""Machine-readable execution failure code.""" + message: str + r"""Caller-safe execution failure description.""" + + +class PlatformAgentRunError(BaseModel): + r"""Caller-safe details of an agent run execution failure.""" + + code: str + r"""Machine-readable execution failure code.""" + + message: str + r"""Caller-safe execution failure description.""" diff --git a/src/glean/api_client/models/platformagentrunresponse.py b/src/glean/api_client/models/platformagentrunresponse.py new file mode 100644 index 00000000..7c02b1ca --- /dev/null +++ b/src/glean/api_client/models/platformagentrunresponse.py @@ -0,0 +1,28 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .platformdurableagentrun import ( + PlatformDurableAgentRun, + PlatformDurableAgentRunTypedDict, +) +from glean.api_client.types import BaseModel +from typing_extensions import TypedDict + + +class PlatformAgentRunResponseTypedDict(TypedDict): + r"""Persisted agent run snapshot with a request ID for support correlation.""" + + run: PlatformDurableAgentRunTypedDict + r"""Agent run state, pending tool approvals, and output available independently of the creation request.""" + request_id: str + r"""Platform-generated request ID for support correlation.""" + + +class PlatformAgentRunResponse(BaseModel): + r"""Persisted agent run snapshot with a request ID for support correlation.""" + + run: PlatformDurableAgentRun + r"""Agent run state, pending tool approvals, and output available independently of the creation request.""" + + request_id: str + r"""Platform-generated request ID for support correlation.""" diff --git a/src/glean/api_client/models/platformagentrunstate.py b/src/glean/api_client/models/platformagentrunstate.py new file mode 100644 index 00000000..dc860898 --- /dev/null +++ b/src/glean/api_client/models/platformagentrunstate.py @@ -0,0 +1,18 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum +from glean.api_client import utils + + +class PlatformAgentRunState(str, Enum, metaclass=utils.OpenEnumMeta): + r"""State of the persisted workflow execution. REQUIRES_INPUT is nonterminal.""" + + QUEUED = "QUEUED" + RUNNING = "RUNNING" + REQUIRES_INPUT = "REQUIRES_INPUT" + SUCCEEDED = "SUCCEEDED" + FAILED = "FAILED" + CANCELLING = "CANCELLING" + CANCELLED = "CANCELLED" + EXPIRED = "EXPIRED" diff --git a/src/glean/api_client/models/platformagentruntoolapproval.py b/src/glean/api_client/models/platformagentruntoolapproval.py new file mode 100644 index 00000000..c51c46ed --- /dev/null +++ b/src/glean/api_client/models/platformagentruntoolapproval.py @@ -0,0 +1,75 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from datetime import datetime +from enum import Enum +from glean.api_client.types import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Any, Dict, Optional +from typing_extensions import NotRequired, TypedDict + + +class PlatformAgentRunToolApprovalType(str, Enum): + r"""Interaction type identifying a tool execution approval request.""" + + TOOL_APPROVAL = "TOOL_APPROVAL" + + +class PlatformAgentRunToolApprovalTypedDict(TypedDict): + r"""Pending approval for a specific persisted tool invocation and its arguments.""" + + interaction_id: str + r"""Identifies this specific invocation approval, not the tool definition.""" + type: PlatformAgentRunToolApprovalType + r"""Interaction type identifying a tool execution approval request.""" + display_name: str + r"""Display name of the tool requesting approval.""" + description: str + r"""Description of the tool associated with this approval request.""" + arguments: Dict[str, Any] + r"""Arguments from the persisted approval request. Older platform tools use flattened parameters.""" + tool_id: NotRequired[str] + r"""Platform tool identifier when recorded. Omitted for requests without one, such as some MCP tools.""" + expires_at: NotRequired[datetime] + r"""Approval deadline, when one is set. Omitted when the approval has no expiration.""" + + +class PlatformAgentRunToolApproval(BaseModel): + r"""Pending approval for a specific persisted tool invocation and its arguments.""" + + interaction_id: str + r"""Identifies this specific invocation approval, not the tool definition.""" + + type: PlatformAgentRunToolApprovalType + r"""Interaction type identifying a tool execution approval request.""" + + display_name: str + r"""Display name of the tool requesting approval.""" + + description: str + r"""Description of the tool associated with this approval request.""" + + arguments: Dict[str, Any] + r"""Arguments from the persisted approval request. Older platform tools use flattened parameters.""" + + tool_id: Optional[str] = None + r"""Platform tool identifier when recorded. Omitted for requests without one, such as some MCP tools.""" + + expires_at: Optional[datetime] = None + r"""Approval deadline, when one is set. Omitted when the approval has no expiration.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["tool_id", "expires_at"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/src/glean/api_client/models/platformchatjsonschemaformat.py b/src/glean/api_client/models/platformchatjsonschemaformat.py new file mode 100644 index 00000000..c22174e0 --- /dev/null +++ b/src/glean/api_client/models/platformchatjsonschemaformat.py @@ -0,0 +1,75 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum +from glean.api_client.types import BaseModel, UNSET_SENTINEL +import pydantic +from pydantic import model_serializer +from typing import Any, Dict, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class PlatformChatJSONSchemaFormatType(str, Enum): + r"""Discriminator. Must be JSON_SCHEMA.""" + + JSON_SCHEMA = "JSON_SCHEMA" + + +class PlatformChatJSONSchemaFormatTypedDict(TypedDict): + r"""Constrains the assistant response to a caller-supplied JSON Schema.""" + + type: PlatformChatJSONSchemaFormatType + r"""Discriminator. Must be JSON_SCHEMA.""" + name: str + r"""A stable identifier for the schema.""" + schema_: Dict[str, Any] + r"""A JSON Schema object describing the desired output shape.""" + description: NotRequired[str] + r"""An optional human-readable description of the schema.""" + strict: NotRequired[bool] + r"""When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true. + + """ + + +class PlatformChatJSONSchemaFormat(BaseModel): + r"""Constrains the assistant response to a caller-supplied JSON Schema.""" + + type: PlatformChatJSONSchemaFormatType + r"""Discriminator. Must be JSON_SCHEMA.""" + + name: str + r"""A stable identifier for the schema.""" + + schema_: Annotated[Dict[str, Any], pydantic.Field(alias="schema")] + r"""A JSON Schema object describing the desired output shape.""" + + description: Optional[str] = None + r"""An optional human-readable description of the schema.""" + + strict: Optional[bool] = True + r"""When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true. + + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["description", "strict"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + PlatformChatJSONSchemaFormat.model_rebuild() +except NameError: + pass diff --git a/src/glean/api_client/models/platformchatoutputtextcontent.py b/src/glean/api_client/models/platformchatoutputtextcontent.py index d3742527..eb56d9a1 100644 --- a/src/glean/api_client/models/platformchatoutputtextcontent.py +++ b/src/glean/api_client/models/platformchatoutputtextcontent.py @@ -6,7 +6,13 @@ PlatformChatCitationAnnotationTypedDict, ) from enum import Enum -from glean.api_client.types import BaseModel, UNSET_SENTINEL +from glean.api_client.types import ( + BaseModel, + Nullable, + OptionalNullable, + UNSET, + UNSET_SENTINEL, +) from pydantic import model_serializer from typing import List, Optional from typing_extensions import NotRequired, TypedDict @@ -16,9 +22,21 @@ class PlatformChatOutputTextContentType(str, Enum): OUTPUT_TEXT = "OUTPUT_TEXT" +class StructuredOutputTypedDict(TypedDict): + r"""Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`.""" + + +class StructuredOutput(BaseModel): + r"""Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`.""" + + class PlatformChatOutputTextContentTypedDict(TypedDict): type: PlatformChatOutputTextContentType text: str + structured_output: NotRequired[Nullable[StructuredOutputTypedDict]] + r"""Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. + + """ annotations: NotRequired[List[PlatformChatCitationAnnotationTypedDict]] @@ -27,20 +45,34 @@ class PlatformChatOutputTextContent(BaseModel): text: str + structured_output: OptionalNullable[StructuredOutput] = UNSET + r"""Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. + + """ + annotations: Optional[List[PlatformChatCitationAnnotation]] = None @model_serializer(mode="wrap") def serialize_model(self, handler): - optional_fields = set(["annotations"]) + optional_fields = set(["structured_output", "annotations"]) + nullable_fields = set(["structured_output"]) serialized = handler(self) m = {} for n, f in type(self).model_fields.items(): k = f.alias or n val = serialized.get(k, serialized.get(n)) + is_nullable_and_explicitly_set = ( + k in nullable_fields + and (self.__pydantic_fields_set__.intersection({n})) # pylint: disable=no-member + ) if val != UNSET_SENTINEL: - if val is not None or k not in optional_fields: + if ( + val is not None + or k not in optional_fields + or is_nullable_and_explicitly_set + ): m[k] = val return m diff --git a/src/glean/api_client/models/platformchattextformat.py b/src/glean/api_client/models/platformchattextformat.py new file mode 100644 index 00000000..aa54c4dc --- /dev/null +++ b/src/glean/api_client/models/platformchattextformat.py @@ -0,0 +1,26 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from enum import Enum +from glean.api_client.types import BaseModel +from typing_extensions import TypedDict + + +class PlatformChatTextFormatType(str, Enum): + r"""Discriminator. Must be TEXT.""" + + TEXT = "TEXT" + + +class PlatformChatTextFormatTypedDict(TypedDict): + r"""Unconstrained plain-text assistant output.""" + + type: PlatformChatTextFormatType + r"""Discriminator. Must be TEXT.""" + + +class PlatformChatTextFormat(BaseModel): + r"""Unconstrained plain-text assistant output.""" + + type: PlatformChatTextFormatType + r"""Discriminator. Must be TEXT.""" diff --git a/src/glean/api_client/models/platformdurableagentrun.py b/src/glean/api_client/models/platformdurableagentrun.py new file mode 100644 index 00000000..842b5cb8 --- /dev/null +++ b/src/glean/api_client/models/platformdurableagentrun.py @@ -0,0 +1,98 @@ +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .platformagentrunerror import PlatformAgentRunError, PlatformAgentRunErrorTypedDict +from .platformagentrunstate import PlatformAgentRunState +from .platformagentruntoolapproval import ( + PlatformAgentRunToolApproval, + PlatformAgentRunToolApprovalTypedDict, +) +from datetime import datetime +from glean.api_client import models +from glean.api_client.types import BaseModel, UNSET_SENTINEL +from pydantic import field_serializer, model_serializer +from typing import Any, Dict, List, Optional +from typing_extensions import NotRequired, TypedDict + + +class PlatformDurableAgentRunTypedDict(TypedDict): + r"""Agent run state, pending tool approvals, and output available independently of the creation request.""" + + run_id: str + r"""ID of the run, preserved across approval continuations.""" + agent_id: str + r"""ID of the agent that owns the run.""" + state: PlatformAgentRunState + r"""State of the persisted workflow execution. REQUIRES_INPUT is nonterminal.""" + created_at: datetime + r"""Timestamp when the run was first persisted.""" + updated_at: datetime + r"""Latest persisted activity timestamp across the execution and its messages, including checkpoint messages. This is not a worker heartbeat or an exact state-transition timestamp. + + """ + pending_interactions: List[PlatformAgentRunToolApprovalTypedDict] + r"""Unanswered tool approvals when the run is in REQUIRES_INPUT. Empty in other states.""" + expires_at: NotRequired[datetime] + r"""Execution deadline, when one is set. Not the run history retention deadline.""" + output: NotRequired[Dict[str, Any]] + r"""Accumulated text-only agent output under the messages key, when available.""" + error: NotRequired[PlatformAgentRunErrorTypedDict] + r"""Caller-safe details of an agent run execution failure.""" + + +class PlatformDurableAgentRun(BaseModel): + r"""Agent run state, pending tool approvals, and output available independently of the creation request.""" + + run_id: str + r"""ID of the run, preserved across approval continuations.""" + + agent_id: str + r"""ID of the agent that owns the run.""" + + state: PlatformAgentRunState + r"""State of the persisted workflow execution. REQUIRES_INPUT is nonterminal.""" + + created_at: datetime + r"""Timestamp when the run was first persisted.""" + + updated_at: datetime + r"""Latest persisted activity timestamp across the execution and its messages, including checkpoint messages. This is not a worker heartbeat or an exact state-transition timestamp. + + """ + + pending_interactions: List[PlatformAgentRunToolApproval] + r"""Unanswered tool approvals when the run is in REQUIRES_INPUT. Empty in other states.""" + + expires_at: Optional[datetime] = None + r"""Execution deadline, when one is set. Not the run history retention deadline.""" + + output: Optional[Dict[str, Any]] = None + r"""Accumulated text-only agent output under the messages key, when available.""" + + error: Optional[PlatformAgentRunError] = None + r"""Caller-safe details of an agent run execution failure.""" + + @field_serializer("state") + def serialize_state(self, value): + if isinstance(value, str): + try: + return models.PlatformAgentRunState(value) + except ValueError: + return value + return value + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["expires_at", "output", "error"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/tests/mockserver/internal/handler/generated_handlers.go b/tests/mockserver/internal/handler/generated_handlers.go index 8e541a71..7e24dd75 100644 --- a/tests/mockserver/internal/handler/generated_handlers.go +++ b/tests/mockserver/internal/handler/generated_handlers.go @@ -15,6 +15,7 @@ func GeneratedHandlers(ctx context.Context, dir *logging.HTTPFileDirectory, rt * NewGeneratedHandler(ctx, http.MethodDelete, "/rest/api/index/custom-metadata/schema/{groupName}", pathDeleteRestAPIIndexCustomMetadataSchemaGroupName(dir, rt)), NewGeneratedHandler(ctx, http.MethodDelete, "/rest/api/index/document/{docId}/custom-metadata/{groupName}", pathDeleteRestAPIIndexDocumentDocIDCustomMetadataGroupName(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/agents/{agent_id}", pathGetAPIAgentsAgentID(dir, rt)), + NewGeneratedHandler(ctx, http.MethodGet, "/api/agents/{agent_id}/runs/{run_id}", pathGetAPIAgentsAgentIDRunsRunID(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/agents/{agent_id}/schemas", pathGetAPIAgentsAgentIDSchemas(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/search/filters", pathGetAPISearchFilters(dir, rt)), NewGeneratedHandler(ctx, http.MethodGet, "/api/skills", pathGetAPISkills(dir, rt)), diff --git a/tests/mockserver/internal/handler/pathgetapiagentsagentidrunsrunid.go b/tests/mockserver/internal/handler/pathgetapiagentsagentidrunsrunid.go new file mode 100644 index 00000000..ef533289 --- /dev/null +++ b/tests/mockserver/internal/handler/pathgetapiagentsagentidrunsrunid.go @@ -0,0 +1,73 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package handler + +import ( + "fmt" + "log" + "mockserver/internal/handler/assert" + "mockserver/internal/logging" + "mockserver/internal/sdk/models/components" + "mockserver/internal/sdk/types" + "mockserver/internal/sdk/utils" + "mockserver/internal/tracking" + "net/http" +) + +func pathGetAPIAgentsAgentIDRunsRunID(dir *logging.HTTPFileDirectory, rt *tracking.RequestTracker) http.HandlerFunc { + return func(w http.ResponseWriter, req *http.Request) { + test := req.Header.Get("x-speakeasy-test-name") + instanceID := req.Header.Get("x-speakeasy-test-instance-id") + + count := rt.GetRequestCount(test, instanceID) + + switch fmt.Sprintf("%s[%d]", test, count) { + case "platform-agents-get-run[0]": + dir.HandlerFunc("platform-agents-get-run", testPlatformAgentsGetRunPlatformAgentsGetRun0)(w, req) + default: + http.Error(w, fmt.Sprintf("Unknown test: %s[%d]", test, count), http.StatusBadRequest) + } + } +} + +func testPlatformAgentsGetRunPlatformAgentsGetRun0(w http.ResponseWriter, req *http.Request) { + if err := assert.SecurityAuthorizationHeader(req, false, "Bearer"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusUnauthorized) + return + } + if err := assert.AcceptHeader(req, []string{"application/json"}); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + if err := assert.HeaderExists(req, "User-Agent"); err != nil { + log.Printf("assertion error: %s\n", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + var respBody *components.PlatformAgentRunResponse = &components.PlatformAgentRunResponse{ + Run: components.PlatformDurableAgentRun{ + RunID: "", + AgentID: "", + State: components.PlatformAgentRunStateCancelling, + CreatedAt: types.MustTimeFromString("2025-02-20T06:37:06.101Z"), + UpdatedAt: types.MustTimeFromString("2025-06-13T07:24:18.599Z"), + PendingInteractions: []components.PlatformAgentRunToolApproval{}, + }, + RequestID: "", + } + respBodyBytes, err := utils.MarshalJSON(respBody, "", true) + + if err != nil { + http.Error( + w, + "Unable to encode response body as JSON: "+err.Error(), + http.StatusInternalServerError, + ) + return + } + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) + _, _ = w.Write(respBodyBytes) +} diff --git a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go index 96d4127e..87401958 100644 --- a/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go +++ b/tests/mockserver/internal/handler/pathpostrestapiv1getchat.go @@ -628,8 +628,8 @@ func testGetchatGetchat0(w http.ResponseWriter, req *http.Request) { Roles: []components.UserRoleSpecification{}, SourceDocumentSpec: types.Pointer(components.CreateDocumentSpecUnionDocumentSpec3( components.DocumentSpec3{ - UgcType: components.DocumentSpecUgcType1Announcements, - ContentID: 848009, + UgcType: components.DocumentSpecUgcType1Shortcuts, + ContentID: 602763, }, )), SourceType: components.AnswerSourceTypeAssistant.ToPointer(), diff --git a/tests/mockserver/internal/sdk/models/components/feedentry.go b/tests/mockserver/internal/sdk/models/components/feedentry.go index e84bac4d..44f5dfe7 100644 --- a/tests/mockserver/internal/sdk/models/components/feedentry.go +++ b/tests/mockserver/internal/sdk/models/components/feedentry.go @@ -122,6 +122,8 @@ const ( JustificationTypeEditDoc JustificationType = "EDIT_DOC" JustificationTypeChatToArtifact JustificationType = "CHAT_TO_ARTIFACT" JustificationTypeShareArtifact JustificationType = "SHARE_ARTIFACT" + JustificationTypeCreateAgent JustificationType = "CREATE_AGENT" + JustificationTypeManagerInvite JustificationType = "MANAGER_INVITE" ) func (e JustificationType) ToPointer() *JustificationType { @@ -264,6 +266,10 @@ func (e *JustificationType) UnmarshalJSON(data []byte) error { case "CHAT_TO_ARTIFACT": fallthrough case "SHARE_ARTIFACT": + fallthrough + case "CREATE_AGENT": + fallthrough + case "MANAGER_INVITE": *e = JustificationType(v) return nil default: diff --git a/tests/mockserver/internal/sdk/models/components/feedrequest.go b/tests/mockserver/internal/sdk/models/components/feedrequest.go index ea9a683c..9489bdd5 100644 --- a/tests/mockserver/internal/sdk/models/components/feedrequest.go +++ b/tests/mockserver/internal/sdk/models/components/feedrequest.go @@ -62,6 +62,8 @@ const ( FeedRequestCategoryEditDoc FeedRequestCategory = "EDIT_DOC" FeedRequestCategoryChatToArtifact FeedRequestCategory = "CHAT_TO_ARTIFACT" FeedRequestCategoryShareArtifact FeedRequestCategory = "SHARE_ARTIFACT" + FeedRequestCategoryCreateAgent FeedRequestCategory = "CREATE_AGENT" + FeedRequestCategoryManagerInvite FeedRequestCategory = "MANAGER_INVITE" ) func (e FeedRequestCategory) ToPointer() *FeedRequestCategory { @@ -176,6 +178,10 @@ func (e *FeedRequestCategory) UnmarshalJSON(data []byte) error { case "CHAT_TO_ARTIFACT": fallthrough case "SHARE_ARTIFACT": + fallthrough + case "CREATE_AGENT": + fallthrough + case "MANAGER_INVITE": *e = FeedRequestCategory(v) return nil default: diff --git a/tests/mockserver/internal/sdk/models/components/feedresult.go b/tests/mockserver/internal/sdk/models/components/feedresult.go index 6e4408b5..4d9a33d3 100644 --- a/tests/mockserver/internal/sdk/models/components/feedresult.go +++ b/tests/mockserver/internal/sdk/models/components/feedresult.go @@ -63,6 +63,8 @@ const ( FeedResultCategoryEditDoc FeedResultCategory = "EDIT_DOC" FeedResultCategoryChatToArtifact FeedResultCategory = "CHAT_TO_ARTIFACT" FeedResultCategoryShareArtifact FeedResultCategory = "SHARE_ARTIFACT" + FeedResultCategoryCreateAgent FeedResultCategory = "CREATE_AGENT" + FeedResultCategoryManagerInvite FeedResultCategory = "MANAGER_INVITE" ) func (e FeedResultCategory) ToPointer() *FeedResultCategory { @@ -177,6 +179,10 @@ func (e *FeedResultCategory) UnmarshalJSON(data []byte) error { case "CHAT_TO_ARTIFACT": fallthrough case "SHARE_ARTIFACT": + fallthrough + case "CREATE_AGENT": + fallthrough + case "MANAGER_INVITE": *e = FeedResultCategory(v) return nil default: diff --git a/tests/mockserver/internal/sdk/models/components/platformagentrunerror.go b/tests/mockserver/internal/sdk/models/components/platformagentrunerror.go new file mode 100644 index 00000000..da40549a --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformagentrunerror.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PlatformAgentRunError - Caller-safe details of an agent run execution failure. +type PlatformAgentRunError struct { + // Machine-readable execution failure code. + Code string `json:"code"` + // Caller-safe execution failure description. + Message string `json:"message"` +} + +func (o *PlatformAgentRunError) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *PlatformAgentRunError) GetMessage() string { + if o == nil { + return "" + } + return o.Message +} diff --git a/tests/mockserver/internal/sdk/models/components/platformagentrunresponse.go b/tests/mockserver/internal/sdk/models/components/platformagentrunresponse.go new file mode 100644 index 00000000..829fc728 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformagentrunresponse.go @@ -0,0 +1,25 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +// PlatformAgentRunResponse - Persisted agent run snapshot with a request ID for support correlation. +type PlatformAgentRunResponse struct { + // Agent run state, pending tool approvals, and output available independently of the creation request. + Run PlatformDurableAgentRun `json:"run"` + // Platform-generated request ID for support correlation. + RequestID string `json:"request_id"` +} + +func (o *PlatformAgentRunResponse) GetRun() PlatformDurableAgentRun { + if o == nil { + return PlatformDurableAgentRun{} + } + return o.Run +} + +func (o *PlatformAgentRunResponse) GetRequestID() string { + if o == nil { + return "" + } + return o.RequestID +} diff --git a/tests/mockserver/internal/sdk/models/components/platformagentrunstate.go b/tests/mockserver/internal/sdk/models/components/platformagentrunstate.go new file mode 100644 index 00000000..76009fe7 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformagentrunstate.go @@ -0,0 +1,53 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" +) + +// PlatformAgentRunState - State of the persisted workflow execution. REQUIRES_INPUT is nonterminal. +type PlatformAgentRunState string + +const ( + PlatformAgentRunStateQueued PlatformAgentRunState = "QUEUED" + PlatformAgentRunStateRunning PlatformAgentRunState = "RUNNING" + PlatformAgentRunStateRequiresInput PlatformAgentRunState = "REQUIRES_INPUT" + PlatformAgentRunStateSucceeded PlatformAgentRunState = "SUCCEEDED" + PlatformAgentRunStateFailed PlatformAgentRunState = "FAILED" + PlatformAgentRunStateCancelling PlatformAgentRunState = "CANCELLING" + PlatformAgentRunStateCancelled PlatformAgentRunState = "CANCELLED" + PlatformAgentRunStateExpired PlatformAgentRunState = "EXPIRED" +) + +func (e PlatformAgentRunState) ToPointer() *PlatformAgentRunState { + return &e +} +func (e *PlatformAgentRunState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "QUEUED": + fallthrough + case "RUNNING": + fallthrough + case "REQUIRES_INPUT": + fallthrough + case "SUCCEEDED": + fallthrough + case "FAILED": + fallthrough + case "CANCELLING": + fallthrough + case "CANCELLED": + fallthrough + case "EXPIRED": + *e = PlatformAgentRunState(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformAgentRunState: %v", v) + } +} diff --git a/tests/mockserver/internal/sdk/models/components/platformagentruntoolapproval.go b/tests/mockserver/internal/sdk/models/components/platformagentruntoolapproval.go new file mode 100644 index 00000000..9037db21 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformagentruntoolapproval.go @@ -0,0 +1,112 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" + "time" +) + +// PlatformAgentRunToolApprovalType - Interaction type identifying a tool execution approval request. +type PlatformAgentRunToolApprovalType string + +const ( + PlatformAgentRunToolApprovalTypeToolApproval PlatformAgentRunToolApprovalType = "TOOL_APPROVAL" +) + +func (e PlatformAgentRunToolApprovalType) ToPointer() *PlatformAgentRunToolApprovalType { + return &e +} +func (e *PlatformAgentRunToolApprovalType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TOOL_APPROVAL": + *e = PlatformAgentRunToolApprovalType(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformAgentRunToolApprovalType: %v", v) + } +} + +// PlatformAgentRunToolApproval - Pending approval for a specific persisted tool invocation and its arguments. +type PlatformAgentRunToolApproval struct { + // Identifies this specific invocation approval, not the tool definition. + InteractionID string `json:"interaction_id"` + // Interaction type identifying a tool execution approval request. + Type PlatformAgentRunToolApprovalType `json:"type"` + // Platform tool identifier when recorded. Omitted for requests without one, such as some MCP tools. + ToolID *string `json:"tool_id,omitempty"` + // Display name of the tool requesting approval. + DisplayName string `json:"display_name"` + // Description of the tool associated with this approval request. + Description string `json:"description"` + // Arguments from the persisted approval request. Older platform tools use flattened parameters. + Arguments map[string]any `json:"arguments"` + // Approval deadline, when one is set. Omitted when the approval has no expiration. + ExpiresAt *time.Time `json:"expires_at,omitempty"` +} + +func (p PlatformAgentRunToolApproval) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformAgentRunToolApproval) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"interaction_id", "type", "display_name", "description", "arguments"}); err != nil { + return err + } + return nil +} + +func (o *PlatformAgentRunToolApproval) GetInteractionID() string { + if o == nil { + return "" + } + return o.InteractionID +} + +func (o *PlatformAgentRunToolApproval) GetType() PlatformAgentRunToolApprovalType { + if o == nil { + return PlatformAgentRunToolApprovalType("") + } + return o.Type +} + +func (o *PlatformAgentRunToolApproval) GetToolID() *string { + if o == nil { + return nil + } + return o.ToolID +} + +func (o *PlatformAgentRunToolApproval) GetDisplayName() string { + if o == nil { + return "" + } + return o.DisplayName +} + +func (o *PlatformAgentRunToolApproval) GetDescription() string { + if o == nil { + return "" + } + return o.Description +} + +func (o *PlatformAgentRunToolApproval) GetArguments() map[string]any { + if o == nil { + return map[string]any{} + } + return o.Arguments +} + +func (o *PlatformAgentRunToolApproval) GetExpiresAt() *time.Time { + if o == nil { + return nil + } + return o.ExpiresAt +} diff --git a/tests/mockserver/internal/sdk/models/components/platformchatjsonschemaformat.go b/tests/mockserver/internal/sdk/models/components/platformchatjsonschemaformat.go new file mode 100644 index 00000000..c4d9b004 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformchatjsonschemaformat.go @@ -0,0 +1,94 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" +) + +// PlatformChatJSONSchemaFormatType - Discriminator. Must be JSON_SCHEMA. +type PlatformChatJSONSchemaFormatType string + +const ( + PlatformChatJSONSchemaFormatTypeJSONSchema PlatformChatJSONSchemaFormatType = "JSON_SCHEMA" +) + +func (e PlatformChatJSONSchemaFormatType) ToPointer() *PlatformChatJSONSchemaFormatType { + return &e +} +func (e *PlatformChatJSONSchemaFormatType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "JSON_SCHEMA": + *e = PlatformChatJSONSchemaFormatType(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformChatJSONSchemaFormatType: %v", v) + } +} + +// PlatformChatJSONSchemaFormat - Constrains the assistant response to a caller-supplied JSON Schema. +type PlatformChatJSONSchemaFormat struct { + // Discriminator. Must be JSON_SCHEMA. + Type PlatformChatJSONSchemaFormatType `json:"type"` + // A stable identifier for the schema. + Name string `json:"name"` + // An optional human-readable description of the schema. + Description *string `json:"description,omitempty"` + // A JSON Schema object describing the desired output shape. + Schema map[string]any `json:"schema"` + // When true, the provider validates the response against the schema. Unsupported by some providers; defaults to true. + // + Strict *bool `default:"true" json:"strict"` +} + +func (p PlatformChatJSONSchemaFormat) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformChatJSONSchemaFormat) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"type", "name", "schema"}); err != nil { + return err + } + return nil +} + +func (o *PlatformChatJSONSchemaFormat) GetType() PlatformChatJSONSchemaFormatType { + if o == nil { + return PlatformChatJSONSchemaFormatType("") + } + return o.Type +} + +func (o *PlatformChatJSONSchemaFormat) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *PlatformChatJSONSchemaFormat) GetDescription() *string { + if o == nil { + return nil + } + return o.Description +} + +func (o *PlatformChatJSONSchemaFormat) GetSchema() map[string]any { + if o == nil { + return map[string]any{} + } + return o.Schema +} + +func (o *PlatformChatJSONSchemaFormat) GetStrict() *bool { + if o == nil { + return nil + } + return o.Strict +} diff --git a/tests/mockserver/internal/sdk/models/components/platformchatoutputtextcontent.go b/tests/mockserver/internal/sdk/models/components/platformchatoutputtextcontent.go index f3be4768..098822c3 100644 --- a/tests/mockserver/internal/sdk/models/components/platformchatoutputtextcontent.go +++ b/tests/mockserver/internal/sdk/models/components/platformchatoutputtextcontent.go @@ -5,6 +5,7 @@ package components import ( "encoding/json" "fmt" + "mockserver/internal/sdk/optionalnullable" "mockserver/internal/sdk/utils" ) @@ -31,10 +32,28 @@ func (e *PlatformChatOutputTextContentType) UnmarshalJSON(data []byte) error { } } +// StructuredOutput - Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. +type StructuredOutput struct { +} + +func (s StructuredOutput) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(s, "", false) +} + +func (s *StructuredOutput) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &s, "", false, nil); err != nil { + return err + } + return nil +} + type PlatformChatOutputTextContent struct { - Type PlatformChatOutputTextContentType `json:"type"` - Text string `json:"text"` - Annotations []PlatformChatCitationAnnotation `json:"annotations,omitempty"` + Type PlatformChatOutputTextContentType `json:"type"` + Text string `json:"text"` + // Parsed and validated JSON object when structured output was requested. Present only when the request included `text.format.type: JSON_SCHEMA`. + // + StructuredOutput optionalnullable.OptionalNullable[StructuredOutput] `json:"structured_output,omitempty"` + Annotations []PlatformChatCitationAnnotation `json:"annotations,omitempty"` } func (p PlatformChatOutputTextContent) MarshalJSON() ([]byte, error) { @@ -62,6 +81,13 @@ func (o *PlatformChatOutputTextContent) GetText() string { return o.Text } +func (o *PlatformChatOutputTextContent) GetStructuredOutput() optionalnullable.OptionalNullable[StructuredOutput] { + if o == nil { + return nil + } + return o.StructuredOutput +} + func (o *PlatformChatOutputTextContent) GetAnnotations() []PlatformChatCitationAnnotation { if o == nil { return nil diff --git a/tests/mockserver/internal/sdk/models/components/platformchattextformat.go b/tests/mockserver/internal/sdk/models/components/platformchattextformat.go new file mode 100644 index 00000000..2549e793 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformchattextformat.go @@ -0,0 +1,57 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "encoding/json" + "fmt" + "mockserver/internal/sdk/utils" +) + +// PlatformChatTextFormatType - Discriminator. Must be TEXT. +type PlatformChatTextFormatType string + +const ( + PlatformChatTextFormatTypeText PlatformChatTextFormatType = "TEXT" +) + +func (e PlatformChatTextFormatType) ToPointer() *PlatformChatTextFormatType { + return &e +} +func (e *PlatformChatTextFormatType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TEXT": + *e = PlatformChatTextFormatType(v) + return nil + default: + return fmt.Errorf("invalid value for PlatformChatTextFormatType: %v", v) + } +} + +// PlatformChatTextFormat - Unconstrained plain-text assistant output. +type PlatformChatTextFormat struct { + // Discriminator. Must be TEXT. + Type PlatformChatTextFormatType `json:"type"` +} + +func (p PlatformChatTextFormat) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformChatTextFormat) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"type"}); err != nil { + return err + } + return nil +} + +func (o *PlatformChatTextFormat) GetType() PlatformChatTextFormatType { + if o == nil { + return PlatformChatTextFormatType("") + } + return o.Type +} diff --git a/tests/mockserver/internal/sdk/models/components/platformdurableagentrun.go b/tests/mockserver/internal/sdk/models/components/platformdurableagentrun.go new file mode 100644 index 00000000..0e838da6 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/components/platformdurableagentrun.go @@ -0,0 +1,105 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "mockserver/internal/sdk/utils" + "time" +) + +// PlatformDurableAgentRun - Agent run state, pending tool approvals, and output available independently of the creation request. +type PlatformDurableAgentRun struct { + // ID of the run, preserved across approval continuations. + RunID string `json:"run_id"` + // ID of the agent that owns the run. + AgentID string `json:"agent_id"` + // State of the persisted workflow execution. REQUIRES_INPUT is nonterminal. + State PlatformAgentRunState `json:"state"` + // Timestamp when the run was first persisted. + CreatedAt time.Time `json:"created_at"` + // Latest persisted activity timestamp across the execution and its messages, including checkpoint messages. This is not a worker heartbeat or an exact state-transition timestamp. + // + UpdatedAt time.Time `json:"updated_at"` + // Execution deadline, when one is set. Not the run history retention deadline. + ExpiresAt *time.Time `json:"expires_at,omitempty"` + // Unanswered tool approvals when the run is in REQUIRES_INPUT. Empty in other states. + PendingInteractions []PlatformAgentRunToolApproval `json:"pending_interactions"` + // Accumulated text-only agent output under the messages key, when available. + Output map[string]any `json:"output,omitempty"` + // Caller-safe details of an agent run execution failure. + Error *PlatformAgentRunError `json:"error,omitempty"` +} + +func (p PlatformDurableAgentRun) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlatformDurableAgentRun) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, []string{"run_id", "agent_id", "state", "created_at", "updated_at", "pending_interactions"}); err != nil { + return err + } + return nil +} + +func (o *PlatformDurableAgentRun) GetRunID() string { + if o == nil { + return "" + } + return o.RunID +} + +func (o *PlatformDurableAgentRun) GetAgentID() string { + if o == nil { + return "" + } + return o.AgentID +} + +func (o *PlatformDurableAgentRun) GetState() PlatformAgentRunState { + if o == nil { + return PlatformAgentRunState("") + } + return o.State +} + +func (o *PlatformDurableAgentRun) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *PlatformDurableAgentRun) GetUpdatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.UpdatedAt +} + +func (o *PlatformDurableAgentRun) GetExpiresAt() *time.Time { + if o == nil { + return nil + } + return o.ExpiresAt +} + +func (o *PlatformDurableAgentRun) GetPendingInteractions() []PlatformAgentRunToolApproval { + if o == nil { + return []PlatformAgentRunToolApproval{} + } + return o.PendingInteractions +} + +func (o *PlatformDurableAgentRun) GetOutput() map[string]any { + if o == nil { + return nil + } + return o.Output +} + +func (o *PlatformDurableAgentRun) GetError() *PlatformAgentRunError { + if o == nil { + return nil + } + return o.Error +} diff --git a/tests/mockserver/internal/sdk/models/operations/platformagentsgetrun.go b/tests/mockserver/internal/sdk/models/operations/platformagentsgetrun.go new file mode 100644 index 00000000..51427bc4 --- /dev/null +++ b/tests/mockserver/internal/sdk/models/operations/platformagentsgetrun.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "mockserver/internal/sdk/models/components" +) + +type PlatformAgentsGetRunRequest struct { + // ID of the agent that owns the run. + AgentID string `pathParam:"style=simple,explode=false,name=agent_id"` + // ID of the durable run to retrieve. + RunID string `pathParam:"style=simple,explode=false,name=run_id"` +} + +func (o *PlatformAgentsGetRunRequest) GetAgentID() string { + if o == nil { + return "" + } + return o.AgentID +} + +func (o *PlatformAgentsGetRunRequest) GetRunID() string { + if o == nil { + return "" + } + return o.RunID +} + +type PlatformAgentsGetRunResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Current persisted run snapshot. A failed execution is still a successful retrieval. + PlatformAgentRunResponse *components.PlatformAgentRunResponse +} + +func (o *PlatformAgentsGetRunResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *PlatformAgentsGetRunResponse) GetPlatformAgentRunResponse() *components.PlatformAgentRunResponse { + if o == nil { + return nil + } + return o.PlatformAgentRunResponse +} diff --git a/tests/mockserver/internal/sdk/models/operations/platformchatcreate.go b/tests/mockserver/internal/sdk/models/operations/platformchatcreate.go index c9dbd053..58f6721f 100644 --- a/tests/mockserver/internal/sdk/models/operations/platformchatcreate.go +++ b/tests/mockserver/internal/sdk/models/operations/platformchatcreate.go @@ -3,6 +3,7 @@ package operations import ( + "encoding/json" "errors" "fmt" "mockserver/internal/sdk/models/components" @@ -74,6 +75,120 @@ func (u PlatformChatCreateInput) MarshalJSON() ([]byte, error) { return nil, errors.New("could not marshal union type PlatformChatCreateInput: all fields are null") } +type PlatformChatCreateFormatType string + +const ( + PlatformChatCreateFormatTypeText PlatformChatCreateFormatType = "TEXT" + PlatformChatCreateFormatTypeJSONSchema PlatformChatCreateFormatType = "JSON_SCHEMA" +) + +// PlatformChatCreateFormat - Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. +type PlatformChatCreateFormat struct { + PlatformChatTextFormat *components.PlatformChatTextFormat `queryParam:"inline"` + PlatformChatJSONSchemaFormat *components.PlatformChatJSONSchemaFormat `queryParam:"inline"` + + Type PlatformChatCreateFormatType +} + +func CreatePlatformChatCreateFormatText(text components.PlatformChatTextFormat) PlatformChatCreateFormat { + typ := PlatformChatCreateFormatTypeText + + typStr := components.PlatformChatTextFormatType(typ) + text.Type = typStr + + return PlatformChatCreateFormat{ + PlatformChatTextFormat: &text, + Type: typ, + } +} + +func CreatePlatformChatCreateFormatJSONSchema(jsonSchema components.PlatformChatJSONSchemaFormat) PlatformChatCreateFormat { + typ := PlatformChatCreateFormatTypeJSONSchema + + typStr := components.PlatformChatJSONSchemaFormatType(typ) + jsonSchema.Type = typStr + + return PlatformChatCreateFormat{ + PlatformChatJSONSchemaFormat: &jsonSchema, + Type: typ, + } +} + +func (u *PlatformChatCreateFormat) UnmarshalJSON(data []byte) error { + + type discriminator struct { + Type string `json:"type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.Type { + case "TEXT": + platformChatTextFormat := new(components.PlatformChatTextFormat) + if err := utils.UnmarshalJSON(data, &platformChatTextFormat, "", true, nil); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (Type == TEXT) type components.PlatformChatTextFormat within PlatformChatCreateFormat: %w", string(data), err) + } + + u.PlatformChatTextFormat = platformChatTextFormat + u.Type = PlatformChatCreateFormatTypeText + return nil + case "JSON_SCHEMA": + platformChatJSONSchemaFormat := new(components.PlatformChatJSONSchemaFormat) + if err := utils.UnmarshalJSON(data, &platformChatJSONSchemaFormat, "", true, nil); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (Type == JSON_SCHEMA) type components.PlatformChatJSONSchemaFormat within PlatformChatCreateFormat: %w", string(data), err) + } + + u.PlatformChatJSONSchemaFormat = platformChatJSONSchemaFormat + u.Type = PlatformChatCreateFormatTypeJSONSchema + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for PlatformChatCreateFormat", string(data)) +} + +func (u PlatformChatCreateFormat) MarshalJSON() ([]byte, error) { + if u.PlatformChatTextFormat != nil { + return utils.MarshalJSON(u.PlatformChatTextFormat, "", true) + } + + if u.PlatformChatJSONSchemaFormat != nil { + return utils.MarshalJSON(u.PlatformChatJSONSchemaFormat, "", true) + } + + return nil, errors.New("could not marshal union type PlatformChatCreateFormat: all fields are null") +} + +// PlatformChatCreateText - Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. +type PlatformChatCreateText struct { + // Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + // + Format *PlatformChatCreateFormat `json:"format,omitempty"` +} + +func (o *PlatformChatCreateText) GetFormat() *PlatformChatCreateFormat { + if o == nil { + return nil + } + return o.Format +} + +func (o *PlatformChatCreateText) GetFormatText() *components.PlatformChatTextFormat { + if v := o.GetFormat(); v != nil { + return v.PlatformChatTextFormat + } + return nil +} + +func (o *PlatformChatCreateText) GetFormatJSONSchema() *components.PlatformChatJSONSchemaFormat { + if v := o.GetFormat(); v != nil { + return v.PlatformChatJSONSchemaFormat + } + return nil +} + type PlatformChatCreateRequest struct { // Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`. // @@ -85,6 +200,9 @@ type PlatformChatCreateRequest struct { // Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. // ConversationID *string `json:"conversation_id,omitempty"` + // Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + // + Text *PlatformChatCreateText `json:"text,omitempty"` } func (p PlatformChatCreateRequest) MarshalJSON() ([]byte, error) { @@ -123,6 +241,13 @@ func (o *PlatformChatCreateRequest) GetConversationID() *string { return o.ConversationID } +func (o *PlatformChatCreateRequest) GetText() *PlatformChatCreateText { + if o == nil { + return nil + } + return o.Text +} + type PlatformChatCreateResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Successful response. diff --git a/tests/mockserver/internal/sdk/models/operations/platformchatcreatestream.go b/tests/mockserver/internal/sdk/models/operations/platformchatcreatestream.go index d94a54b7..72e44e52 100644 --- a/tests/mockserver/internal/sdk/models/operations/platformchatcreatestream.go +++ b/tests/mockserver/internal/sdk/models/operations/platformchatcreatestream.go @@ -3,6 +3,7 @@ package operations import ( + "encoding/json" "errors" "fmt" "mockserver/internal/sdk/models/components" @@ -75,6 +76,120 @@ func (u PlatformChatCreateStreamInput) MarshalJSON() ([]byte, error) { return nil, errors.New("could not marshal union type PlatformChatCreateStreamInput: all fields are null") } +type PlatformChatCreateStreamFormatType string + +const ( + PlatformChatCreateStreamFormatTypeText PlatformChatCreateStreamFormatType = "TEXT" + PlatformChatCreateStreamFormatTypeJSONSchema PlatformChatCreateStreamFormatType = "JSON_SCHEMA" +) + +// PlatformChatCreateStreamFormat - Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. +type PlatformChatCreateStreamFormat struct { + PlatformChatTextFormat *components.PlatformChatTextFormat `queryParam:"inline"` + PlatformChatJSONSchemaFormat *components.PlatformChatJSONSchemaFormat `queryParam:"inline"` + + Type PlatformChatCreateStreamFormatType +} + +func CreatePlatformChatCreateStreamFormatText(text components.PlatformChatTextFormat) PlatformChatCreateStreamFormat { + typ := PlatformChatCreateStreamFormatTypeText + + typStr := components.PlatformChatTextFormatType(typ) + text.Type = typStr + + return PlatformChatCreateStreamFormat{ + PlatformChatTextFormat: &text, + Type: typ, + } +} + +func CreatePlatformChatCreateStreamFormatJSONSchema(jsonSchema components.PlatformChatJSONSchemaFormat) PlatformChatCreateStreamFormat { + typ := PlatformChatCreateStreamFormatTypeJSONSchema + + typStr := components.PlatformChatJSONSchemaFormatType(typ) + jsonSchema.Type = typStr + + return PlatformChatCreateStreamFormat{ + PlatformChatJSONSchemaFormat: &jsonSchema, + Type: typ, + } +} + +func (u *PlatformChatCreateStreamFormat) UnmarshalJSON(data []byte) error { + + type discriminator struct { + Type string `json:"type"` + } + + dis := new(discriminator) + if err := json.Unmarshal(data, &dis); err != nil { + return fmt.Errorf("could not unmarshal discriminator: %w", err) + } + + switch dis.Type { + case "TEXT": + platformChatTextFormat := new(components.PlatformChatTextFormat) + if err := utils.UnmarshalJSON(data, &platformChatTextFormat, "", true, nil); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (Type == TEXT) type components.PlatformChatTextFormat within PlatformChatCreateStreamFormat: %w", string(data), err) + } + + u.PlatformChatTextFormat = platformChatTextFormat + u.Type = PlatformChatCreateStreamFormatTypeText + return nil + case "JSON_SCHEMA": + platformChatJSONSchemaFormat := new(components.PlatformChatJSONSchemaFormat) + if err := utils.UnmarshalJSON(data, &platformChatJSONSchemaFormat, "", true, nil); err != nil { + return fmt.Errorf("could not unmarshal `%s` into expected (Type == JSON_SCHEMA) type components.PlatformChatJSONSchemaFormat within PlatformChatCreateStreamFormat: %w", string(data), err) + } + + u.PlatformChatJSONSchemaFormat = platformChatJSONSchemaFormat + u.Type = PlatformChatCreateStreamFormatTypeJSONSchema + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for PlatformChatCreateStreamFormat", string(data)) +} + +func (u PlatformChatCreateStreamFormat) MarshalJSON() ([]byte, error) { + if u.PlatformChatTextFormat != nil { + return utils.MarshalJSON(u.PlatformChatTextFormat, "", true) + } + + if u.PlatformChatJSONSchemaFormat != nil { + return utils.MarshalJSON(u.PlatformChatJSONSchemaFormat, "", true) + } + + return nil, errors.New("could not marshal union type PlatformChatCreateStreamFormat: all fields are null") +} + +// PlatformChatCreateStreamText - Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. +type PlatformChatCreateStreamText struct { + // Output format for the assistant text. TEXT is unconstrained. JSON_SCHEMA constrains the response to the supplied schema. + // + Format *PlatformChatCreateStreamFormat `json:"format,omitempty"` +} + +func (o *PlatformChatCreateStreamText) GetFormat() *PlatformChatCreateStreamFormat { + if o == nil { + return nil + } + return o.Format +} + +func (o *PlatformChatCreateStreamText) GetFormatText() *components.PlatformChatTextFormat { + if v := o.GetFormat(); v != nil { + return v.PlatformChatTextFormat + } + return nil +} + +func (o *PlatformChatCreateStreamText) GetFormatJSONSchema() *components.PlatformChatJSONSchemaFormat { + if v := o.GetFormat(); v != nil { + return v.PlatformChatJSONSchemaFormat + } + return nil +} + type PlatformChatCreateStreamRequest struct { // Either a plain string (single user turn) or a chronological array of `USER`/`ASSISTANT` messages. The final array message must be `USER`. // @@ -86,6 +201,9 @@ type PlatformChatCreateStreamRequest struct { // Continue an existing stored conversation. Incompatible with message-array `input` and with `store: false`. // ConversationID *string `json:"conversation_id,omitempty"` + // Optional configuration for the assistant's text response. When `format.type` is `JSON_SCHEMA`, the response is constrained to the supplied JSON schema and returned in `output[*].content[*].structured_output`. Structured output is not supported when `stream` is true. + // + Text *PlatformChatCreateStreamText `json:"text,omitempty"` } func (p PlatformChatCreateStreamRequest) MarshalJSON() ([]byte, error) { @@ -124,6 +242,13 @@ func (o *PlatformChatCreateStreamRequest) GetConversationID() *string { return o.ConversationID } +func (o *PlatformChatCreateStreamRequest) GetText() *PlatformChatCreateStreamText { + if o == nil { + return nil + } + return o.Text +} + type PlatformChatCreateStreamResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Successful response. diff --git a/tests/test_agents.py b/tests/test_agents.py index 39a3f77b..e0b97e2a 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -144,3 +144,17 @@ def test_agents_platform_agents_create_run(): stream=False, ) assert res is not None + + +def test_agents_platform_agents_get_run(): + test_http_client = create_test_http_client("platform-agents-get-run") + + with Glean( + server_url=os.getenv("TEST_SERVER_URL", "http://localhost:18080"), + client=test_http_client, + api_token=os.getenv("GLEAN_API_TOKEN", "value"), + ) as glean: + assert glean is not None + + res = glean.agents.get_run(agent_id="{agent_id}", run_id="{run_id}") + assert res is not None diff --git a/tests/test_chat_sdk.py b/tests/test_chat_sdk.py index 80a92728..cfc1294c 100644 --- a/tests/test_chat_sdk.py +++ b/tests/test_chat_sdk.py @@ -1,6 +1,6 @@ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" -from glean.api_client import Glean +from glean.api_client import Glean, models import os from tests.test_client import create_test_http_client @@ -15,5 +15,30 @@ def test_chat_sdk_platform_chat_create(): ) as glean: assert glean is not None - res = glean.chat.create(input="What is our parental leave policy?", store=True) + res = glean.chat.create( + input="Summarize our parental leave policy as JSON.", + store=True, + text={ + "format_": { + "type": models.PlatformChatJSONSchemaFormatType.JSON_SCHEMA, + "name": "policy_summary", + "schema_": { + "properties": { + "duration_weeks": { + "type": "integer", + }, + "eligible_employees": { + "type": "string", + }, + }, + "required": [ + "eligible_employees", + "duration_weeks", + ], + "type": "object", + }, + "strict": True, + }, + }, + ) assert res is not None diff --git a/tests/test_messages.py b/tests/test_messages.py index 132005ec..36643db3 100644 --- a/tests/test_messages.py +++ b/tests/test_messages.py @@ -18,7 +18,7 @@ def test_messages_messages(): res = glean.client.messages.retrieve( id_type=models.IDType.CONVERSATION_ID, id="", - datasource=models.Datasource.FACEBOOKWORKPLACE, + datasource=models.Datasource.MICROSOFTTEAMS, timestamp_millis=558834, ) assert res is not None diff --git a/tests/test_summarize.py b/tests/test_summarize.py index 072b3207..df71d57d 100644 --- a/tests/test_summarize.py +++ b/tests/test_summarize.py @@ -18,11 +18,12 @@ def test_summarize_summarize(): res = glean.client.documents.summarize( document_specs=[ { - "id": "", + "ugc_type": models.DocumentSpecUgcType2.ANNOUNCEMENTS, + "ugc_id": "", }, { - "ugc_type": models.DocumentSpecUgcType2.SHORTCUTS, - "ugc_id": "", + "ugc_type": models.DocumentSpecUgcType1.COLLECTIONS, + "content_id": 885812, }, ] )