|
|
|
|
@ -9,7 +9,9 @@ from core.file import File, FileAttribute, file_manager
|
|
|
|
|
from core.variables import Segment, SegmentGroup, Variable
|
|
|
|
|
from core.variables.consts import MIN_SELECTORS_LENGTH
|
|
|
|
|
from core.variables.segments import FileSegment, NoneSegment
|
|
|
|
|
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID, SYSTEM_VARIABLE_NODE_ID
|
|
|
|
|
from core.variables.variables import RAGPipelineVariableInput
|
|
|
|
|
from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, ENVIRONMENT_VARIABLE_NODE_ID, \
|
|
|
|
|
SYSTEM_VARIABLE_NODE_ID, RAG_PIPELINE_VARIABLE_NODE_ID
|
|
|
|
|
from core.workflow.enums import SystemVariableKey
|
|
|
|
|
from factories import variable_factory
|
|
|
|
|
|
|
|
|
|
@ -44,9 +46,9 @@ class VariablePool(BaseModel):
|
|
|
|
|
description="Conversation variables.",
|
|
|
|
|
default_factory=list,
|
|
|
|
|
)
|
|
|
|
|
rag_pipeline_variables: Mapping[str, Any] = Field(
|
|
|
|
|
rag_pipeline_variables: list[RAGPipelineVariableInput] = Field(
|
|
|
|
|
description="RAG pipeline variables.",
|
|
|
|
|
default_factory=dict,
|
|
|
|
|
default_factory=list,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def model_post_init(self, context: Any, /) -> None:
|
|
|
|
|
@ -59,8 +61,8 @@ class VariablePool(BaseModel):
|
|
|
|
|
for var in self.conversation_variables:
|
|
|
|
|
self.add((CONVERSATION_VARIABLE_NODE_ID, var.name), var)
|
|
|
|
|
# Add rag pipeline variables to the variable pool
|
|
|
|
|
for var, value in self.rag_pipeline_variables.items():
|
|
|
|
|
self.add((RAG_PIPELINE_VARIABLE_NODE_ID, var), value)
|
|
|
|
|
for var in self.rag_pipeline_variables:
|
|
|
|
|
self.add((RAG_PIPELINE_VARIABLE_NODE_ID, var.variable.belong_to_node_id, var.variable.variable), var.value)
|
|
|
|
|
|
|
|
|
|
def add(self, selector: Sequence[str], value: Any, /) -> None:
|
|
|
|
|
"""
|
|
|
|
|
|