lfx-nightly 0.1.13.dev1__py3-none-any.whl → 0.1.13.dev3__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.
Potentially problematic release.
This version of lfx-nightly might be problematic. Click here for more details.
- lfx/_assets/component_index.json +1 -1
- lfx/base/agents/agent.py +17 -1
- lfx/base/agents/utils.py +15 -2
- lfx/base/datastax/__init__.py +5 -0
- lfx/{components/vectorstores/astradb.py → base/datastax/astradb_base.py} +81 -471
- lfx/base/mcp/util.py +30 -10
- lfx/components/agents/agent.py +9 -1
- lfx/components/datastax/__init__.py +12 -6
- lfx/components/datastax/{astra_assistant_manager.py → astradb_assistant_manager.py} +1 -0
- lfx/components/datastax/astradb_chatmemory.py +40 -0
- lfx/components/datastax/astradb_cql.py +5 -31
- lfx/components/datastax/astradb_graph.py +9 -123
- lfx/components/datastax/astradb_tool.py +12 -52
- lfx/components/datastax/astradb_vectorstore.py +133 -976
- lfx/components/datastax/create_assistant.py +1 -0
- lfx/components/datastax/create_thread.py +1 -0
- lfx/components/datastax/dotenv.py +1 -0
- lfx/components/datastax/get_assistant.py +1 -0
- lfx/components/datastax/getenvvar.py +1 -0
- lfx/components/datastax/graph_rag.py +1 -1
- lfx/components/datastax/list_assistants.py +1 -0
- lfx/components/datastax/run.py +1 -0
- lfx/components/input_output/chat.py +8 -0
- lfx/components/input_output/chat_output.py +8 -0
- lfx/components/knowledge_bases/ingestion.py +17 -9
- lfx/components/knowledge_bases/retrieval.py +16 -8
- lfx/components/logic/loop.py +4 -0
- lfx/components/vectorstores/__init__.py +0 -6
- lfx/field_typing/constants.py +1 -0
- lfx/graph/edge/base.py +2 -2
- {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/METADATA +1 -1
- {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/RECORD +35 -56
- lfx/components/datastax/astra_db.py +0 -77
- lfx/components/datastax/cassandra.py +0 -92
- lfx/components/vectorstores/astradb_graph.py +0 -326
- lfx/components/vectorstores/cassandra.py +0 -264
- lfx/components/vectorstores/cassandra_graph.py +0 -238
- lfx/components/vectorstores/chroma.py +0 -167
- lfx/components/vectorstores/clickhouse.py +0 -135
- lfx/components/vectorstores/couchbase.py +0 -102
- lfx/components/vectorstores/elasticsearch.py +0 -267
- lfx/components/vectorstores/faiss.py +0 -111
- lfx/components/vectorstores/graph_rag.py +0 -141
- lfx/components/vectorstores/hcd.py +0 -314
- lfx/components/vectorstores/milvus.py +0 -115
- lfx/components/vectorstores/mongodb_atlas.py +0 -213
- lfx/components/vectorstores/opensearch.py +0 -243
- lfx/components/vectorstores/pgvector.py +0 -72
- lfx/components/vectorstores/pinecone.py +0 -134
- lfx/components/vectorstores/qdrant.py +0 -109
- lfx/components/vectorstores/supabase.py +0 -76
- lfx/components/vectorstores/upstash.py +0 -124
- lfx/components/vectorstores/vectara.py +0 -97
- lfx/components/vectorstores/vectara_rag.py +0 -164
- lfx/components/vectorstores/weaviate.py +0 -89
- /lfx/components/datastax/{astra_vectorize.py → astradb_vectorize.py} +0 -0
- {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/WHEEL +0 -0
- {lfx_nightly-0.1.13.dev1.dist-info → lfx_nightly-0.1.13.dev3.dist-info}/entry_points.txt +0 -0
|
@@ -8,6 +8,7 @@ class AssistantsListAssistants(ComponentWithCache):
|
|
|
8
8
|
display_name = "List Assistants"
|
|
9
9
|
description = "Returns a list of assistant id's"
|
|
10
10
|
icon = "AstraDB"
|
|
11
|
+
legacy = True
|
|
11
12
|
outputs = [
|
|
12
13
|
Output(display_name="Assistants", name="assistants", method="process_inputs"),
|
|
13
14
|
]
|
lfx/components/datastax/run.py
CHANGED
|
@@ -60,6 +60,13 @@ class ChatInput(ChatComponent):
|
|
|
60
60
|
info="The session ID of the chat. If empty, the current session ID parameter will be used.",
|
|
61
61
|
advanced=True,
|
|
62
62
|
),
|
|
63
|
+
MessageTextInput(
|
|
64
|
+
name="context_id",
|
|
65
|
+
display_name="Context ID",
|
|
66
|
+
info="The context ID of the chat. Adds an extra layer to the local memory.",
|
|
67
|
+
value="",
|
|
68
|
+
advanced=True,
|
|
69
|
+
),
|
|
63
70
|
FileInput(
|
|
64
71
|
name="files",
|
|
65
72
|
display_name="Files",
|
|
@@ -87,6 +94,7 @@ class ChatInput(ChatComponent):
|
|
|
87
94
|
sender=self.sender,
|
|
88
95
|
sender_name=self.sender_name,
|
|
89
96
|
session_id=self.session_id,
|
|
97
|
+
context_id=self.context_id,
|
|
90
98
|
files=files,
|
|
91
99
|
)
|
|
92
100
|
if self.session_id and isinstance(message, Message) and self.should_store_message:
|
|
@@ -63,6 +63,13 @@ class ChatOutput(ChatComponent):
|
|
|
63
63
|
info="The session ID of the chat. If empty, the current session ID parameter will be used.",
|
|
64
64
|
advanced=True,
|
|
65
65
|
),
|
|
66
|
+
MessageTextInput(
|
|
67
|
+
name="context_id",
|
|
68
|
+
display_name="Context ID",
|
|
69
|
+
info="The context ID of the chat. Adds an extra layer to the local memory.",
|
|
70
|
+
value="",
|
|
71
|
+
advanced=True,
|
|
72
|
+
),
|
|
66
73
|
MessageTextInput(
|
|
67
74
|
name="data_template",
|
|
68
75
|
display_name="Data Template",
|
|
@@ -121,6 +128,7 @@ class ChatOutput(ChatComponent):
|
|
|
121
128
|
message.sender = self.sender
|
|
122
129
|
message.sender_name = self.sender_name
|
|
123
130
|
message.session_id = self.session_id
|
|
131
|
+
message.context_id = self.context_id
|
|
124
132
|
message.flow_id = self.graph.flow_id if hasattr(self, "graph") else None
|
|
125
133
|
message.properties.source = self._build_source(source_id, display_name, source)
|
|
126
134
|
|
|
@@ -48,12 +48,20 @@ HUGGINGFACE_MODEL_NAMES = [
|
|
|
48
48
|
]
|
|
49
49
|
COHERE_MODEL_NAMES = ["embed-english-v3.0", "embed-multilingual-v3.0"]
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
_KNOWLEDGE_BASES_ROOT_PATH: Path | None = None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _get_knowledge_bases_root_path() -> Path:
|
|
55
|
+
"""Lazy load the knowledge bases root path from settings."""
|
|
56
|
+
global _KNOWLEDGE_BASES_ROOT_PATH # noqa: PLW0603
|
|
57
|
+
if _KNOWLEDGE_BASES_ROOT_PATH is None:
|
|
58
|
+
settings = get_settings_service().settings
|
|
59
|
+
knowledge_directory = settings.knowledge_bases_dir
|
|
60
|
+
if not knowledge_directory:
|
|
61
|
+
msg = "Knowledge bases directory is not set in the settings."
|
|
62
|
+
raise ValueError(msg)
|
|
63
|
+
_KNOWLEDGE_BASES_ROOT_PATH = Path(knowledge_directory).expanduser()
|
|
64
|
+
return _KNOWLEDGE_BASES_ROOT_PATH
|
|
57
65
|
|
|
58
66
|
|
|
59
67
|
class KnowledgeIngestionComponent(Component):
|
|
@@ -203,7 +211,7 @@ class KnowledgeIngestionComponent(Component):
|
|
|
203
211
|
# ------ Internal helpers ---------------------------------------------
|
|
204
212
|
def _get_kb_root(self) -> Path:
|
|
205
213
|
"""Return the root directory for knowledge bases."""
|
|
206
|
-
return
|
|
214
|
+
return _get_knowledge_bases_root_path()
|
|
207
215
|
|
|
208
216
|
def _validate_column_config(self, df_source: pd.DataFrame) -> list[dict[str, Any]]:
|
|
209
217
|
"""Validate column configuration using Structured Output patterns."""
|
|
@@ -662,7 +670,7 @@ class KnowledgeIngestionComponent(Component):
|
|
|
662
670
|
raise ValueError(msg) from e
|
|
663
671
|
|
|
664
672
|
# Create the new knowledge base directory
|
|
665
|
-
kb_path =
|
|
673
|
+
kb_path = _get_knowledge_bases_root_path() / kb_user / field_value["01_new_kb_name"]
|
|
666
674
|
kb_path.mkdir(parents=True, exist_ok=True)
|
|
667
675
|
|
|
668
676
|
# Save the embedding metadata
|
|
@@ -675,7 +683,7 @@ class KnowledgeIngestionComponent(Component):
|
|
|
675
683
|
|
|
676
684
|
# Update the knowledge base options dynamically
|
|
677
685
|
build_config["knowledge_base"]["options"] = await get_knowledge_bases(
|
|
678
|
-
|
|
686
|
+
_get_knowledge_bases_root_path(),
|
|
679
687
|
user_id=self.user_id,
|
|
680
688
|
)
|
|
681
689
|
|
|
@@ -16,12 +16,20 @@ from lfx.schema.data import Data
|
|
|
16
16
|
from lfx.schema.dataframe import DataFrame
|
|
17
17
|
from lfx.services.deps import get_settings_service, session_scope
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
_KNOWLEDGE_BASES_ROOT_PATH: Path | None = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _get_knowledge_bases_root_path() -> Path:
|
|
23
|
+
"""Lazy load the knowledge bases root path from settings."""
|
|
24
|
+
global _KNOWLEDGE_BASES_ROOT_PATH # noqa: PLW0603
|
|
25
|
+
if _KNOWLEDGE_BASES_ROOT_PATH is None:
|
|
26
|
+
settings = get_settings_service().settings
|
|
27
|
+
knowledge_directory = settings.knowledge_bases_dir
|
|
28
|
+
if not knowledge_directory:
|
|
29
|
+
msg = "Knowledge bases directory is not set in the settings."
|
|
30
|
+
raise ValueError(msg)
|
|
31
|
+
_KNOWLEDGE_BASES_ROOT_PATH = Path(knowledge_directory).expanduser()
|
|
32
|
+
return _KNOWLEDGE_BASES_ROOT_PATH
|
|
25
33
|
|
|
26
34
|
|
|
27
35
|
class KnowledgeRetrievalComponent(Component):
|
|
@@ -90,7 +98,7 @@ class KnowledgeRetrievalComponent(Component):
|
|
|
90
98
|
if field_name == "knowledge_base":
|
|
91
99
|
# Update the knowledge base options dynamically
|
|
92
100
|
build_config["knowledge_base"]["options"] = await get_knowledge_bases(
|
|
93
|
-
|
|
101
|
+
_get_knowledge_bases_root_path(),
|
|
94
102
|
user_id=self.user_id, # Use the user_id from the component context
|
|
95
103
|
)
|
|
96
104
|
|
|
@@ -186,7 +194,7 @@ class KnowledgeRetrievalComponent(Component):
|
|
|
186
194
|
msg = f"User with ID {self.user_id} not found."
|
|
187
195
|
raise ValueError(msg)
|
|
188
196
|
kb_user = current_user.username
|
|
189
|
-
kb_path =
|
|
197
|
+
kb_path = _get_knowledge_bases_root_path() / kb_user / self.knowledge_base
|
|
190
198
|
|
|
191
199
|
metadata = self._get_kb_metadata(kb_path)
|
|
192
200
|
if not metadata:
|
lfx/components/logic/loop.py
CHANGED
|
@@ -89,6 +89,10 @@ class LoopComponent(Component):
|
|
|
89
89
|
item_dependency_id = self.get_incoming_edge_by_target_param("item")
|
|
90
90
|
if item_dependency_id not in self.graph.run_manager.run_predecessors[self._id]:
|
|
91
91
|
self.graph.run_manager.run_predecessors[self._id].append(item_dependency_id)
|
|
92
|
+
# CRITICAL: Also update run_map so remove_from_predecessors() works correctly
|
|
93
|
+
# run_map[predecessor] = list of vertices that depend on predecessor
|
|
94
|
+
if self._id not in self.graph.run_manager.run_map[item_dependency_id]:
|
|
95
|
+
self.graph.run_manager.run_map[item_dependency_id].append(self._id)
|
|
92
96
|
|
|
93
97
|
def done_output(self) -> DataFrame:
|
|
94
98
|
"""Trigger the done output when iteration is complete."""
|
|
@@ -5,20 +5,14 @@ from typing import TYPE_CHECKING, Any
|
|
|
5
5
|
from lfx.components._importing import import_mod
|
|
6
6
|
|
|
7
7
|
if TYPE_CHECKING:
|
|
8
|
-
from .astradb import AstraDBVectorStoreComponent
|
|
9
8
|
from .local_db import LocalDBComponent
|
|
10
|
-
from .mongodb_atlas import MongoVectorStoreComponent
|
|
11
9
|
|
|
12
10
|
_dynamic_imports = {
|
|
13
11
|
"LocalDBComponent": "local_db",
|
|
14
|
-
"AstraDBVectorStoreComponent": "astradb",
|
|
15
|
-
"MongoVectorStoreComponent": "mongodb_atlas",
|
|
16
12
|
}
|
|
17
13
|
|
|
18
14
|
__all__ = [
|
|
19
|
-
"AstraDBVectorStoreComponent",
|
|
20
15
|
"LocalDBComponent",
|
|
21
|
-
"MongoVectorStoreComponent",
|
|
22
16
|
]
|
|
23
17
|
|
|
24
18
|
|
lfx/field_typing/constants.py
CHANGED
lfx/graph/edge/base.py
CHANGED
|
@@ -63,8 +63,8 @@ class Edge:
|
|
|
63
63
|
# target_param is documents
|
|
64
64
|
if isinstance(self._target_handle, str):
|
|
65
65
|
self.target_param = self._target_handle.split("|")[1]
|
|
66
|
-
self.source_handle = None
|
|
67
|
-
self.target_handle = None
|
|
66
|
+
self.source_handle = None # type: ignore[assignment]
|
|
67
|
+
self.target_handle = None # type: ignore[assignment]
|
|
68
68
|
else:
|
|
69
69
|
msg = "Target handle is not a string"
|
|
70
70
|
raise ValueError(msg)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lfx-nightly
|
|
3
|
-
Version: 0.1.13.
|
|
3
|
+
Version: 0.1.13.dev3
|
|
4
4
|
Summary: Langflow Executor - A lightweight CLI tool for executing and serving Langflow AI flows
|
|
5
5
|
Author-email: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
|
|
6
6
|
Requires-Python: <3.14,>=3.10
|
|
@@ -4,17 +4,17 @@ lfx/constants.py,sha256=Ert_SpwXhutgcTKEvtDArtkONXgyE5x68opMoQfukMA,203
|
|
|
4
4
|
lfx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
lfx/settings.py,sha256=wnx4zkOLQ8mvampYsnnvVV9GvEnRUuWQpKFSbFTCIp4,181
|
|
6
6
|
lfx/type_extraction.py,sha256=eCZNl9nAQivKdaPv_9BK71N0JV9Rtr--veAht0dnQ4A,2921
|
|
7
|
-
lfx/_assets/component_index.json,sha256=
|
|
7
|
+
lfx/_assets/component_index.json,sha256=O2JrHZv0-VCF9c_h9B2oENDX89EGU0Hp4PqI1MDabRE,3513619
|
|
8
8
|
lfx/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
lfx/base/constants.py,sha256=v9vo0Ifg8RxDu__XqgGzIXHlsnUFyWM-SSux0uHHoz8,1187
|
|
10
10
|
lfx/base/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
lfx/base/agents/agent.py,sha256
|
|
11
|
+
lfx/base/agents/agent.py,sha256=daiAVaVCSsg3VC3HMVUUrOaLTi6BkZNv5xRB6OIG_4k,12695
|
|
12
12
|
lfx/base/agents/callback.py,sha256=mjlT9ukBMVrfjYrHsJowqpY4g9hVGBVBIYhncLWr3tQ,3692
|
|
13
13
|
lfx/base/agents/context.py,sha256=u0wboX1aRR22Ia8gY14WF12RjhE0Rxv9hPBiixT9DtQ,3916
|
|
14
14
|
lfx/base/agents/default_prompts.py,sha256=tUjfczwt4D5R1KozNOl1uSL2V2rSCZeUMS-cfV4Gwn0,955
|
|
15
15
|
lfx/base/agents/errors.py,sha256=4QY1AqSWZaOjq-iQRYH_aeCfH_hWECLQkiwybNXz66U,531
|
|
16
16
|
lfx/base/agents/events.py,sha256=jOhfGf_za5IYMvxRMvi1qqU0gw9b1imvDCOQP3r3wlo,14598
|
|
17
|
-
lfx/base/agents/utils.py,sha256=
|
|
17
|
+
lfx/base/agents/utils.py,sha256=VEAVYC6oOadjKeZ-cUS-1OOCnWW69FhpcGWzjvR4uZ8,7161
|
|
18
18
|
lfx/base/agents/crewai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
lfx/base/agents/crewai/crew.py,sha256=TN1JyLXMpJc2yPH3tokhFmxKKYoJ4lMvmG19DmpKfeY,7953
|
|
20
20
|
lfx/base/agents/crewai/tasks.py,sha256=1pBok1UDdAjLtOf2Y-rDrjRaM93no-XLy5Bf_zvWsRM,151
|
|
@@ -32,6 +32,8 @@ lfx/base/data/__init__.py,sha256=lQsYYMyAg_jA9ZF7oc-LNZsRE2uMGT6g16WzsUByHqs,81
|
|
|
32
32
|
lfx/base/data/base_file.py,sha256=UKpF9BsNHgg-cdB1uVB8F00czvCTLfks320aLg3F_kM,28049
|
|
33
33
|
lfx/base/data/docling_utils.py,sha256=gVDxOZghSJEo5n-UNkVGBQYqkvfNqkNkltBhAnoaJd4,13048
|
|
34
34
|
lfx/base/data/utils.py,sha256=dGqEO4zE5s_V2Cs4j0EEeyLjYLX6Zex-EGzIOznK76o,5960
|
|
35
|
+
lfx/base/datastax/__init__.py,sha256=s72q8NeqlMuNXb5WcYR2DTIuWOiBtfX23Z_Zte2PHGo,90
|
|
36
|
+
lfx/base/datastax/astradb_base.py,sha256=7AnZyMvnqtxXmcfrOoXMY0-ub2BmZ5lQxd2jP01DxNM,36671
|
|
35
37
|
lfx/base/document_transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
38
|
lfx/base/document_transformers/model.py,sha256=etVEmyakiEgflB-fayClPnFRhaEdXfdUu4cqpgtk8ek,1317
|
|
37
39
|
lfx/base/embeddings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -53,7 +55,7 @@ lfx/base/langwatch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
53
55
|
lfx/base/langwatch/utils.py,sha256=N7rH3sRwgmNQzG0pKjj4wr_ans_drwtvkx4BQt-B0WA,457
|
|
54
56
|
lfx/base/mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
57
|
lfx/base/mcp/constants.py,sha256=-1XnJxejlqm9zs1R91qGtOeX-_F1ZpdHVzCIqUCvhgE,62
|
|
56
|
-
lfx/base/mcp/util.py,sha256=
|
|
58
|
+
lfx/base/mcp/util.py,sha256=ytuE7i1vmmOk-OZQLilb3zh8QCM4IvkK6Qwh5e_Zhx0,69655
|
|
57
59
|
lfx/base/memory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
58
60
|
lfx/base/memory/memory.py,sha256=kZ-aZoHvRW4PJAgY1LUt5UBj7YXbos_aVBPGjC1EFCY,1835
|
|
59
61
|
lfx/base/memory/model.py,sha256=2oDORZV_l-DHLx9j9--wYprQUIYKOb8aTJpXmR1qOLw,1330
|
|
@@ -113,7 +115,7 @@ lfx/components/Notion/update_page_property.py,sha256=tgmPMbD1eX58dQQNXv1w5FzDec7
|
|
|
113
115
|
lfx/components/agentql/__init__.py,sha256=Erl669Dzsk-SegsDPWTtkKbprMXVuv8UTCo5REzZGTc,56
|
|
114
116
|
lfx/components/agentql/agentql_api.py,sha256=N94yEK7ZuQCIsFBlr_8dqrJY-K1-KNb6QEEYfDIsDME,5569
|
|
115
117
|
lfx/components/agents/__init__.py,sha256=UBu5kO9hp8yFyxTU-u9KHN9zTSoHhJSYdKtRuT5ig9c,1164
|
|
116
|
-
lfx/components/agents/agent.py,sha256=
|
|
118
|
+
lfx/components/agents/agent.py,sha256=vbi422N1dpML7fpYn3FqcwQ5nYS7BQBnmSN--WnheOg,26988
|
|
117
119
|
lfx/components/agents/cuga_agent.py,sha256=r_342LveLdERtvE84UJJOdKTEwWSIjvASRYke9JV2Ik,44494
|
|
118
120
|
lfx/components/agents/mcp_component.py,sha256=mE2HvbHcdkuWWylxmaNNZobbtgBRktOOakeGwUYs7Qs,25586
|
|
119
121
|
lfx/components/aiml/__init__.py,sha256=DNKB-HMFGFYmsdkON-s8557ttgBXVXADmS-BcuSQiIQ,1087
|
|
@@ -239,24 +241,23 @@ lfx/components/data/sql_executor.py,sha256=sN1lWM65O_pCfZxNAzgjtZmcTPGBLqMud2_7n
|
|
|
239
241
|
lfx/components/data/url.py,sha256=zbfTeTBukw3F_mRBMIJrQYF94psEIBuS8dFjcQku5SE,11001
|
|
240
242
|
lfx/components/data/web_search.py,sha256=48SCp-2I_Qckp5tmTVC9JBw2C-MhBDF14MJLaGjLpyQ,12758
|
|
241
243
|
lfx/components/data/webhook.py,sha256=i2jdXSLUVA0UpnYBZzdPo035MeiUcFKVJy37EhLKq6o,1643
|
|
242
|
-
lfx/components/datastax/__init__.py,sha256=
|
|
243
|
-
lfx/components/datastax/
|
|
244
|
-
lfx/components/datastax/
|
|
245
|
-
lfx/components/datastax/
|
|
246
|
-
lfx/components/datastax/
|
|
247
|
-
lfx/components/datastax/
|
|
248
|
-
lfx/components/datastax/
|
|
249
|
-
lfx/components/datastax/astradb_vectorstore.py,sha256
|
|
250
|
-
lfx/components/datastax/
|
|
251
|
-
lfx/components/datastax/
|
|
252
|
-
lfx/components/datastax/
|
|
253
|
-
lfx/components/datastax/
|
|
254
|
-
lfx/components/datastax/
|
|
255
|
-
lfx/components/datastax/
|
|
256
|
-
lfx/components/datastax/graph_rag.py,sha256=4NmYQkjSru_zaDhJfxdaYtap-RMGJfv2AYN2NEYSdds,5163
|
|
244
|
+
lfx/components/datastax/__init__.py,sha256=4zuJU2d0ucI2sCrfXQ06lpURgli_8DkIyd1szjkx2Ts,2712
|
|
245
|
+
lfx/components/datastax/astradb_assistant_manager.py,sha256=jUrBzuN6ws_KuWG4NplR0Mbcw-7FlDCnXFeWpckvNdc,11575
|
|
246
|
+
lfx/components/datastax/astradb_chatmemory.py,sha256=uvyB94x2O_6LH7CBeNp6watpYU31_wTPPPcSeXyF3t8,1475
|
|
247
|
+
lfx/components/datastax/astradb_cql.py,sha256=MQthGbCvoNl2ccqtiXN97T9D9yVlsqteGKNkc7LpFA4,10930
|
|
248
|
+
lfx/components/datastax/astradb_graph.py,sha256=-LQlwfU1NI2Pnzm4HWNmf0UonuCogzwpI3qNX32axvc,8415
|
|
249
|
+
lfx/components/datastax/astradb_tool.py,sha256=wMbRqH2Ovj8qTr4py2Vj4i1nmehX4FWLjkynYYoiF8g,15048
|
|
250
|
+
lfx/components/datastax/astradb_vectorize.py,sha256=PZdmkMJiPAnTankXjFjdG192OeHVetxBfGzbwxgPQ54,4912
|
|
251
|
+
lfx/components/datastax/astradb_vectorstore.py,sha256=-xkJKMDCrlZ3j0TCuBonu2yYNDznMUQQtmKZn8q6Gpg,18870
|
|
252
|
+
lfx/components/datastax/create_assistant.py,sha256=jZhp2aid7fxH7yrDFOECmqVZ-56g4KAY_NUTIJvNN1o,2124
|
|
253
|
+
lfx/components/datastax/create_thread.py,sha256=XUCnOsz98fVRuTgoGgD5aw6KChIeomM1ikeXfc-zGaM,1103
|
|
254
|
+
lfx/components/datastax/dotenv.py,sha256=ND6pqsobuZXUg6dYJiHkrZmwWEl5bJl0gApsTVWg5J8,1116
|
|
255
|
+
lfx/components/datastax/get_assistant.py,sha256=H2DaFh_T3s-3P96Qg0-anBXZcpz26tRy-KO8fE6CC5A,1273
|
|
256
|
+
lfx/components/datastax/getenvvar.py,sha256=CD8KlPOAWZ2wqLY6M33mmlI3THvl3Q2PIvoq_gkhtTk,965
|
|
257
|
+
lfx/components/datastax/graph_rag.py,sha256=TYNwml9ftIGiybIemxVRPiuKBAJussW6Bi7bCUgvVlo,5162
|
|
257
258
|
lfx/components/datastax/hcd.py,sha256=fnRp4DvFTHqDlKZD-a0xZBGoPrVvxaZ_vXJXzHzt-ts,12478
|
|
258
|
-
lfx/components/datastax/list_assistants.py,sha256=
|
|
259
|
-
lfx/components/datastax/run.py,sha256=
|
|
259
|
+
lfx/components/datastax/list_assistants.py,sha256=F-nFx4pu6hPK3Ka5H3Lff3ZA_9jkVWl94v_bFZhD6QA,946
|
|
260
|
+
lfx/components/datastax/run.py,sha256=XiGc0pDTaHPMOf8cioYfSPDVRh0d3ee3qV5iogjpiCI,3081
|
|
260
261
|
lfx/components/deactivated/__init__.py,sha256=A94MZ_EW-Ckp2sgDMiXNrptAaUzMbgbkl6yVpBjJXm8,485
|
|
261
262
|
lfx/components/deactivated/amazon_kendra.py,sha256=y2klL_LZCKphRQoZbimTB3P1ohUWtBuFZaTCMBnI6tg,2152
|
|
262
263
|
lfx/components/deactivated/chat_litellm_model.py,sha256=8YGuEPxhRJKQ8py0y-dBSZaU6_ad5DAMhmuM5xU8p9Y,4982
|
|
@@ -340,8 +341,8 @@ lfx/components/ibm/watsonx_embeddings.py,sha256=_97UE-qQDCjkWfX3NFWNCti4TUXxO1LO
|
|
|
340
341
|
lfx/components/icosacomputing/__init__.py,sha256=NByWM-IMPf7N1lOeZDet8CvIa8A25kG3yKircYwS52w,120
|
|
341
342
|
lfx/components/icosacomputing/combinatorial_reasoner.py,sha256=SFVwR_8jGHVDaGO81jj2vzzeKh892h1nMGxCDljbvNY,2766
|
|
342
343
|
lfx/components/input_output/__init__.py,sha256=BaDAE9j41eSg04p5S6MJyUs4daU8UNp5e4m988K4VLQ,1291
|
|
343
|
-
lfx/components/input_output/chat.py,sha256=
|
|
344
|
-
lfx/components/input_output/chat_output.py,sha256=
|
|
344
|
+
lfx/components/input_output/chat.py,sha256=ABSltBgX0KcpqEjAsJY25Vn4_0GVGTRNAktSsp7xi3Y,3428
|
|
345
|
+
lfx/components/input_output/chat_output.py,sha256=SEitPjXVTitj50hmQrq9LRu68GWSt2NtNa5Www02aFM,6931
|
|
345
346
|
lfx/components/input_output/text.py,sha256=PdKOpZG5zVIoh45uzxRbY_pcycmrLaicoFhf9dauhZ0,743
|
|
346
347
|
lfx/components/input_output/text_output.py,sha256=Ij_Xk2hubdSwZoNDoltJU78YdCw91rE9kkGbY6qLViY,820
|
|
347
348
|
lfx/components/jigsawstack/__init__.py,sha256=vqTmy5sxj_CAdkkdStaquvLrze7FMwGFTjcapd0r5eU,935
|
|
@@ -357,8 +358,8 @@ lfx/components/jigsawstack/text_to_sql.py,sha256=MKoMwV-4QjDLfEs0o_HwZDJYbkhGY_1
|
|
|
357
358
|
lfx/components/jigsawstack/text_translate.py,sha256=RiM-GZYf3oRBKaq7FkzssL2sDU9y7jf3QkMDkER-h8Y,2826
|
|
358
359
|
lfx/components/jigsawstack/vocr.py,sha256=pESRlHunJ8u1QlmG3672Zomf6AeyeF1NZ5vtmDx06AQ,4158
|
|
359
360
|
lfx/components/knowledge_bases/__init__.py,sha256=lcxAelAmtjSo1zEKjtCayPFasuOAIzpKjX_wgW-fTJg,1143
|
|
360
|
-
lfx/components/knowledge_bases/ingestion.py,sha256=
|
|
361
|
-
lfx/components/knowledge_bases/retrieval.py,sha256=
|
|
361
|
+
lfx/components/knowledge_bases/ingestion.py,sha256=x1PpImGucmAPUDnusWCJW1uPuhvdfQ0NWq06uyO5tSQ,28385
|
|
362
|
+
lfx/components/knowledge_bases/retrieval.py,sha256=GJis1t9LZ7tw3zsSebV3RW2GA2UCUE6Bs9AQx9UZRlg,10665
|
|
362
363
|
lfx/components/langchain_utilities/__init__.py,sha256=f39oVjaQixPLfshFl6EeI6rDZgq6U3cVQEi9C-u6Ybw,4386
|
|
363
364
|
lfx/components/langchain_utilities/character.py,sha256=2jCYk9ZOiHeOLCST4GW4ojTgDa-uAFIjSJ3hdx2sTjA,1747
|
|
364
365
|
lfx/components/langchain_utilities/conversation.py,sha256=sOQETT8IHogc_xZu4PIEKCuCknV0FtAxOfMmc5g2XK4,1864
|
|
@@ -398,7 +399,7 @@ lfx/components/logic/data_conditional_router.py,sha256=b6G_QWajQqoFCQM-614QbrPoU
|
|
|
398
399
|
lfx/components/logic/flow_tool.py,sha256=k0jXnRn0TIarE7cw61w80R-a_XmloRTIHioYGeZrBeU,3984
|
|
399
400
|
lfx/components/logic/listen.py,sha256=k_wRN3yW5xtG1CjTdGYhL5LxdgCZ0Bi9cbWP54FkyuY,935
|
|
400
401
|
lfx/components/logic/llm_conditional_router.py,sha256=wHCAryCKBvQG5SEwm4KmTufliGBlLFS0Dby2ndF-77w,18714
|
|
401
|
-
lfx/components/logic/loop.py,sha256=
|
|
402
|
+
lfx/components/logic/loop.py,sha256=OUKEGB4YrwGSaZfrHqHcKEE95YxdSGvQ8YIU5JHzvCE,5020
|
|
402
403
|
lfx/components/logic/notify.py,sha256=A9aLooUwudRUsf2BRdE7CmGibCCRuQeCadneart9BEg,3086
|
|
403
404
|
lfx/components/logic/pass_message.py,sha256=BNPh7TOQ-svrhR2-uMQMMT0LBW0sT_zzIpbuWeEEPDY,1085
|
|
404
405
|
lfx/components/logic/run_flow.py,sha256=DA08G-LYKmRr4srpLpfqma8iVUBdPEWYlOFgUrv6TDU,2914
|
|
@@ -528,30 +529,8 @@ lfx/components/upstash/upstash.py,sha256=tbLXjoxE3wFMawy_coPFQgmEVQvcTLolLuu3a0F
|
|
|
528
529
|
lfx/components/vectara/__init__.py,sha256=sGf28Z5XdvL0fIxZzjoX6542fTb2Tiw0UesFz7Ii_lg,1065
|
|
529
530
|
lfx/components/vectara/vectara.py,sha256=ojCeBGwGBGbpuSProTqz4MS74J-2THcZZ9uIpBTuRhE,3557
|
|
530
531
|
lfx/components/vectara/vectara_rag.py,sha256=Ejye75GR37Wy9OdfCw7aJfjyPbbzaBxtTGoYZftzHDo,5674
|
|
531
|
-
lfx/components/vectorstores/__init__.py,sha256=
|
|
532
|
-
lfx/components/vectorstores/astradb.py,sha256=DibYwThNg1OBdk_fNh8Cv4NF8JoNf5K1fR4wREYsYus,53429
|
|
533
|
-
lfx/components/vectorstores/astradb_graph.py,sha256=9HUnnjQqmQClYhgxtYR6bVuvhDimSXSVsS6bx-sMAKw,12663
|
|
534
|
-
lfx/components/vectorstores/cassandra.py,sha256=gz8nfaq3ta6h_zVkHVn8uRKtcs9vDRuE7d1p5vI7LhE,9540
|
|
535
|
-
lfx/components/vectorstores/cassandra_graph.py,sha256=JsY_gHRexI2p3U6uiQuygC7upu_HljquasDMId6PG6Y,8305
|
|
536
|
-
lfx/components/vectorstores/chroma.py,sha256=DxvHJqhqx6CYdPoAG5Ly6jJsEOMR2R4lXv4UlvGQmQc,6171
|
|
537
|
-
lfx/components/vectorstores/clickhouse.py,sha256=kQnoE9ycFPWDE0rNLxaTyjxq5b3aCeaf-f5H_Lx7iBs,5035
|
|
538
|
-
lfx/components/vectorstores/couchbase.py,sha256=cO1HWm9IisWWVcxKjr7TuoOfqnY2Ndnq_QPP3L2yAoc,3965
|
|
539
|
-
lfx/components/vectorstores/elasticsearch.py,sha256=WcBi8THcOzopZeYOQeEoHxsZkACHk4R3MKhSEYGxnfY,9773
|
|
540
|
-
lfx/components/vectorstores/faiss.py,sha256=K9egZNckeHOrPqxuFia4VL4-mFphyEl6dQ_F-lXvax8,3893
|
|
541
|
-
lfx/components/vectorstores/graph_rag.py,sha256=4NmYQkjSru_zaDhJfxdaYtap-RMGJfv2AYN2NEYSdds,5163
|
|
542
|
-
lfx/components/vectorstores/hcd.py,sha256=Fo7Zj4U-A1ZcbsdhlTxheMJDy8EzbYWlo85iY6vASnQ,12379
|
|
532
|
+
lfx/components/vectorstores/__init__.py,sha256=GXlk9X_CfFFlRbwmUrCoT2Ey8vObZ_C1hS_04zZIx9Y,920
|
|
543
533
|
lfx/components/vectorstores/local_db.py,sha256=bruzpEk6PQc1DeGqSWJblsVplJ5eC1JsSlncxRc4yuQ,10648
|
|
544
|
-
lfx/components/vectorstores/milvus.py,sha256=_jMyO4l5y6O2Lkx9eHyuhgcHtXcApkI-ktuqa1YxnGI,4395
|
|
545
|
-
lfx/components/vectorstores/mongodb_atlas.py,sha256=OlAstNMToHuvGI-8djkiGr7kdGBr927O0SE5cnVd0O0,8594
|
|
546
|
-
lfx/components/vectorstores/opensearch.py,sha256=P8Eq4KsjHT8b7iOUOKMFRwOLwgRfIWfxIHLD0GJsw24,9080
|
|
547
|
-
lfx/components/vectorstores/pgvector.py,sha256=UBF2B79eVfjj3hHoxrHzmT2UXOsUZxp4dWvyuPS2wh4,2635
|
|
548
|
-
lfx/components/vectorstores/pinecone.py,sha256=VkygoOmrco417hYInjYIFwuxX1M7peYJl9-jhuiySR8,5137
|
|
549
|
-
lfx/components/vectorstores/qdrant.py,sha256=1U2pdqXbo_HBgb8f8UUEkajfn9lq-SCUF_oiBuOE-40,4233
|
|
550
|
-
lfx/components/vectorstores/supabase.py,sha256=UEW4HDQL_6GkPBsszowhrq8thouir--n2HE4DcAsD6k,2820
|
|
551
|
-
lfx/components/vectorstores/upstash.py,sha256=bab5s-ALR4bT_pZhjFUlVHifrUachVFVQyxE6Hh5lgA,4083
|
|
552
|
-
lfx/components/vectorstores/vectara.py,sha256=ojCeBGwGBGbpuSProTqz4MS74J-2THcZZ9uIpBTuRhE,3557
|
|
553
|
-
lfx/components/vectorstores/vectara_rag.py,sha256=Ejye75GR37Wy9OdfCw7aJfjyPbbzaBxtTGoYZftzHDo,5674
|
|
554
|
-
lfx/components/vectorstores/weaviate.py,sha256=ZrqR1qRA3IZsJB-TB07C7Qyqt5ysh-eEiHp7BcBtOsE,3280
|
|
555
534
|
lfx/components/vertexai/__init__.py,sha256=bIcDPTzHyUujS75CWtFxYCvdY7eygvH3UDmWVAcX8I0,1090
|
|
556
535
|
lfx/components/vertexai/vertexai.py,sha256=2fdSgdP6lfVYZElxWvuwi5wylpwFEtlSUlT1zaCGtgE,2992
|
|
557
536
|
lfx/components/vertexai/vertexai_embeddings.py,sha256=Or1cFSZKKUp063yZVny7oqKiWgEqonhhCHPbRjY4CMA,3135
|
|
@@ -601,13 +580,13 @@ lfx/events/event_manager.py,sha256=M2-k9obLHiAdjipPtjDf2tI2g7AUZLLrKMSBj60PNzY,3
|
|
|
601
580
|
lfx/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
602
581
|
lfx/exceptions/component.py,sha256=Tu9OYNXs3dOuOAujr4KMqkqAmFGgW7aqhTNsDPyYf3Q,446
|
|
603
582
|
lfx/field_typing/__init__.py,sha256=cfwSKHa79AIGqvbH4gmcGRA0purLyLy_XG_YihfWdBU,1730
|
|
604
|
-
lfx/field_typing/constants.py,sha256=
|
|
583
|
+
lfx/field_typing/constants.py,sha256=VVkolqwicz8CUppSZ2N0OfhwwBbEOUdNxVerKgleXOQ,5790
|
|
605
584
|
lfx/field_typing/range_spec.py,sha256=q7_CHhOO6YA1tFOgDAaeval-C_wzoAMSZQ8flkzCwnQ,1187
|
|
606
585
|
lfx/graph/__init__.py,sha256=uHjF2QW6i88_q3uspuPnulTyEA_QNV6eygOD8UZgG40,309
|
|
607
586
|
lfx/graph/schema.py,sha256=58vzeUEseURXBjLFeEFFWcXmFSzeQczYdzIhQ_79Nlg,2668
|
|
608
587
|
lfx/graph/utils.py,sha256=E0COGP-CzVNmIq-5hsqanTQw9T2bUtA_kEM53h3ZLYc,5920
|
|
609
588
|
lfx/graph/edge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
610
|
-
lfx/graph/edge/base.py,sha256=
|
|
589
|
+
lfx/graph/edge/base.py,sha256=_5kYebmaNE-ZBVDa01WbsKHUMmlo2G2a9CoB1gEthPc,12867
|
|
611
590
|
lfx/graph/edge/schema.py,sha256=bKlprxymeV04bTMw3jDLpYQAA3eRc4BIdD_-4XGGU3c,3806
|
|
612
591
|
lfx/graph/edge/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
613
592
|
lfx/graph/graph/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -749,7 +728,7 @@ lfx/utils/schemas.py,sha256=NbOtVQBrn4d0BAu-0H_eCTZI2CXkKZlRY37XCSmuJwc,3865
|
|
|
749
728
|
lfx/utils/util.py,sha256=Ww85wbr1-vjh2pXVtmTqoUVr6MXAW8S7eDx_Ys6HpE8,20696
|
|
750
729
|
lfx/utils/util_strings.py,sha256=nU_IcdphNaj6bAPbjeL-c1cInQPfTBit8mp5Y57lwQk,1686
|
|
751
730
|
lfx/utils/version.py,sha256=cHpbO0OJD2JQAvVaTH_6ibYeFbHJV0QDHs_YXXZ-bT8,671
|
|
752
|
-
lfx_nightly-0.1.13.
|
|
753
|
-
lfx_nightly-0.1.13.
|
|
754
|
-
lfx_nightly-0.1.13.
|
|
755
|
-
lfx_nightly-0.1.13.
|
|
731
|
+
lfx_nightly-0.1.13.dev3.dist-info/METADATA,sha256=3KKMr_v8ERnwxOgybcVPRHz9CMi_5UpKwxrv-21PLmA,8289
|
|
732
|
+
lfx_nightly-0.1.13.dev3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
733
|
+
lfx_nightly-0.1.13.dev3.dist-info/entry_points.txt,sha256=1724p3RHDQRT2CKx_QRzEIa7sFuSVO0Ux70YfXfoMT4,42
|
|
734
|
+
lfx_nightly-0.1.13.dev3.dist-info/RECORD,,
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
|
|
3
|
-
from lfx.base.memory.model import LCChatMemoryComponent
|
|
4
|
-
from lfx.field_typing.constants import Memory
|
|
5
|
-
from lfx.inputs.inputs import MessageTextInput, SecretStrInput, StrInput
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class AstraDBChatMemory(LCChatMemoryComponent):
|
|
9
|
-
display_name = "Astra DB Chat Memory"
|
|
10
|
-
description = "Retrieves and store chat messages from Astra DB."
|
|
11
|
-
name = "AstraDBChatMemory"
|
|
12
|
-
documentation: str = "https://docs.langflow.org/bundles-datastax#astra-db-chat-memory"
|
|
13
|
-
icon: str = "AstraDB"
|
|
14
|
-
|
|
15
|
-
inputs = [
|
|
16
|
-
SecretStrInput(
|
|
17
|
-
name="token",
|
|
18
|
-
display_name="Astra DB Application Token",
|
|
19
|
-
info="Authentication token for accessing Astra DB.",
|
|
20
|
-
value="ASTRA_DB_APPLICATION_TOKEN",
|
|
21
|
-
required=True,
|
|
22
|
-
advanced=os.getenv("ASTRA_ENHANCED", "false").lower() == "true",
|
|
23
|
-
),
|
|
24
|
-
SecretStrInput(
|
|
25
|
-
name="api_endpoint",
|
|
26
|
-
display_name="Astra DB API Endpoint",
|
|
27
|
-
info="API endpoint URL for the Astra DB service.",
|
|
28
|
-
value="ASTRA_DB_API_ENDPOINT",
|
|
29
|
-
required=True,
|
|
30
|
-
),
|
|
31
|
-
StrInput(
|
|
32
|
-
name="collection_name",
|
|
33
|
-
display_name="Collection Name",
|
|
34
|
-
info="The name of the collection within Astra DB where the vectors will be stored.",
|
|
35
|
-
required=True,
|
|
36
|
-
),
|
|
37
|
-
StrInput(
|
|
38
|
-
name="namespace",
|
|
39
|
-
display_name="Namespace",
|
|
40
|
-
info="Optional namespace within Astra DB to use for the collection.",
|
|
41
|
-
advanced=True,
|
|
42
|
-
),
|
|
43
|
-
MessageTextInput(
|
|
44
|
-
name="session_id",
|
|
45
|
-
display_name="Session ID",
|
|
46
|
-
info="The session ID of the chat. If empty, the current session ID parameter will be used.",
|
|
47
|
-
advanced=True,
|
|
48
|
-
),
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
def build_message_history(self) -> Memory:
|
|
52
|
-
try:
|
|
53
|
-
from astrapy.admin import parse_api_endpoint
|
|
54
|
-
from langchain_astradb.chat_message_histories import AstraDBChatMessageHistory
|
|
55
|
-
|
|
56
|
-
except ImportError as e:
|
|
57
|
-
msg = (
|
|
58
|
-
"Could not import langchain Astra DB integration package. "
|
|
59
|
-
"Please install it with `pip install langchain-astradb`."
|
|
60
|
-
)
|
|
61
|
-
raise ImportError(msg) from e
|
|
62
|
-
|
|
63
|
-
try:
|
|
64
|
-
from astrapy.admin import parse_api_endpoint
|
|
65
|
-
|
|
66
|
-
except ImportError as e:
|
|
67
|
-
msg = "Could not import astrapy package. "
|
|
68
|
-
raise ImportError(msg) from e
|
|
69
|
-
|
|
70
|
-
return AstraDBChatMessageHistory(
|
|
71
|
-
session_id=self.session_id,
|
|
72
|
-
collection_name=self.collection_name,
|
|
73
|
-
token=self.token,
|
|
74
|
-
api_endpoint=self.api_endpoint,
|
|
75
|
-
namespace=self.namespace or None,
|
|
76
|
-
environment=parse_api_endpoint(self.api_endpoint).environment,
|
|
77
|
-
)
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
from lfx.base.memory.model import LCChatMemoryComponent
|
|
2
|
-
from lfx.field_typing.constants import Memory
|
|
3
|
-
from lfx.inputs.inputs import DictInput, MessageTextInput, SecretStrInput
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CassandraChatMemory(LCChatMemoryComponent):
|
|
7
|
-
display_name = "Cassandra Chat Memory"
|
|
8
|
-
description = "Retrieves and store chat messages from Apache Cassandra."
|
|
9
|
-
name = "CassandraChatMemory"
|
|
10
|
-
icon = "Cassandra"
|
|
11
|
-
|
|
12
|
-
inputs = [
|
|
13
|
-
MessageTextInput(
|
|
14
|
-
name="database_ref",
|
|
15
|
-
display_name="Contact Points / Astra Database ID",
|
|
16
|
-
info="Contact points for the database (or Astra DB database ID)",
|
|
17
|
-
required=True,
|
|
18
|
-
),
|
|
19
|
-
MessageTextInput(
|
|
20
|
-
name="username", display_name="Username", info="Username for the database (leave empty for Astra DB)."
|
|
21
|
-
),
|
|
22
|
-
SecretStrInput(
|
|
23
|
-
name="token",
|
|
24
|
-
display_name="Password / Astra DB Token",
|
|
25
|
-
info="User password for the database (or Astra DB token).",
|
|
26
|
-
required=True,
|
|
27
|
-
),
|
|
28
|
-
MessageTextInput(
|
|
29
|
-
name="keyspace",
|
|
30
|
-
display_name="Keyspace",
|
|
31
|
-
info="Table Keyspace (or Astra DB namespace).",
|
|
32
|
-
required=True,
|
|
33
|
-
),
|
|
34
|
-
MessageTextInput(
|
|
35
|
-
name="table_name",
|
|
36
|
-
display_name="Table Name",
|
|
37
|
-
info="The name of the table (or Astra DB collection) where vectors will be stored.",
|
|
38
|
-
required=True,
|
|
39
|
-
),
|
|
40
|
-
MessageTextInput(
|
|
41
|
-
name="session_id", display_name="Session ID", info="Session ID for the message.", advanced=True
|
|
42
|
-
),
|
|
43
|
-
DictInput(
|
|
44
|
-
name="cluster_kwargs",
|
|
45
|
-
display_name="Cluster arguments",
|
|
46
|
-
info="Optional dictionary of additional keyword arguments for the Cassandra cluster.",
|
|
47
|
-
advanced=True,
|
|
48
|
-
is_list=True,
|
|
49
|
-
),
|
|
50
|
-
]
|
|
51
|
-
|
|
52
|
-
def build_message_history(self) -> Memory:
|
|
53
|
-
from langchain_community.chat_message_histories import CassandraChatMessageHistory
|
|
54
|
-
|
|
55
|
-
try:
|
|
56
|
-
import cassio
|
|
57
|
-
except ImportError as e:
|
|
58
|
-
msg = "Could not import cassio integration package. Please install it with `pip install cassio`."
|
|
59
|
-
raise ImportError(msg) from e
|
|
60
|
-
|
|
61
|
-
from uuid import UUID
|
|
62
|
-
|
|
63
|
-
database_ref = self.database_ref
|
|
64
|
-
|
|
65
|
-
try:
|
|
66
|
-
UUID(self.database_ref)
|
|
67
|
-
is_astra = True
|
|
68
|
-
except ValueError:
|
|
69
|
-
is_astra = False
|
|
70
|
-
if "," in self.database_ref:
|
|
71
|
-
# use a copy because we can't change the type of the parameter
|
|
72
|
-
database_ref = self.database_ref.split(",")
|
|
73
|
-
|
|
74
|
-
if is_astra:
|
|
75
|
-
cassio.init(
|
|
76
|
-
database_id=database_ref,
|
|
77
|
-
token=self.token,
|
|
78
|
-
cluster_kwargs=self.cluster_kwargs,
|
|
79
|
-
)
|
|
80
|
-
else:
|
|
81
|
-
cassio.init(
|
|
82
|
-
contact_points=database_ref,
|
|
83
|
-
username=self.username,
|
|
84
|
-
password=self.token,
|
|
85
|
-
cluster_kwargs=self.cluster_kwargs,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
return CassandraChatMessageHistory(
|
|
89
|
-
session_id=self.session_id,
|
|
90
|
-
table_name=self.table_name,
|
|
91
|
-
keyspace=self.keyspace,
|
|
92
|
-
)
|