langflow-base-nightly 0.5.0.dev37__py3-none-any.whl → 0.5.0.dev39__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.
- langflow/__main__.py +1 -1
- langflow/alembic/versions/0882f9657f22_encrypt_existing_mcp_auth_settings_.py +122 -0
- langflow/alembic/versions/4e5980a44eaa_fix_date_times_again.py +24 -30
- langflow/alembic/versions/58b28437a398_modify_nullable.py +6 -6
- langflow/alembic/versions/79e675cb6752_change_datetime_type.py +24 -30
- langflow/alembic/versions/b2fa308044b5_add_unique_constraints.py +12 -13
- langflow/api/build.py +21 -26
- langflow/api/health_check_router.py +3 -3
- langflow/api/utils.py +3 -3
- langflow/api/v1/callback.py +2 -2
- langflow/api/v1/chat.py +19 -31
- langflow/api/v1/endpoints.py +10 -10
- langflow/api/v1/flows.py +1 -1
- langflow/api/v1/knowledge_bases.py +3 -3
- langflow/api/v1/mcp.py +12 -12
- langflow/api/v1/mcp_projects.py +405 -120
- langflow/api/v1/mcp_utils.py +8 -8
- langflow/api/v1/schemas.py +2 -7
- langflow/api/v1/store.py +1 -1
- langflow/api/v1/validate.py +2 -2
- langflow/api/v1/voice_mode.py +58 -62
- langflow/api/v2/files.py +2 -2
- langflow/api/v2/mcp.py +10 -9
- langflow/base/composio/composio_base.py +21 -2
- langflow/base/data/docling_utils.py +194 -0
- langflow/base/embeddings/aiml_embeddings.py +1 -1
- langflow/base/flow_processing/utils.py +1 -2
- langflow/base/io/__init__.py +0 -1
- langflow/base/langwatch/utils.py +2 -1
- langflow/base/mcp/util.py +49 -47
- langflow/base/prompts/api_utils.py +1 -1
- langflow/base/tools/flow_tool.py +2 -2
- langflow/base/tools/run_flow.py +2 -6
- langflow/components/FAISS/__init__.py +34 -0
- langflow/components/Notion/add_content_to_page.py +2 -2
- langflow/components/Notion/list_database_properties.py +2 -2
- langflow/components/Notion/list_pages.py +2 -2
- langflow/components/Notion/page_content_viewer.py +2 -2
- langflow/components/Notion/update_page_property.py +1 -1
- langflow/components/agentql/agentql_api.py +2 -10
- langflow/components/agents/agent.py +249 -55
- langflow/components/agents/mcp_component.py +14 -14
- langflow/components/anthropic/anthropic.py +5 -4
- langflow/components/assemblyai/assemblyai_get_subtitles.py +2 -2
- langflow/components/assemblyai/assemblyai_lemur.py +2 -2
- langflow/components/assemblyai/assemblyai_list_transcripts.py +2 -2
- langflow/components/assemblyai/assemblyai_poll_transcript.py +2 -2
- langflow/components/assemblyai/assemblyai_start_transcript.py +2 -2
- langflow/components/cassandra/__init__.py +40 -0
- langflow/components/chroma/__init__.py +34 -0
- langflow/components/clickhouse/__init__.py +34 -0
- langflow/components/couchbase/__init__.py +34 -0
- langflow/components/data/file.py +575 -55
- langflow/components/data/url.py +1 -1
- langflow/components/datastax/__init__.py +3 -3
- langflow/components/datastax/astra_assistant_manager.py +3 -3
- langflow/components/datastax/create_assistant.py +1 -2
- langflow/components/deactivated/merge_data.py +1 -2
- langflow/components/deactivated/sub_flow.py +6 -7
- langflow/components/deactivated/vectara_self_query.py +3 -3
- langflow/components/docling/__init__.py +0 -198
- langflow/components/docling/docling_inline.py +1 -1
- langflow/components/elastic/__init__.py +37 -0
- langflow/components/embeddings/text_embedder.py +3 -3
- langflow/components/firecrawl/firecrawl_extract_api.py +2 -9
- langflow/components/google/gmail.py +1 -1
- langflow/components/google/google_generative_ai.py +5 -11
- langflow/components/groq/groq.py +4 -3
- langflow/components/helpers/current_date.py +2 -3
- langflow/components/helpers/memory.py +1 -1
- langflow/components/ibm/watsonx.py +1 -1
- langflow/components/ibm/watsonx_embeddings.py +1 -1
- langflow/components/langwatch/langwatch.py +3 -3
- langflow/components/logic/flow_tool.py +2 -2
- langflow/components/logic/notify.py +1 -1
- langflow/components/logic/run_flow.py +2 -3
- langflow/components/logic/sub_flow.py +4 -5
- langflow/components/mem0/mem0_chat_memory.py +2 -8
- langflow/components/milvus/__init__.py +34 -0
- langflow/components/mongodb/__init__.py +34 -0
- langflow/components/nvidia/nvidia.py +3 -3
- langflow/components/olivya/olivya.py +7 -7
- langflow/components/ollama/ollama.py +9 -6
- langflow/components/perplexity/perplexity.py +3 -13
- langflow/components/pgvector/__init__.py +34 -0
- langflow/components/pinecone/__init__.py +34 -0
- langflow/components/processing/batch_run.py +8 -8
- langflow/components/processing/data_operations.py +2 -2
- langflow/components/processing/merge_data.py +1 -2
- langflow/components/processing/message_to_data.py +2 -3
- langflow/components/processing/parse_json_data.py +1 -1
- langflow/components/prototypes/python_function.py +2 -3
- langflow/components/qdrant/__init__.py +34 -0
- langflow/components/redis/__init__.py +36 -2
- langflow/components/redis/redis.py +75 -29
- langflow/components/redis/redis_chat.py +43 -0
- langflow/components/serpapi/serp.py +1 -1
- langflow/components/supabase/__init__.py +37 -0
- langflow/components/tavily/tavily_extract.py +1 -1
- langflow/components/tavily/tavily_search.py +1 -1
- langflow/components/tools/calculator.py +2 -2
- langflow/components/tools/python_code_structured_tool.py +3 -10
- langflow/components/tools/python_repl.py +2 -2
- langflow/components/tools/searxng.py +3 -3
- langflow/components/tools/serp_api.py +2 -2
- langflow/components/tools/tavily_search_tool.py +2 -2
- langflow/components/tools/yahoo_finance.py +1 -1
- langflow/components/twelvelabs/video_embeddings.py +4 -4
- langflow/components/upstash/__init__.py +34 -0
- langflow/components/vectara/__init__.py +37 -0
- langflow/components/vectorstores/__init__.py +0 -69
- langflow/components/vectorstores/local_db.py +2 -1
- langflow/components/weaviate/__init__.py +34 -0
- langflow/components/yahoosearch/yahoo.py +1 -1
- langflow/components/youtube/trending.py +3 -4
- langflow/custom/attributes.py +2 -1
- langflow/custom/code_parser/code_parser.py +1 -1
- langflow/custom/custom_component/base_component.py +1 -1
- langflow/custom/custom_component/component.py +16 -2
- langflow/custom/dependency_analyzer.py +165 -0
- langflow/custom/directory_reader/directory_reader.py +7 -7
- langflow/custom/directory_reader/utils.py +1 -2
- langflow/custom/utils.py +63 -45
- langflow/events/event_manager.py +1 -1
- langflow/frontend/assets/{SlackIcon-CnvyOamQ.js → SlackIcon-Cr3Q15Px.js} +1 -1
- langflow/frontend/assets/{Wikipedia-nyTEXdr2.js → Wikipedia-GxM5sPdM.js} +1 -1
- langflow/frontend/assets/{Wolfram-BYMQkNSq.js → Wolfram-BN3-VOCA.js} +1 -1
- langflow/frontend/assets/{index-DZTC5pdT.js → index-28oOcafk.js} +1 -1
- langflow/frontend/assets/{index-ChXJpBz4.js → index-2wSXqBtB.js} +1 -1
- langflow/frontend/assets/{index-BB15_iOb.js → index-3wW7BClE.js} +1 -1
- langflow/frontend/assets/{index-DKHNourL.js → index-6pyH3ZJB.js} +1 -1
- langflow/frontend/assets/{index-BvwZfF2i.js → index-AWCSdofD.js} +1 -1
- langflow/frontend/assets/{index-Bvxg4_ux.js → index-B2Zgv_xv.js} +1 -1
- langflow/frontend/assets/{index-Bd6WtbKA.js → index-B2ptVQGM.js} +1 -1
- langflow/frontend/assets/{index-C7QWbnLK.js → index-B3TANVes.js} +1 -1
- langflow/frontend/assets/{index-CpvYQ0ug.js → index-B4yCvZKV.js} +1 -1
- langflow/frontend/assets/{index-Dg-63Si_.js → index-BC65VuWx.js} +1 -1
- langflow/frontend/assets/{index-C6jri9Wm.js → index-BCDSei1q.js} +1 -1
- langflow/frontend/assets/{index-OazXJdEl.js → index-BJy50PvP.js} +1 -1
- langflow/frontend/assets/{index-CWdkbVsd.js → index-BKseQQ2I.js} +1 -1
- langflow/frontend/assets/{index-CaQ_H9ww.js → index-BLTxEeTi.js} +1 -1
- langflow/frontend/assets/{index-DGRMNe9n.js → index-BRg1f4Mu.js} +1 -1
- langflow/frontend/assets/{index-D8lOi1GI.js → index-BS8Vo8nc.js} +1 -1
- langflow/frontend/assets/{index-B748uLP1.js → index-BTKOU4xC.js} +1 -1
- langflow/frontend/assets/{index-Dqd4RjYA.js → index-BVwJDmw-.js} +1 -1
- langflow/frontend/assets/{index-DbMFlnHE.js → index-BWYuQ2Sj.js} +1 -1
- langflow/frontend/assets/{index-BEMw2Np8.js → index-BWdLILDG.js} +1 -1
- langflow/frontend/assets/{index-BmX5CoED.js → index-BZcw4827.js} +1 -1
- langflow/frontend/assets/{index-CyPvTB63.js → index-Bbi87Ve4.js} +1 -1
- langflow/frontend/assets/{index-BTEW9e8P.js → index-Bf0IYKLd.js} +1 -1
- langflow/frontend/assets/{index-BZgXW854.js → index-Bg5nrMRh.js} +1 -1
- langflow/frontend/assets/{index-BBxAPk1y.js → index-BiC280Nx.js} +1 -1
- langflow/frontend/assets/{index-BR0bkVqX.js → index-BiKKN6FR.js} +1 -1
- langflow/frontend/assets/{index-CTrt1Q_j.js → index-Bief6eyJ.js} +1 -1
- langflow/frontend/assets/{index-D5_DsUJc.js → index-BkXec1Yf.js} +1 -1
- langflow/frontend/assets/{index-CZQ9rXNa.js → index-Bnl6QHtP.js} +1 -1
- langflow/frontend/assets/{index-BChjg6Az.js → index-BpxbUiZD.js} +1979 -1979
- langflow/frontend/assets/{index-BOeo01QB.js → index-BrJV8psX.js} +1 -1
- langflow/frontend/assets/{index-DysKpOuj.js → index-BwLWcUXL.js} +1 -1
- langflow/frontend/assets/{index-Bnqod3vk.js → index-Bx7dBY26.js} +1 -1
- langflow/frontend/assets/{index-D3DDfngy.js → index-C-EdnFdA.js} +1 -1
- langflow/frontend/assets/{index-Bsa0xZyL.js → index-C-Xfg4cD.js} +1 -1
- langflow/frontend/assets/{index-BTrsh9LS.js → index-C1f2wMat.js} +1 -1
- langflow/frontend/assets/index-C1xroOlH.css +1 -0
- langflow/frontend/assets/{index-B1YN7oMV.js → index-C3KequvP.js} +1 -1
- langflow/frontend/assets/{index-DzW2mfkK.js → index-C3ZjKdCD.js} +1 -1
- langflow/frontend/assets/{index-ajRge-Mg.js → index-C3l0zYn0.js} +1 -1
- langflow/frontend/assets/{index-cvZdgWHQ.js → index-C3yvArUT.js} +1 -1
- langflow/frontend/assets/{index-C-2hghRJ.js → index-C9Cxnkl8.js} +1 -1
- langflow/frontend/assets/{index-BhIOhlCH.js → index-CBc8fEAE.js} +1 -1
- langflow/frontend/assets/{index-B3Sur4Z3.js → index-CBvrGgID.js} +1 -1
- langflow/frontend/assets/{index-CCePCqkT.js → index-CD-PqGCY.js} +1 -1
- langflow/frontend/assets/{index-8yMsjVV2.js → index-CGO1CiUr.js} +1 -1
- langflow/frontend/assets/{index-DF5VwgU6.js → index-CH5UVA9b.js} +1 -1
- langflow/frontend/assets/{index-dcnYpT9N.js → index-CLJeJYjH.js} +1 -1
- langflow/frontend/assets/{index-DfxYyS3M.js → index-CMZ79X-Y.js} +1 -1
- langflow/frontend/assets/{index-ya2uXE8v.js → index-CMzfJKiW.js} +1 -1
- langflow/frontend/assets/{index-DkelbYy7.js → index-CNw1H-Wc.js} +1 -1
- langflow/frontend/assets/{index-DytJENYD.js → index-CPHEscq9.js} +1 -1
- langflow/frontend/assets/{index-Bv8h2Z-q.js → index-CRPKJZw9.js} +1 -1
- langflow/frontend/assets/{index-D-9TI74R.js → index-CRPyCfYy.js} +1 -1
- langflow/frontend/assets/{index-BLGYN-9b.js → index-CRcMqCIj.js} +1 -1
- langflow/frontend/assets/{index-tVYiABdp.js → index-CUVDws8F.js} +1 -1
- langflow/frontend/assets/{index-CpcbQZIF.js → index-CVWQfRYZ.js} +1 -1
- langflow/frontend/assets/{index-DPCzHdsC.js → index-CVl6MbaM.js} +1 -1
- langflow/frontend/assets/{index-DkXy1WFo.js → index-CVwWoX99.js} +1 -1
- langflow/frontend/assets/{index-DK1Ptcc4.js → index-CWPzZtSx.js} +1 -1
- langflow/frontend/assets/{index-DHq8TQPB.js → index-CZqRL9DE.js} +1 -1
- langflow/frontend/assets/{index-DnEGCgih.js → index-CdIf07Rw.js} +1 -1
- langflow/frontend/assets/{index-BIQQCMvz.js → index-Cewy7JZE.js} +1 -1
- langflow/frontend/assets/{index-D8GJngXa.js → index-CfwLpbMM.js} +1 -1
- langflow/frontend/assets/{index-C_TdzfAn.js → index-CiR1dxI4.js} +1 -1
- langflow/frontend/assets/{index-BzL_EoKd.js → index-CiixOzDG.js} +1 -1
- langflow/frontend/assets/{index-Boso-xEw.js → index-ClsuDmR6.js} +1 -1
- langflow/frontend/assets/{index-8WdfSTTz.js → index-CmEYYRN1.js} +1 -1
- langflow/frontend/assets/{index-FUxmznS-.js → index-Co20d-eQ.js} +1 -1
- langflow/frontend/assets/{index-C82JjCPD.js → index-CpzXS6md.js} +1 -1
- langflow/frontend/assets/{index-DIDDfmlJ.js → index-Cqpzl1J4.js} +1 -1
- langflow/frontend/assets/{index-_UcqeEjm.js → index-CtVIONP2.js} +1 -1
- langflow/frontend/assets/{index-Gkrq-vzm.js → index-CuFXdTx4.js} +1 -1
- langflow/frontend/assets/{index-WPFivmdQ.js → index-Cyd2HtHK.js} +1 -1
- langflow/frontend/assets/{index-BFp_O-c9.js → index-D-1tA8Dt.js} +1 -1
- langflow/frontend/assets/{index-BqPpO6KG.js → index-D-KY3kkq.js} +1 -1
- langflow/frontend/assets/{index-Db71w3lq.js → index-D-_B1a8v.js} +1 -1
- langflow/frontend/assets/{index-BIzTEqFh.js → index-D14EWPyZ.js} +1 -1
- langflow/frontend/assets/{index-BbJjt5m4.js → index-D2N3l-cw.js} +1 -1
- langflow/frontend/assets/{index-DCRk27Tp.js → index-D5ETnvJa.js} +1 -1
- langflow/frontend/assets/{index-CvcEzq4x.js → index-D7kquVv2.js} +1 -1
- langflow/frontend/assets/{index-Q9vDw0Xl.js → index-DA6-bvgN.js} +1 -1
- langflow/frontend/assets/{index-l7bzB8Ex.js → index-DDWBeudF.js} +1 -1
- langflow/frontend/assets/{index-BCCGvqay.js → index-DDcMAaG4.js} +1 -1
- langflow/frontend/assets/{index-pCQ_yw8m.js → index-DHgomBdh.js} +1 -1
- langflow/frontend/assets/{index-BxEuHa76.js → index-DJP-ss47.js} +1 -1
- langflow/frontend/assets/{index-BbRm7beF.js → index-DQ7VYqQc.js} +1 -1
- langflow/frontend/assets/{index-Car-zdor.js → index-DTqbvGC0.js} +1 -1
- langflow/frontend/assets/{index-BRxvproo.js → index-DUpri6zF.js} +1 -1
- langflow/frontend/assets/{index-BQ6NUdMY.js → index-DV3utZDZ.js} +1 -1
- langflow/frontend/assets/{index-DjQETUy8.js → index-DXRfN4HV.js} +1 -1
- langflow/frontend/assets/{index-DfngcQxO.js → index-Db9dYSzy.js} +1 -1
- langflow/frontend/assets/{index-rXV1G1aB.js → index-DdtMEn6I.js} +1 -1
- langflow/frontend/assets/{index-DmMDPoi0.js → index-DfDhMHgQ.js} +1 -1
- langflow/frontend/assets/{index-DJB12jIC.js → index-Dfe7qfvf.js} +1 -1
- langflow/frontend/assets/{index-C_veJlEb.js → index-DhtZ5hx8.js} +1 -1
- langflow/frontend/assets/{index-CQMoqLAu.js → index-DiB3CTo8.js} +1 -1
- langflow/frontend/assets/{index-DVlceYFD.js → index-DiGWASY5.js} +1 -1
- langflow/frontend/assets/{index-Du_18NCU.js → index-Dl5amdBz.js} +1 -1
- langflow/frontend/assets/{index-CYDAYm-i.js → index-DlD4dXlZ.js} +1 -1
- langflow/frontend/assets/{index-CLPdN-q6.js → index-DmeiHnfl.js} +1 -1
- langflow/frontend/assets/index-Dmu-X5-4.js +1 -0
- langflow/frontend/assets/{index-BzEUlaw_.js → index-DpVWih90.js} +1 -1
- langflow/frontend/assets/{index-D6PSjHxP.js → index-DrDrcajG.js} +1 -1
- langflow/frontend/assets/{index-Dq5ilsem.js → index-Du-pc0KE.js} +1 -1
- langflow/frontend/assets/{index-CYe8Ipef.js → index-DwPkMTaY.js} +1 -1
- langflow/frontend/assets/{index-BVEZDXxS.js → index-DwQEZe3C.js} +1 -1
- langflow/frontend/assets/{index-BvT7L317.js → index-DyJFTK24.js} +1 -1
- langflow/frontend/assets/{index-HK3bVMYA.js → index-J38wh62w.js} +1 -1
- langflow/frontend/assets/{index-CCxGSSTT.js → index-Kwdl-e29.js} +1 -1
- langflow/frontend/assets/{index-BOB_zsjl.js → index-OwPvCmpW.js} +1 -1
- langflow/frontend/assets/{index-Dsps-jKu.js → index-Tw3Os-DN.js} +1 -1
- langflow/frontend/assets/{index-CFDvOtKC.js → index-X0guhYF8.js} +1 -1
- langflow/frontend/assets/{index-BX5D-USa.js → index-dJWNxIRH.js} +1 -1
- langflow/frontend/assets/{index-BRYjyhAd.js → index-dcJ8-agu.js} +1 -1
- langflow/frontend/assets/{index-Ui4xUImO.js → index-eo2mAtL-.js} +1 -1
- langflow/frontend/assets/{index-CxvP91st.js → index-hG24k5xJ.js} +1 -1
- langflow/frontend/assets/{index-CVQmT7ZL.js → index-h_aSZHf3.js} +1 -1
- langflow/frontend/assets/{index-BIXaW2aY.js → index-hbndqB9B.js} +1 -1
- langflow/frontend/assets/{index-DIkNW9Cd.js → index-iJngutFo.js} +1 -1
- langflow/frontend/assets/{index-BWmPX4iQ.js → index-lTpteg8t.js} +1 -1
- langflow/frontend/assets/{index-xuIrH2Dq.js → index-lZX9AvZW.js} +1 -1
- langflow/frontend/assets/{index-yCHsaqs8.js → index-m8QA6VNM.js} +1 -1
- langflow/frontend/assets/{index-BkPYpfgw.js → index-o0D2S7xW.js} +1 -1
- langflow/frontend/assets/{index-DpClkXIV.js → index-ovFJ_0J6.js} +1 -1
- langflow/frontend/assets/{index-CmplyEaa.js → index-pYJJOcma.js} +1 -1
- langflow/frontend/assets/{index-CJo_cyWW.js → index-sI75DsdM.js} +1 -1
- langflow/frontend/assets/{index-nVwHLjuV.js → index-xvFOmxx4.js} +1 -1
- langflow/frontend/assets/{index-LbYjHKkn.js → index-z3SRY-mX.js} +1 -1
- langflow/frontend/assets/lazyIconImports-D97HEZkE.js +2 -0
- langflow/frontend/assets/{use-post-add-user-BrBYH9eR.js → use-post-add-user-C0MdTpQ5.js} +1 -1
- langflow/frontend/index.html +2 -2
- langflow/graph/edge/base.py +2 -3
- langflow/graph/graph/base.py +15 -13
- langflow/graph/graph/constants.py +3 -0
- langflow/graph/utils.py +6 -6
- langflow/graph/vertex/base.py +4 -5
- langflow/graph/vertex/param_handler.py +1 -1
- langflow/graph/vertex/vertex_types.py +2 -2
- langflow/helpers/flow.py +1 -1
- langflow/initial_setup/setup.py +32 -30
- langflow/initial_setup/starter_projects/Basic Prompt Chaining.json +26 -0
- langflow/initial_setup/starter_projects/Basic Prompting.json +26 -0
- langflow/initial_setup/starter_projects/Blog Writer.json +58 -2
- langflow/initial_setup/starter_projects/Custom Component Generator.json +37 -2
- langflow/initial_setup/starter_projects/Document Q&A.json +27 -1
- langflow/initial_setup/starter_projects/Financial Report Parser.json +43 -0
- langflow/initial_setup/starter_projects/Hybrid Search RAG.json +83 -1
- langflow/initial_setup/starter_projects/Image Sentiment Analysis.json +43 -0
- langflow/initial_setup/starter_projects/Instagram Copywriter.json +51 -3
- langflow/initial_setup/starter_projects/Invoice Summarizer.json +40 -1
- langflow/initial_setup/starter_projects/Knowledge Ingestion.json +73 -2
- langflow/initial_setup/starter_projects/Knowledge Retrieval.json +63 -0
- langflow/initial_setup/starter_projects/Market Research.json +59 -3
- langflow/initial_setup/starter_projects/Meeting Summary.json +101 -6
- langflow/initial_setup/starter_projects/Memory Chatbot.json +37 -2
- langflow/initial_setup/starter_projects/News Aggregator.json +63 -3
- langflow/initial_setup/starter_projects/Nvidia Remix.json +69 -4
- langflow/initial_setup/starter_projects/Pok/303/251dex Agent.json" +48 -1
- langflow/initial_setup/starter_projects/Portfolio Website Code Generator.json +44 -1
- langflow/initial_setup/starter_projects/Price Deal Finder.json +57 -5
- langflow/initial_setup/starter_projects/Research Agent.json +42 -3
- langflow/initial_setup/starter_projects/Research Translation Loop.json +66 -0
- langflow/initial_setup/starter_projects/SEO Keyword Generator.json +17 -0
- langflow/initial_setup/starter_projects/SaaS Pricing.json +27 -1
- langflow/initial_setup/starter_projects/Search agent.json +40 -1
- langflow/initial_setup/starter_projects/Sequential Tasks Agents.json +76 -7
- langflow/initial_setup/starter_projects/Simple Agent.json +59 -3
- langflow/initial_setup/starter_projects/Social Media Agent.json +77 -1
- langflow/initial_setup/starter_projects/Text Sentiment Analysis.json +35 -1
- langflow/initial_setup/starter_projects/Travel Planning Agents.json +51 -3
- langflow/initial_setup/starter_projects/Twitter Thread Generator.json +80 -0
- langflow/initial_setup/starter_projects/Vector Store RAG.json +110 -3
- langflow/initial_setup/starter_projects/Youtube Analysis.json +84 -3
- langflow/initial_setup/starter_projects/vector_store_rag.py +1 -1
- langflow/interface/components.py +23 -22
- langflow/interface/initialize/loading.py +5 -5
- langflow/interface/run.py +1 -1
- langflow/interface/utils.py +1 -1
- langflow/io/__init__.py +0 -1
- langflow/langflow_launcher.py +1 -1
- langflow/load/load.py +2 -7
- langflow/logging/__init__.py +0 -1
- langflow/logging/logger.py +191 -115
- langflow/logging/setup.py +1 -1
- langflow/main.py +37 -52
- langflow/memory.py +7 -7
- langflow/middleware.py +1 -1
- langflow/processing/process.py +6 -3
- langflow/schema/artifact.py +2 -2
- langflow/schema/data.py +10 -2
- langflow/schema/dataframe.py +1 -1
- langflow/schema/message.py +1 -1
- langflow/serialization/serialization.py +1 -1
- langflow/services/auth/mcp_encryption.py +104 -0
- langflow/services/auth/utils.py +2 -2
- langflow/services/cache/disk.py +1 -1
- langflow/services/cache/service.py +3 -3
- langflow/services/database/models/flow/model.py +2 -7
- langflow/services/database/models/transactions/crud.py +2 -2
- langflow/services/database/models/user/crud.py +2 -2
- langflow/services/database/service.py +8 -8
- langflow/services/database/utils.py +6 -5
- langflow/services/deps.py +2 -3
- langflow/services/factory.py +1 -1
- langflow/services/flow/flow_runner.py +7 -12
- langflow/services/job_queue/service.py +16 -15
- langflow/services/manager.py +3 -4
- langflow/services/settings/auth.py +1 -1
- langflow/services/settings/base.py +3 -8
- langflow/services/settings/feature_flags.py +1 -1
- langflow/services/settings/manager.py +1 -1
- langflow/services/settings/utils.py +1 -1
- langflow/services/socket/__init__.py +0 -1
- langflow/services/socket/service.py +3 -3
- langflow/services/socket/utils.py +4 -4
- langflow/services/state/service.py +1 -2
- langflow/services/storage/factory.py +1 -1
- langflow/services/storage/local.py +9 -8
- langflow/services/storage/s3.py +11 -10
- langflow/services/store/service.py +3 -3
- langflow/services/store/utils.py +3 -2
- langflow/services/task/temp_flow_cleanup.py +7 -7
- langflow/services/telemetry/service.py +10 -10
- langflow/services/tracing/arize_phoenix.py +2 -2
- langflow/services/tracing/langfuse.py +1 -1
- langflow/services/tracing/langsmith.py +1 -1
- langflow/services/tracing/langwatch.py +1 -1
- langflow/services/tracing/opik.py +1 -1
- langflow/services/tracing/service.py +25 -6
- langflow/services/tracing/traceloop.py +245 -0
- langflow/services/utils.py +7 -7
- langflow/services/variable/kubernetes.py +3 -3
- langflow/services/variable/kubernetes_secrets.py +2 -1
- langflow/services/variable/service.py +5 -5
- langflow/utils/component_utils.py +9 -6
- langflow/utils/util.py +5 -5
- langflow/utils/validate.py +3 -3
- langflow/utils/voice_utils.py +2 -2
- {langflow_base_nightly-0.5.0.dev37.dist-info → langflow_base_nightly-0.5.0.dev39.dist-info}/METADATA +2 -1
- {langflow_base_nightly-0.5.0.dev37.dist-info → langflow_base_nightly-0.5.0.dev39.dist-info}/RECORD +393 -374
- langflow/components/vectorstores/redis.py +0 -89
- langflow/frontend/assets/index-C26RqKWL.js +0 -1
- langflow/frontend/assets/index-CqS7zir1.css +0 -1
- langflow/frontend/assets/lazyIconImports-t6wEndt1.js +0 -2
- /langflow/components/{vectorstores → FAISS}/faiss.py +0 -0
- /langflow/components/{vectorstores → cassandra}/cassandra.py +0 -0
- /langflow/components/{datastax/cassandra.py → cassandra/cassandra_chat.py} +0 -0
- /langflow/components/{vectorstores → cassandra}/cassandra_graph.py +0 -0
- /langflow/components/{vectorstores → chroma}/chroma.py +0 -0
- /langflow/components/{vectorstores → clickhouse}/clickhouse.py +0 -0
- /langflow/components/{vectorstores → couchbase}/couchbase.py +0 -0
- /langflow/components/{vectorstores → datastax}/astradb.py +0 -0
- /langflow/components/{vectorstores → datastax}/astradb_graph.py +0 -0
- /langflow/components/{vectorstores → datastax}/graph_rag.py +0 -0
- /langflow/components/{vectorstores → datastax}/hcd.py +0 -0
- /langflow/components/{vectorstores → elastic}/elasticsearch.py +0 -0
- /langflow/components/{vectorstores → elastic}/opensearch.py +0 -0
- /langflow/components/{vectorstores → milvus}/milvus.py +0 -0
- /langflow/components/{vectorstores → mongodb}/mongodb_atlas.py +0 -0
- /langflow/components/{vectorstores → pgvector}/pgvector.py +0 -0
- /langflow/components/{vectorstores → pinecone}/pinecone.py +0 -0
- /langflow/components/{vectorstores → qdrant}/qdrant.py +0 -0
- /langflow/components/{vectorstores → supabase}/supabase.py +0 -0
- /langflow/components/{vectorstores → upstash}/upstash.py +0 -0
- /langflow/components/{vectorstores → vectara}/vectara.py +0 -0
- /langflow/components/{vectorstores → vectara}/vectara_rag.py +0 -0
- /langflow/components/{vectorstores → weaviate}/weaviate.py +0 -0
- {langflow_base_nightly-0.5.0.dev37.dist-info → langflow_base_nightly-0.5.0.dev39.dist-info}/WHEEL +0 -0
- {langflow_base_nightly-0.5.0.dev37.dist-info → langflow_base_nightly-0.5.0.dev39.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
|
|
5
|
+
from langflow.components._importing import import_mod
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from .faiss import FaissVectorStoreComponent
|
|
9
|
+
|
|
10
|
+
_dynamic_imports = {
|
|
11
|
+
"FaissVectorStoreComponent": "faiss",
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"FaissVectorStoreComponent",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __getattr__(attr_name: str) -> Any:
|
|
20
|
+
"""Lazily import FAISS components on attribute access."""
|
|
21
|
+
if attr_name not in _dynamic_imports:
|
|
22
|
+
msg = f"module '{__name__}' has no attribute '{attr_name}'"
|
|
23
|
+
raise AttributeError(msg)
|
|
24
|
+
try:
|
|
25
|
+
result = import_mod(attr_name, _dynamic_imports[attr_name], __spec__.parent)
|
|
26
|
+
except (ModuleNotFoundError, ImportError, AttributeError) as e:
|
|
27
|
+
msg = f"Could not import '{attr_name}' from '{__name__}': {e}"
|
|
28
|
+
raise AttributeError(msg) from e
|
|
29
|
+
globals()[attr_name] = result
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def __dir__() -> list[str]:
|
|
34
|
+
return list(__all__)
|
|
@@ -4,13 +4,13 @@ from typing import Any
|
|
|
4
4
|
import requests
|
|
5
5
|
from bs4 import BeautifulSoup
|
|
6
6
|
from langchain.tools import StructuredTool
|
|
7
|
-
from loguru import logger
|
|
8
7
|
from markdown import markdown
|
|
9
8
|
from pydantic import BaseModel, Field
|
|
10
9
|
|
|
11
10
|
from langflow.base.langchain_utilities.model import LCToolComponent
|
|
12
11
|
from langflow.field_typing import Tool
|
|
13
12
|
from langflow.inputs.inputs import MultilineInput, SecretStrInput, StrInput
|
|
13
|
+
from langflow.logging.logger import logger
|
|
14
14
|
from langflow.schema.data import Data
|
|
15
15
|
|
|
16
16
|
MIN_ROWS_IN_TABLE = 3
|
|
@@ -84,7 +84,7 @@ class AddContentToPage(LCToolComponent):
|
|
|
84
84
|
error_message += f" Status code: {e.response.status_code}, Response: {e.response.text}"
|
|
85
85
|
return error_message
|
|
86
86
|
except Exception as e: # noqa: BLE001
|
|
87
|
-
logger.
|
|
87
|
+
logger.debug("Error adding content to Notion page", exc_info=True)
|
|
88
88
|
return f"Error: An unexpected error occurred while adding content to Notion page. {e}"
|
|
89
89
|
|
|
90
90
|
def process_node(self, node):
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
from langchain.tools import StructuredTool
|
|
3
|
-
from loguru import logger
|
|
4
3
|
from pydantic import BaseModel, Field
|
|
5
4
|
|
|
6
5
|
from langflow.base.langchain_utilities.model import LCToolComponent
|
|
7
6
|
from langflow.field_typing import Tool
|
|
8
7
|
from langflow.inputs.inputs import SecretStrInput, StrInput
|
|
8
|
+
from langflow.logging.logger import logger
|
|
9
9
|
from langflow.schema.data import Data
|
|
10
10
|
|
|
11
11
|
|
|
@@ -64,5 +64,5 @@ class NotionDatabaseProperties(LCToolComponent):
|
|
|
64
64
|
except ValueError as e:
|
|
65
65
|
return f"Error parsing Notion API response: {e}"
|
|
66
66
|
except Exception as e: # noqa: BLE001
|
|
67
|
-
logger.
|
|
67
|
+
logger.debug("Error fetching Notion database properties", exc_info=True)
|
|
68
68
|
return f"An unexpected error occurred: {e}"
|
|
@@ -3,12 +3,12 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
import requests
|
|
5
5
|
from langchain.tools import StructuredTool
|
|
6
|
-
from loguru import logger
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from langflow.base.langchain_utilities.model import LCToolComponent
|
|
10
9
|
from langflow.field_typing import Tool
|
|
11
10
|
from langflow.inputs.inputs import MultilineInput, SecretStrInput, StrInput
|
|
11
|
+
from langflow.logging.logger import logger
|
|
12
12
|
from langflow.schema.data import Data
|
|
13
13
|
|
|
14
14
|
|
|
@@ -118,5 +118,5 @@ class NotionListPages(LCToolComponent):
|
|
|
118
118
|
except KeyError:
|
|
119
119
|
return "Unexpected response format from Notion API"
|
|
120
120
|
except Exception as e: # noqa: BLE001
|
|
121
|
-
logger.
|
|
121
|
+
logger.debug("Error querying Notion database", exc_info=True)
|
|
122
122
|
return f"An unexpected error occurred: {e}"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import requests
|
|
2
2
|
from langchain.tools import StructuredTool
|
|
3
|
-
from loguru import logger
|
|
4
3
|
from pydantic import BaseModel, Field
|
|
5
4
|
|
|
6
5
|
from langflow.base.langchain_utilities.model import LCToolComponent
|
|
7
6
|
from langflow.field_typing import Tool
|
|
8
7
|
from langflow.inputs.inputs import SecretStrInput, StrInput
|
|
8
|
+
from langflow.logging.logger import logger
|
|
9
9
|
from langflow.schema.data import Data
|
|
10
10
|
|
|
11
11
|
|
|
@@ -65,7 +65,7 @@ class NotionPageContent(LCToolComponent):
|
|
|
65
65
|
error_message += f" Status code: {e.response.status_code}, Response: {e.response.text}"
|
|
66
66
|
return error_message
|
|
67
67
|
except Exception as e: # noqa: BLE001
|
|
68
|
-
logger.
|
|
68
|
+
logger.debug("Error retrieving Notion page content", exc_info=True)
|
|
69
69
|
return f"Error: An unexpected error occurred while retrieving Notion page content. {e}"
|
|
70
70
|
|
|
71
71
|
def parse_blocks(self, blocks: list) -> str:
|
|
@@ -3,12 +3,12 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
import requests
|
|
5
5
|
from langchain.tools import StructuredTool
|
|
6
|
-
from loguru import logger
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from langflow.base.langchain_utilities.model import LCToolComponent
|
|
10
9
|
from langflow.field_typing import Tool
|
|
11
10
|
from langflow.inputs.inputs import MultilineInput, SecretStrInput, StrInput
|
|
11
|
+
from langflow.logging.logger import logger
|
|
12
12
|
from langflow.schema.data import Data
|
|
13
13
|
|
|
14
14
|
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import httpx
|
|
2
|
-
from loguru import logger
|
|
3
2
|
|
|
4
3
|
from langflow.custom.custom_component.component import Component
|
|
5
4
|
from langflow.field_typing.range_spec import RangeSpec
|
|
6
|
-
from langflow.io import
|
|
7
|
-
|
|
8
|
-
DropdownInput,
|
|
9
|
-
IntInput,
|
|
10
|
-
MessageTextInput,
|
|
11
|
-
MultilineInput,
|
|
12
|
-
Output,
|
|
13
|
-
SecretStrInput,
|
|
14
|
-
)
|
|
5
|
+
from langflow.io import BoolInput, DropdownInput, IntInput, MessageTextInput, MultilineInput, Output, SecretStrInput
|
|
6
|
+
from langflow.logging.logger import logger
|
|
15
7
|
from langflow.schema.data import Data
|
|
16
8
|
|
|
17
9
|
|
|
@@ -2,6 +2,7 @@ import json
|
|
|
2
2
|
import re
|
|
3
3
|
|
|
4
4
|
from langchain_core.tools import StructuredTool
|
|
5
|
+
from pydantic import ValidationError
|
|
5
6
|
|
|
6
7
|
from langflow.base.agents.agent import LCToolsAgentComponent
|
|
7
8
|
from langflow.base.agents.events import ExceptionWithMessageError
|
|
@@ -19,11 +20,13 @@ from langflow.components.langchain_utilities.tool_calling import ToolCallingAgen
|
|
|
19
20
|
from langflow.custom.custom_component.component import _get_component_toolkit
|
|
20
21
|
from langflow.custom.utils import update_component_build_config
|
|
21
22
|
from langflow.field_typing import Tool
|
|
22
|
-
from langflow.
|
|
23
|
+
from langflow.helpers.base_model import build_model_from_schema
|
|
24
|
+
from langflow.io import BoolInput, DropdownInput, IntInput, MultilineInput, Output, TableInput
|
|
23
25
|
from langflow.logging import logger
|
|
24
26
|
from langflow.schema.data import Data
|
|
25
27
|
from langflow.schema.dotdict import dotdict
|
|
26
28
|
from langflow.schema.message import Message
|
|
29
|
+
from langflow.schema.table import EditMode
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
def set_advanced_true(component_input):
|
|
@@ -78,6 +81,67 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
78
81
|
advanced=True,
|
|
79
82
|
show=True,
|
|
80
83
|
),
|
|
84
|
+
MultilineInput(
|
|
85
|
+
name="format_instructions",
|
|
86
|
+
display_name="Output Format Instructions",
|
|
87
|
+
info="Generic Template for structured output formatting. Valid only with Structured response.",
|
|
88
|
+
value=(
|
|
89
|
+
"You are an AI that extracts structured JSON objects from unstructured text. "
|
|
90
|
+
"Use a predefined schema with expected types (str, int, float, bool, dict). "
|
|
91
|
+
"Extract ALL relevant instances that match the schema - if multiple patterns exist, capture them all. "
|
|
92
|
+
"Fill missing or ambiguous values with defaults: null for missing values. "
|
|
93
|
+
"Remove exact duplicates but keep variations that have different field values. "
|
|
94
|
+
"Always return valid JSON in the expected format, never throw errors. "
|
|
95
|
+
"If multiple objects can be extracted, return them all in the structured format."
|
|
96
|
+
),
|
|
97
|
+
advanced=True,
|
|
98
|
+
),
|
|
99
|
+
TableInput(
|
|
100
|
+
name="output_schema",
|
|
101
|
+
display_name="Output Schema",
|
|
102
|
+
info=(
|
|
103
|
+
"Schema Validation: Define the structure and data types for structured output. "
|
|
104
|
+
"No validation if no output schema."
|
|
105
|
+
),
|
|
106
|
+
advanced=True,
|
|
107
|
+
required=False,
|
|
108
|
+
value=[],
|
|
109
|
+
table_schema=[
|
|
110
|
+
{
|
|
111
|
+
"name": "name",
|
|
112
|
+
"display_name": "Name",
|
|
113
|
+
"type": "str",
|
|
114
|
+
"description": "Specify the name of the output field.",
|
|
115
|
+
"default": "field",
|
|
116
|
+
"edit_mode": EditMode.INLINE,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "description",
|
|
120
|
+
"display_name": "Description",
|
|
121
|
+
"type": "str",
|
|
122
|
+
"description": "Describe the purpose of the output field.",
|
|
123
|
+
"default": "description of field",
|
|
124
|
+
"edit_mode": EditMode.POPOVER,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "type",
|
|
128
|
+
"display_name": "Type",
|
|
129
|
+
"type": "str",
|
|
130
|
+
"edit_mode": EditMode.INLINE,
|
|
131
|
+
"description": ("Indicate the data type of the output field (e.g., str, int, float, bool, dict)."),
|
|
132
|
+
"options": ["str", "int", "float", "bool", "dict"],
|
|
133
|
+
"default": "str",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "multiple",
|
|
137
|
+
"display_name": "As List",
|
|
138
|
+
"type": "boolean",
|
|
139
|
+
"description": "Set to True if this output field should be a list of the specified type.",
|
|
140
|
+
"default": "False",
|
|
141
|
+
"edit_mode": EditMode.INLINE,
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
),
|
|
81
145
|
*LCToolsAgentComponent._base_inputs,
|
|
82
146
|
# removed memory inputs from agent component
|
|
83
147
|
# *memory_inputs,
|
|
@@ -94,31 +158,33 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
94
158
|
Output(name="structured_response", display_name="Structured Response", method="json_response", tool_mode=False),
|
|
95
159
|
]
|
|
96
160
|
|
|
161
|
+
async def get_agent_requirements(self):
|
|
162
|
+
"""Get the agent requirements for the agent."""
|
|
163
|
+
llm_model, display_name = await self.get_llm()
|
|
164
|
+
if llm_model is None:
|
|
165
|
+
msg = "No language model selected. Please choose a model to proceed."
|
|
166
|
+
raise ValueError(msg)
|
|
167
|
+
self.model_name = get_model_name(llm_model, display_name=display_name)
|
|
168
|
+
|
|
169
|
+
# Get memory data
|
|
170
|
+
self.chat_history = await self.get_memory_data()
|
|
171
|
+
if isinstance(self.chat_history, Message):
|
|
172
|
+
self.chat_history = [self.chat_history]
|
|
173
|
+
|
|
174
|
+
# Add current date tool if enabled
|
|
175
|
+
if self.add_current_date_tool:
|
|
176
|
+
if not isinstance(self.tools, list): # type: ignore[has-type]
|
|
177
|
+
self.tools = []
|
|
178
|
+
current_date_tool = (await CurrentDateComponent(**self.get_base_args()).to_toolkit()).pop(0)
|
|
179
|
+
if not isinstance(current_date_tool, StructuredTool):
|
|
180
|
+
msg = "CurrentDateComponent must be converted to a StructuredTool"
|
|
181
|
+
raise TypeError(msg)
|
|
182
|
+
self.tools.append(current_date_tool)
|
|
183
|
+
return llm_model, self.chat_history, self.tools
|
|
184
|
+
|
|
97
185
|
async def message_response(self) -> Message:
|
|
98
186
|
try:
|
|
99
|
-
|
|
100
|
-
llm_model, display_name = self.get_llm()
|
|
101
|
-
if llm_model is None:
|
|
102
|
-
msg = "No language model selected. Please choose a model to proceed."
|
|
103
|
-
raise ValueError(msg)
|
|
104
|
-
self.model_name = get_model_name(llm_model, display_name=display_name)
|
|
105
|
-
|
|
106
|
-
# Get memory data
|
|
107
|
-
self.chat_history = await self.get_memory_data()
|
|
108
|
-
if isinstance(self.chat_history, Message):
|
|
109
|
-
self.chat_history = [self.chat_history]
|
|
110
|
-
|
|
111
|
-
# Add current date tool if enabled
|
|
112
|
-
if self.add_current_date_tool:
|
|
113
|
-
if not isinstance(self.tools, list): # type: ignore[has-type]
|
|
114
|
-
self.tools = []
|
|
115
|
-
current_date_tool = (await CurrentDateComponent(**self.get_base_args()).to_toolkit()).pop(0)
|
|
116
|
-
if not isinstance(current_date_tool, StructuredTool):
|
|
117
|
-
msg = "CurrentDateComponent must be converted to a StructuredTool"
|
|
118
|
-
raise TypeError(msg)
|
|
119
|
-
self.tools.append(current_date_tool)
|
|
120
|
-
# note the tools are not required to run the agent, hence the validation removed.
|
|
121
|
-
|
|
187
|
+
llm_model, self.chat_history, self.tools = await self.get_agent_requirements()
|
|
122
188
|
# Set up and run agent
|
|
123
189
|
self.set(
|
|
124
190
|
llm=llm_model,
|
|
@@ -132,52 +198,180 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
132
198
|
|
|
133
199
|
# Store result for potential JSON output
|
|
134
200
|
self._agent_result = result
|
|
135
|
-
# return result
|
|
136
201
|
|
|
137
202
|
except (ValueError, TypeError, KeyError) as e:
|
|
138
|
-
logger.
|
|
203
|
+
await logger.aerror(f"{type(e).__name__}: {e!s}")
|
|
139
204
|
raise
|
|
140
205
|
except ExceptionWithMessageError as e:
|
|
141
|
-
logger.
|
|
206
|
+
await logger.aerror(f"ExceptionWithMessageError occurred: {e}")
|
|
142
207
|
raise
|
|
208
|
+
# Avoid catching blind Exception; let truly unexpected exceptions propagate
|
|
143
209
|
except Exception as e:
|
|
144
|
-
logger.
|
|
210
|
+
await logger.aerror(f"Unexpected error: {e!s}")
|
|
145
211
|
raise
|
|
146
212
|
else:
|
|
147
213
|
return result
|
|
148
214
|
|
|
149
|
-
|
|
150
|
-
"""
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
215
|
+
def _preprocess_schema(self, schema):
|
|
216
|
+
"""Preprocess schema to ensure correct data types for build_model_from_schema."""
|
|
217
|
+
processed_schema = []
|
|
218
|
+
for field in schema:
|
|
219
|
+
processed_field = {
|
|
220
|
+
"name": str(field.get("name", "field")),
|
|
221
|
+
"type": str(field.get("type", "str")),
|
|
222
|
+
"description": str(field.get("description", "")),
|
|
223
|
+
"multiple": field.get("multiple", False),
|
|
224
|
+
}
|
|
225
|
+
# Ensure multiple is handled correctly
|
|
226
|
+
if isinstance(processed_field["multiple"], str):
|
|
227
|
+
processed_field["multiple"] = processed_field["multiple"].lower() in ["true", "1", "t", "y", "yes"]
|
|
228
|
+
processed_schema.append(processed_field)
|
|
229
|
+
return processed_schema
|
|
230
|
+
|
|
231
|
+
async def build_structured_output_base(self, content: str):
|
|
232
|
+
"""Build structured output with optional BaseModel validation."""
|
|
233
|
+
json_pattern = r"\{.*\}"
|
|
234
|
+
schema_error_msg = "Try setting an output schema"
|
|
235
|
+
|
|
236
|
+
# Try to parse content as JSON first
|
|
237
|
+
json_data = None
|
|
166
238
|
try:
|
|
167
239
|
json_data = json.loads(content)
|
|
168
|
-
return Data(data=json_data)
|
|
169
240
|
except json.JSONDecodeError:
|
|
170
|
-
|
|
171
|
-
json_match = re.search(r"\{.*\}", content, re.DOTALL)
|
|
241
|
+
json_match = re.search(json_pattern, content, re.DOTALL)
|
|
172
242
|
if json_match:
|
|
173
243
|
try:
|
|
174
244
|
json_data = json.loads(json_match.group())
|
|
175
|
-
return Data(data=json_data)
|
|
176
245
|
except json.JSONDecodeError:
|
|
177
|
-
|
|
246
|
+
return {"content": content, "error": schema_error_msg}
|
|
247
|
+
else:
|
|
248
|
+
return {"content": content, "error": schema_error_msg}
|
|
249
|
+
|
|
250
|
+
# If no output schema provided, return parsed JSON without validation
|
|
251
|
+
if not hasattr(self, "output_schema") or not self.output_schema or len(self.output_schema) == 0:
|
|
252
|
+
return json_data
|
|
253
|
+
|
|
254
|
+
# Use BaseModel validation with schema
|
|
255
|
+
try:
|
|
256
|
+
processed_schema = self._preprocess_schema(self.output_schema)
|
|
257
|
+
output_model = build_model_from_schema(processed_schema)
|
|
258
|
+
|
|
259
|
+
# Validate against the schema
|
|
260
|
+
if isinstance(json_data, list):
|
|
261
|
+
# Multiple objects
|
|
262
|
+
validated_objects = []
|
|
263
|
+
for item in json_data:
|
|
264
|
+
try:
|
|
265
|
+
validated_obj = output_model.model_validate(item)
|
|
266
|
+
validated_objects.append(validated_obj.model_dump())
|
|
267
|
+
except ValidationError as e:
|
|
268
|
+
await logger.aerror(f"Validation error for item: {e}")
|
|
269
|
+
# Include invalid items with error info
|
|
270
|
+
validated_objects.append({"data": item, "validation_error": str(e)})
|
|
271
|
+
return validated_objects
|
|
272
|
+
|
|
273
|
+
# Single object
|
|
274
|
+
try:
|
|
275
|
+
validated_obj = output_model.model_validate(json_data)
|
|
276
|
+
return [validated_obj.model_dump()] # Return as list for consistency
|
|
277
|
+
except ValidationError as e:
|
|
278
|
+
await logger.aerror(f"Validation error: {e}")
|
|
279
|
+
return [{"data": json_data, "validation_error": str(e)}]
|
|
280
|
+
|
|
281
|
+
except (TypeError, ValueError) as e:
|
|
282
|
+
await logger.aerror(f"Error building structured output: {e}")
|
|
283
|
+
# Fallback to parsed JSON without validation
|
|
284
|
+
return json_data
|
|
285
|
+
|
|
286
|
+
async def json_response(self) -> Data:
|
|
287
|
+
"""Convert agent response to structured JSON Data output with schema validation."""
|
|
288
|
+
# Always use structured chat agent for JSON response mode for better JSON formatting
|
|
289
|
+
try:
|
|
290
|
+
system_components = []
|
|
291
|
+
|
|
292
|
+
# 1. Agent Instructions (system_prompt)
|
|
293
|
+
agent_instructions = getattr(self, "system_prompt", "") or ""
|
|
294
|
+
if agent_instructions:
|
|
295
|
+
system_components.append(f"{agent_instructions}")
|
|
296
|
+
|
|
297
|
+
# 2. Format Instructions
|
|
298
|
+
format_instructions = getattr(self, "format_instructions", "") or ""
|
|
299
|
+
if format_instructions:
|
|
300
|
+
system_components.append(f"Format instructions: {format_instructions}")
|
|
178
301
|
|
|
179
|
-
#
|
|
180
|
-
|
|
302
|
+
# 3. Schema Information from BaseModel
|
|
303
|
+
if hasattr(self, "output_schema") and self.output_schema and len(self.output_schema) > 0:
|
|
304
|
+
try:
|
|
305
|
+
processed_schema = self._preprocess_schema(self.output_schema)
|
|
306
|
+
output_model = build_model_from_schema(processed_schema)
|
|
307
|
+
schema_dict = output_model.model_json_schema()
|
|
308
|
+
schema_info = (
|
|
309
|
+
"You are given some text that may include format instructions, "
|
|
310
|
+
"explanations, or other content alongside a JSON schema.\n\n"
|
|
311
|
+
"Your task:\n"
|
|
312
|
+
"- Extract only the JSON schema.\n"
|
|
313
|
+
"- Return it as valid JSON.\n"
|
|
314
|
+
"- Do not include format instructions, explanations, or extra text.\n\n"
|
|
315
|
+
"Input:\n"
|
|
316
|
+
f"{json.dumps(schema_dict, indent=2)}\n\n"
|
|
317
|
+
"Output (only JSON schema):"
|
|
318
|
+
)
|
|
319
|
+
system_components.append(schema_info)
|
|
320
|
+
except (ValidationError, ValueError, TypeError, KeyError) as e:
|
|
321
|
+
await logger.aerror(f"Could not build schema for prompt: {e}", exc_info=True)
|
|
322
|
+
|
|
323
|
+
# Combine all components
|
|
324
|
+
combined_instructions = "\n\n".join(system_components) if system_components else ""
|
|
325
|
+
llm_model, self.chat_history, self.tools = await self.get_agent_requirements()
|
|
326
|
+
self.set(
|
|
327
|
+
llm=llm_model,
|
|
328
|
+
tools=self.tools or [],
|
|
329
|
+
chat_history=self.chat_history,
|
|
330
|
+
input_value=self.input_value,
|
|
331
|
+
system_prompt=combined_instructions,
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
# Create and run structured chat agent
|
|
335
|
+
try:
|
|
336
|
+
structured_agent = self.create_agent_runnable()
|
|
337
|
+
except (NotImplementedError, ValueError, TypeError) as e:
|
|
338
|
+
await logger.aerror(f"Error with structured chat agent: {e}")
|
|
339
|
+
raise
|
|
340
|
+
try:
|
|
341
|
+
result = await self.run_agent(structured_agent)
|
|
342
|
+
except (ExceptionWithMessageError, ValueError, TypeError, RuntimeError) as e:
|
|
343
|
+
await logger.aerror(f"Error with structured agent result: {e}")
|
|
344
|
+
raise
|
|
345
|
+
# Extract content from structured agent result
|
|
346
|
+
if hasattr(result, "content"):
|
|
347
|
+
content = result.content
|
|
348
|
+
elif hasattr(result, "text"):
|
|
349
|
+
content = result.text
|
|
350
|
+
else:
|
|
351
|
+
content = str(result)
|
|
352
|
+
|
|
353
|
+
except (ExceptionWithMessageError, ValueError, TypeError, NotImplementedError, AttributeError) as e:
|
|
354
|
+
await logger.aerror(f"Error with structured chat agent: {e}")
|
|
355
|
+
# Fallback to regular agent
|
|
356
|
+
content_str = "No content returned from agent"
|
|
357
|
+
return Data(data={"content": content_str, "error": str(e)})
|
|
358
|
+
|
|
359
|
+
# Process with structured output validation
|
|
360
|
+
try:
|
|
361
|
+
structured_output = await self.build_structured_output_base(content)
|
|
362
|
+
|
|
363
|
+
# Handle different output formats
|
|
364
|
+
if isinstance(structured_output, list) and structured_output:
|
|
365
|
+
if len(structured_output) == 1:
|
|
366
|
+
return Data(data=structured_output[0])
|
|
367
|
+
return Data(data={"results": structured_output})
|
|
368
|
+
if isinstance(structured_output, dict):
|
|
369
|
+
return Data(data=structured_output)
|
|
370
|
+
return Data(data={"content": content})
|
|
371
|
+
|
|
372
|
+
except (ValueError, TypeError) as e:
|
|
373
|
+
await logger.aerror(f"Error in structured output processing: {e}")
|
|
374
|
+
return Data(data={"content": content, "error": str(e)})
|
|
181
375
|
|
|
182
376
|
async def get_memory_data(self):
|
|
183
377
|
# TODO: This is a temporary fix to avoid message duplication. We should develop a function for this.
|
|
@@ -190,7 +384,7 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
190
384
|
message for message in messages if getattr(message, "id", None) != getattr(self.input_value, "id", None)
|
|
191
385
|
]
|
|
192
386
|
|
|
193
|
-
def get_llm(self):
|
|
387
|
+
async def get_llm(self):
|
|
194
388
|
if not isinstance(self.agent_llm, str):
|
|
195
389
|
return self.agent_llm, None
|
|
196
390
|
|
|
@@ -207,8 +401,8 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
207
401
|
|
|
208
402
|
return self._build_llm_model(component_class, inputs, prefix), display_name
|
|
209
403
|
|
|
210
|
-
except
|
|
211
|
-
logger.
|
|
404
|
+
except (AttributeError, ValueError, TypeError, RuntimeError) as e:
|
|
405
|
+
await logger.aerror(f"Error building {self.agent_llm} language model: {e!s}")
|
|
212
406
|
msg = f"Failed to initialize language model: {e!s}"
|
|
213
407
|
raise ValueError(msg) from e
|
|
214
408
|
|
|
@@ -117,12 +117,12 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
117
117
|
schema_inputs = schema_to_langflow_inputs(input_schema)
|
|
118
118
|
if not schema_inputs:
|
|
119
119
|
msg = f"No input parameters defined for tool '{tool_obj.name}'"
|
|
120
|
-
logger.
|
|
120
|
+
await logger.awarning(msg)
|
|
121
121
|
return []
|
|
122
122
|
|
|
123
123
|
except Exception as e:
|
|
124
124
|
msg = f"Error validating schema inputs: {e!s}"
|
|
125
|
-
logger.
|
|
125
|
+
await logger.aexception(msg)
|
|
126
126
|
raise ValueError(msg) from e
|
|
127
127
|
else:
|
|
128
128
|
return schema_inputs
|
|
@@ -202,11 +202,11 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
202
202
|
|
|
203
203
|
except (TimeoutError, asyncio.TimeoutError) as e:
|
|
204
204
|
msg = f"Timeout updating tool list: {e!s}"
|
|
205
|
-
logger.
|
|
205
|
+
await logger.aexception(msg)
|
|
206
206
|
raise TimeoutError(msg) from e
|
|
207
207
|
except Exception as e:
|
|
208
208
|
msg = f"Error updating tool list: {e!s}"
|
|
209
|
-
logger.
|
|
209
|
+
await logger.aexception(msg)
|
|
210
210
|
raise ValueError(msg) from e
|
|
211
211
|
else:
|
|
212
212
|
return tool_list, {"name": server_name, "config": server_config}
|
|
@@ -223,7 +223,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
223
223
|
build_config["tool"]["placeholder"] = "Select a tool"
|
|
224
224
|
except (TimeoutError, asyncio.TimeoutError) as e:
|
|
225
225
|
msg = f"Timeout updating tool list: {e!s}"
|
|
226
|
-
logger.
|
|
226
|
+
await logger.aexception(msg)
|
|
227
227
|
if not build_config["tools_metadata"]["show"]:
|
|
228
228
|
build_config["tool"]["show"] = True
|
|
229
229
|
build_config["tool"]["options"] = []
|
|
@@ -249,7 +249,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
249
249
|
break
|
|
250
250
|
if tool_obj is None:
|
|
251
251
|
msg = f"Tool {field_value} not found in available tools: {self.tools}"
|
|
252
|
-
logger.
|
|
252
|
+
await logger.awarning(msg)
|
|
253
253
|
return build_config
|
|
254
254
|
await self._update_tool_config(build_config, field_value)
|
|
255
255
|
except Exception as e:
|
|
@@ -333,7 +333,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
333
333
|
|
|
334
334
|
except Exception as e:
|
|
335
335
|
msg = f"Error in update_build_config: {e!s}"
|
|
336
|
-
logger.
|
|
336
|
+
await logger.aexception(msg)
|
|
337
337
|
raise ValueError(msg) from e
|
|
338
338
|
else:
|
|
339
339
|
return build_config
|
|
@@ -386,7 +386,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
386
386
|
msg = f"Tool {tool_name} not found in available tools: {self.tools}"
|
|
387
387
|
self.remove_non_default_keys(build_config)
|
|
388
388
|
build_config["tool"]["value"] = ""
|
|
389
|
-
logger.
|
|
389
|
+
await logger.awarning(msg)
|
|
390
390
|
return
|
|
391
391
|
|
|
392
392
|
try:
|
|
@@ -404,14 +404,14 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
404
404
|
self.schema_inputs = await self._validate_schema_inputs(tool_obj)
|
|
405
405
|
if not self.schema_inputs:
|
|
406
406
|
msg = f"No input parameters to configure for tool '{tool_name}'"
|
|
407
|
-
logger.
|
|
407
|
+
await logger.ainfo(msg)
|
|
408
408
|
return
|
|
409
409
|
|
|
410
410
|
# Add new inputs to build config
|
|
411
411
|
for schema_input in self.schema_inputs:
|
|
412
412
|
if not schema_input or not hasattr(schema_input, "name"):
|
|
413
413
|
msg = "Invalid schema input detected, skipping"
|
|
414
|
-
logger.
|
|
414
|
+
await logger.awarning(msg)
|
|
415
415
|
continue
|
|
416
416
|
|
|
417
417
|
try:
|
|
@@ -428,16 +428,16 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
428
428
|
|
|
429
429
|
except (AttributeError, KeyError, TypeError) as e:
|
|
430
430
|
msg = f"Error processing schema input {schema_input}: {e!s}"
|
|
431
|
-
logger.
|
|
431
|
+
await logger.aexception(msg)
|
|
432
432
|
continue
|
|
433
433
|
except ValueError as e:
|
|
434
434
|
msg = f"Schema validation error for tool {tool_name}: {e!s}"
|
|
435
|
-
logger.
|
|
435
|
+
await logger.aexception(msg)
|
|
436
436
|
self.schema_inputs = []
|
|
437
437
|
return
|
|
438
438
|
except (AttributeError, KeyError, TypeError) as e:
|
|
439
439
|
msg = f"Error updating tool config: {e!s}"
|
|
440
|
-
logger.
|
|
440
|
+
await logger.aexception(msg)
|
|
441
441
|
raise ValueError(msg) from e
|
|
442
442
|
|
|
443
443
|
async def build_output(self) -> DataFrame:
|
|
@@ -474,7 +474,7 @@ class MCPToolsComponent(ComponentWithCache):
|
|
|
474
474
|
return DataFrame(data=[{"error": "You must select a tool"}])
|
|
475
475
|
except Exception as e:
|
|
476
476
|
msg = f"Error in build_output: {e!s}"
|
|
477
|
-
logger.
|
|
477
|
+
await logger.aexception(msg)
|
|
478
478
|
raise ValueError(msg) from e
|
|
479
479
|
|
|
480
480
|
def _get_session_context(self) -> str | None:
|