writer 0.8.3rc4__py3-none-any.whl → 1.25.1rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- writer/__init__.py +1 -1
- writer/abstract.py +1 -1
- writer/{ai.py → ai/__init__.py} +867 -163
- writer/app_runner.py +596 -241
- writer/app_templates/default/.wf/components-blueprints_blueprint-0-0decp3w5erhvl0nw.jsonl +11 -0
- writer/app_templates/default/.wf/components-blueprints_root.jsonl +1 -0
- writer/app_templates/default/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl +27 -0
- writer/app_templates/default/.wf/components-root.jsonl +1 -0
- writer/app_templates/default/.wf/components-workflows_root.jsonl +1 -0
- writer/app_templates/default/.wf/components-workflows_workflow-0-lfltcky7l1fsm6j2.jsonl +1 -0
- writer/app_templates/default/.wf/metadata.json +3 -0
- writer/app_templates/default/README.md +3 -0
- writer/app_templates/default/main.py +16 -0
- writer/app_templates/default/requirements.txt +1 -0
- writer/app_templates/default/static/README.md +8 -0
- writer/app_templates/default/static/agent_builder_demo.png +0 -0
- writer/app_templates/default/static/favicon.png +0 -0
- writer/app_templates/hello/.wf/components-blueprints_blueprint-0-t84xyhxau9ej3823.jsonl +18 -0
- writer/app_templates/hello/.wf/components-blueprints_root.jsonl +1 -0
- writer/app_templates/hello/.wf/components-page-0-c0f99a9e-5004-4e75-a6c6-36f17490b134.jsonl +15 -0
- writer/app_templates/hello/.wf/components-root.jsonl +1 -0
- writer/app_templates/hello/.wf/metadata.json +3 -0
- writer/app_templates/hello/main.py +16 -0
- writer/app_templates/hello/static/README.md +8 -0
- writer/app_templates/hello/static/favicon.png +0 -0
- writer/app_templates/hello/static/welcome.svg +40 -0
- writer/auth.py +7 -2
- writer/autogen.py +352 -0
- writer/blocks/__init__.py +51 -17
- writer/blocks/addtostatelist.py +10 -9
- writer/blocks/apitrigger.py +45 -0
- writer/blocks/base_block.py +332 -21
- writer/blocks/base_trigger.py +14 -0
- writer/blocks/calleventhandler.py +39 -35
- writer/blocks/changepage.py +48 -0
- writer/blocks/code.py +102 -0
- writer/blocks/crontrigger.py +49 -0
- writer/blocks/foreach.py +70 -53
- writer/blocks/httprequest.py +112 -99
- writer/blocks/ifelse.py +71 -0
- writer/blocks/logmessage.py +34 -39
- writer/blocks/parsejson.py +30 -29
- writer/blocks/returnvalue.py +7 -7
- writer/blocks/runblueprint.py +63 -0
- writer/blocks/setstate.py +43 -33
- writer/blocks/sharedblueprint.py +86 -0
- writer/blocks/uieventtrigger.py +49 -0
- writer/blocks/writeraddchatmessage.py +50 -12
- writer/blocks/writeraddtokg.py +38 -11
- writer/blocks/writeraskkg.py +123 -0
- writer/blocks/writerchat.py +80 -61
- writer/blocks/writerchatreply.py +279 -0
- writer/blocks/writerchatreplywithtoolconfig.py +393 -0
- writer/blocks/writerclassification.py +78 -39
- writer/blocks/writercompletion.py +49 -44
- writer/blocks/writerfileapi.py +85 -0
- writer/blocks/writerinitchat.py +24 -12
- writer/blocks/writerkeyvaluestorage.py +106 -0
- writer/blocks/writernocodeapp.py +35 -37
- writer/blocks/writerparsepdf.py +73 -0
- writer/blocks/writerstructuredoutput.py +105 -0
- writer/blocks/writertoolcalling.py +251 -0
- writer/blocks/writervision.py +141 -0
- writer/blocks/writerwebsearch.py +175 -0
- writer/blueprints.py +839 -0
- writer/command_line.py +52 -16
- writer/core.py +562 -290
- writer/core_ui.py +6 -2
- writer/evaluator.py +98 -46
- writer/journal.py +227 -0
- writer/keyvalue_storage.py +93 -0
- writer/logs.py +277 -0
- writer/serve.py +625 -327
- writer/ss_types.py +101 -12
- writer/static/assets/Arrow.dom-GBJpMYQS.js +1 -0
- writer/static/assets/BaseMarkdown-Wrvby5J8.js +1 -0
- writer/static/assets/BlueprintToolbar-BuXNRxWT.js +1 -0
- writer/static/assets/BlueprintToolbar-wpfX0jo_.css +1 -0
- writer/static/assets/BuilderApp-PTOI76jZ.js +8 -0
- writer/static/assets/BuilderApp-WimUfNZr.css +1 -0
- writer/static/assets/BuilderApplicationSelect-DXzy4e_h.js +7 -0
- writer/static/assets/BuilderApplicationSelect-XaM1D5fv.css +1 -0
- writer/static/assets/BuilderBlueprintLibraryPanel-Ckrhknlh.css +1 -0
- writer/static/assets/BuilderBlueprintLibraryPanel-DBDzhTlc.js +1 -0
- writer/static/assets/BuilderEmbeddedCodeEditor-B0bcjlhk.css +1 -0
- writer/static/assets/BuilderEmbeddedCodeEditor-Dn7eDICN.js +726 -0
- writer/static/assets/BuilderGraphSelect-C-LRsO8W.js +7 -0
- writer/static/assets/BuilderGraphSelect-D7B61d5s.css +1 -0
- writer/static/assets/BuilderInsertionLabel-BhyL9wgn.js +1 -0
- writer/static/assets/BuilderInsertionLabel-_YS5WPfq.css +1 -0
- writer/static/assets/BuilderInsertionOverlay-D2XS0ij9.css +1 -0
- writer/static/assets/BuilderInsertionOverlay-MkAIVruY.js +1 -0
- writer/static/assets/BuilderJournal-A0LcEwGI.js +7 -0
- writer/static/assets/BuilderJournal-DHv3Pvvm.css +1 -0
- writer/static/assets/BuilderModelSelect-CdSo_sih.js +7 -0
- writer/static/assets/BuilderModelSelect-Dc4IPLp2.css +1 -0
- writer/static/assets/BuilderSettings-BDwZBveu.js +16 -0
- writer/static/assets/BuilderSettings-lZkOXEYw.css +1 -0
- writer/static/assets/BuilderSettingsArtifactAPITriggerDetails-3O6jKBXD.js +4 -0
- writer/static/assets/BuilderSettingsArtifactAPITriggerDetails-DnX66iRg.css +1 -0
- writer/static/assets/BuilderSettingsDeploySharedBlueprint-BR_3ptsd.js +1 -0
- writer/static/assets/BuilderSettingsDeploySharedBlueprint-KJTl8gxP.css +1 -0
- writer/static/assets/BuilderSettingsHandlers-CBtEQFSo.js +1 -0
- writer/static/assets/BuilderSettingsHandlers-DJPeASfz.css +1 -0
- writer/static/assets/BuilderSidebarComponentTree-DLltgas5.js +1 -0
- writer/static/assets/BuilderSidebarComponentTree-DYu1F793.css +1 -0
- writer/static/assets/BuilderSidebarToolkit-CApZNTAq.js +7 -0
- writer/static/assets/BuilderSidebarToolkit-CwqbjRv8.css +1 -0
- writer/static/assets/BuilderTemplateEditor-CYSDeWgV.css +1 -0
- writer/static/assets/BuilderTemplateEditor-DnRDRcA0.js +87 -0
- writer/static/assets/BuilderVault-2vGoV0sx.js +1 -0
- writer/static/assets/BuilderVault-Cx6oQSES.css +1 -0
- writer/static/assets/ComponentRenderer-72hqvEvI.css +1 -0
- writer/static/assets/ComponentRenderer-D4Pj1i3s.js +1 -0
- writer/static/assets/SharedCopyClipboardButton-BipJKGtz.css +1 -0
- writer/static/assets/SharedCopyClipboardButton-DNI9kLe6.js +1 -0
- writer/static/assets/WdsCheckbox-DKvpPA4D.css +1 -0
- writer/static/assets/WdsCheckbox-edQcn1cf.js +1 -0
- writer/static/assets/WdsDropdownMenu-CzzPN9Wg.css +1 -0
- writer/static/assets/WdsDropdownMenu-DQnrRBNV.js +1 -0
- writer/static/assets/WdsFieldWrapper-Cmufx5Nj.js +1 -0
- writer/static/assets/WdsFieldWrapper-CsemOh8D.css +1 -0
- writer/static/assets/WdsTabs-DKj7BqI0.css +1 -0
- writer/static/assets/WdsTabs-DcfY_zn5.js +1 -0
- writer/static/assets/abap-D8nrxEjS.js +6 -0
- writer/static/assets/apex-BrXDlLUW.js +6 -0
- writer/static/assets/art-paper-D70v1WMA.svg +180 -0
- writer/static/assets/azcli-CElzELwZ.js +6 -0
- writer/static/assets/bat-CUsyEhik.js +6 -0
- writer/static/assets/bicep-BtxyJn6H.js +7 -0
- writer/static/assets/cameligo-ClBCoF8h.js +6 -0
- writer/static/assets/clojure-B9TqLHAk.js +6 -0
- writer/static/assets/codicon-BA2IlpFX.ttf +0 -0
- writer/static/assets/coffee-DYsfeylR.js +6 -0
- writer/static/assets/cpp-VVGvvgir.js +6 -0
- writer/static/assets/csharp-Z6z2stHy.js +6 -0
- writer/static/assets/csp-DgZoLDI1.js +6 -0
- writer/static/assets/css-KqQ96-gC.js +8 -0
- writer/static/assets/css.worker-DvNUQFd1.js +84 -0
- writer/static/assets/cssMode-BYq4oZGq.js +9 -0
- writer/static/assets/cypher-CYoSlgTu.js +6 -0
- writer/static/assets/dart-BGDl7St1.js +6 -0
- writer/static/assets/dockerfile-CuCtxA7T.js +6 -0
- writer/static/assets/ecl-BCTFAUpS.js +6 -0
- writer/static/assets/editor.worker-BVwmgLrR.js +11 -0
- writer/static/assets/elixir-C7hRTYZ9.js +6 -0
- writer/static/assets/flow9-Bi_qi707.js +6 -0
- writer/static/assets/freemarker2-CnNourkO.js +8 -0
- writer/static/assets/fsharp-CxaaEKKi.js +6 -0
- writer/static/assets/go-DUImKuGY.js +6 -0
- writer/static/assets/graphql-D5sGVkLV.js +6 -0
- writer/static/assets/handlebars-Bm22yapJ.js +6 -0
- writer/static/assets/hcl-zD_CCkZ1.js +6 -0
- writer/static/assets/html-CAKAfoZF.js +6 -0
- writer/static/assets/html.worker-BJMlcbMU.js +458 -0
- writer/static/assets/htmlMode-BGZ97n-V.js +9 -0
- writer/static/assets/index-5u5REPT4.js +16 -0
- writer/static/assets/index-BKNuk68o.css +1 -0
- writer/static/assets/index-BQNXU3IR.js +17 -0
- writer/static/assets/index-BQr1pfrb.js +1 -0
- writer/static/assets/index-DHXAd5Yn.js +4 -0
- writer/static/assets/index-Zki-pfO-.js +8525 -0
- writer/static/assets/index.esm-B1ZQtduY.js +17 -0
- writer/static/assets/ini-8kKHd4ZL.js +6 -0
- writer/static/assets/java-De1axCfe.js +6 -0
- writer/static/assets/javascript-X1f02eyK.js +6 -0
- writer/static/assets/json.worker-BwvX8PuZ.js +42 -0
- writer/static/assets/jsonMode-hT0bNgT8.js +11 -0
- writer/static/assets/julia-D3ApGBxz.js +6 -0
- writer/static/assets/kotlin-GbSrCElU.js +6 -0
- writer/static/assets/less-DNUaDNdz.js +7 -0
- writer/static/assets/lexon-Bg9QKxBu.js +6 -0
- writer/static/assets/liquid-KmCCiJw2.js +6 -0
- writer/static/assets/lua-Crkvc3mc.js +6 -0
- writer/static/assets/m3-DsrzVyM1.js +6 -0
- writer/static/assets/mapbox-gl-C0cyFYYW.js +2329 -0
- writer/static/assets/markdown-CY5IOZuu.js +6 -0
- writer/static/assets/marked.esm-273vDTCT.js +45 -0
- writer/static/assets/mdx-DtRFauUw.js +6 -0
- writer/static/assets/mips-BE8RsGBA.js +6 -0
- writer/static/assets/msdax-N5ajIiFQ.js +6 -0
- writer/static/assets/mysql-DRxbB97D.js +6 -0
- writer/static/assets/objective-c-BHUZy23s.js +6 -0
- writer/static/assets/pascal-BemVzBTY.js +6 -0
- writer/static/assets/pascaligo-BACCcnx_.js +6 -0
- writer/static/assets/pdf-B6-yWJ-Y.js +12 -0
- writer/static/assets/pdf.worker.min-CyUfim15.mjs +21 -0
- writer/static/assets/perl-CuU66Ptk.js +6 -0
- writer/static/assets/pgsql-CQ6TMH2r.js +6 -0
- writer/static/assets/php-BvyzZa65.js +6 -0
- writer/static/assets/pla-DrIuu9u1.js +6 -0
- writer/static/assets/plotly.min-DutuuatZ.js +4030 -0
- writer/static/assets/poppins-latin-300-italic-4WBEAciR.woff +0 -0
- writer/static/assets/poppins-latin-300-italic-EWCPeN2Y.woff2 +0 -0
- writer/static/assets/poppins-latin-300-normal-DCNuMXUj.woff +0 -0
- writer/static/assets/poppins-latin-300-normal-Dku2WoCh.woff2 +0 -0
- writer/static/assets/poppins-latin-400-italic-B4GYq972.woff2 +0 -0
- writer/static/assets/poppins-latin-400-italic-BPejoDS-.woff +0 -0
- writer/static/assets/poppins-latin-400-normal-BOb3E3N0.woff +0 -0
- writer/static/assets/poppins-latin-400-normal-cpxAROuN.woff2 +0 -0
- writer/static/assets/poppins-latin-500-italic-Ce_qjtl5.woff +0 -0
- writer/static/assets/poppins-latin-500-italic-o28Otv0U.woff2 +0 -0
- writer/static/assets/poppins-latin-500-normal-C8OXljZJ.woff2 +0 -0
- writer/static/assets/poppins-latin-500-normal-DGXqpDMm.woff +0 -0
- writer/static/assets/poppins-latin-600-italic-BhOZippK.woff +0 -0
- writer/static/assets/poppins-latin-600-italic-CZ4wqKBi.woff2 +0 -0
- writer/static/assets/poppins-latin-600-normal-BJdTmd5m.woff +0 -0
- writer/static/assets/poppins-latin-600-normal-zEkxB9Mr.woff2 +0 -0
- writer/static/assets/poppins-latin-700-italic-CW91C-LJ.woff +0 -0
- writer/static/assets/poppins-latin-700-italic-RKf6esGj.woff2 +0 -0
- writer/static/assets/poppins-latin-700-normal-BVuQR_eA.woff +0 -0
- writer/static/assets/poppins-latin-700-normal-Qrb0O0WB.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-300-italic-CBzyU4Pf.woff +0 -0
- writer/static/assets/poppins-latin-ext-300-italic-DdDvTq5-.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-300-normal-7Zg2msWE.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-300-normal-C9p7gvmA.woff +0 -0
- writer/static/assets/poppins-latin-ext-400-italic-BiCGV3eO.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-400-italic-gsPYOGqV.woff +0 -0
- writer/static/assets/poppins-latin-ext-400-normal-CIpeJEZw.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-400-normal-Ce_uWq1Z.woff +0 -0
- writer/static/assets/poppins-latin-ext-500-italic-CwrTHwbn.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-500-italic-jdc8Bv4M.woff +0 -0
- writer/static/assets/poppins-latin-ext-500-normal-Bl1-S02S.woff +0 -0
- writer/static/assets/poppins-latin-ext-500-normal-H4Q0z8D2.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-600-italic-BqeDa496.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-600-italic-C7MQPb_A.woff +0 -0
- writer/static/assets/poppins-latin-ext-600-normal-Cn4C8475.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-600-normal-DB6FJURc.woff +0 -0
- writer/static/assets/poppins-latin-ext-700-italic-BAdhB_WS.woff2 +0 -0
- writer/static/assets/poppins-latin-ext-700-italic-WKTwQMp8.woff +0 -0
- writer/static/assets/poppins-latin-ext-700-normal-CE2WFKmF.woff +0 -0
- writer/static/assets/poppins-latin-ext-700-normal-DDaViAzG.woff2 +0 -0
- writer/static/assets/postiats-BR_hrfni.js +6 -0
- writer/static/assets/powerquery-CKDUeRmd.js +6 -0
- writer/static/assets/powershell-Dsa4rhA_.js +6 -0
- writer/static/assets/protobuf-CGsvhooB.js +7 -0
- writer/static/assets/pug-D2p3uOX2.js +6 -0
- writer/static/assets/python-DVhxg746.js +6 -0
- writer/static/assets/qsharp-B7F3HtPF.js +6 -0
- writer/static/assets/r-3aLoi2fs.js +6 -0
- writer/static/assets/razor-DR5Ns_BC.js +6 -0
- writer/static/assets/redis-jqFeRM5s.js +6 -0
- writer/static/assets/redshift-BriwQgXR.js +6 -0
- writer/static/assets/restructuredtext-hbBFZ0w9.js +6 -0
- writer/static/assets/ruby-ByThyB2Q.js +6 -0
- writer/static/assets/rust-DIEZMp5R.js +6 -0
- writer/static/assets/sb-C6Gjjw_x.js +6 -0
- writer/static/assets/scala-DZNw3jJB.js +6 -0
- writer/static/assets/scheme-55eqh71t.js +6 -0
- writer/static/assets/scss-D-OVkc4F.js +8 -0
- writer/static/assets/serialization-DJC7NP0N.js +20 -0
- writer/static/assets/shell-DSpi8_qN.js +6 -0
- writer/static/assets/solidity-BHddiNFS.js +6 -0
- writer/static/assets/sophia-D6taVZFb.js +6 -0
- writer/static/assets/sparql-LA0C7mUc.js +6 -0
- writer/static/assets/sql-C3-3IcFM.js +6 -0
- writer/static/assets/st-C4g7059C.js +6 -0
- writer/static/assets/swift-DNI1vH3h.js +8 -0
- writer/static/assets/systemverilog-DL_FVbcQ.js +6 -0
- writer/static/assets/tcl-DVJXmIwd.js +6 -0
- writer/static/assets/ts.worker-CwG1rUES.js +37021 -0
- writer/static/assets/tsMode-BNUEZzir.js +16 -0
- writer/static/assets/twig-BVWDLtw5.js +6 -0
- writer/static/assets/typescript-CRVt7Hx0.js +6 -0
- writer/static/assets/useBlueprintRun-C00bCxh-.js +1 -0
- writer/static/assets/useKeyValueEditor-nDmI7cTJ.js +1 -0
- writer/static/assets/useListResources-DLkZhRSJ.js +1 -0
- writer/static/assets/vb-Btz91-7U.js +6 -0
- writer/static/assets/vega-embed.module-SNP5iNdJ.js +201 -0
- writer/static/assets/wgsl-D8V_buCG.js +303 -0
- writer/static/assets/xml-C_6-t1tb.js +6 -0
- writer/static/assets/yaml-DIw8G7jk.js +6 -0
- writer/static/components/annotatedtext.svg +4 -0
- writer/static/components/avatar.svg +4 -0
- writer/static/components/blueprints_addtostatelist.svg +4 -0
- writer/static/components/blueprints_apitrigger.svg +4 -0
- writer/static/components/blueprints_calleventhandler.svg +9 -0
- writer/static/components/blueprints_category_Logic.svg +4 -0
- writer/static/components/blueprints_category_Other.svg +4 -0
- writer/static/components/blueprints_category_Triggers.svg +4 -0
- writer/static/components/blueprints_category_Writer.svg +25 -0
- writer/static/components/blueprints_code.svg +9 -0
- writer/static/components/blueprints_crontrigger.svg +6 -0
- writer/static/components/blueprints_foreach.svg +4 -0
- writer/static/components/blueprints_httprequest.svg +11 -0
- writer/static/components/blueprints_logmessage.svg +11 -0
- writer/static/components/blueprints_parsejson.svg +4 -0
- writer/static/components/blueprints_returnvalue.svg +4 -0
- writer/static/components/blueprints_runblueprint.svg +4 -0
- writer/static/components/blueprints_setstate.svg +4 -0
- writer/static/components/blueprints_uieventtrigger.svg +4 -0
- writer/static/components/blueprints_writeraddchatmessage.svg +19 -0
- writer/static/components/blueprints_writeraddtokg.svg +19 -0
- writer/static/components/blueprints_writerchat.svg +11 -0
- writer/static/components/blueprints_writerchatreply.svg +19 -0
- writer/static/components/blueprints_writerclassification.svg +24 -0
- writer/static/components/blueprints_writercompletion.svg +14 -0
- writer/static/components/blueprints_writerinitchat.svg +11 -0
- writer/static/components/blueprints_writernocodeapp.svg +14 -0
- writer/static/components/button.svg +4 -0
- writer/static/components/category_Content.svg +4 -0
- writer/static/components/category_Embed.svg +4 -0
- writer/static/components/category_Input.svg +5 -0
- writer/static/components/category_Layout.svg +9 -0
- writer/static/components/category_Other.svg +4 -0
- writer/static/components/chatbot.svg +4 -0
- writer/static/components/checkboxinput.svg +4 -0
- writer/static/components/colorinput.svg +11 -0
- writer/static/components/column.svg +4 -0
- writer/static/components/columns.svg +4 -0
- writer/static/components/dataframe.svg +4 -0
- writer/static/components/dateinput.svg +4 -0
- writer/static/components/dropdowninput.svg +5 -0
- writer/static/components/fileinput.svg +4 -0
- writer/static/components/googlemaps.svg +4 -0
- writer/static/components/header.svg +4 -0
- writer/static/components/heading.svg +9 -0
- writer/static/components/horizontalstack.svg +4 -0
- writer/static/components/html.svg +9 -0
- writer/static/components/icon.svg +4 -0
- writer/static/components/iframe.svg +4 -0
- writer/static/components/image.svg +11 -0
- writer/static/components/jsonviewer.svg +4 -0
- writer/static/components/link.svg +12 -0
- writer/static/components/mapbox.svg +4 -0
- writer/static/components/message.svg +4 -0
- writer/static/components/metric.svg +4 -0
- writer/static/components/multiselectinput.svg +4 -0
- writer/static/components/numberinput.svg +4 -0
- writer/static/components/page.svg +50 -0
- writer/static/components/pagination.svg +4 -0
- writer/static/components/pdf.svg +4 -0
- writer/static/components/plotlygraph.svg +7 -0
- writer/static/components/progressbar.svg +5 -0
- writer/static/components/radioinput.svg +4 -0
- writer/static/components/rangeinput.svg +4 -0
- writer/static/components/ratinginput.svg +4 -0
- writer/static/components/repeater.svg +4 -0
- writer/static/components/reuse.svg +4 -0
- writer/static/components/section.svg +4 -0
- writer/static/components/selectinput.svg +5 -0
- writer/static/components/separator.svg +4 -0
- writer/static/components/sidebar.svg +4 -0
- writer/static/components/sliderinput.svg +4 -0
- writer/static/components/step.svg +4 -0
- writer/static/components/steps.svg +4 -0
- writer/static/components/switchinput.svg +4 -0
- writer/static/components/tab.svg +4 -0
- writer/static/components/tabs.svg +4 -0
- writer/static/components/tags.svg +11 -0
- writer/static/components/text.svg +4 -0
- writer/static/components/textareainput.svg +11 -0
- writer/static/components/textinput.svg +4 -0
- writer/static/components/timeinput.svg +4 -0
- writer/static/components/timer.svg +4 -0
- writer/static/components/vegalitechart.svg +7 -0
- writer/static/components/videoplayer.svg +11 -0
- writer/static/components/webcamcapture.svg +4 -0
- writer/static/favicon.png +0 -0
- writer/static/index.html +84 -0
- writer/static/status/cancelled.svg +5 -0
- writer/static/status/error.svg +5 -0
- writer/static/status/skipped.svg +4 -0
- writer/static/status/stopped.svg +4 -0
- writer/static/status/success.svg +4 -0
- writer/sync.py +431 -0
- writer/ui.py +2268 -0
- writer/vault.py +48 -0
- writer/wf_project.py +90 -66
- writer-1.25.1rc1.dist-info/METADATA +92 -0
- writer-1.25.1rc1.dist-info/RECORD +382 -0
- {writer-0.8.3rc4.dist-info → writer-1.25.1rc1.dist-info}/WHEEL +1 -1
- writer/blocks/runworkflow.py +0 -59
- writer/workflows.py +0 -183
- writer-0.8.3rc4.dist-info/METADATA +0 -117
- writer-0.8.3rc4.dist-info/RECORD +0 -44
- {writer-0.8.3rc4.dist-info → writer-1.25.1rc1.dist-info}/entry_points.txt +0 -0
- {writer-0.8.3rc4.dist-info → writer-1.25.1rc1.dist-info/licenses}/LICENSE.txt +0 -0
writer/autogen.py
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Dict, List, Optional, cast
|
|
4
|
+
|
|
5
|
+
from writerai import Writer
|
|
6
|
+
|
|
7
|
+
import writer.abstract
|
|
8
|
+
|
|
9
|
+
client = Writer()
|
|
10
|
+
MAX_ITERATIONS = 5
|
|
11
|
+
ALLOWED_BLOCK_TYPES = {
|
|
12
|
+
type_: template for type_, template in writer.abstract.templates.items()
|
|
13
|
+
if not template.writer.get("deprecated", False)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _validate_blueprint_nodes(nodes: List[Dict]) -> bool:
|
|
18
|
+
if not nodes:
|
|
19
|
+
raise ValueError("Blueprint must contain at least one node")
|
|
20
|
+
|
|
21
|
+
relationship_counts = {node.get("id"): 0 for node in nodes if node.get("id")}
|
|
22
|
+
errors = []
|
|
23
|
+
graph = {}
|
|
24
|
+
|
|
25
|
+
for i, node in enumerate(nodes):
|
|
26
|
+
node_id = node.get("id")
|
|
27
|
+
if not node_id:
|
|
28
|
+
errors.append(f"A node at index {i} is missing its id.")
|
|
29
|
+
continue
|
|
30
|
+
block_type = node.get("type")
|
|
31
|
+
if not block_type:
|
|
32
|
+
errors.append(f"Node at index {i} is missing a block type.")
|
|
33
|
+
elif block_type not in ALLOWED_BLOCK_TYPES:
|
|
34
|
+
errors.append(f"Node at index {i} has unknown block type: {block_type}.")
|
|
35
|
+
if node_id in graph:
|
|
36
|
+
errors.append(f"Node id {node_id} is duplicated.")
|
|
37
|
+
graph[node_id] = node
|
|
38
|
+
|
|
39
|
+
for node in nodes:
|
|
40
|
+
node_id = node.get("id")
|
|
41
|
+
outs = node.get("outs", [])
|
|
42
|
+
for out in outs:
|
|
43
|
+
to_node_id = out.get("toNodeId")
|
|
44
|
+
relationship_counts[node_id] += 1
|
|
45
|
+
if to_node_id not in graph:
|
|
46
|
+
errors.append(f"Node {node_id} connects to non-existent node {to_node_id}.")
|
|
47
|
+
else:
|
|
48
|
+
relationship_counts[to_node_id] += 1
|
|
49
|
+
|
|
50
|
+
for node_id, count in relationship_counts.items():
|
|
51
|
+
if count == 0:
|
|
52
|
+
errors.append(
|
|
53
|
+
f"Block {node_id} has no incoming or outgoing edges. The block needs to connect to another block somehow."
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Raise all errors at once
|
|
57
|
+
if errors:
|
|
58
|
+
raise ValueError(" | ".join(errors))
|
|
59
|
+
|
|
60
|
+
return True
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _get_block_definitions():
|
|
64
|
+
block_definitions = []
|
|
65
|
+
for type, template in ALLOWED_BLOCK_TYPES.items():
|
|
66
|
+
field_properties = {}
|
|
67
|
+
for field_key, field in template.writer.get("fields", {}).items():
|
|
68
|
+
field_properties[field_key] = {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": f"Info about this field: {repr(field)}",
|
|
71
|
+
}
|
|
72
|
+
name = template.writer.get("name")
|
|
73
|
+
description = template.writer.get("description")
|
|
74
|
+
|
|
75
|
+
dynamic_out = None
|
|
76
|
+
outcome_ids = []
|
|
77
|
+
outs = template.writer.get("outs") or {}
|
|
78
|
+
for out_id, out in outs.items():
|
|
79
|
+
if out.get("field") is None:
|
|
80
|
+
outcome_ids.append(out_id)
|
|
81
|
+
continue
|
|
82
|
+
dynamic_out = out_id, out
|
|
83
|
+
|
|
84
|
+
if dynamic_out:
|
|
85
|
+
patterns = "|".join([f"{dynamic_out[0]}_.*"] + outcome_ids)
|
|
86
|
+
out_ids = {"type": "string", "pattern": f"^({patterns})$"}
|
|
87
|
+
else:
|
|
88
|
+
out_ids = {"type": "string", "enum": outcome_ids}
|
|
89
|
+
|
|
90
|
+
block_definitions.append(
|
|
91
|
+
{
|
|
92
|
+
"type": "object",
|
|
93
|
+
"required": ["id", "type", "outs", "content"],
|
|
94
|
+
"description": f"Name: {name} | Description: {description}",
|
|
95
|
+
"additionalProperties": False,
|
|
96
|
+
"properties": {
|
|
97
|
+
"id": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"pattern": "^aig\\d+$",
|
|
100
|
+
"description": "Unique identifier.",
|
|
101
|
+
},
|
|
102
|
+
"type": {"const": type},
|
|
103
|
+
"outs": {
|
|
104
|
+
"type": "array",
|
|
105
|
+
"minItems": 0,
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"required": ["outId", "toNodeId"],
|
|
109
|
+
"additionalProperties": False,
|
|
110
|
+
"properties": {
|
|
111
|
+
"outId": out_ids,
|
|
112
|
+
"toNodeId": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"pattern": "^aig\\d+$",
|
|
115
|
+
"description": "The id of the node this outcome is connected to.",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
"content": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {"alias": {"type": "string"}} | field_properties,
|
|
123
|
+
"additionalProperties": False,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
return block_definitions
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _get_tools():
|
|
132
|
+
return [
|
|
133
|
+
{
|
|
134
|
+
"type": "function",
|
|
135
|
+
"function": {
|
|
136
|
+
"name": "generate_blueprint",
|
|
137
|
+
"description": """
|
|
138
|
+
Generate a blueprint.
|
|
139
|
+
When an application integration node isn't available, use an HTTP request.
|
|
140
|
+
To use a value from state as part of a field, use the syntax @{my_var}, this will fetch the value "my_var" from state.
|
|
141
|
+
All property or index access is via dots, for example @{my_arr.0.subprop} or @{my_obj.subprop}
|
|
142
|
+
To get the result of the latest block, use @{result}, this will fetch the value from the execution environment, which is combined with state during runtime.
|
|
143
|
+
To access the result of a block that's not the latest use @{results.[id]} for example @{results.aig1}
|
|
144
|
+
All nodes must be connected to each other via "outs", either by being the source or destination of an out.
|
|
145
|
+
No circular references are allowed.
|
|
146
|
+
The system has built-in mechanisms to announce errors, success, so don't add anything for that.
|
|
147
|
+
Make sure the "outs", "type", "id" and "content" are all inside the component, because sometimes you get confused about the structure. Also, sometimes you try to include things twice, make sure you don't duplicate. Follow the schema to a tee - it's the most important thing.
|
|
148
|
+
""",
|
|
149
|
+
"parameters": {
|
|
150
|
+
"type": "object",
|
|
151
|
+
"additionalProperties": False,
|
|
152
|
+
"properties": {
|
|
153
|
+
"components": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": {
|
|
156
|
+
"oneOf": _get_block_definitions(),
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _get_main_prompt(description: str):
|
|
167
|
+
prompt = """
|
|
168
|
+
<governing>
|
|
169
|
+
You're using the Writer Agent Editor, a solution that combines reusable blocks to get to an outcome.
|
|
170
|
+
The blocks are combined into a blueprint.
|
|
171
|
+
You make function calls to create blueprints.
|
|
172
|
+
</governing>
|
|
173
|
+
<examples>
|
|
174
|
+
<example>
|
|
175
|
+
<description>
|
|
176
|
+
- connect to hubspot
|
|
177
|
+
- get the posts
|
|
178
|
+
- for every post, classify it as high value or low value, depending on its potential for business transformation
|
|
179
|
+
- if it's of high value, add the title to a google sheet
|
|
180
|
+
</description>
|
|
181
|
+
<blueprint>
|
|
182
|
+
[{"id":"aig1","type":"blueprints_httprequest","content":{"alias":"Connect to HubSpot","method":"GET","url":"https://api.hubapi.com/blog/v3/posts","headers":"{\"Authorization\": \"Bearer YOUR_HUBSPOT_API_KEY\"}"},"outs":[{"outId":"success","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_foreach","content":{"alias":"Iterate over posts","items":"@{result.body.results}"},"outs":[{"outId":"loop","toNodeId":"aig3"}]},{"id":"aig3","type":"blueprints_writerclassification","content":{"alias":"Classify post","text":"@{item.title}","categories":"{\"high_value\": \"Potential for business transformation is high\", \"low_value\": \"Potential for business transformation is low\"}"},"outs":[{"outId":"category_high_value","toNodeId":"aig4"},{"toNodeId":"goftybhrb99d1uk7","outId":"category_low_value"}]},{"id":"aig4","type":"blueprints_httprequest","content":{"alias":"Add title to Google Sheet","method":"POST","url":"https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values/Sheet1!A1:append?valueInputOption=RAW","headers":"{\"Authorization\": \"Bearer YOUR_GOOGLE_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"values\": [[\"@{item.title}\"]]}"},"outs":[]},{"id":"goftybhrb99d1uk7","type":"blueprints_logmessage","content":{"alias":"Announce low value","message":"Post with id @{itemId} was considered low value, so it hasn't been added to the Google Sheet."}}]
|
|
183
|
+
</blueprint>
|
|
184
|
+
</example>
|
|
185
|
+
<example>
|
|
186
|
+
<description>
|
|
187
|
+
- Write some python code that adds two numbers
|
|
188
|
+
- Submit it via an http request to example.com
|
|
189
|
+
</description>
|
|
190
|
+
<blueprint>
|
|
191
|
+
[{"id":"aig1","type":"blueprints_code","content":{"alias":"Add two numbers","code":"# State is accessible as a global variable. For example:\nstate[\"num1\"] = 5\nstate[\"num2\"] = 10\n\n# To set the output of this block, which will be available via result to the next block:\nresult = state[\"num1\"] + state[\"num2\"]\nset_output(result)\n"},"outs":[{"outId":"success","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_httprequest","content":{"alias":"Submit to example.com","method":"POST","url":"https://example.com","headers":"{\"Content-Type\": \"application/json\"}","body":"{\"result\": @{result}}"},"outs":[]}]
|
|
192
|
+
</blueprint>
|
|
193
|
+
</example>
|
|
194
|
+
<example>
|
|
195
|
+
<description>
|
|
196
|
+
- get the latest jira ticket from a board
|
|
197
|
+
- classify it as a frontend, full stack, or backend ticket
|
|
198
|
+
- if it's frontend, you'll send an email to kyril
|
|
199
|
+
- if it's full stack, to mateusz
|
|
200
|
+
- if it's backend, to muayad
|
|
201
|
+
</description>
|
|
202
|
+
<blueprint>
|
|
203
|
+
[{"id":"aig1","type":"blueprints_httprequest","content":{"alias":"Get Latest Jira Ticket","method":"GET","url":"https://your-jira-instance.com/rest/api/2/search?jql=project=YOUR_PROJECT_KEY&maxResults=1&fields=summary,issuetype","headers":"{\"Authorization\": \"Basic YOUR_BASE64_ENCODED_CREDENTIALS\"}"},"outs":[{"outId":"success","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_parsejson","content":{"alias":"Parse Jira Response","plainText":"@{result.body}"},"outs":[{"outId":"success","toNodeId":"aig3"}]},{"id":"aig3","type":"blueprints_writerclassification","content":{"alias":"Classify Ticket","text":"@{result.issues.0.fields.summary}","categories":"{\"frontend\": \"Issue type is related to frontend development\", \"full_stack\": \"Issue type is related to full stack development\", \"backend\": \"Issue type is related to backend development\"}"},"outs":[{"outId":"category_frontend","toNodeId":"aig4"},{"outId":"category_full_stack","toNodeId":"aig5"},{"outId":"category_backend","toNodeId":"aig6"}]},{"id":"aig4","type":"blueprints_httprequest","content":{"alias":"Send Email to Kyril","method":"POST","url":"https://api.sendgrid.com/v3/mail/send","headers":"{\"Authorization\": \"Bearer YOUR_SENDGRID_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"personalizations\": [{\"to\": [{\"email\": \"kyril@example.com\"}], \"subject\": \"New Frontend Jira Ticket\"}], \"from\": {\"email\": \"no-reply@example.com\"}, \"content\": [{\"type\": \"text/plain\", \"value\": \"A new frontend ticket has been created: @{result.issues.0.fields.summary}\"}]}"},"outs":[]},{"id":"aig5","type":"blueprints_httprequest","content":{"alias":"Send Email to Mateusz","method":"POST","url":"https://api.sendgrid.com/v3/mail/send","headers":"{\"Authorization\": \"Bearer YOUR_SENDGRID_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"personalizations\": [{\"to\": [{\"email\": \"mateusz@example.com\"}], \"subject\": \"New Full Stack Jira Ticket\"}], \"from\": {\"email\": \"no-reply@example.com\"}, \"content\": [{\"type\": \"text/plain\", \"value\": \"A new full stack ticket has been created: @{result.issues.0.fields.summary}\"}]}"},"outs":[]},{"id":"aig6","type":"blueprints_httprequest","content":{"alias":"Send Email to Muayad","method":"POST","url":"https://api.sendgrid.com/v3/mail/send","headers":"{\"Authorization\": \"Bearer YOUR_SENDGRID_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"personalizations\": [{\"to\": [{\"email\": \"muayad@example.com\"}], \"subject\": \"New Backend Jira Ticket\"}], \"from\": {\"email\": \"no-reply@example.com\"}, \"content\": [{\"type\": \"text/plain\", \"value\": \"A new backend ticket has been created: @{result.issues.0.fields.summary}\"}]}"},"outs":[]}]
|
|
204
|
+
</blueprint>
|
|
205
|
+
</example>
|
|
206
|
+
<example>
|
|
207
|
+
<description>
|
|
208
|
+
- Connect to Hubspot
|
|
209
|
+
- Get posts
|
|
210
|
+
- Classify posts as “high value” or “low value”, based on their potential for business transformation
|
|
211
|
+
- Ignore the “low value” posts
|
|
212
|
+
- The high value posts, classify them into “AI related” or “non-AI related”
|
|
213
|
+
- The AI-related ones, post them (their titles) to a Google Sheet
|
|
214
|
+
- The non-AI related ones, send via email to Ramiro at ramiro@example.com
|
|
215
|
+
</description>
|
|
216
|
+
<blueprint>
|
|
217
|
+
[{"id":"aig1","type":"blueprints_httprequest","content":{"alias":"Connect to HubSpot","method":"GET","url":"https://api.hubapi.com/blog/v3/posts","headers":"{\"Authorization\": \"Bearer YOUR_HUBSPOT_API_KEY\"}"},"outs":[{"outId":"success","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_foreach","content":{"alias":"Iterate over posts","items":"@{result.body.results}"},"outs":[{"outId":"loop","toNodeId":"aig3"}]},{"id":"aig3","type":"blueprints_writerclassification","content":{"alias":"Classify Post","text":"@{item.title}","categories":"{\"high_value\": \"Potential for business transformation is high\", \"low_value\": \"Potential for business transformation is low\"}"},"outs":[{"outId":"category_high_value","toNodeId":"aig4"},{"outId":"category_low_value","toNodeId":"aig5"}]},{"id":"aig4","type":"blueprints_writerclassification","content":{"alias":"Classify High Value Post","text":"@{item.title}","categories":"{\"ai_related\": \"Post is related to AI\", \"non_ai_related\": \"Post is not related to AI\"}"},"outs":[{"outId":"category_ai_related","toNodeId":"aig6"},{"outId":"category_non_ai_related","toNodeId":"aig7"}]},{"id":"aig5","type":"blueprints_logmessage","content":{"alias":"Ignore Low Value Post","message":"Post with id @{itemId} was considered low value and ignored."},"outs":[]},{"id":"aig6","type":"blueprints_httprequest","content":{"alias":"Post AI Related Title to Google Sheet","method":"POST","url":"https://sheets.googleapis.com/v4/spreadsheets/YOUR_GOOGLE_SHEET_ID/values/Sheet1!A1:append?valueInputOption=RAW","headers":"{\"Authorization\": \"Bearer YOUR_GOOGLE_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"values\": [[\"@{item.title}\"]]}"},"outs":[]},{"id":"aig7","type":"blueprints_httprequest","content":{"alias":"Send Non-AI Related Title to Ramiro","method":"POST","url":"https://api.sendgrid.com/v3/mail/send","headers":"{\"Authorization\": \"Bearer YOUR_SENDGRID_API_KEY\", \"Content-Type\": \"application/json\"}","body":"{\"personalizations\": [{\"to\": [{\"email\": \"ramiro@example.com\"}], \"subject\": \"New Non-AI Related Post\"}], \"from\": {\"email\": \"no-reply@example.com\"}, \"content\": [{\"type\": \"text/plain\", \"value\": \"A new non-AI related post has been created: @{item.title}\"}]}"},"outs":[{"outId":"success","toNodeId":"aig8"}]},{"id":"aig8","type":"blueprints_logmessage","content":{"alias":"Announce Non-AI Related Post","message":"Non-AI related post with title @{item.title} has been sent to Ramiro."},"outs":[]}]
|
|
218
|
+
</blueprint>
|
|
219
|
+
</example>
|
|
220
|
+
<example>
|
|
221
|
+
<description>
|
|
222
|
+
- Loop through "dogs", "cats", "ducks" and "elephants"
|
|
223
|
+
- For each of these, write an article
|
|
224
|
+
- Post the article to Wordpress
|
|
225
|
+
- Send a confirmation Slack message to Ramiro
|
|
226
|
+
</description>
|
|
227
|
+
<blueprint>
|
|
228
|
+
[{"id":"aig1","type":"blueprints_foreach","content":{"alias":"Iterate over animals","items":"[\"dogs\", \"cats\", \"ducks\", \"elephants\"]"},"outs":[{"outId":"loop","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_writercompletion","content":{"alias":"Write article","prompt":"Write an informative and engaging article about @{item}.","modelId":"palmyra-x-004"},"outs":[{"outId":"success","toNodeId":"aig3"}]},{"id":"aig3","type":"blueprints_httprequest","content":{"alias":"Post article to WordPress","method":"POST","url":"https://your-wordpress-site.com/wp-json/wp/v2/posts","headers":"{\"Authorization\": \"Bearer YOUR_WORDPRESS_API_TOKEN\", \"Content-Type\": \"application/json\"}","body":"{\"title\": \"@{item} Article\", \"content\": \"@{result}\", \"status\": \"publish\"}"},"outs":[{"outId":"success","toNodeId":"aig4"}]},{"id":"aig4","type":"blueprints_httprequest","content":{"alias":"Send Slack confirmation to Ramiro","method":"POST","url":"https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_URL","headers":"{\"Content-Type\": \"application/json\"}","body":"{\"text\": \"An article about @{item} has been posted to WordPress.\"}"},"outs":[]}]
|
|
229
|
+
</blueprint>
|
|
230
|
+
</example>
|
|
231
|
+
<example>
|
|
232
|
+
<description>
|
|
233
|
+
- Loop through "Ugo", "Shivam", "Anant" and "Yaseen", our AI experts
|
|
234
|
+
- Get Chuck Norris fact using the API that you know
|
|
235
|
+
- Adapt it using a Text Completion so that instead of Chuck Norris it references the AI expert
|
|
236
|
+
- Log it
|
|
237
|
+
</description>
|
|
238
|
+
<blueprint>
|
|
239
|
+
[{"id":"aig1","type":"blueprints_foreach","content":{"alias":"Iterate over AI experts","items":"[\"Ugo\", \"Shivam\", \"Anant\", \"Yaseen\"]"},"outs":[{"outId":"loop","toNodeId":"aig2"}]},{"id":"aig2","type":"blueprints_httprequest","content":{"alias":"Get Chuck Norris fact","method":"GET","url":"https://api.chucknorris.io/jokes/random","headers":"{}"},"outs":[{"outId":"success","toNodeId":"aig3"}]},{"id":"aig3","type":"blueprints_writercompletion","content":{"alias":"Adapt fact to AI expert","prompt":"Rewrite the following Chuck Norris fact so that it references @{item} instead of Chuck Norris: @{result.body.value}","modelId":"palmyra-x-004"},"outs":[{"outId":"success","toNodeId":"aig4"}]},{"id":"aig4","type":"blueprints_logmessage","content":{"alias":"Log adapted fact","type":"info","message":"@{result}"},"outs":[]}]
|
|
240
|
+
</blueprint>
|
|
241
|
+
</example>
|
|
242
|
+
<example>
|
|
243
|
+
<description>
|
|
244
|
+
tool calling agent that uses a log_message tool
|
|
245
|
+
</description>
|
|
246
|
+
<blueprint>
|
|
247
|
+
[{"id":"jy8pcl7qj2v99tx5","type":"blueprints_writertoolcalling","content":{"alias":"Agent","prompt":"Log message \"hi\" ","tools":"{\"log_message\":{\"description\":\"Logs a message\",\"parameters\":{\"message\":{\"type\":\"string\",\"description\":\"The message you'd like to log.\"}},\"type\":\"function\"}}"},"outs":[{"toNodeId":"htq6iidblgk83869","outId":"tools_log_message"}]},{"id":"htq6iidblgk83869","type":"blueprints_logmessage","content":{}}]
|
|
248
|
+
</blueprint>
|
|
249
|
+
</example>
|
|
250
|
+
<example>
|
|
251
|
+
<description>
|
|
252
|
+
Iterate over a hardcoded list of Sabrina Carpenter songs, iterate over a hardcoded list of Tupac songs, compare the songs with AI
|
|
253
|
+
</description>
|
|
254
|
+
<blueprint>
|
|
255
|
+
[{"id":"ybalvr6zo1q0td5z","type":"blueprints_foreach","content":{"alias":"Iterate over Sabrina Carpenter songs","items":"[\"Espresso\", \"Please Please Please\", \"Thumbs\"]","prefix":"sabrina"},"outs":[{"toNodeId":"63aqcc35n0ps1lil","outId":"loop"}]},{"id":"63aqcc35n0ps1lil","type":"blueprints_foreach","content":{"alias":"Iterate over Tupac songs","items":"[\"Changes\", \"California Love\"]"},"outs":[{"toNodeId":"xvi8hg1uxd4ac4pz","outId":"loop"}]},{"id":"xvi8hg1uxd4ac4pz","type":"blueprints_writerclassification","content":{"alias":"Compare songs with AI","categories":"{\"similar\": \"The songs are similar in theme or style\", \"different\": \"The songs are different in theme or style\"}","text":"Compare @{sabrina_item} with @{item}"},"outs":[{"outId":"category_similar","toNodeId":"xj7kc1mfy5mzwbp1"},{"outId":"category_different","toNodeId":"ylnluee85qwvbi4y"}]},{"id":"xj7kc1mfy5mzwbp1","type":"blueprints_logmessage","content":{"type":"info","alias":"Log similar comparison","message":"The songs @{sabrina_item} and @{item_tupac} are similar."},"outs":[]},{"id":"ylnluee85qwvbi4y","type":"blueprints_logmessage","content":{"type":"info","alias":"Log different comparison","message":"The songs @{sabrina_item} and @{item} are different."},"outs":[]}]
|
|
256
|
+
</blueprint>
|
|
257
|
+
</example>
|
|
258
|
+
<example>
|
|
259
|
+
<description>
|
|
260
|
+
Create a chatbot that acts as a customer support agent
|
|
261
|
+
</description>
|
|
262
|
+
<blueprint>
|
|
263
|
+
[{"id":"jozm6cm910p9rt6i","type":"blueprints_uieventtrigger","content":{"alias":"Chatbot - wf-chatbot-message","defaultResult":"{\"role\":\"user\",\"content\":\"I'm building a Chatbot\"}","refComponentId":"j26lfnf2znk4brwn","refEventType":"wf-chatbot-message"},"outs":[{"toNodeId":"e1p3d3zhdgsuxwky","outId":"trigger"}]},{"id":"e1p3d3zhdgsuxwky","type":"blueprints_writerchatmanager","content":{"conversationStateElement":"chat","message":"@{payload}","systemPrompt":"You are a technical support assistant for Agent Builder, designed to help users troubleshoot issues, debug problems, and navigate our documentation.\n\nYour goal is to understand the user's issue clearly, ask clarifying questions if needed, and provide helpful, accurate, and concise solutions.\n\nYou have access to product documentation and common troubleshooting steps.\n\nAlways include:\n• Links or references to relevant docs\n• Step-by-step instructions if applicable\n• Warnings or caveats for edge cases\n\nYou are polite, clear, and technical. When in doubt, you ask follow-up questions before giving advice.\n\nUse this structure:\nIssue Summary: (Briefly restate the user's problem)\nSuggested Fix: (Provide 1-2 options with steps)\nReference: (Link to doc or mention relevant section)","tools":"{}","generateReply":"yes"}}]
|
|
264
|
+
</blueprint>
|
|
265
|
+
</example>
|
|
266
|
+
</examples>"""
|
|
267
|
+
prompt += f"""
|
|
268
|
+
<task>
|
|
269
|
+
Generate a blueprint with the characteristics below
|
|
270
|
+
-----
|
|
271
|
+
{description}
|
|
272
|
+
</task>"""
|
|
273
|
+
return prompt
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def generate_blueprint(description: str, token_header: Optional[str] = None):
|
|
277
|
+
prompt = _get_main_prompt(description)
|
|
278
|
+
messages = [
|
|
279
|
+
{
|
|
280
|
+
"role": "user",
|
|
281
|
+
"content": prompt,
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
tools = _get_tools()
|
|
285
|
+
print(json.dumps(tools))
|
|
286
|
+
|
|
287
|
+
if token_header:
|
|
288
|
+
extra_headers = {
|
|
289
|
+
"X-Agent-Token": token_header
|
|
290
|
+
}
|
|
291
|
+
else:
|
|
292
|
+
extra_headers = {}
|
|
293
|
+
|
|
294
|
+
for i in range(MAX_ITERATIONS):
|
|
295
|
+
if i > 0:
|
|
296
|
+
messages += [
|
|
297
|
+
{
|
|
298
|
+
"role": "user",
|
|
299
|
+
"content": "Please try again using the errors brought to your attention after the function call. Challenge your own reasoning.",
|
|
300
|
+
}
|
|
301
|
+
]
|
|
302
|
+
response = client.chat.chat(
|
|
303
|
+
messages=messages,
|
|
304
|
+
model="palmyra-x5",
|
|
305
|
+
tool_choice="required",
|
|
306
|
+
tools=tools,
|
|
307
|
+
stream=False, # type: ignore
|
|
308
|
+
extra_headers=extra_headers
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
response_message = response.choices[0].message
|
|
312
|
+
tool_calls = response_message.tool_calls
|
|
313
|
+
messages.append(response_message)
|
|
314
|
+
|
|
315
|
+
if tool_calls:
|
|
316
|
+
tool_call = tool_calls[0]
|
|
317
|
+
tool_call_id = tool_call.id
|
|
318
|
+
|
|
319
|
+
try:
|
|
320
|
+
print(tool_call.function.arguments)
|
|
321
|
+
blueprint = json.loads(tool_call.function.arguments, strict=False)
|
|
322
|
+
_validate_blueprint_nodes(blueprint.get("components"))
|
|
323
|
+
except BaseException as exception:
|
|
324
|
+
message: Optional[str] = None
|
|
325
|
+
if isinstance(exception, json.JSONDecodeError):
|
|
326
|
+
message = "The JSON structure is incorrect. Please make sure you're abiding by the schema."
|
|
327
|
+
else:
|
|
328
|
+
message = "An error occurred. " + repr(exception)
|
|
329
|
+
logging.error(f"Autogen error. {message}")
|
|
330
|
+
messages.append(
|
|
331
|
+
{
|
|
332
|
+
"role": "tool",
|
|
333
|
+
"tool_call_id": tool_call_id,
|
|
334
|
+
"name": "generate_blueprint",
|
|
335
|
+
"content": message,
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
else:
|
|
339
|
+
return {"blueprint": blueprint, "messages": messages}
|
|
340
|
+
else:
|
|
341
|
+
messages.append(
|
|
342
|
+
{
|
|
343
|
+
"role": "user",
|
|
344
|
+
"content": "A tool call is required.",
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
|
|
348
|
+
return {"blueprint": None, "messages": messages}
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
if __name__ == "__main__":
|
|
352
|
+
generate_blueprint("Log message hello")
|
writer/blocks/__init__.py
CHANGED
|
@@ -1,33 +1,67 @@
|
|
|
1
1
|
from writer.blocks.addtostatelist import AddToStateList
|
|
2
|
+
from writer.blocks.apitrigger import APITrigger
|
|
2
3
|
from writer.blocks.calleventhandler import CallEventHandler
|
|
4
|
+
from writer.blocks.changepage import ChangePage
|
|
5
|
+
from writer.blocks.code import CodeBlock
|
|
6
|
+
from writer.blocks.crontrigger import CronTrigger
|
|
3
7
|
from writer.blocks.foreach import ForEach
|
|
4
8
|
from writer.blocks.httprequest import HTTPRequest
|
|
9
|
+
from writer.blocks.ifelse import IfElseBlock
|
|
5
10
|
from writer.blocks.logmessage import LogMessage
|
|
6
11
|
from writer.blocks.parsejson import ParseJSON
|
|
7
12
|
from writer.blocks.returnvalue import ReturnValue
|
|
8
|
-
from writer.blocks.
|
|
13
|
+
from writer.blocks.runblueprint import RunBlueprint
|
|
9
14
|
from writer.blocks.setstate import SetState
|
|
15
|
+
from writer.blocks.sharedblueprint import SharedBlueprint
|
|
16
|
+
from writer.blocks.uieventtrigger import UIEventTrigger
|
|
10
17
|
from writer.blocks.writeraddchatmessage import WriterAddChatMessage
|
|
11
18
|
from writer.blocks.writeraddtokg import WriterAddToKG
|
|
19
|
+
from writer.blocks.writeraskkg import WriterAskGraphQuestion
|
|
12
20
|
from writer.blocks.writerchat import WriterChat
|
|
21
|
+
from writer.blocks.writerchatreply import WriterChatReply
|
|
22
|
+
from writer.blocks.writerchatreplywithtoolconfig import WriterChatReplyWithToolConfig
|
|
13
23
|
from writer.blocks.writerclassification import WriterClassification
|
|
14
24
|
from writer.blocks.writercompletion import WriterCompletion
|
|
25
|
+
from writer.blocks.writerfileapi import WriterUploadFile
|
|
15
26
|
from writer.blocks.writerinitchat import WriterInitChat
|
|
27
|
+
from writer.blocks.writerkeyvaluestorage import WriterKeyValueStorage
|
|
16
28
|
from writer.blocks.writernocodeapp import WriterNoCodeApp
|
|
29
|
+
from writer.blocks.writerparsepdf import WriterParsePDFByFileID
|
|
30
|
+
from writer.blocks.writerstructuredoutput import WriterStructuredOutput
|
|
31
|
+
from writer.blocks.writertoolcalling import WriterToolCalling
|
|
32
|
+
from writer.blocks.writervision import WriterVision
|
|
33
|
+
from writer.blocks.writerwebsearch import WriterWebSearch
|
|
17
34
|
|
|
18
|
-
SetState.register("
|
|
19
|
-
WriterClassification.register("
|
|
20
|
-
WriterCompletion.register("
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
SetState.register("blueprints_setstate")
|
|
36
|
+
WriterClassification.register("blueprints_writerclassification")
|
|
37
|
+
WriterCompletion.register("blueprints_writercompletion")
|
|
38
|
+
WriterChatReply.register("blueprints_writerchatreply")
|
|
39
|
+
HTTPRequest.register("blueprints_httprequest")
|
|
40
|
+
RunBlueprint.register("blueprints_runblueprint")
|
|
41
|
+
WriterNoCodeApp.register("blueprints_writernocodeapp")
|
|
42
|
+
ForEach.register("blueprints_foreach")
|
|
43
|
+
IfElseBlock.register("blueprints_ifelse")
|
|
44
|
+
LogMessage.register("blueprints_logmessage")
|
|
45
|
+
WriterChat.register("blueprints_writerchat")
|
|
46
|
+
WriterAddChatMessage.register("blueprints_writeraddchatmessage")
|
|
47
|
+
ParseJSON.register("blueprints_parsejson")
|
|
48
|
+
CallEventHandler.register("blueprints_calleventhandler")
|
|
49
|
+
AddToStateList.register("blueprints_addtostatelist")
|
|
50
|
+
ReturnValue.register("blueprints_returnvalue")
|
|
51
|
+
WriterInitChat.register("blueprints_writerinitchat")
|
|
52
|
+
WriterAddToKG.register("blueprints_writeraddtokg")
|
|
53
|
+
UIEventTrigger.register("blueprints_uieventtrigger")
|
|
54
|
+
APITrigger.register("blueprints_apitrigger")
|
|
55
|
+
CronTrigger.register("blueprints_crontrigger")
|
|
56
|
+
CodeBlock.register("blueprints_code")
|
|
57
|
+
ChangePage.register("blueprints_changepage")
|
|
58
|
+
WriterStructuredOutput.register("blueprints_writerstructuredoutput")
|
|
59
|
+
WriterToolCalling.register("blueprints_writertoolcalling")
|
|
60
|
+
WriterAskGraphQuestion.register("blueprints_writeraskgraphquestion")
|
|
61
|
+
WriterParsePDFByFileID.register("blueprints_writerparsepdf")
|
|
62
|
+
WriterUploadFile.register("blueprints_writeruploadfile")
|
|
63
|
+
WriterVision.register("blueprints_writervision")
|
|
64
|
+
WriterWebSearch.register("blueprints_writerwebsearch")
|
|
65
|
+
WriterKeyValueStorage.register("blueprints_writerkeyvaluestorage")
|
|
66
|
+
WriterChatReplyWithToolConfig.register("blueprints_writerchatreplywithtoolconfig")
|
|
67
|
+
SharedBlueprint.register("blueprints_shared")
|
writer/blocks/addtostatelist.py
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
from writer.abstract import register_abstract_template
|
|
2
|
-
from writer.blocks.base_block import
|
|
2
|
+
from writer.blocks.base_block import BlueprintBlock
|
|
3
3
|
from writer.ss_types import AbstractTemplate, WriterConfigurationError
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class AddToStateList(
|
|
6
|
+
class AddToStateList(BlueprintBlock):
|
|
7
7
|
|
|
8
8
|
@classmethod
|
|
9
9
|
def register(cls, type: str):
|
|
10
10
|
super(AddToStateList, cls).register(type)
|
|
11
11
|
register_abstract_template(type, AbstractTemplate(
|
|
12
|
-
baseType="
|
|
12
|
+
baseType="blueprints_node",
|
|
13
13
|
writer={
|
|
14
14
|
"name": "Add to state list",
|
|
15
|
-
"description": "Adds a
|
|
15
|
+
"description": "Adds a new item to a list in the Agent's state. Useful for tracking multiple values over time.",
|
|
16
16
|
"category": "Other",
|
|
17
17
|
"fields": {
|
|
18
18
|
"element": {
|
|
19
|
-
"name": "
|
|
20
|
-
"type": "
|
|
19
|
+
"name": "Link Variable",
|
|
20
|
+
"type": "Binding",
|
|
21
|
+
"desc": "Set the variable here and use it across your agent.",
|
|
21
22
|
},
|
|
22
23
|
"value": {
|
|
23
24
|
"name": "Value",
|
|
@@ -28,12 +29,12 @@ class AddToStateList(WorkflowBlock):
|
|
|
28
29
|
"outs": {
|
|
29
30
|
"success": {
|
|
30
31
|
"name": "Success",
|
|
31
|
-
"description": "
|
|
32
|
+
"description": "The item was added to the list.",
|
|
32
33
|
"style": "success",
|
|
33
34
|
},
|
|
34
35
|
"error": {
|
|
35
36
|
"name": "Error",
|
|
36
|
-
"description": "
|
|
37
|
+
"description": "There was an error adding the item to the list.",
|
|
37
38
|
"style": "error",
|
|
38
39
|
},
|
|
39
40
|
},
|
|
@@ -57,4 +58,4 @@ class AddToStateList(WorkflowBlock):
|
|
|
57
58
|
self.outcome = "success"
|
|
58
59
|
except BaseException as e:
|
|
59
60
|
self.outcome = "error"
|
|
60
|
-
raise e
|
|
61
|
+
raise e
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from writer.abstract import register_abstract_template
|
|
2
|
+
from writer.blocks.base_trigger import BlueprintTrigger
|
|
3
|
+
from writer.ss_types import AbstractTemplate
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class APITrigger(BlueprintTrigger):
|
|
7
|
+
@classmethod
|
|
8
|
+
def register(cls, type: str):
|
|
9
|
+
super(APITrigger, cls).register(type)
|
|
10
|
+
register_abstract_template(
|
|
11
|
+
type,
|
|
12
|
+
AbstractTemplate(
|
|
13
|
+
baseType="blueprints_node",
|
|
14
|
+
writer={
|
|
15
|
+
"name": "API Trigger",
|
|
16
|
+
"description": "Triggers an event via API call.",
|
|
17
|
+
"category": "Triggers",
|
|
18
|
+
"fields": {
|
|
19
|
+
"blueprintId": {
|
|
20
|
+
"name": "Blueprint ID",
|
|
21
|
+
"type": "Blueprint Id",
|
|
22
|
+
},
|
|
23
|
+
"defaultResult": {
|
|
24
|
+
"name": "Default result",
|
|
25
|
+
"type": "Code",
|
|
26
|
+
"desc": 'The result that is used when the blueprint is triggered from the "Run blueprint" button',
|
|
27
|
+
"isArtifactField": True,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
"outs": {
|
|
31
|
+
"trigger": {
|
|
32
|
+
"name": "Trigger",
|
|
33
|
+
"style": "success",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
"settingsArtifacts": [
|
|
37
|
+
{"key": "apiTriggerDetails", "position": "bottom"}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
def run(self):
|
|
44
|
+
super().run()
|
|
45
|
+
self.outcome = "trigger"
|