lfx-nightly 0.1.12.dev26__py3-none-any.whl → 0.1.12.dev28__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.
- lfx/base/agents/agent.py +25 -10
- lfx/base/agents/utils.py +22 -3
- lfx/base/data/base_file.py +28 -19
- lfx/components/agents/agent.py +1 -1
- lfx/components/data/__init__.py +0 -6
- lfx/components/data/file.py +1 -1
- lfx/components/data/mock_data.py +5 -8
- lfx/components/data/save_file.py +625 -0
- lfx/components/data/web_search.py +225 -11
- lfx/components/docling/docling_remote.py +4 -1
- lfx/components/input_output/chat.py +8 -1
- lfx/components/nvidia/nvidia.py +1 -4
- lfx/components/processing/__init__.py +3 -3
- lfx/components/processing/dataframe_to_toolset.py +259 -0
- lfx/components/processing/lambda_filter.py +3 -3
- lfx/graph/vertex/param_handler.py +49 -0
- lfx/interface/initialize/loading.py +114 -21
- lfx/schema/image.py +72 -19
- lfx/schema/message.py +7 -2
- lfx/schema/table.py +2 -0
- lfx/services/settings/base.py +7 -0
- lfx/utils/util.py +135 -0
- {lfx_nightly-0.1.12.dev26.dist-info → lfx_nightly-0.1.12.dev28.dist-info}/METADATA +1 -1
- {lfx_nightly-0.1.12.dev26.dist-info → lfx_nightly-0.1.12.dev28.dist-info}/RECORD +26 -27
- lfx/components/data/news_search.py +0 -164
- lfx/components/data/rss.py +0 -69
- lfx/components/processing/save_file.py +0 -225
- {lfx_nightly-0.1.12.dev26.dist-info → lfx_nightly-0.1.12.dev28.dist-info}/WHEEL +0 -0
- {lfx_nightly-0.1.12.dev26.dist-info → lfx_nightly-0.1.12.dev28.dist-info}/entry_points.txt +0 -0
|
@@ -7,13 +7,13 @@ lfx/type_extraction.py,sha256=eCZNl9nAQivKdaPv_9BK71N0JV9Rtr--veAht0dnQ4A,2921
|
|
|
7
7
|
lfx/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
lfx/base/constants.py,sha256=v9vo0Ifg8RxDu__XqgGzIXHlsnUFyWM-SSux0uHHoz8,1187
|
|
9
9
|
lfx/base/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
lfx/base/agents/agent.py,sha256
|
|
10
|
+
lfx/base/agents/agent.py,sha256=-PZ0gzBCXB4EXDHoXhYNY-tPvcOogfSNfV_eb1B1u-c,11784
|
|
11
11
|
lfx/base/agents/callback.py,sha256=mjlT9ukBMVrfjYrHsJowqpY4g9hVGBVBIYhncLWr3tQ,3692
|
|
12
12
|
lfx/base/agents/context.py,sha256=u0wboX1aRR22Ia8gY14WF12RjhE0Rxv9hPBiixT9DtQ,3916
|
|
13
13
|
lfx/base/agents/default_prompts.py,sha256=tUjfczwt4D5R1KozNOl1uSL2V2rSCZeUMS-cfV4Gwn0,955
|
|
14
14
|
lfx/base/agents/errors.py,sha256=4QY1AqSWZaOjq-iQRYH_aeCfH_hWECLQkiwybNXz66U,531
|
|
15
15
|
lfx/base/agents/events.py,sha256=1SLai0H5pvorojgBL7l_xbtJ7gpkcddd5IWyUw25UTg,14035
|
|
16
|
-
lfx/base/agents/utils.py,sha256=
|
|
16
|
+
lfx/base/agents/utils.py,sha256=OcmtZx4BTFTyq2A3rta3WoJn98UzEYdEXoRLs8-mTVo,6511
|
|
17
17
|
lfx/base/agents/crewai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
lfx/base/agents/crewai/crew.py,sha256=TN1JyLXMpJc2yPH3tokhFmxKKYoJ4lMvmG19DmpKfeY,7953
|
|
19
19
|
lfx/base/agents/crewai/tasks.py,sha256=1pBok1UDdAjLtOf2Y-rDrjRaM93no-XLy5Bf_zvWsRM,151
|
|
@@ -28,7 +28,7 @@ lfx/base/compressors/model.py,sha256=-FFBAPAy9bAgvklIo7x_uwShZR5NoMHakF6f_hNnLHg
|
|
|
28
28
|
lfx/base/curl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
29
|
lfx/base/curl/parse.py,sha256=Yw6mMbGg7e-ffrBItEUJeTiljneCXlNyt5afzEP9eUI,6094
|
|
30
30
|
lfx/base/data/__init__.py,sha256=lQsYYMyAg_jA9ZF7oc-LNZsRE2uMGT6g16WzsUByHqs,81
|
|
31
|
-
lfx/base/data/base_file.py,sha256=
|
|
31
|
+
lfx/base/data/base_file.py,sha256=TUD84Jj0tYr0DEz_D7oK9FUBkBCAIHitxryX9nXwgus,27571
|
|
32
32
|
lfx/base/data/docling_utils.py,sha256=gVDxOZghSJEo5n-UNkVGBQYqkvfNqkNkltBhAnoaJd4,13048
|
|
33
33
|
lfx/base/data/utils.py,sha256=dGqEO4zE5s_V2Cs4j0EEeyLjYLX6Zex-EGzIOznK76o,5960
|
|
34
34
|
lfx/base/document_transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -110,7 +110,7 @@ lfx/components/Notion/update_page_property.py,sha256=tgmPMbD1eX58dQQNXv1w5FzDec7
|
|
|
110
110
|
lfx/components/agentql/__init__.py,sha256=Erl669Dzsk-SegsDPWTtkKbprMXVuv8UTCo5REzZGTc,56
|
|
111
111
|
lfx/components/agentql/agentql_api.py,sha256=N94yEK7ZuQCIsFBlr_8dqrJY-K1-KNb6QEEYfDIsDME,5569
|
|
112
112
|
lfx/components/agents/__init__.py,sha256=u1PH9Ui0dUgTdTZVP7cdVysCv4extdusKS_brcbE7Eg,1049
|
|
113
|
-
lfx/components/agents/agent.py,sha256=
|
|
113
|
+
lfx/components/agents/agent.py,sha256=gUZ5RTgf_6G8Yi6QnQRuC4qn1rh2eeIF9MHQL8G-D3k,26592
|
|
114
114
|
lfx/components/agents/mcp_component.py,sha256=dW0eENDKz8esIShOooDEL48r3J3GoI1h0tuqIPLSnR4,25462
|
|
115
115
|
lfx/components/aiml/__init__.py,sha256=DNKB-HMFGFYmsdkON-s8557ttgBXVXADmS-BcuSQiIQ,1087
|
|
116
116
|
lfx/components/aiml/aiml.py,sha256=23Ineg1ajlCoqXgWgp50I20OnQbaleRNsw1c6IzPu3A,3877
|
|
@@ -201,18 +201,17 @@ lfx/components/crewai/sequential_task.py,sha256=sfF7j8xcFri5JCA_AEePYRCq9ll2wnZv
|
|
|
201
201
|
lfx/components/crewai/sequential_task_agent.py,sha256=ClSD74LDE1dOIL9i0Dj0OUi3jyGAGUu3NpxZ_U3OjxU,4738
|
|
202
202
|
lfx/components/custom_component/__init__.py,sha256=3GXaQiQL8mTRYU-tpVPxtRKFkAd2zBQWAsbc-pQKJMA,928
|
|
203
203
|
lfx/components/custom_component/custom_component.py,sha256=1QpopvpXkzQ3Vg7TzFI2TszRBR5fFDcQNJYra_q_hrA,919
|
|
204
|
-
lfx/components/data/__init__.py,sha256=
|
|
204
|
+
lfx/components/data/__init__.py,sha256=g2vQndQWDTcaJrwi8EaDgW4UJoDtItwhCmDBb2cxEDw,1925
|
|
205
205
|
lfx/components/data/api_request.py,sha256=gKVtJhEzh1PdawZqQtxBwi0vU3kQ_f25jCd2tj-EeU0,20211
|
|
206
206
|
lfx/components/data/csv_to_data.py,sha256=NsNe8rZdkqscnWPynbbd3-svrRj3EEWNaJszjW9b1_k,3345
|
|
207
207
|
lfx/components/data/directory.py,sha256=iqINxxy5w60l753zraB-EDpYny8FR6vaa-AgVkdYsLk,3936
|
|
208
|
-
lfx/components/data/file.py,sha256=
|
|
208
|
+
lfx/components/data/file.py,sha256=pPlmaEHElAeUfSs60G0cl-goynWg9I3uo7IPeN63UEc,26073
|
|
209
209
|
lfx/components/data/json_to_data.py,sha256=p6MPyUgDvY9aKTL2_2cUGmkeK7baS-G9rkCvzHAnhw8,3571
|
|
210
|
-
lfx/components/data/mock_data.py,sha256=
|
|
211
|
-
lfx/components/data/
|
|
212
|
-
lfx/components/data/rss.py,sha256=RGUB2Iz07Du7p_GOm84W-i2uqDfG6DOc0IQdTKNQsjY,2487
|
|
210
|
+
lfx/components/data/mock_data.py,sha256=0h3OezKb8P5x6XWGzZJ8JmqmB9eK-bhpfLm0GO21MNY,16039
|
|
211
|
+
lfx/components/data/save_file.py,sha256=1ZPSQROFRjt1SivSuFr0jtnAMR1Bqf9DJLokYzbGyY8,25190
|
|
213
212
|
lfx/components/data/sql_executor.py,sha256=sN1lWM65O_pCfZxNAzgjtZmcTPGBLqMud2_7nFv-kpM,3726
|
|
214
213
|
lfx/components/data/url.py,sha256=zbfTeTBukw3F_mRBMIJrQYF94psEIBuS8dFjcQku5SE,11001
|
|
215
|
-
lfx/components/data/web_search.py,sha256=
|
|
214
|
+
lfx/components/data/web_search.py,sha256=48SCp-2I_Qckp5tmTVC9JBw2C-MhBDF14MJLaGjLpyQ,12758
|
|
216
215
|
lfx/components/data/webhook.py,sha256=i2jdXSLUVA0UpnYBZzdPo035MeiUcFKVJy37EhLKq6o,1643
|
|
217
216
|
lfx/components/datastax/__init__.py,sha256=VEh_Qu8dYPOVB9dISRaxheFPKxzQoNNe1DCwTWTGNIU,2415
|
|
218
217
|
lfx/components/datastax/astra_assistant_manager.py,sha256=5vLbuCxSz04GKxEpP0TNm9K_RAxxoMTz-Mt_YhkyfH0,11557
|
|
@@ -260,7 +259,7 @@ lfx/components/deepseek/deepseek.py,sha256=yNrHoljXOMScKng-oSB-ceWhVZeuh11lmrAY7
|
|
|
260
259
|
lfx/components/docling/__init__.py,sha256=O4utz9GHFpTVe_Wy0PR80yA1irJQRnAFQWkoLCVj888,1424
|
|
261
260
|
lfx/components/docling/chunk_docling_document.py,sha256=OX-jj4nX3UZgopViMAGAnFgtLql0sgs6cVmU8p9QbqA,7600
|
|
262
261
|
lfx/components/docling/docling_inline.py,sha256=12s4U860c-wkpmd2JYi6qxK1Wx_PF9j9BARLhXCL0E0,8496
|
|
263
|
-
lfx/components/docling/docling_remote.py,sha256=
|
|
262
|
+
lfx/components/docling/docling_remote.py,sha256=Ju61E93tLBq6KsRRGVA1_ySWzEOdOFj9jS9kJ7gc3H4,6980
|
|
264
263
|
lfx/components/docling/export_docling_document.py,sha256=TeFt3TesCxSqW57nv-30gf2dX8qMDUHLRhwU-1ciq08,4681
|
|
265
264
|
lfx/components/documentloaders/__init__.py,sha256=LNl2hG2InevQCUREFKhF9ylaTf_kwPsdjiDbx2ElX3M,69
|
|
266
265
|
lfx/components/duckduckgo/__init__.py,sha256=Y4zaOLVOKsD_qwF7KRLek1pcaKKHa6lGUHObuQTR9iY,104
|
|
@@ -315,7 +314,7 @@ lfx/components/ibm/watsonx_embeddings.py,sha256=_97UE-qQDCjkWfX3NFWNCti4TUXxO1LO
|
|
|
315
314
|
lfx/components/icosacomputing/__init__.py,sha256=NByWM-IMPf7N1lOeZDet8CvIa8A25kG3yKircYwS52w,120
|
|
316
315
|
lfx/components/icosacomputing/combinatorial_reasoner.py,sha256=SFVwR_8jGHVDaGO81jj2vzzeKh892h1nMGxCDljbvNY,2766
|
|
317
316
|
lfx/components/input_output/__init__.py,sha256=BaDAE9j41eSg04p5S6MJyUs4daU8UNp5e4m988K4VLQ,1291
|
|
318
|
-
lfx/components/input_output/chat.py,sha256=
|
|
317
|
+
lfx/components/input_output/chat.py,sha256=9wH2hrMl-pD0uhopsi8kWcs--o_1lCsoCSDllAKSLqc,3143
|
|
319
318
|
lfx/components/input_output/chat_output.py,sha256=lkf00vS0CYsTIdCN_ZX7DG4IL8hD2I9xQahyuL0St-w,6641
|
|
320
319
|
lfx/components/input_output/text.py,sha256=PdKOpZG5zVIoh45uzxRbY_pcycmrLaicoFhf9dauhZ0,743
|
|
321
320
|
lfx/components/input_output/text_output.py,sha256=Ij_Xk2hubdSwZoNDoltJU78YdCw91rE9kkGbY6qLViY,820
|
|
@@ -399,7 +398,7 @@ lfx/components/notdiamond/notdiamond.py,sha256=om6_UB9n5rt1T-yXxgMFBPBEP2tJtnGC2
|
|
|
399
398
|
lfx/components/novita/__init__.py,sha256=i8RrVPX00S3RupAlZ078-mdGB7VHwvpdnL7IfsWWPIo,937
|
|
400
399
|
lfx/components/novita/novita.py,sha256=IULE3StkQwECxOR3HMJsEyE7cN5hwslxovvhMmquuNo,4368
|
|
401
400
|
lfx/components/nvidia/__init__.py,sha256=Phf45VUW7An5LnauqpB-lIRVwwBiQawZkoWbqBjQnWE,1756
|
|
402
|
-
lfx/components/nvidia/nvidia.py,sha256=
|
|
401
|
+
lfx/components/nvidia/nvidia.py,sha256=Z5EomVSAzV_fqtgSKw4kO2ko59IIoXiQat8cgfpTlks,6180
|
|
403
402
|
lfx/components/nvidia/nvidia_embedding.py,sha256=D97QOAgtZEzwHvBmDDShTmZhDAyN2SRbfb71515ib-g,2658
|
|
404
403
|
lfx/components/nvidia/nvidia_ingest.py,sha256=_wxmYNmRQ2kBfAxaXLykBIlKFXVGXEsTY22spVeoCCI,12065
|
|
405
404
|
lfx/components/nvidia/nvidia_rerank.py,sha256=zzl2skHxf2oXINDZBmG8-GbkTkc6EWtyMjyV8pVRAm4,2293
|
|
@@ -421,7 +420,7 @@ lfx/components/pgvector/__init__.py,sha256=swho2zRxXeqlLBtSJD--b2XS0R3UiLPtwejql
|
|
|
421
420
|
lfx/components/pgvector/pgvector.py,sha256=UBF2B79eVfjj3hHoxrHzmT2UXOsUZxp4dWvyuPS2wh4,2635
|
|
422
421
|
lfx/components/pinecone/__init__.py,sha256=iz4GAXdbt9vo_CeWns1qyT0s7a56Q5CyS4H5MWa4Mv0,953
|
|
423
422
|
lfx/components/pinecone/pinecone.py,sha256=VkygoOmrco417hYInjYIFwuxX1M7peYJl9-jhuiySR8,5137
|
|
424
|
-
lfx/components/processing/__init__.py,sha256
|
|
423
|
+
lfx/components/processing/__init__.py,sha256=-M4X7S2PjQ2wGFbH1B1tuIs_-kCifCatHIu6pPhyV8U,5056
|
|
425
424
|
lfx/components/processing/alter_metadata.py,sha256=Cy_mLq7E8nEJd36kmCVwqjvt-4HvWcqAXwPXjdOqVps,3831
|
|
426
425
|
lfx/components/processing/batch_run.py,sha256=KZtEaQMuSEUsQ5qwiU-dJPMAqNE5LA83HoLk-Y646hg,7861
|
|
427
426
|
lfx/components/processing/combine_text.py,sha256=EP-2VD3Za5usoNj87Gtjbjh7e23_4tNpXzFo7pXpKx8,1290
|
|
@@ -430,11 +429,12 @@ lfx/components/processing/create_data.py,sha256=PjE1JQkNrXtWpk2KHow27fArlXkRCwOG
|
|
|
430
429
|
lfx/components/processing/data_operations.py,sha256=9dloD4ZEvwlpQwpV2Tig6sGwWTOxWXb9gMX6RO_hiL0,21515
|
|
431
430
|
lfx/components/processing/data_to_dataframe.py,sha256=V7n3kCjp6v6vdcsrdVJQxlgaYHqevL46x4lAcgnKNGA,2408
|
|
432
431
|
lfx/components/processing/dataframe_operations.py,sha256=tNaxm27vTkH_uVqqQ5k-c0HwVuvGAgNRzT0LCCbqmnI,11552
|
|
432
|
+
lfx/components/processing/dataframe_to_toolset.py,sha256=jnXdzOPrQnKne7P7MTiU8Oye4KUydCe6BKfkT9E7kr0,9911
|
|
433
433
|
lfx/components/processing/extract_key.py,sha256=7e0_ThUzvAe6blYuj0A8zc-b3FzYqlPJPvK4krF4voc,2012
|
|
434
434
|
lfx/components/processing/filter_data.py,sha256=BMUJNyFtTLRdmuxcyPeH_W2PfEWErH6rxMfsLSQrarw,1317
|
|
435
435
|
lfx/components/processing/filter_data_values.py,sha256=hHUiVJxnbERVbvyycmBmUrl4nDK6x7cfQThs5N9JRkk,3182
|
|
436
436
|
lfx/components/processing/json_cleaner.py,sha256=XBUJl67E0qI93yK6L_8uHmbMRaKllk1cQ2c1Dz5DdWw,3750
|
|
437
|
-
lfx/components/processing/lambda_filter.py,sha256=
|
|
437
|
+
lfx/components/processing/lambda_filter.py,sha256=QHhlDuyU-4Cm28UB0umKohkd7yp_Hlnngj-d2faHvIk,5566
|
|
438
438
|
lfx/components/processing/llm_router.py,sha256=FYC0SylbjUDlOBRLSdpFfU6Ep4IMk7tWpRAQJ5k9aA4,23198
|
|
439
439
|
lfx/components/processing/merge_data.py,sha256=ouy4E6rFi2A4_xC6T8Vr3GwFy7fhR98WBuXLGFGom7o,3569
|
|
440
440
|
lfx/components/processing/message_to_data.py,sha256=0K8SIq6vuAvQ3K7siXstNint6R1-rAuZ5NIwQiiG_n0,1342
|
|
@@ -445,7 +445,6 @@ lfx/components/processing/parser.py,sha256=vxnub-7jUTAtMgcLTdZGzHuRby_B1d1HOntsx
|
|
|
445
445
|
lfx/components/processing/prompt.py,sha256=c4LQPOQSvz1Z1e73uyOm8TaTxWDpCGcujBd-a6AxL1A,2761
|
|
446
446
|
lfx/components/processing/python_repl_core.py,sha256=6kOu64pWyBwBpTqOTM9LPnSsnTX6q_J-Hqhmoxp0wFs,3472
|
|
447
447
|
lfx/components/processing/regex.py,sha256=9n171_Ze--5gpKFJJyJlYafuEOwbPQPiyjhdLY3SUrY,2689
|
|
448
|
-
lfx/components/processing/save_file.py,sha256=UZsmG2aTYGgd6pTF1RXNhQDKVUc-IGmVsdMrREtIA6E,9559
|
|
449
448
|
lfx/components/processing/select_data.py,sha256=BRK9mM5NuHveCrMOyIXjzzpEsNMEiA7oQXvk1DZLHM4,1788
|
|
450
449
|
lfx/components/processing/split_text.py,sha256=8oZ-_aYfjxEdzFFr2reKeBVPjMrAeAauZiQkM9J7Syc,5293
|
|
451
450
|
lfx/components/processing/structured_output.py,sha256=pbGwTZ_MCRwfpNY55zKDrSCw1fFYosL11QVNkZZndz8,8125
|
|
@@ -596,7 +595,7 @@ lfx/graph/vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
596
595
|
lfx/graph/vertex/base.py,sha256=drvm5o-y2NMyZ99uupHqjh4lUl8kIV4SeYol-q7FTdQ,33310
|
|
597
596
|
lfx/graph/vertex/constants.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
598
597
|
lfx/graph/vertex/exceptions.py,sha256=QTe-7TRCI0TXswRZh1kh0Z3KySjQsJgY5zTU6o0jboQ,193
|
|
599
|
-
lfx/graph/vertex/param_handler.py,sha256=
|
|
598
|
+
lfx/graph/vertex/param_handler.py,sha256=ugIsqxXd5YHYixbufW39VDgrfDICvI-im2U_oxiOWGM,12887
|
|
600
599
|
lfx/graph/vertex/schema.py,sha256=3h6c7TTdZI1mzfAebhD-6CCCRLu1mQ8UDmgJijx5zWg,552
|
|
601
600
|
lfx/graph/vertex/utils.py,sha256=iJmY4PXta5dYWTX2SMEbpfMKrzwkJVQmi8qstSv8D7I,738
|
|
602
601
|
lfx/graph/vertex/vertex_types.py,sha256=r4eMlTUTWR5CQf-W34BBzpHpQ9KdWcK3L-2byE22enU,21140
|
|
@@ -618,7 +617,7 @@ lfx/interface/utils.py,sha256=qKi2HRg-QgeI3hmXLMtG6DHBbaQPuVMW5-o9lcN7j0Q,3790
|
|
|
618
617
|
lfx/interface/importing/__init__.py,sha256=uPlvLJZ_XQ4eK08GjfqOyoQ0ercc2ApRO-JRSB26z1o,154
|
|
619
618
|
lfx/interface/importing/utils.py,sha256=-3-M4MSzA_2zlwRWy1SdJHDsjeRkFvWZaTynITRj1x8,1460
|
|
620
619
|
lfx/interface/initialize/__init__.py,sha256=wxisnaYxjaqrjA_-By2oHmd4Fht5lAAJFYrotkPm7HA,45
|
|
621
|
-
lfx/interface/initialize/loading.py,sha256=
|
|
620
|
+
lfx/interface/initialize/loading.py,sha256=WF6sp20wYvY52nKbAQpPDrzGKBHwW5xEz45qnGZBc_o,12229
|
|
622
621
|
lfx/io/__init__.py,sha256=hIH6GC2gKdupGZVyRqrbOIm9UyUhNqIga8z1jd4ri2w,1131
|
|
623
622
|
lfx/io/schema.py,sha256=ddF10TCK2TLx4rGSFCP-NTEDpTS7wyG4WzpZ0HJgZ2c,10404
|
|
624
623
|
lfx/load/__init__.py,sha256=y35GBUhVTOsG3GzL5UVL-RNAsu0D7T8MVPrNXoDMx7U,224
|
|
@@ -641,15 +640,15 @@ lfx/schema/dataframe.py,sha256=Jo07krf3lI-dicAu5Y5Enf90NSEWkpD_di0rSj9krIM,7477
|
|
|
641
640
|
lfx/schema/dotdict.py,sha256=d6R5jv8V_pxaQUX3QP41ZzTz2wZpnZ0OFsylFf3xL-Q,2756
|
|
642
641
|
lfx/schema/encoders.py,sha256=7vlWHZnZuDv1UVuP9X7Xn8srP1HZqLygOmkps3EJyY0,332
|
|
643
642
|
lfx/schema/graph.py,sha256=o7qXhHZT4lEwjJZtlg4k9SNPgmMVZsZsclBbe8v_y6Y,1313
|
|
644
|
-
lfx/schema/image.py,sha256=
|
|
643
|
+
lfx/schema/image.py,sha256=WdaOT3bjkJaG28RpgmurtfcnOG7Hr2phZ27YXH25uHA,5970
|
|
645
644
|
lfx/schema/json_schema.py,sha256=keN4trNimJzqrLnPvBhq90rc5FTwQH44lLpmLv4BzhA,5316
|
|
646
645
|
lfx/schema/log.py,sha256=xbwSvJKmT1U8kxqIcV8BYgJxtu8Q6ntJKF8cIeksPEo,1943
|
|
647
|
-
lfx/schema/message.py,sha256=
|
|
646
|
+
lfx/schema/message.py,sha256=Fg83OjS67qJYCevqt_5JcBu9xXkh1WY6S6DBLAvT62g,18076
|
|
648
647
|
lfx/schema/openai_responses_schemas.py,sha256=drMCAlliefHfGRojBTMepPwk4DyEGh67naWvMPD10Sw,2596
|
|
649
648
|
lfx/schema/properties.py,sha256=ZRY6FUDfqpc5wQ-bi-ZuUUrusF9t-pt9fQa_FNPpia0,1356
|
|
650
649
|
lfx/schema/schema.py,sha256=XbIuvD64EdVljP1V32tsEL-ETXOQSFipMDaiMGzYttM,5079
|
|
651
650
|
lfx/schema/serialize.py,sha256=Y7aL91w3BW4ZYkgdIHosUYdpIJUDku-SoqYoIQtwtGM,252
|
|
652
|
-
lfx/schema/table.py,sha256=
|
|
651
|
+
lfx/schema/table.py,sha256=1RdMmk1vbzmPFW0JEGhP7WDDRtvUKH9lkDw5v-JWhSw,4668
|
|
653
652
|
lfx/schema/validators.py,sha256=1CC4jU3sFmPnauie_U_Xb_QpcnsBf3XT7oWphr5Lt8U,4023
|
|
654
653
|
lfx/serialization/__init__.py,sha256=g-CG7Y--Eog6mSPMI7wqXh6J8lYygFthqmJWrCa3P7k,145
|
|
655
654
|
lfx/serialization/constants.py,sha256=mAYNbapEPu9-KixSHVPCXUyM-bsFMjSoCc4ohkQGvQY,47
|
|
@@ -675,7 +674,7 @@ lfx/services/mcp_composer/factory.py,sha256=f8Bj0ZR9A_o1c3Kw5JKyR6SbtbCEPNWOy8b0
|
|
|
675
674
|
lfx/services/mcp_composer/service.py,sha256=Binv29dXSRscUPOa40714w_NYmebZB3gwBp68KnaSFc,25765
|
|
676
675
|
lfx/services/settings/__init__.py,sha256=UISBvOQIqoA3a8opwJrTQp4PSTqpReY6GQ_7O6WuqJQ,65
|
|
677
676
|
lfx/services/settings/auth.py,sha256=_18KZipq0udCJPq-4xCD_juhqSwAEvoCqxOTSYsNv5w,5720
|
|
678
|
-
lfx/services/settings/base.py,sha256=
|
|
677
|
+
lfx/services/settings/base.py,sha256=z45EHJpkuvN9DwBuOOaShdxpeX_D0moyMAlG2E640l0,26119
|
|
679
678
|
lfx/services/settings/constants.py,sha256=ZBJolZ4kx0ZoYp2BDyHkgDFgaXEQAH-ZcLqgunv_MqQ,908
|
|
680
679
|
lfx/services/settings/factory.py,sha256=NezZ6TE_xP955B9l9pI6ONNyoylrHPfUZN8arvLVRXg,615
|
|
681
680
|
lfx/services/settings/feature_flags.py,sha256=HGuDGgfOBIDtuEiEVTgoWHxKqX2vuVBRgsqdX_4D9kg,205
|
|
@@ -715,10 +714,10 @@ lfx/utils/image.py,sha256=wMWBEI1gW3cFlQcio3mWgfHBaOw1uoAnqNmEacE_8xo,2133
|
|
|
715
714
|
lfx/utils/lazy_load.py,sha256=UDtXi8N7NT9r-FRGxsLUfDtGU_X8yqt-RQqgpc9TqAw,394
|
|
716
715
|
lfx/utils/request_utils.py,sha256=A6vmwpr7f3ZUxHg6Sz2-BdUUsyAwg84-7N_DNoPC8_Q,518
|
|
717
716
|
lfx/utils/schemas.py,sha256=NbOtVQBrn4d0BAu-0H_eCTZI2CXkKZlRY37XCSmuJwc,3865
|
|
718
|
-
lfx/utils/util.py,sha256=
|
|
717
|
+
lfx/utils/util.py,sha256=ZW7sYJBtIhM6o_GHgHoI-mXB8l2vTNgRgdUfsogFp0g,20419
|
|
719
718
|
lfx/utils/util_strings.py,sha256=nU_IcdphNaj6bAPbjeL-c1cInQPfTBit8mp5Y57lwQk,1686
|
|
720
719
|
lfx/utils/version.py,sha256=cHpbO0OJD2JQAvVaTH_6ibYeFbHJV0QDHs_YXXZ-bT8,671
|
|
721
|
-
lfx_nightly-0.1.12.
|
|
722
|
-
lfx_nightly-0.1.12.
|
|
723
|
-
lfx_nightly-0.1.12.
|
|
724
|
-
lfx_nightly-0.1.12.
|
|
720
|
+
lfx_nightly-0.1.12.dev28.dist-info/METADATA,sha256=gzrj10pfKq79hA5TOZP0FfKFsQklv-9L_XZd-OiWytk,8068
|
|
721
|
+
lfx_nightly-0.1.12.dev28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
722
|
+
lfx_nightly-0.1.12.dev28.dist-info/entry_points.txt,sha256=1724p3RHDQRT2CKx_QRzEIa7sFuSVO0Ux70YfXfoMT4,42
|
|
723
|
+
lfx_nightly-0.1.12.dev28.dist-info/RECORD,,
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
from urllib.parse import quote_plus
|
|
2
|
-
|
|
3
|
-
import pandas as pd
|
|
4
|
-
import requests
|
|
5
|
-
from bs4 import BeautifulSoup
|
|
6
|
-
|
|
7
|
-
from lfx.custom import Component
|
|
8
|
-
from lfx.io import IntInput, MessageTextInput, Output
|
|
9
|
-
from lfx.schema import DataFrame
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class NewsSearchComponent(Component):
|
|
13
|
-
display_name = "News Search"
|
|
14
|
-
description = "Searches Google News via RSS. Returns clean article data."
|
|
15
|
-
documentation: str = "https://docs.langflow.org/components-data#news-search"
|
|
16
|
-
icon = "newspaper"
|
|
17
|
-
name = "NewsSearch"
|
|
18
|
-
|
|
19
|
-
inputs = [
|
|
20
|
-
MessageTextInput(
|
|
21
|
-
name="query",
|
|
22
|
-
display_name="Search Query",
|
|
23
|
-
info="Search keywords for news articles.",
|
|
24
|
-
tool_mode=True,
|
|
25
|
-
required=True,
|
|
26
|
-
),
|
|
27
|
-
MessageTextInput(
|
|
28
|
-
name="hl",
|
|
29
|
-
display_name="Language (hl)",
|
|
30
|
-
info="Language code, e.g. en-US, fr, de. Default: en-US.",
|
|
31
|
-
tool_mode=False,
|
|
32
|
-
input_types=[],
|
|
33
|
-
required=False,
|
|
34
|
-
advanced=True,
|
|
35
|
-
),
|
|
36
|
-
MessageTextInput(
|
|
37
|
-
name="gl",
|
|
38
|
-
display_name="Country (gl)",
|
|
39
|
-
info="Country code, e.g. US, FR, DE. Default: US.",
|
|
40
|
-
tool_mode=False,
|
|
41
|
-
input_types=[],
|
|
42
|
-
required=False,
|
|
43
|
-
advanced=True,
|
|
44
|
-
),
|
|
45
|
-
MessageTextInput(
|
|
46
|
-
name="ceid",
|
|
47
|
-
display_name="Country:Language (ceid)",
|
|
48
|
-
info="e.g. US:en, FR:fr. Default: US:en.",
|
|
49
|
-
tool_mode=False,
|
|
50
|
-
value="US:en",
|
|
51
|
-
input_types=[],
|
|
52
|
-
required=False,
|
|
53
|
-
advanced=True,
|
|
54
|
-
),
|
|
55
|
-
MessageTextInput(
|
|
56
|
-
name="topic",
|
|
57
|
-
display_name="Topic",
|
|
58
|
-
info="One of: WORLD, NATION, BUSINESS, TECHNOLOGY, ENTERTAINMENT, SCIENCE, SPORTS, HEALTH.",
|
|
59
|
-
tool_mode=False,
|
|
60
|
-
input_types=[],
|
|
61
|
-
required=False,
|
|
62
|
-
advanced=True,
|
|
63
|
-
),
|
|
64
|
-
MessageTextInput(
|
|
65
|
-
name="location",
|
|
66
|
-
display_name="Location (Geo)",
|
|
67
|
-
info="City, state, or country for location-based news. Leave blank for keyword search.",
|
|
68
|
-
tool_mode=False,
|
|
69
|
-
input_types=[],
|
|
70
|
-
required=False,
|
|
71
|
-
advanced=True,
|
|
72
|
-
),
|
|
73
|
-
IntInput(
|
|
74
|
-
name="timeout",
|
|
75
|
-
display_name="Timeout",
|
|
76
|
-
info="Timeout for the request in seconds.",
|
|
77
|
-
value=5,
|
|
78
|
-
required=False,
|
|
79
|
-
advanced=True,
|
|
80
|
-
),
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
outputs = [Output(name="articles", display_name="News Articles", method="search_news")]
|
|
84
|
-
|
|
85
|
-
def search_news(self) -> DataFrame:
|
|
86
|
-
# Defaults
|
|
87
|
-
hl = getattr(self, "hl", None) or "en-US"
|
|
88
|
-
gl = getattr(self, "gl", None) or "US"
|
|
89
|
-
ceid = getattr(self, "ceid", None) or f"{gl}:{hl.split('-')[0]}"
|
|
90
|
-
topic = getattr(self, "topic", None)
|
|
91
|
-
location = getattr(self, "location", None)
|
|
92
|
-
query = getattr(self, "query", None)
|
|
93
|
-
|
|
94
|
-
# Build base URL
|
|
95
|
-
if topic:
|
|
96
|
-
# Topic-based feed
|
|
97
|
-
base_url = f"https://news.google.com/rss/headlines/section/topic/{quote_plus(topic.upper())}"
|
|
98
|
-
params = f"?hl={hl}&gl={gl}&ceid={ceid}"
|
|
99
|
-
rss_url = base_url + params
|
|
100
|
-
elif location:
|
|
101
|
-
# Location-based feed
|
|
102
|
-
base_url = f"https://news.google.com/rss/headlines/section/geo/{quote_plus(location)}"
|
|
103
|
-
params = f"?hl={hl}&gl={gl}&ceid={ceid}"
|
|
104
|
-
rss_url = base_url + params
|
|
105
|
-
elif query:
|
|
106
|
-
# Keyword search feed
|
|
107
|
-
base_url = "https://news.google.com/rss/search?q="
|
|
108
|
-
query_parts = [query]
|
|
109
|
-
query_encoded = quote_plus(" ".join(query_parts))
|
|
110
|
-
params = f"&hl={hl}&gl={gl}&ceid={ceid}"
|
|
111
|
-
rss_url = f"{base_url}{query_encoded}{params}"
|
|
112
|
-
else:
|
|
113
|
-
self.status = "No search query, topic, or location provided."
|
|
114
|
-
self.log(self.status)
|
|
115
|
-
return DataFrame(
|
|
116
|
-
pd.DataFrame(
|
|
117
|
-
[
|
|
118
|
-
{
|
|
119
|
-
"title": "Error",
|
|
120
|
-
"link": "",
|
|
121
|
-
"published": "",
|
|
122
|
-
"summary": "No search query, topic, or location provided.",
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
try:
|
|
129
|
-
response = requests.get(rss_url, timeout=self.timeout)
|
|
130
|
-
response.raise_for_status()
|
|
131
|
-
soup = BeautifulSoup(response.content, "xml")
|
|
132
|
-
items = soup.find_all("item")
|
|
133
|
-
except requests.RequestException as e:
|
|
134
|
-
self.status = f"Failed to fetch news: {e}"
|
|
135
|
-
self.log(self.status)
|
|
136
|
-
return DataFrame(pd.DataFrame([{"title": "Error", "link": "", "published": "", "summary": str(e)}]))
|
|
137
|
-
except (AttributeError, ValueError, TypeError) as e:
|
|
138
|
-
self.status = f"Unexpected error: {e!s}"
|
|
139
|
-
self.log(self.status)
|
|
140
|
-
return DataFrame(pd.DataFrame([{"title": "Error", "link": "", "published": "", "summary": str(e)}]))
|
|
141
|
-
|
|
142
|
-
if not items:
|
|
143
|
-
self.status = "No news articles found."
|
|
144
|
-
self.log(self.status)
|
|
145
|
-
return DataFrame(pd.DataFrame([{"title": "No articles found", "link": "", "published": "", "summary": ""}]))
|
|
146
|
-
|
|
147
|
-
articles = []
|
|
148
|
-
for item in items:
|
|
149
|
-
try:
|
|
150
|
-
title = self.clean_html(item.title.text if item.title else "")
|
|
151
|
-
link = item.link.text if item.link else ""
|
|
152
|
-
published = item.pubDate.text if item.pubDate else ""
|
|
153
|
-
summary = self.clean_html(item.description.text if item.description else "")
|
|
154
|
-
articles.append({"title": title, "link": link, "published": published, "summary": summary})
|
|
155
|
-
except (AttributeError, ValueError, TypeError) as e:
|
|
156
|
-
self.log(f"Error parsing article: {e!s}")
|
|
157
|
-
continue
|
|
158
|
-
|
|
159
|
-
df_articles = pd.DataFrame(articles)
|
|
160
|
-
self.log(f"Found {len(df_articles)} articles.")
|
|
161
|
-
return DataFrame(df_articles)
|
|
162
|
-
|
|
163
|
-
def clean_html(self, html_string: str) -> str:
|
|
164
|
-
return BeautifulSoup(html_string, "html.parser").get_text(separator=" ", strip=True)
|
lfx/components/data/rss.py
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import pandas as pd
|
|
2
|
-
import requests
|
|
3
|
-
from bs4 import BeautifulSoup
|
|
4
|
-
|
|
5
|
-
from lfx.custom import Component
|
|
6
|
-
from lfx.io import IntInput, MessageTextInput, Output
|
|
7
|
-
from lfx.log.logger import logger
|
|
8
|
-
from lfx.schema import DataFrame
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class RSSReaderComponent(Component):
|
|
12
|
-
display_name = "RSS Reader"
|
|
13
|
-
description = "Fetches and parses an RSS feed."
|
|
14
|
-
documentation: str = "https://docs.langflow.org/components-data#rss-reader"
|
|
15
|
-
icon = "rss"
|
|
16
|
-
name = "RSSReaderSimple"
|
|
17
|
-
|
|
18
|
-
inputs = [
|
|
19
|
-
MessageTextInput(
|
|
20
|
-
name="rss_url",
|
|
21
|
-
display_name="RSS Feed URL",
|
|
22
|
-
info="URL of the RSS feed to parse.",
|
|
23
|
-
tool_mode=True,
|
|
24
|
-
required=True,
|
|
25
|
-
),
|
|
26
|
-
IntInput(
|
|
27
|
-
name="timeout",
|
|
28
|
-
display_name="Timeout",
|
|
29
|
-
info="Timeout for the RSS feed request.",
|
|
30
|
-
value=5,
|
|
31
|
-
advanced=True,
|
|
32
|
-
),
|
|
33
|
-
]
|
|
34
|
-
|
|
35
|
-
outputs = [Output(name="articles", display_name="Articles", method="read_rss")]
|
|
36
|
-
|
|
37
|
-
def read_rss(self) -> DataFrame:
|
|
38
|
-
try:
|
|
39
|
-
response = requests.get(self.rss_url, timeout=self.timeout)
|
|
40
|
-
response.raise_for_status()
|
|
41
|
-
if not response.content.strip():
|
|
42
|
-
msg = "Empty response received"
|
|
43
|
-
raise ValueError(msg)
|
|
44
|
-
# Check if the response is valid XML
|
|
45
|
-
try:
|
|
46
|
-
BeautifulSoup(response.content, "xml")
|
|
47
|
-
except Exception as e:
|
|
48
|
-
msg = f"Invalid XML response: {e}"
|
|
49
|
-
raise ValueError(msg) from e
|
|
50
|
-
soup = BeautifulSoup(response.content, "xml")
|
|
51
|
-
items = soup.find_all("item")
|
|
52
|
-
except (requests.RequestException, ValueError) as e:
|
|
53
|
-
self.status = f"Failed to fetch RSS: {e}"
|
|
54
|
-
return DataFrame(pd.DataFrame([{"title": "Error", "link": "", "published": "", "summary": str(e)}]))
|
|
55
|
-
|
|
56
|
-
articles = [
|
|
57
|
-
{
|
|
58
|
-
"title": item.title.text if item.title else "",
|
|
59
|
-
"link": item.link.text if item.link else "",
|
|
60
|
-
"published": item.pubDate.text if item.pubDate else "",
|
|
61
|
-
"summary": item.description.text if item.description else "",
|
|
62
|
-
}
|
|
63
|
-
for item in items
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
# Ensure the DataFrame has the correct columns even if empty
|
|
67
|
-
df_articles = pd.DataFrame(articles, columns=["title", "link", "published", "summary"])
|
|
68
|
-
logger.info(f"Fetched {len(df_articles)} articles.")
|
|
69
|
-
return DataFrame(df_articles)
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from collections.abc import AsyncIterator, Iterator
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
|
|
5
|
-
import orjson
|
|
6
|
-
import pandas as pd
|
|
7
|
-
from fastapi import UploadFile
|
|
8
|
-
from fastapi.encoders import jsonable_encoder
|
|
9
|
-
|
|
10
|
-
from lfx.custom import Component
|
|
11
|
-
from lfx.io import DropdownInput, HandleInput, StrInput
|
|
12
|
-
from lfx.schema import Data, DataFrame, Message
|
|
13
|
-
from lfx.services.deps import get_settings_service, get_storage_service
|
|
14
|
-
from lfx.template.field.base import Output
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class SaveToFileComponent(Component):
|
|
18
|
-
display_name = "Save File"
|
|
19
|
-
description = "Save data to a local file in the selected format."
|
|
20
|
-
documentation: str = "https://docs.langflow.org/components-processing#save-file"
|
|
21
|
-
icon = "save"
|
|
22
|
-
name = "SaveToFile"
|
|
23
|
-
|
|
24
|
-
# File format options for different types
|
|
25
|
-
DATA_FORMAT_CHOICES = ["csv", "excel", "json", "markdown"]
|
|
26
|
-
MESSAGE_FORMAT_CHOICES = ["txt", "json", "markdown"]
|
|
27
|
-
|
|
28
|
-
inputs = [
|
|
29
|
-
HandleInput(
|
|
30
|
-
name="input",
|
|
31
|
-
display_name="Input",
|
|
32
|
-
info="The input to save.",
|
|
33
|
-
dynamic=True,
|
|
34
|
-
input_types=["Data", "DataFrame", "Message"],
|
|
35
|
-
required=True,
|
|
36
|
-
),
|
|
37
|
-
StrInput(
|
|
38
|
-
name="file_name",
|
|
39
|
-
display_name="File Name",
|
|
40
|
-
info="Name file will be saved as (without extension).",
|
|
41
|
-
required=True,
|
|
42
|
-
),
|
|
43
|
-
DropdownInput(
|
|
44
|
-
name="file_format",
|
|
45
|
-
display_name="File Format",
|
|
46
|
-
options=list(dict.fromkeys(DATA_FORMAT_CHOICES + MESSAGE_FORMAT_CHOICES)),
|
|
47
|
-
info="Select the file format to save the input. If not provided, the default format will be used.",
|
|
48
|
-
value="",
|
|
49
|
-
advanced=True,
|
|
50
|
-
),
|
|
51
|
-
]
|
|
52
|
-
|
|
53
|
-
outputs = [Output(display_name="File Path", name="message", method="save_to_file")]
|
|
54
|
-
|
|
55
|
-
async def save_to_file(self) -> Message:
|
|
56
|
-
"""Save the input to a file and upload it, returning a confirmation message."""
|
|
57
|
-
# Validate inputs
|
|
58
|
-
if not self.file_name:
|
|
59
|
-
msg = "File name must be provided."
|
|
60
|
-
raise ValueError(msg)
|
|
61
|
-
if not self._get_input_type():
|
|
62
|
-
msg = "Input type is not set."
|
|
63
|
-
raise ValueError(msg)
|
|
64
|
-
|
|
65
|
-
# Validate file format based on input type
|
|
66
|
-
file_format = self.file_format or self._get_default_format()
|
|
67
|
-
allowed_formats = (
|
|
68
|
-
self.MESSAGE_FORMAT_CHOICES if self._get_input_type() == "Message" else self.DATA_FORMAT_CHOICES
|
|
69
|
-
)
|
|
70
|
-
if file_format not in allowed_formats:
|
|
71
|
-
msg = f"Invalid file format '{file_format}' for {self._get_input_type()}. Allowed: {allowed_formats}"
|
|
72
|
-
raise ValueError(msg)
|
|
73
|
-
|
|
74
|
-
# Prepare file path
|
|
75
|
-
file_path = Path(self.file_name).expanduser()
|
|
76
|
-
if not file_path.parent.exists():
|
|
77
|
-
file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
78
|
-
file_path = self._adjust_file_path_with_format(file_path, file_format)
|
|
79
|
-
|
|
80
|
-
# Save the input to file based on type
|
|
81
|
-
if self._get_input_type() == "DataFrame":
|
|
82
|
-
confirmation = self._save_dataframe(self.input, file_path, file_format)
|
|
83
|
-
elif self._get_input_type() == "Data":
|
|
84
|
-
confirmation = self._save_data(self.input, file_path, file_format)
|
|
85
|
-
elif self._get_input_type() == "Message":
|
|
86
|
-
confirmation = await self._save_message(self.input, file_path, file_format)
|
|
87
|
-
else:
|
|
88
|
-
msg = f"Unsupported input type: {self._get_input_type()}"
|
|
89
|
-
raise ValueError(msg)
|
|
90
|
-
|
|
91
|
-
# Upload the saved file
|
|
92
|
-
await self._upload_file(file_path)
|
|
93
|
-
|
|
94
|
-
# Return the final file path and confirmation message
|
|
95
|
-
final_path = Path.cwd() / file_path if not file_path.is_absolute() else file_path
|
|
96
|
-
|
|
97
|
-
return Message(text=f"{confirmation} at {final_path}")
|
|
98
|
-
|
|
99
|
-
def _get_input_type(self) -> str:
|
|
100
|
-
"""Determine the input type based on the provided input."""
|
|
101
|
-
# Use exact type checking (type() is) instead of isinstance() to avoid inheritance issues.
|
|
102
|
-
# Since Message inherits from Data, isinstance(message, Data) would return True for Message objects,
|
|
103
|
-
# causing Message inputs to be incorrectly identified as Data type.
|
|
104
|
-
if type(self.input) is DataFrame:
|
|
105
|
-
return "DataFrame"
|
|
106
|
-
if type(self.input) is Message:
|
|
107
|
-
return "Message"
|
|
108
|
-
if type(self.input) is Data:
|
|
109
|
-
return "Data"
|
|
110
|
-
msg = f"Unsupported input type: {type(self.input)}"
|
|
111
|
-
raise ValueError(msg)
|
|
112
|
-
|
|
113
|
-
def _get_default_format(self) -> str:
|
|
114
|
-
"""Return the default file format based on input type."""
|
|
115
|
-
if self._get_input_type() == "DataFrame":
|
|
116
|
-
return "csv"
|
|
117
|
-
if self._get_input_type() == "Data":
|
|
118
|
-
return "json"
|
|
119
|
-
if self._get_input_type() == "Message":
|
|
120
|
-
return "json"
|
|
121
|
-
return "json" # Fallback
|
|
122
|
-
|
|
123
|
-
def _adjust_file_path_with_format(self, path: Path, fmt: str) -> Path:
|
|
124
|
-
"""Adjust the file path to include the correct extension."""
|
|
125
|
-
file_extension = path.suffix.lower().lstrip(".")
|
|
126
|
-
if fmt == "excel":
|
|
127
|
-
return Path(f"{path}.xlsx").expanduser() if file_extension not in ["xlsx", "xls"] else path
|
|
128
|
-
return Path(f"{path}.{fmt}").expanduser() if file_extension != fmt else path
|
|
129
|
-
|
|
130
|
-
async def _upload_file(self, file_path: Path) -> None:
|
|
131
|
-
"""Upload the saved file using the upload_user_file service."""
|
|
132
|
-
try:
|
|
133
|
-
from langflow.api.v2.files import upload_user_file
|
|
134
|
-
from langflow.services.database.models.user.crud import get_user_by_id
|
|
135
|
-
except ImportError as e:
|
|
136
|
-
msg = (
|
|
137
|
-
"Langflow file upload functionality is not available. "
|
|
138
|
-
"This feature requires the full Langflow installation. "
|
|
139
|
-
)
|
|
140
|
-
raise ImportError(msg) from e
|
|
141
|
-
|
|
142
|
-
if not file_path.exists():
|
|
143
|
-
msg = f"File not found: {file_path}"
|
|
144
|
-
raise FileNotFoundError(msg)
|
|
145
|
-
|
|
146
|
-
with file_path.open("rb") as f:
|
|
147
|
-
try:
|
|
148
|
-
from langflow.services.database.models.user.crud import get_user_by_id
|
|
149
|
-
from langflow.services.deps import session_scope
|
|
150
|
-
except ImportError as e:
|
|
151
|
-
msg = (
|
|
152
|
-
"Langflow MCP server functionality is not available. "
|
|
153
|
-
"This feature requires the full Langflow installation."
|
|
154
|
-
)
|
|
155
|
-
raise ImportError(msg) from e
|
|
156
|
-
async with session_scope() as db:
|
|
157
|
-
if not self.user_id:
|
|
158
|
-
msg = "User ID is required for file saving."
|
|
159
|
-
raise ValueError(msg)
|
|
160
|
-
current_user = await get_user_by_id(db, self.user_id)
|
|
161
|
-
|
|
162
|
-
await upload_user_file(
|
|
163
|
-
file=UploadFile(filename=file_path.name, file=f, size=file_path.stat().st_size),
|
|
164
|
-
session=db,
|
|
165
|
-
current_user=current_user,
|
|
166
|
-
storage_service=get_storage_service(),
|
|
167
|
-
settings_service=get_settings_service(),
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
def _save_dataframe(self, dataframe: DataFrame, path: Path, fmt: str) -> str:
|
|
171
|
-
"""Save a DataFrame to the specified file format."""
|
|
172
|
-
if fmt == "csv":
|
|
173
|
-
dataframe.to_csv(path, index=False)
|
|
174
|
-
elif fmt == "excel":
|
|
175
|
-
dataframe.to_excel(path, index=False, engine="openpyxl")
|
|
176
|
-
elif fmt == "json":
|
|
177
|
-
dataframe.to_json(path, orient="records", indent=2)
|
|
178
|
-
elif fmt == "markdown":
|
|
179
|
-
path.write_text(dataframe.to_markdown(index=False), encoding="utf-8")
|
|
180
|
-
else:
|
|
181
|
-
msg = f"Unsupported DataFrame format: {fmt}"
|
|
182
|
-
raise ValueError(msg)
|
|
183
|
-
return f"DataFrame saved successfully as '{path}'"
|
|
184
|
-
|
|
185
|
-
def _save_data(self, data: Data, path: Path, fmt: str) -> str:
|
|
186
|
-
"""Save a Data object to the specified file format."""
|
|
187
|
-
if fmt == "csv":
|
|
188
|
-
pd.DataFrame(data.data).to_csv(path, index=False)
|
|
189
|
-
elif fmt == "excel":
|
|
190
|
-
pd.DataFrame(data.data).to_excel(path, index=False, engine="openpyxl")
|
|
191
|
-
elif fmt == "json":
|
|
192
|
-
path.write_text(
|
|
193
|
-
orjson.dumps(jsonable_encoder(data.data), option=orjson.OPT_INDENT_2).decode("utf-8"), encoding="utf-8"
|
|
194
|
-
)
|
|
195
|
-
elif fmt == "markdown":
|
|
196
|
-
path.write_text(pd.DataFrame(data.data).to_markdown(index=False), encoding="utf-8")
|
|
197
|
-
else:
|
|
198
|
-
msg = f"Unsupported Data format: {fmt}"
|
|
199
|
-
raise ValueError(msg)
|
|
200
|
-
return f"Data saved successfully as '{path}'"
|
|
201
|
-
|
|
202
|
-
async def _save_message(self, message: Message, path: Path, fmt: str) -> str:
|
|
203
|
-
"""Save a Message to the specified file format, handling async iterators."""
|
|
204
|
-
content = ""
|
|
205
|
-
if message.text is None:
|
|
206
|
-
content = ""
|
|
207
|
-
elif isinstance(message.text, AsyncIterator):
|
|
208
|
-
async for item in message.text:
|
|
209
|
-
content += str(item) + " "
|
|
210
|
-
content = content.strip()
|
|
211
|
-
elif isinstance(message.text, Iterator):
|
|
212
|
-
content = " ".join(str(item) for item in message.text)
|
|
213
|
-
else:
|
|
214
|
-
content = str(message.text)
|
|
215
|
-
|
|
216
|
-
if fmt == "txt":
|
|
217
|
-
path.write_text(content, encoding="utf-8")
|
|
218
|
-
elif fmt == "json":
|
|
219
|
-
path.write_text(json.dumps({"message": content}, indent=2), encoding="utf-8")
|
|
220
|
-
elif fmt == "markdown":
|
|
221
|
-
path.write_text(f"**Message:**\n\n{content}", encoding="utf-8")
|
|
222
|
-
else:
|
|
223
|
-
msg = f"Unsupported Message format: {fmt}"
|
|
224
|
-
raise ValueError(msg)
|
|
225
|
-
return f"Message saved successfully as '{path}'"
|
|
File without changes
|
|
File without changes
|