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/blocks/parsejson.py
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import json
|
|
2
2
|
|
|
3
3
|
from writer.abstract import register_abstract_template
|
|
4
|
-
from writer.blocks.base_block import
|
|
4
|
+
from writer.blocks.base_block import BlueprintBlock
|
|
5
5
|
from writer.ss_types import AbstractTemplate
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class ParseJSON(
|
|
9
|
-
|
|
8
|
+
class ParseJSON(BlueprintBlock):
|
|
10
9
|
@classmethod
|
|
11
10
|
def register(cls, type: str):
|
|
12
11
|
super(ParseJSON, cls).register(type)
|
|
13
|
-
register_abstract_template(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"type": "Text",
|
|
23
|
-
"control": "Textarea"
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
"outs": {
|
|
27
|
-
"success": {
|
|
28
|
-
"name": "Success",
|
|
29
|
-
"description": "The request was successful.",
|
|
30
|
-
"style": "success",
|
|
12
|
+
register_abstract_template(
|
|
13
|
+
type,
|
|
14
|
+
AbstractTemplate(
|
|
15
|
+
baseType="blueprints_node",
|
|
16
|
+
writer={
|
|
17
|
+
"name": "Parse JSON",
|
|
18
|
+
"description": "Converts a JSON string into an object, so you can work with it in your logic.",
|
|
19
|
+
"category": "Other",
|
|
20
|
+
"fields": {
|
|
21
|
+
"plainText": {"name": "Plain text", "type": "Text", "control": "Textarea"},
|
|
31
22
|
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
"outs": {
|
|
24
|
+
"success": {
|
|
25
|
+
"name": "Success",
|
|
26
|
+
"description": "The request was successful.",
|
|
27
|
+
"style": "success",
|
|
28
|
+
},
|
|
29
|
+
"error": {
|
|
30
|
+
"name": "Error",
|
|
31
|
+
"description": "The text provided couldn't be parsed.",
|
|
32
|
+
"style": "error",
|
|
33
|
+
},
|
|
36
34
|
},
|
|
37
35
|
},
|
|
38
|
-
|
|
39
|
-
)
|
|
36
|
+
),
|
|
37
|
+
)
|
|
40
38
|
|
|
41
39
|
def run(self):
|
|
42
40
|
try:
|
|
43
41
|
plain_text = self._get_field("plainText")
|
|
44
|
-
|
|
42
|
+
if isinstance(plain_text, dict):
|
|
43
|
+
self.result = plain_text
|
|
44
|
+
else:
|
|
45
|
+
self.result = json.loads(plain_text)
|
|
45
46
|
self.outcome = "success"
|
|
46
47
|
except BaseException as e:
|
|
47
48
|
self.outcome = "error"
|
|
48
|
-
raise e
|
|
49
|
+
raise e
|
writer/blocks/returnvalue.py
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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 ReturnValue(
|
|
6
|
+
class ReturnValue(BlueprintBlock):
|
|
7
7
|
|
|
8
8
|
@classmethod
|
|
9
9
|
def register(cls, type: str):
|
|
10
10
|
super(ReturnValue, cls).register(type)
|
|
11
11
|
register_abstract_template(type, AbstractTemplate(
|
|
12
|
-
baseType="
|
|
12
|
+
baseType="blueprints_node",
|
|
13
13
|
writer={
|
|
14
14
|
"name": "Return value",
|
|
15
|
-
"description": "Returns a value from
|
|
15
|
+
"description": "Returns a value from this block to the caller. Use to pass results to another blueprint.",
|
|
16
16
|
"category": "Logic",
|
|
17
17
|
"fields": {
|
|
18
18
|
"value": {
|
|
@@ -24,12 +24,12 @@ class ReturnValue(WorkflowBlock):
|
|
|
24
24
|
"outs": {
|
|
25
25
|
"success": {
|
|
26
26
|
"name": "Success",
|
|
27
|
-
"description": "
|
|
27
|
+
"description": "The value was returned successfully.",
|
|
28
28
|
"style": "success",
|
|
29
29
|
},
|
|
30
30
|
"error": {
|
|
31
31
|
"name": "Error",
|
|
32
|
-
"description": "
|
|
32
|
+
"description": "There was an error returning the value.",
|
|
33
33
|
"style": "error",
|
|
34
34
|
},
|
|
35
35
|
},
|
|
@@ -46,4 +46,4 @@ class ReturnValue(WorkflowBlock):
|
|
|
46
46
|
self.outcome = "success"
|
|
47
47
|
except BaseException as e:
|
|
48
48
|
self.outcome = "error"
|
|
49
|
-
raise e
|
|
49
|
+
raise e
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from writer.abstract import register_abstract_template
|
|
2
|
+
from writer.blocks.base_block import BlueprintBlock
|
|
3
|
+
from writer.ss_types import AbstractTemplate
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class RunBlueprint(BlueprintBlock):
|
|
7
|
+
@classmethod
|
|
8
|
+
def register(cls, type: str):
|
|
9
|
+
super(RunBlueprint, cls).register(type)
|
|
10
|
+
register_abstract_template(
|
|
11
|
+
type,
|
|
12
|
+
AbstractTemplate(
|
|
13
|
+
baseType="blueprints_node",
|
|
14
|
+
writer={
|
|
15
|
+
"name": "Run blueprint",
|
|
16
|
+
"description": "Starts another blueprint by key. Useful for breaking logic into smaller, reusable parts.",
|
|
17
|
+
"category": "Logic",
|
|
18
|
+
"fields": {
|
|
19
|
+
"blueprintKey": {
|
|
20
|
+
"name": "Blueprint Key",
|
|
21
|
+
"type": "Blueprint Key",
|
|
22
|
+
"validator": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"format": "writer#blueprintKey",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
"payload": {
|
|
28
|
+
"name": "Payload",
|
|
29
|
+
"desc": "The value specified will be available using the template syntax, e.g. @{payload}.",
|
|
30
|
+
"default": "{}",
|
|
31
|
+
"type": "Text",
|
|
32
|
+
"control": "Textarea",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
"outs": {
|
|
36
|
+
"success": {
|
|
37
|
+
"name": "Success",
|
|
38
|
+
"description": "The request was successful.",
|
|
39
|
+
"style": "success",
|
|
40
|
+
},
|
|
41
|
+
"error": {
|
|
42
|
+
"name": "Error",
|
|
43
|
+
"description": "The blueprint execution failed.",
|
|
44
|
+
"style": "error",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def run(self):
|
|
52
|
+
try:
|
|
53
|
+
blueprint_key = self._get_field("blueprintKey")
|
|
54
|
+
payload = self._get_field("payload")
|
|
55
|
+
expanded_execution_environment = self.execution_environment | {"payload": payload}
|
|
56
|
+
return_value = self.runner.run_blueprint_by_key(
|
|
57
|
+
blueprint_key, expanded_execution_environment
|
|
58
|
+
)
|
|
59
|
+
self.result = return_value
|
|
60
|
+
self.outcome = "success"
|
|
61
|
+
except BaseException as e:
|
|
62
|
+
self.outcome = "error"
|
|
63
|
+
raise e
|
writer/blocks/setstate.py
CHANGED
|
@@ -1,53 +1,63 @@
|
|
|
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
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class SetState(
|
|
7
|
-
|
|
6
|
+
class SetState(BlueprintBlock):
|
|
8
7
|
@classmethod
|
|
9
8
|
def register(cls, type: str):
|
|
10
9
|
super(SetState, cls).register(type)
|
|
11
|
-
register_abstract_template(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
register_abstract_template(
|
|
11
|
+
type,
|
|
12
|
+
AbstractTemplate(
|
|
13
|
+
baseType="blueprints_node",
|
|
14
|
+
writer={
|
|
15
|
+
"name": "Set state",
|
|
16
|
+
"description": "Stores a value in the Agent's state. Use to remember data across steps.",
|
|
17
|
+
"category": "Other",
|
|
18
|
+
"fields": {
|
|
19
|
+
"element": {
|
|
20
|
+
"name": "Link Variable",
|
|
21
|
+
"type": "Binding",
|
|
22
|
+
"desc": "Set the variable here and use it across your agent.",
|
|
23
|
+
},
|
|
24
|
+
"valueType": {
|
|
25
|
+
"name": "Value type",
|
|
26
|
+
"type": "Text",
|
|
27
|
+
"description": "Specify whether to interpret the value as plain text or JSON.",
|
|
28
|
+
"options": {
|
|
29
|
+
"text": "Plain text",
|
|
30
|
+
"JSON": "JSON",
|
|
31
|
+
},
|
|
32
|
+
"default": "text",
|
|
33
|
+
},
|
|
34
|
+
"value": {"name": "Value", "type": "Text", "control": "Textarea"},
|
|
33
35
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
"outs": {
|
|
37
|
+
"success": {
|
|
38
|
+
"name": "Success",
|
|
39
|
+
"description": "The state was updated successfully.",
|
|
40
|
+
"style": "success",
|
|
41
|
+
},
|
|
42
|
+
"error": {
|
|
43
|
+
"name": "Error",
|
|
44
|
+
"description": "There was an error updating the state.",
|
|
45
|
+
"style": "error",
|
|
46
|
+
},
|
|
38
47
|
},
|
|
39
48
|
},
|
|
40
|
-
|
|
41
|
-
)
|
|
49
|
+
),
|
|
50
|
+
)
|
|
42
51
|
|
|
43
52
|
def run(self):
|
|
44
53
|
try:
|
|
45
54
|
element = self._get_field("element", required=True)
|
|
46
|
-
|
|
55
|
+
value_type = self._get_field("valueType")
|
|
56
|
+
value = self._get_field("value", as_json=value_type == "JSON")
|
|
47
57
|
|
|
48
58
|
self._set_state(element, value)
|
|
49
59
|
self.result = value
|
|
50
60
|
self.outcome = "success"
|
|
51
61
|
except BaseException as e:
|
|
52
62
|
self.outcome = "error"
|
|
53
|
-
raise e
|
|
63
|
+
raise e
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared blueprint implementation for user-created reusable blueprints.
|
|
3
|
+
|
|
4
|
+
Shared blueprints execute stored blueprint components by loading them from the component tree.
|
|
5
|
+
The component's content.sourceBlueprintId field references the source blueprint.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from writer.abstract import register_abstract_template
|
|
9
|
+
from writer.blocks.base_block import BlueprintBlock
|
|
10
|
+
from writer.ss_types import AbstractTemplate
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SharedBlueprint(BlueprintBlock):
|
|
14
|
+
"""
|
|
15
|
+
Shared blueprint that executes components from a source blueprint in the component tree.
|
|
16
|
+
|
|
17
|
+
The source blueprint is identified by the sourceBlueprintId content field.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def register(cls, type: str):
|
|
22
|
+
"""Register the blueprints_shared type with its abstract template."""
|
|
23
|
+
super(SharedBlueprint, cls).register(type)
|
|
24
|
+
register_abstract_template(
|
|
25
|
+
type,
|
|
26
|
+
AbstractTemplate(
|
|
27
|
+
baseType="blueprints_node",
|
|
28
|
+
writer={
|
|
29
|
+
"name": "Shared Blueprint",
|
|
30
|
+
"description": "Executes a shared blueprint from the component tree.",
|
|
31
|
+
"category": "Logic",
|
|
32
|
+
"toolkit": "blueprints",
|
|
33
|
+
"featureFlags": ["shared_blueprints"],
|
|
34
|
+
"fields": {
|
|
35
|
+
"payload": {
|
|
36
|
+
"name": "Payload",
|
|
37
|
+
"desc": "The value specified will be available using the template syntax, e.g. @{payload}.",
|
|
38
|
+
"default": "{}",
|
|
39
|
+
"type": "Text",
|
|
40
|
+
"control": "Textarea",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
"outs": {
|
|
44
|
+
"success": {
|
|
45
|
+
"name": "Success",
|
|
46
|
+
"description": "Blueprint executed successfully.",
|
|
47
|
+
"style": "success",
|
|
48
|
+
},
|
|
49
|
+
"error": {
|
|
50
|
+
"name": "Error",
|
|
51
|
+
"description": "Blueprint execution failed.",
|
|
52
|
+
"style": "error",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def run(self):
|
|
60
|
+
"""Execute the source blueprint's components."""
|
|
61
|
+
source_blueprint_id = self.component.content.get("sourceBlueprintId", "")
|
|
62
|
+
|
|
63
|
+
if not source_blueprint_id:
|
|
64
|
+
raise ValueError("No source blueprint ID specified")
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
payload = self._get_field("payload")
|
|
68
|
+
expanded_execution_environment = self.execution_environment | {"payload": payload}
|
|
69
|
+
|
|
70
|
+
# Get blueprint name for title (matching run_blueprint_by_key pattern)
|
|
71
|
+
source_blueprint = self.runner.session.session_component_tree.get_component(
|
|
72
|
+
source_blueprint_id
|
|
73
|
+
)
|
|
74
|
+
blueprint_name = source_blueprint.content.get("key", "Shared Blueprint") if source_blueprint else "Shared Blueprint"
|
|
75
|
+
|
|
76
|
+
return_value = self.runner.run_blueprint(
|
|
77
|
+
source_blueprint_id,
|
|
78
|
+
expanded_execution_environment,
|
|
79
|
+
title=f"Shared blueprint execution ({blueprint_name})"
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
self.result = return_value
|
|
83
|
+
self.outcome = "success"
|
|
84
|
+
except BaseException as e:
|
|
85
|
+
self.outcome = "error"
|
|
86
|
+
raise e
|
|
@@ -0,0 +1,49 @@
|
|
|
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 UIEventTrigger(BlueprintTrigger):
|
|
7
|
+
@classmethod
|
|
8
|
+
def register(cls, type: str):
|
|
9
|
+
super(UIEventTrigger, cls).register(type)
|
|
10
|
+
register_abstract_template(
|
|
11
|
+
type,
|
|
12
|
+
AbstractTemplate(
|
|
13
|
+
baseType="blueprints_node",
|
|
14
|
+
writer={
|
|
15
|
+
"name": "UI Trigger",
|
|
16
|
+
"description": "Triggers an event based on UI interactions like button clicks or input changes.",
|
|
17
|
+
"category": "Triggers",
|
|
18
|
+
"fields": {
|
|
19
|
+
"refComponentId": {
|
|
20
|
+
"name": "Component Id",
|
|
21
|
+
"type": "Component Id",
|
|
22
|
+
"options": "uiComponentsWithEvents",
|
|
23
|
+
"desc": "The id of the component that will trigger this branch.",
|
|
24
|
+
},
|
|
25
|
+
"refEventType": {
|
|
26
|
+
"name": "Event type",
|
|
27
|
+
"type": "Component Event Type",
|
|
28
|
+
"desc": "The type of the event that will trigger this branch. For example, wf-click.",
|
|
29
|
+
"options": "eventTypes",
|
|
30
|
+
},
|
|
31
|
+
"defaultResult": {
|
|
32
|
+
"name": "Default result",
|
|
33
|
+
"type": "Code",
|
|
34
|
+
"desc": 'The result that is used when the blueprint is triggered from the "Run blueprint" button',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
"outs": {
|
|
38
|
+
"trigger": {
|
|
39
|
+
"name": "Trigger",
|
|
40
|
+
"style": "success",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def run(self):
|
|
48
|
+
super().run()
|
|
49
|
+
self.outcome = "trigger"
|
|
@@ -1,34 +1,72 @@
|
|
|
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 WriterAddChatMessage(
|
|
6
|
+
class WriterAddChatMessage(BlueprintBlock):
|
|
7
7
|
|
|
8
8
|
@classmethod
|
|
9
9
|
def register(cls, type: str):
|
|
10
10
|
super(WriterAddChatMessage, cls).register(type)
|
|
11
11
|
register_abstract_template(type, AbstractTemplate(
|
|
12
|
-
baseType="
|
|
12
|
+
baseType="blueprints_node",
|
|
13
13
|
writer={
|
|
14
14
|
"name": "Add chat message",
|
|
15
|
-
"description": "
|
|
15
|
+
"description": "Adds a message to the conversation history. Use for displaying user or AI messages.",
|
|
16
16
|
"category": "Writer",
|
|
17
|
+
"deprecated": True,
|
|
17
18
|
"fields": {
|
|
18
19
|
"conversationStateElement": {
|
|
19
20
|
"name": "Conversation state element",
|
|
20
|
-
"desc": "
|
|
21
|
-
"type": "
|
|
21
|
+
"desc": "The variable that has your conversation object.",
|
|
22
|
+
"type": "Binding",
|
|
22
23
|
},
|
|
23
24
|
"message": {
|
|
24
25
|
"name": "Message",
|
|
25
26
|
"type": "Object",
|
|
26
27
|
"init": '{ "role": "assistant", "content": "Hello" }',
|
|
28
|
+
"desc": "A message object. Content can be text string or array of objects for multimodal (text + images) with X5 model.",
|
|
27
29
|
"validator": {
|
|
28
30
|
"type": "object",
|
|
29
31
|
"properties": {
|
|
30
|
-
"role": {
|
|
31
|
-
"content": {
|
|
32
|
+
"role": {"type": "string"},
|
|
33
|
+
"content": {
|
|
34
|
+
"oneOf": [
|
|
35
|
+
{"type": "string"},
|
|
36
|
+
{
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"oneOf": [
|
|
40
|
+
{
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"type": {"type": "string", "enum": ["text"]},
|
|
44
|
+
"text": {"type": "string"}
|
|
45
|
+
},
|
|
46
|
+
"required": ["type", "text"],
|
|
47
|
+
"additionalProperties": False
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"type": "object",
|
|
51
|
+
"properties": {
|
|
52
|
+
"type": {"type": "string", "enum": ["image_url"]},
|
|
53
|
+
"image_url": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"url": {"type": "string"}
|
|
57
|
+
},
|
|
58
|
+
"required": ["url"],
|
|
59
|
+
"additionalProperties": False
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"required": ["type", "image_url"],
|
|
63
|
+
"additionalProperties": False
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
32
70
|
},
|
|
33
71
|
"additionalProperties": False,
|
|
34
72
|
}
|
|
@@ -37,12 +75,12 @@ class WriterAddChatMessage(WorkflowBlock):
|
|
|
37
75
|
"outs": {
|
|
38
76
|
"success": {
|
|
39
77
|
"name": "Success",
|
|
40
|
-
"description": "
|
|
78
|
+
"description": "The message was added to the conversation.",
|
|
41
79
|
"style": "success",
|
|
42
80
|
},
|
|
43
81
|
"error": {
|
|
44
82
|
"name": "Error",
|
|
45
|
-
"description": "
|
|
83
|
+
"description": "There was an error adding the message.",
|
|
46
84
|
"style": "error",
|
|
47
85
|
},
|
|
48
86
|
},
|
|
@@ -59,7 +97,7 @@ class WriterAddChatMessage(WorkflowBlock):
|
|
|
59
97
|
conversation = self.evaluator.evaluate_expression(conversation_state_element, self.instance_path, self.execution_environment)
|
|
60
98
|
|
|
61
99
|
if conversation is None or not isinstance(conversation, writer.ai.Conversation):
|
|
62
|
-
raise WriterConfigurationError("The state element specified doesn't contain a conversation. Initialize one using the block '
|
|
100
|
+
raise WriterConfigurationError("The state element specified doesn't contain a conversation. Initialize one using the block 'Start chat conversation'.")
|
|
63
101
|
|
|
64
102
|
writer.ai.Conversation.validate_message(message)
|
|
65
103
|
conversation += message
|
|
@@ -71,4 +109,4 @@ class WriterAddChatMessage(WorkflowBlock):
|
|
|
71
109
|
self.outcome = "error"
|
|
72
110
|
raise e
|
|
73
111
|
|
|
74
|
-
|
|
112
|
+
|
writer/blocks/writeraddtokg.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
3
|
from writer.abstract import register_abstract_template
|
|
4
|
-
from writer.blocks.base_block import
|
|
4
|
+
from writer.blocks.base_block import WriterBlock
|
|
5
5
|
from writer.ss_types import AbstractTemplate, WriterConfigurationError
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class WriterAddToKG(
|
|
8
|
+
class WriterAddToKG(WriterBlock):
|
|
9
9
|
|
|
10
10
|
@classmethod
|
|
11
11
|
def register(cls, type: str):
|
|
12
12
|
super(WriterAddToKG, cls).register(type)
|
|
13
13
|
register_abstract_template(type, AbstractTemplate(
|
|
14
|
-
baseType="
|
|
14
|
+
baseType="blueprints_node",
|
|
15
15
|
writer={
|
|
16
16
|
"name": "Add to Knowledge Graph",
|
|
17
|
-
"description": "Adds
|
|
17
|
+
"description": "Adds structured information to the knowledge graph. Use for storing facts AI can reference.",
|
|
18
18
|
"category": "Writer",
|
|
19
19
|
"fields": {
|
|
20
20
|
"graphId": {
|
|
21
|
-
"name": "Graph
|
|
22
|
-
"type": "
|
|
21
|
+
"name": "Graph Id",
|
|
22
|
+
"type": "Graph Id",
|
|
23
23
|
"desc": "The id for an existing knowledge graph. It has a UUID format.",
|
|
24
24
|
"validator": {
|
|
25
25
|
"type": "string",
|
|
@@ -30,21 +30,34 @@ class WriterAddToKG(WorkflowBlock):
|
|
|
30
30
|
"name": "Files",
|
|
31
31
|
"type": "Object",
|
|
32
32
|
"default": "[]",
|
|
33
|
-
"desc": "A list of files to be uploaded and added to the knowledge graph. You can use files uploaded via the File
|
|
33
|
+
"desc": "A list of files to be uploaded and added to the knowledge graph. You can use files uploaded via the File input component or specify dictionaries with data, type and name.",
|
|
34
34
|
"validator": {
|
|
35
35
|
"type": "array",
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
+
"urls": {
|
|
39
|
+
"name": "URLs",
|
|
40
|
+
"type": "Object",
|
|
41
|
+
"default": "[]",
|
|
42
|
+
"desc": "A list of URLs to be added to the knowledge graph. Web content from these URLs will be indexed.",
|
|
43
|
+
"validator": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"format": "uri",
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
38
51
|
},
|
|
39
52
|
"outs": {
|
|
40
53
|
"success": {
|
|
41
54
|
"name": "Success",
|
|
42
|
-
"description": "
|
|
55
|
+
"description": "Content was added to the knowledge graph.",
|
|
43
56
|
"style": "success",
|
|
44
57
|
},
|
|
45
58
|
"error": {
|
|
46
59
|
"name": "Error",
|
|
47
|
-
"description": "
|
|
60
|
+
"description": "There was an error adding content to the knowledge graph.",
|
|
48
61
|
"style": "error",
|
|
49
62
|
},
|
|
50
63
|
},
|
|
@@ -65,24 +78,38 @@ class WriterAddToKG(WorkflowBlock):
|
|
|
65
78
|
import writer.ai
|
|
66
79
|
|
|
67
80
|
graph_id = self._get_field("graphId", required=True)
|
|
68
|
-
raw_files = self._get_field("files", as_json=True)
|
|
81
|
+
raw_files = self._get_field("files", as_json=True, default_field_value="[]")
|
|
82
|
+
urls = self._get_field("urls", as_json=True, default_field_value="[]")
|
|
69
83
|
prepared_files = []
|
|
70
84
|
|
|
71
85
|
if not isinstance(raw_files, list):
|
|
72
86
|
raise WriterConfigurationError("Files must be a list.")
|
|
87
|
+
|
|
88
|
+
if not isinstance(urls, list):
|
|
89
|
+
raise WriterConfigurationError("URLs must be a list.")
|
|
90
|
+
|
|
91
|
+
if not raw_files and not urls:
|
|
92
|
+
raise WriterConfigurationError("At least one file or URL must be provided.")
|
|
73
93
|
|
|
74
94
|
for raw_file in raw_files:
|
|
75
95
|
prepared_files.append(self._get_prepared_file(raw_file))
|
|
76
96
|
|
|
77
97
|
graph = writer.ai.retrieve_graph(graph_id)
|
|
78
98
|
|
|
99
|
+
# Add files to the graph
|
|
79
100
|
for prepared_file in prepared_files:
|
|
80
101
|
file = writer.ai.upload_file(prepared_file.get("data"),
|
|
81
102
|
prepared_file.get("type"),
|
|
82
103
|
prepared_file.get("name"))
|
|
83
104
|
graph.add_file(file)
|
|
105
|
+
|
|
106
|
+
# Add URLs to the graph using SDK 2.3.0 feature
|
|
107
|
+
for url in urls:
|
|
108
|
+
if not isinstance(url, str):
|
|
109
|
+
raise WriterConfigurationError(f"URL must be a string, got {type(url)}")
|
|
110
|
+
graph.add_url(url)
|
|
84
111
|
|
|
85
112
|
self.outcome = "success"
|
|
86
113
|
except BaseException as e:
|
|
87
114
|
self.outcome = "error"
|
|
88
|
-
raise e
|
|
115
|
+
raise e
|