diff --git a/packages/dbgpt-app/src/dbgpt_app/operators/rag.py b/packages/dbgpt-app/src/dbgpt_app/operators/rag.py index 1f0a47055..18144bc09 100644 --- a/packages/dbgpt-app/src/dbgpt_app/operators/rag.py +++ b/packages/dbgpt-app/src/dbgpt_app/operators/rag.py @@ -194,6 +194,7 @@ class HOKnowledgeOperator(MapOperator[str, HOContextBody]): space_id=space.id, top_k=self._top_k, rerank=reranker, + system_app=self.system_app, ) async def map(self, query: str) -> HOContextBody: diff --git a/packages/dbgpt-core/src/dbgpt/core/awel/flow/base.py b/packages/dbgpt-core/src/dbgpt/core/awel/flow/base.py index b69475726..c7c5dcb6e 100644 --- a/packages/dbgpt-core/src/dbgpt/core/awel/flow/base.py +++ b/packages/dbgpt-core/src/dbgpt/core/awel/flow/base.py @@ -90,6 +90,7 @@ def _get_type_cls(type_name: str) -> Type[Any]: if type_name in _TYPE_REGISTRY: return _TYPE_REGISTRY[type_name] + # Not registered, try to get the new class name from the compat config. new_cls = get_new_class_name(type_name) if new_cls and new_cls in _TYPE_REGISTRY: return _TYPE_REGISTRY[new_cls] @@ -1521,4 +1522,6 @@ def _register_resource( alias_ids: Optional[List[str]] = None, ): """Register the operator.""" + # Register the type + _ = _get_type_name(cls) _OPERATOR_REGISTRY.register_flow(cls, resource_metadata, alias_ids) diff --git a/packages/dbgpt-core/src/dbgpt/core/awel/flow/compat.py b/packages/dbgpt-core/src/dbgpt/core/awel/flow/compat.py index 028023500..1c0f29fad 100644 --- a/packages/dbgpt-core/src/dbgpt/core/awel/flow/compat.py +++ b/packages/dbgpt-core/src/dbgpt/core/awel/flow/compat.py @@ -90,6 +90,9 @@ def _register( def _register_flow_compat( curr_version: str, last_support_version: str, metadata: FlowCompatMetadata ): + # We use type_name as the key + # For example, dbgpt.core.DefaultLLMOperator may be refactor to + # dbgpt_ext.DefaultLLMOperator, so we use DefaultLLMOperator as the key _TYPE_NAME_TO_COMPAT_METADATA[metadata.type_name].append( _FlowCompat(curr_version, last_support_version, metadata) ) diff --git a/packages/dbgpt-core/src/dbgpt/core/awel/flow/flow_factory.py b/packages/dbgpt-core/src/dbgpt/core/awel/flow/flow_factory.py index 827e1e448..6277a57f7 100644 --- a/packages/dbgpt-core/src/dbgpt/core/awel/flow/flow_factory.py +++ b/packages/dbgpt-core/src/dbgpt/core/awel/flow/flow_factory.py @@ -5,7 +5,7 @@ import logging import uuid from contextlib import suppress from enum import Enum -from typing import Any, Dict, List, Literal, Optional, Type, Union, cast +from typing import Any, Callable, Dict, List, Literal, Optional, Type, Union, cast from typing_extensions import Annotated @@ -1013,7 +1013,14 @@ def _build_mapper_operators(dag: DAG, mappers: List[str]) -> List[DAGNode]: return tasks -def fill_flow_panel(flow_panel: FlowPanel): +def fill_flow_panel( + flow_panel: FlowPanel, + metadata_func: Callable[ + [Union[ViewMetadata, ResourceMetadata]], Union[ViewMetadata, ResourceMetadata] + ] = None, + ignore_options_error: bool = False, + update_id: bool = False, +): """Fill the flow panel with the latest metadata. Args: @@ -1021,14 +1028,19 @@ def fill_flow_panel(flow_panel: FlowPanel): """ if not flow_panel.flow_data: return + id_mapping = {} for node in flow_panel.flow_data.nodes: try: parameters_map = {} if node.data.is_operator: data = cast(ViewMetadata, node.data) - key = data.get_operator_key() - operator_cls: Type[DAGNode] = _get_operator_class(key) - metadata = operator_cls.metadata + metadata = None + if metadata_func: + metadata = metadata_func(data) + if not metadata: + key = data.get_operator_key() + operator_cls: Type[DAGNode] = _get_operator_class(key) + metadata = operator_cls.metadata if not metadata: raise ValueError("Metadata is not set.") input_parameters = {p.name: p for p in metadata.inputs} @@ -1036,6 +1048,8 @@ def fill_flow_panel(flow_panel: FlowPanel): for i in node.data.inputs: if i.name in input_parameters: new_param = input_parameters[i.name] + i.type_name = new_param.type_name + i.type_cls = new_param.type_cls i.label = new_param.label i.description = new_param.description i.dynamic = new_param.dynamic @@ -1045,6 +1059,8 @@ def fill_flow_panel(flow_panel: FlowPanel): for i in node.data.outputs: if i.name in output_parameters: new_param = output_parameters[i.name] + i.type_name = new_param.type_name + i.type_cls = new_param.type_cls i.label = new_param.label i.description = new_param.description i.dynamic = new_param.dynamic @@ -1053,13 +1069,27 @@ def fill_flow_panel(flow_panel: FlowPanel): i.mappers = new_param.mappers else: data = cast(ResourceMetadata, node.data) - key = data.get_origin_id() - metadata = _get_resource_class(key).metadata + metadata = None + if metadata_func: + metadata = metadata_func(data) + if not metadata: + key = data.get_origin_id() + metadata = _get_resource_class(key).metadata for param in metadata.parameters: parameters_map[param.name] = param # Update the latest metadata. + if node.data.type_cls != metadata.type_cls: + old_type_cls = node.data.type_cls + node.data.type_cls = metadata.type_cls + node.data.type_name = metadata.type_name + if not node.data.is_operator and update_id: + # Update key + old_id = data.id + new_id = old_id.replace(old_type_cls, metadata.type_cls) + data.id = new_id + id_mapping[old_id] = new_id node.data.label = metadata.label node.data.description = metadata.description node.data.category = metadata.category @@ -1072,7 +1102,16 @@ def fill_flow_panel(flow_panel: FlowPanel): new_param = parameters_map[param.name] param.label = new_param.label param.description = new_param.description - param.options = new_param.get_dict_options() # type: ignore + try: + param.options = new_param.get_dict_options() # type: ignore + except Exception as e: + if ignore_options_error: + logger.warning( + f"Unable to fill the options for the parameter: {e}" + ) + else: + raise + param.type_cls = new_param.type_cls param.default = new_param.default param.placeholder = new_param.placeholder param.alias = new_param.alias @@ -1080,3 +1119,13 @@ def fill_flow_panel(flow_panel: FlowPanel): except (FlowException, ValueError) as e: logger.warning(f"Unable to fill the flow panel: {e}") + + if not update_id: + return + + for edge in flow_panel.flow_data.edges: + for old_id, new_id in id_mapping.items(): + edge.source.replace(old_id, new_id) + edge.target.replace(old_id, new_id) + edge.source_handle.replace(old_id, new_id) + edge.target_handle.replace(old_id, new_id) diff --git a/packages/dbgpt-core/src/dbgpt/util/cli/flow_compat.py b/packages/dbgpt-core/src/dbgpt/util/cli/flow_compat.py index f5fd7f0fc..3af372e50 100644 --- a/packages/dbgpt-core/src/dbgpt/util/cli/flow_compat.py +++ b/packages/dbgpt-core/src/dbgpt/util/cli/flow_compat.py @@ -1,5 +1,7 @@ +import copy +import json import os -from typing import Optional +from typing import List, Optional, Tuple, Union import click @@ -60,14 +62,24 @@ def tool_flow_cli_group(): "by one minor version." ), ) +@click.option( + "--update-template", + is_flag=True, + default=False, + required=False, + help=_("Update the template file."), +) def gen_compat( module: Optional[str], output: Optional[str], curr_version: Optional[str], last_support_version: Optional[str], + update_template: bool = False, ): """Generate the compatibility flow mapping file.""" - from ._module import _scan_awel_flow + from dbgpt.util.cli._module import _scan_awel_flow + + lang = os.getenv("LANGUAGE") modules = [] if module: @@ -96,10 +108,108 @@ def gen_compat( os.makedirs(output, exist_ok=True) output_file = os.path.join(output, curr_version + "_compat_flow.json") user_input = clog.ask(f"Output to {output_file}, do you want to continue?(y/n)") + save_compat = True + if not user_input or user_input.lower() != "y": + clog.info("Cancelled") + save_compat = False + if save_compat: + with open(output_file, "w") as f: + import json + + json.dump(output_dicts, f, ensure_ascii=False, indent=4) + + if update_template: + _update_template(output_dicts, lang=lang) + + +def _update_template( + compat_data: dict, template_file: Optional[str] = None, lang: str = "en" +): + from dbgpt.core.awel.dag.base import DAGNode + from dbgpt.core.awel.flow.base import ( + _TYPE_REGISTRY, + ) + from dbgpt.core.awel.flow.compat import ( + FlowCompatMetadata, + _register_flow_compat, + get_new_class_name, + ) + from dbgpt.core.awel.flow.flow_factory import ( + ResourceMetadata, + ViewMetadata, + fill_flow_panel, + ) + from dbgpt_serve.flow.api.schemas import ServerResponse + from dbgpt_serve.flow.service.service import ( + _get_flow_templates_from_files, + _parse_flow_template_from_json, + ) + + last_support_version = compat_data["last_support_version"] + curr_version = compat_data["curr_version"] + + for data in compat_data["compat"]: + metadata = FlowCompatMetadata(**data) + _register_flow_compat(curr_version, last_support_version, metadata) + + templates: List[Tuple[str, ServerResponse]] = [] + if template_file: + with open(template_file, "r") as f: + data = json.load(f) + templates.append((template_file, _parse_flow_template_from_json(data))) + else: + templates.extend(_get_flow_templates_from_files(lang)) + + new_templates: List[Tuple[str, ServerResponse]] = [] + + def metadata_func(old_metadata: Union[ViewMetadata, ResourceMetadata]): + type_cls = old_metadata.type_cls + if type_cls in _TYPE_REGISTRY: + return None + new_type_cls = None + try: + new_type_cls = get_new_class_name(type_cls) + if not new_type_cls or new_type_cls not in _TYPE_REGISTRY: + return None + obj_type = _TYPE_REGISTRY[new_type_cls] + if isinstance(old_metadata, ViewMetadata): + if not isinstance(obj_type, DAGNode): + return None + obj_type.metadata + elif isinstance(old_metadata, ResourceMetadata): + metadata_attr = f"_resource_metadata_{obj_type.__name__}" + return getattr(obj_type, metadata_attr) + else: + raise ValueError(f"Unknown metadata type: {type(old_metadata)}") + except Exception as e: + clog.warning( + f"Error get metadata for {type_cls}: {str(e)}, new_type_cls: " + f"{new_type_cls}" + ) + return None + + for template_file, template in templates: + new_flow_template = copy.deepcopy(template) + try: + fill_flow_panel( + new_flow_template, + metadata_func, + ignore_options_error=True, + update_id=True, + ) + new_templates.append((template_file, new_flow_template)) + except Exception as e: + import traceback + + traceback.print_exc() + clog.warning(f"Error fill flow panel for {template_file}: {str(e)}") + + user_input = clog.ask("Do you want to update the template file?(y/n)") if not user_input or user_input.lower() != "y": clog.info("Cancelled") return - with open(output_file, "w") as f: - import json - - json.dump(output_dicts, f, ensure_ascii=False, indent=4) + for template_file, flow in new_templates: + template_dict = {"flow": flow.model_dump()} + dag_json = json.dumps(template_dict, indent=4, ensure_ascii=False) + with open(template_file, "w") as f: + f.write(dag_json) diff --git a/packages/dbgpt-core/src/dbgpt/vis/tags/vis_chart.py b/packages/dbgpt-core/src/dbgpt/vis/tags/vis_chart.py index 99a1f5593..3980aef21 100644 --- a/packages/dbgpt-core/src/dbgpt/vis/tags/vis_chart.py +++ b/packages/dbgpt-core/src/dbgpt/vis/tags/vis_chart.py @@ -60,7 +60,7 @@ class VisChart(Vis): """Return the prompt for the vis protocol.""" return default_chart_type_prompt() - async def generate_param(self, **kwargs) -> Optional[Dict[str, Any]]: + def sync_generate_param(self, **kwargs) -> Optional[Dict[str, Any]]: """Generate the parameters required by the vis protocol.""" chart = kwargs.get("chart", None) data_df = kwargs.get("data_df", None) diff --git a/packages/dbgpt-core/src/dbgpt/vis/tags/vis_dashboard.py b/packages/dbgpt-core/src/dbgpt/vis/tags/vis_dashboard.py index 10422b0da..104c6adaf 100644 --- a/packages/dbgpt-core/src/dbgpt/vis/tags/vis_dashboard.py +++ b/packages/dbgpt-core/src/dbgpt/vis/tags/vis_dashboard.py @@ -12,7 +12,7 @@ logger = logging.getLogger(__name__) class VisDashboard(Vis): """Dashboard Vis Protocol.""" - async def generate_param(self, **kwargs) -> Optional[Dict[str, Any]]: + def sync_generate_param(self, **kwargs) -> Optional[Dict[str, Any]]: """Generate the parameters required by the vis protocol.""" charts: Optional[dict] = kwargs.get("charts", None) title: Optional[str] = kwargs.get("title", None) diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/compat/0.7.0_compat_flow.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/compat/0.7.0_compat_flow.json index 27cf4f457..559d6f036 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/compat/0.7.0_compat_flow.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/compat/0.7.0_compat_flow.json @@ -149,14 +149,51 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.siliconflow.SiliconFlowDeployModelParameters", + "type_name": "SiliconFlowDeployModelParameters", + "name": "SiliconFlowDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.siliconflow.SiliconFlowDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", - "api_base" + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAICompatibleDeployModelParameters", + "type_name": "OpenAICompatibleDeployModelParameters", + "name": "OpenAICompatibleDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAICompatibleDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" ], "outputs": [], "inputs": [], @@ -170,7 +207,7 @@ "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", "category": "llm_client", "parameters": [ - "apk_key", + "api_key", "api_base" ], "outputs": [], @@ -179,13 +216,124 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.zhipu.ZhipuDeployModelParameters", + "type_name": "ZhipuDeployModelParameters", + "name": "ZhipuDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.zhipu.ZhipuDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.moonshot.MoonshotDeployModelParameters", + "type_name": "MoonshotDeployModelParameters", + "name": "MoonshotDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.moonshot.MoonshotDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.gitee.GiteeDeployModelParameters", + "type_name": "GiteeDeployModelParameters", + "name": "GiteeDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.gitee.GiteeDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.deepseek.DeepSeekDeployModelParameters", + "type_name": "DeepSeekDeployModelParameters", + "name": "DeepSeekDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.deepseek.DeepSeekDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.ollama.OllamaDeployModelParameters", + "type_name": "OllamaDeployModelParameters", + "name": "OllamaDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.ollama.OllamaDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", "api_base" ], "outputs": [], @@ -194,14 +342,25 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.yi.YiDeployModelParameters", + "type_name": "YiDeployModelParameters", + "name": "YiDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.yi.YiDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", - "api_base" + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" ], "outputs": [], "inputs": [], @@ -209,14 +368,25 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.spark.SparkDeployModelParameters", + "type_name": "SparkDeployModelParameters", + "name": "SparkDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.spark.SparkDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", - "api_base" + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" ], "outputs": [], "inputs": [], @@ -224,14 +394,25 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.baichuan.BaichuanDeployModelParameters", + "type_name": "BaichuanDeployModelParameters", + "name": "BaichuanDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.baichuan.BaichuanDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", - "api_base" + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" ], "outputs": [], "inputs": [], @@ -239,14 +420,126 @@ }, { "type": "resource", - "type_cls": "dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", - "type_name": "OpenAILLMClient", - "name": "openai_llm_client", - "id": "resource_dbgpt.model.proxy.llms.chatgpt.OpenAILLMClient", + "type_cls": "dbgpt.model.proxy.llms.gemini.GeminiDeployModelParameters", + "type_name": "GeminiDeployModelParameters", + "name": "GeminiDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.gemini.GeminiDeployModelParameters", "category": "llm_client", "parameters": [ - "apk_key", - "api_base" + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.tongyi.TongyiDeployModelParameters", + "type_name": "TongyiDeployModelParameters", + "name": "TongyiDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.tongyi.TongyiDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.volcengine.VolcengineDeployModelParameters", + "type_name": "VolcengineDeployModelParameters", + "name": "VolcengineDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.volcengine.VolcengineDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.wenxin.WenxinDeployModelParameters", + "type_name": "WenxinDeployModelParameters", + "name": "WenxinDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.wenxin.WenxinDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_key", + "api_secret" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt.model.proxy.llms.claude.ClaudeDeployModelParameters", + "type_name": "ClaudeDeployModelParameters", + "name": "ClaudeDeployModelParameters", + "id": "resource_dbgpt.model.proxy.llms.claude.ClaudeDeployModelParameters", + "category": "llm_client", + "parameters": [ + "name", + "backend", + "provider", + "verbose", + "concurrency", + "prompt_template", + "context_length", + "reasoning_model", + "api_base", + "api_key", + "api_type", + "api_version", + "http_proxy" ], "outputs": [], "inputs": [], @@ -491,20 +784,6 @@ "inputs": [], "version": "v1" }, - { - "type": "resource", - "type_cls": "dbgpt.rag.text_splitter.text_splitter.CharacterTextSplitter", - "type_name": "CharacterTextSplitter", - "name": "character_text_splitter", - "id": "resource_dbgpt.rag.text_splitter.text_splitter.CharacterTextSplitter", - "category": "rag", - "parameters": [ - "separator" - ], - "outputs": [], - "inputs": [], - "version": "v1" - }, { "type": "resource", "type_cls": "dbgpt.rag.text_splitter.text_splitter.RecursiveCharacterTextSplitter", @@ -1658,6 +1937,7 @@ "port", "user", "database", + "engine", "password", "http_pool_maxsize", "http_pool_num_pools", @@ -1708,29 +1988,6 @@ "inputs": [], "version": "v1" }, - { - "type": "resource", - "type_cls": "dbgpt_ext.storage.vector_store.elastic_store.ElasticsearchVectorConfig", - "type_name": "ElasticsearchVectorConfig", - "name": "elasticsearch_vector_config", - "id": "resource_dbgpt_ext.storage.vector_store.elastic_store.ElasticsearchVectorConfig", - "category": "vector_store", - "parameters": [ - "name", - "user", - "password", - "embedding_fn", - "max_chunks_once_load", - "max_threads", - "uri", - "port", - "alias", - "index_name" - ], - "outputs": [], - "inputs": [], - "version": "v1" - }, { "type": "resource", "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", @@ -2014,6 +2271,89 @@ "inputs": [], "version": "v1" }, + { + "type": "resource", + "type_cls": "dbgpt_serve.dbgpts.my.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.dbgpts.my.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.dbgpts.hub.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.dbgpts.hub.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.model.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.model.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "model_storage" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.evaluate.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.evaluate.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "embedding_model", + "similarity_top_k" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.rag.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.rag.config.ServeConfig", + "category": "rag", + "parameters": [ + "api_keys", + "embedding_model", + "rerank_model", + "chunk_size", + "chunk_overlap", + "similarity_top_k", + "similarity_score_threshold", + "query_rewrite", + "max_chunks_once_load", + "max_threads", + "rerank_top_k" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, { "type": "operator", "type_cls": "dbgpt_serve.rag.operators.knowledge_space.KnowledgeSpacePromptBuilderOperator", @@ -2054,6 +2394,86 @@ ], "version": "v1" }, + { + "type": "resource", + "type_cls": "dbgpt_serve.datasource.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.datasource.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.flow.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.flow.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "load_dbgpts_interval", + "encrypt_key" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.file.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.file.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "check_hash", + "host", + "port", + "download_chunk_size", + "save_chunk_size", + "transfer_chunk_size", + "transfer_timeout", + "local_storage_path" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.feedback.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.feedback.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.libro.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.libro.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, { "type": "operator", "type_cls": "dbgpt_serve.conversation.operators.DefaultServePreChatHistoryLoadOperator", @@ -2089,6 +2509,37 @@ ], "version": "v1" }, + { + "type": "resource", + "type_cls": "dbgpt_serve.conversation.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.conversation.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "default_model" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, + { + "type": "resource", + "type_cls": "dbgpt_serve.prompt.config.ServeConfig", + "type_name": "ServeConfig", + "name": "ServeConfig", + "id": "resource_dbgpt_serve.prompt.config.ServeConfig", + "category": "common", + "parameters": [ + "api_keys", + "default_user", + "default_sys_code" + ], + "outputs": [], + "inputs": [], + "version": "v1" + }, { "type": "operator", "type_cls": "dbgpt.core.interface.output_parser.BaseOutputParser", diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/service/service.py b/packages/dbgpt-serve/src/dbgpt_serve/flow/service/service.py index 777832b5d..0a5f439cb 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/service/service.py +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/service/service.py @@ -1,7 +1,7 @@ import json import logging import os -from typing import AsyncIterator, List, Optional, cast +from typing import AsyncIterator, List, Optional, Tuple, cast import schedule from fastapi import HTTPException @@ -424,29 +424,13 @@ class Service(BaseService[ServeEntity, ServeRequest, ServerResponse]): Returns: List[ServerResponse]: The response """ - local_file_templates = self._get_flow_templates_from_files() - return PaginationResult.build_from_all(local_file_templates, page, page_size) - - def _get_flow_templates_from_files(self) -> List[ServerResponse]: - """Get a list of Flow templates from files""" user_lang = self._system_app.config.get_current_lang(default="en") - # List files in current directory - parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - template_dir = os.path.join(parent_dir, "templates", user_lang) - default_template_dir = os.path.join(parent_dir, "templates", "en") - if not os.path.exists(template_dir): - template_dir = default_template_dir + local_file_templates = _get_flow_templates_from_files(user_lang) templates = [] - for root, _, files in os.walk(template_dir): - for file in files: - if file.endswith(".json"): - try: - with open(os.path.join(root, file), "r") as f: - data = json.load(f) - templates.append(_parse_flow_template_from_json(data)) - except Exception as e: - logger.warning(f"Load template {file} error: {str(e)}") - return templates + for _, t in local_file_templates: + fill_flow_panel(t) + templates.append(t) + return PaginationResult.build_from_all(templates, page, page_size) async def chat_stream_flow_str( self, flow_uid: str, request: CommonLLMHttpRequestBody @@ -734,3 +718,29 @@ def _parse_flow_template_from_json(json_dict: dict) -> ServerResponse: flow_json["state"] = State.INITIALIZING flow_json["dag_id"] = None return ServerResponse(**flow_json) + + +def _get_flow_templates_from_files( + user_lang: str = "en", +) -> List[Tuple[str, ServerResponse]]: + """Get a list of Flow templates from files""" + # List files in current directory + parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + template_dir = os.path.join(parent_dir, "templates", user_lang) + default_template_dir = os.path.join(parent_dir, "templates", "en") + if not os.path.exists(template_dir): + template_dir = default_template_dir + templates = [] + for root, _, files in os.walk(template_dir): + for file in files: + if file.endswith(".json"): + try: + full_path = os.path.join(root, file) + with open(full_path, "r") as f: + data = json.load(f) + templates.append( + (full_path, _parse_flow_template_from_json(data)) + ) + except Exception as e: + logger.warning(f"Load template {file} error: {str(e)}") + return templates diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/embedded-knowledge-process-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/embedded-knowledge-process-flow-template.json index a555188e3..5498aca08 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/embedded-knowledge-process-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/embedded-knowledge-process-flow-template.json @@ -1,852 +1,811 @@ { - "flow": { - "uid": "0a2bb656-4538-45bf-963a-c2101127a767", - "label": "Embedding Knowledge Process Workflow", - "name": "embedding_process_workflow", - "flow_category": null, - "flow_data": { - "nodes": [ - { - "width": 320, - "height": 323, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "position": { - "x": -25.997695320590083, - "y": -90.04159277333981, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Vector Storage Operator", - "custom_label": null, - "name": "vector_storage_operator", - "description": "Persist embeddings into vector storage.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "VectorStoreBase", - "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Vector Storage连接器", - "name": "vector_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "已组装的Chunk,已持久化到Vector Storage中.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "VectorStorageOperator", - "type_cls": "dbgpt.rag.operators.vector_store.VectorStorageOperator" - }, - "position_absolute": { - "x": -25.997695320590083, - "y": -90.04159277333981, - "zoom": 0 - } - }, - { - "width": 320, - "height": 321, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "position": { - "x": -913.571872386726, - "y": -61.6367538649408, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Chunk Manager Operator", - "custom_label": null, - "name": "chunk_manager_operator", - "description": " Split Knowledge Documents into chunks.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chunk Split Parameters", - "name": "chunk_parameters", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Chunk Split Parameters.", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "Knowledge", - "custom_label": null, - "name": "knowledge", - "description": "The knowledge to be loaded.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "The split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "ChunkManagerOperator", - "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator" - }, - "position_absolute": { - "x": -913.571872386726, - "y": -61.6367538649408, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "position": { - "x": -256.96257013540503, - "y": -509.98997877383584, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaStore", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "label": "Chroma Vector Store", - "custom_label": null, - "name": "chroma_vector_store", - "description": "Chroma Vector Storage.", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chroma Config", - "name": "vector_store_config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "the chroma config of vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "dbgpt.storage.vector_store.base.VectorStoreBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -256.96257013540503, - "y": -509.98997877383584, - "zoom": 0 - } - }, - { - "width": 320, - "height": 674, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "position": { - "x": -731.2095474673597, - "y": -879.5845342539665, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "label": "Chroma Config", - "custom_label": null, - "name": "chroma_vector_config", - "description": "Chroma vector store config.", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "集合名称", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "Vector Storage的名称,如果未设置,将使用默认名称.", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "用户", - "name": "user", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Vector Storage的用户,如果未设置,将使用默认用户.", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "密码", - "name": "password", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Vector Storage的密码,如果未设置,将使用默认密码.", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Vector Storage的嵌入函数,如果未设置,将使用默认的嵌入函数.", - "options": null, - "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "max_chunks_once_load", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "max_chunks_once_load default 10.", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "max_threads", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "max_threads.", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Persist Path", - "name": "persist_path", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Vector Storage Path", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dbgpt.storage.vector_store.base.VectorStoreConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -731.2095474673597, - "y": -879.5845342539665, - "zoom": 0 - } - }, - { - "width": 320, - "height": 431, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -1517.087378905087, - "y": -191.2030717055229, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Knowledge Loader Operator", - "custom_label": null, - "name": "knowledge_operator", - "description": "Knowledge Loader Operator.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": "https://github.com/openai/openai-python", - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "默认数据源", - "name": "datasource", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "默认数据源.", - "options": null, - "value": "../../docs/docs/awel/awel.md", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Type", - "name": "knowledge_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "DOCUMENT", - "placeholder": null, - "description": "Knowledge Type.", - "options": [ + "flow": { + "uid": "e1d6fba4-7ea6-4120-8f59-e4f56964258f", + "label": "Embedding Knowledge Process Workflow", + "name": "embedding_process_workflow", + "flow_category": null, + "description": "Embedding Knowledge Process Workflow", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-12-16 18:04:00", + "gmt_modified": "2024-12-16 18:04:00", + "metadata": { + "triggers": [ { - "label": "DOCUMENT", - "name": "DOCUMENT", - "value": "DOCUMENT", - "children": null - }, - { - "label": "URL", - "name": "URL", - "value": "URL", - "children": null - }, - { - "label": "TEXT", - "name": "TEXT", - "value": "TEXT", - "children": null + "trigger_type": "http" } - ], - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "Knowledge Datasource", - "custom_label": null, - "name": "knowledge datasource", - "description": "Knowledge data source.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "Knowledge", - "custom_label": null, - "name": "Knowledge", - "description": "Knowledge.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator" + ], + "sse_output": false, + "streaming_output": false, + "tags": {} }, - "position_absolute": { - "x": -1517.087378905087, - "y": -191.2030717055229, - "zoom": 0 - } - }, - { - "width": 320, - "height": 602, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Dict HTTP Trigger", - "custom_label": null, - "name": "dict_http_trigger", - "description": "通过 HTTP 请求触发您的工作流,并将请求主体解析为Dict", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API Endpoint", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "API Endpoint", - "options": null, - "value": "/rag/knowledge/embedding/process", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP Method", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API Method", - "options": [ + "variables": null, + "authors": null, + "flow_data": { + "edges": [ { - "label": "HTTP PUT Method", - "name": "http_put", - "value": "PUT", - "children": null + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" }, { - "label": "HTTP POST Method", - "name": "http_post", - "value": "POST", - "children": null + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "target_order": 3, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", + "type": "buttonedge" + }, + { + "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" } - ], - "value": null, - "alias": null, - "ui": null + ], + "viewport": { + "x": 1043.477794539488, + "y": 580.8652141334148, + "zoom": 0.4897130009645833 }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "响应是否为流式传输", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API 响应主体", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Media Type", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Media Type", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP Status", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP Status", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API Body", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "DictHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger" - }, - "position_absolute": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 + "nodes": [ + { + "width": 320, + "height": 323, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "position": { + "x": -25.997695320590083, + "y": -90.04159277333981, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -25.997695320590083, + "y": -90.04159277333981, + "zoom": 0.0 + }, + "data": { + "label": "Vector Storage Operator", + "custom_label": null, + "name": "vector_storage_operator", + "description": "Persist embeddings into vector storage.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to vector store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "VectorStorageOperator", + "type_cls": "dbgpt_ext.rag.operators.vector_store.VectorStorageOperator", + "parameters": [ + { + "type_name": "VectorStoreBase", + "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Vector Store Connector", + "name": "vector_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The vector store.", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 321, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "position": { + "x": -913.571872386726, + "y": -61.6367538649408, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -913.571872386726, + "y": -61.6367538649408, + "zoom": 0.0 + }, + "data": { + "label": "Chunk Manager Operator", + "custom_label": null, + "name": "chunk_manager_operator", + "description": " Split Knowledge Documents into chunks.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "knowledge", + "description": "The knowledge to be loaded.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "ChunkManagerOperator", + "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator", + "parameters": [ + { + "type_name": "ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chunk Split Parameters", + "name": "chunk_parameters", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Chunk Split Parameters.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "position": { + "x": -256.96257013540503, + "y": -509.98997877383584, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -256.96257013540503, + "y": -509.98997877383584, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaStore", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaStore", + "label": "Chroma Vector Store", + "custom_label": null, + "name": "chroma_vector_store", + "description": "Chroma vector store.", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaStore_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaStore", + "dbgpt.storage.vector_store.base.VectorStoreBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chroma Config", + "name": "vector_store_config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "the chroma config of vector store.", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 674, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "position": { + "x": -731.2095474673597, + "y": -879.5845342539665, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -731.2095474673597, + "y": -879.5845342539665, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "label": "Chroma Config", + "custom_label": null, + "name": "chroma_vector_config", + "description": "Chroma vector store config.", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", + "dbgpt.storage.vector_store.base.VectorStoreConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Collection Name", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "The name of vector store, if not set, will use the default name.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "User", + "name": "user", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The user of vector store, if not set, will use the default user.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Password", + "name": "password", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The password of vector store, if not set, will use the default password.", + "value": null, + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Embedding Function", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The embedding function of vector store, if not set, will use the default embedding function.", + "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Max Chunks Once Load", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "The max number of chunks to load at once. If your document is large, you can set this value to a larger number to speed up the loading process. Default is 10.", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Max Threads", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "The max number of threads to use. Default is 1. If you set this bigger than 1, please make sure your vector store is thread-safe.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Persist Path", + "name": "persist_path", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "the persist path of vector store.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 431, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -1517.087378905087, + "y": -191.2030717055229, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1517.087378905087, + "y": -191.2030717055229, + "zoom": 0.0 + }, + "data": { + "label": "Knowledge Loader Operator", + "custom_label": null, + "name": "knowledge_operator", + "description": "The knowledge operator, which can create knowledge from datasource.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": "https://github.com/openai/openai-python", + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "knowledge datasource", + "custom_label": null, + "name": "knowledge datasource", + "description": "knowledge datasource, which can be a document, url, or text.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "Knowledge", + "description": "Knowledge object.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Default datasource", + "name": "datasource", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Default datasource.", + "value": "../../docs/docs/awel/awel.md", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Knowledge type", + "name": "knowledge_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "DOCUMENT", + "placeholder": null, + "description": "Knowledge type.", + "value": null, + "options": [ + { + "label": "DOCUMENT", + "name": "DOCUMENT", + "value": "DOCUMENT", + "children": null + }, + { + "label": "URL", + "name": "URL", + "value": "URL", + "children": null + }, + { + "label": "TEXT", + "name": "TEXT", + "value": "TEXT", + "children": null + } + ] + } + ] + } + }, + { + "width": 320, + "height": 602, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "data": { + "label": "Dict Http Trigger", + "custom_label": null, + "name": "dict_http_trigger", + "description": "Trigger your workflow by http request, and parse the request body as a dict", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "DictHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API Endpoint", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The API endpoint", + "value": "/rag/knowledge/embedding/process", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Methods", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "The methods of the API endpoint", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Streaming Response", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "Whether the response is streaming", + "value": null, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Response Body", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response body of the API endpoint", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Response Media Type", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response media type", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Status Code", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "The http status code", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 148, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "position": { + "x": -1297.0596621977236, + "y": -756.4644248292581, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1297.0596621977236, + "y": -756.4644248292581, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultEmbeddings", + "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "label": "Default Embeddings", + "custom_label": null, + "name": "default_embeddings", + "description": "Default embeddings(using default embedding model of current system)", + "category": "embeddings", + "category_label": "Embeddings", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "dbgpt.core.interface.embeddings.Embeddings" + ], + "parameters": [] + } + } + ] } - }, - { - "width": 320, - "height": 148, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "position": { - "x": -1297.0596621977236, - "y": -756.4644248292581, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultEmbeddings", - "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "label": "DefaultEmbeddings", - "custom_label": null, - "name": "default_embeddings", - "description": "DefaultEmbeddings", - "category": "embeddings", - "category_label": "Embeddings", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "dbgpt.core.interface.embeddings.Embeddings" - ] - }, - "position_absolute": { - "x": -1297.0596621977236, - "y": -756.4644248292581, - "zoom": 0 - } - } - ], - "edges": [ - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "target_order": 3, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", - "type": "buttonedge" - }, - { - "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 1043.477794539488, - "y": 580.8652141334148, - "zoom": 0.4897130009645833 } - }, - "description": "Embedding Knowledge Process Workflow", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_embedding_process_workflow_0a2bb656-4538-45bf-963a-c2101127a767", - "gmt_created": "2024-12-16 18:04:00", - "gmt_modified": "2024-12-16 18:04:00", - "metadata": { - "sse_output": false, - "streaming_output": false, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/rag/embdding/process", - "methods": [ - "POST" - ], - "trigger_mode": "command" - } - ] - }, - "variables": null, - "authors": null -} } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/hybrid-knowledge-process-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/hybrid-knowledge-process-template.json index 2429dba43..6a8de347e 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/hybrid-knowledge-process-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/hybrid-knowledge-process-template.json @@ -1,20 +1,20 @@ { "flow": { - "uid": "fa8f01ab-fc7b-4e35-9533-f8e4cf045cce", + "uid": "3b6a2c55-0c3b-4e38-bd71-d68104cccf37", "label": "Hybrid Knowledge Process Workflow", "name": "hybrid_knowledge_process_workflow", "flow_category": null, "description": "hybrid_knowledge_process_workflow", - "state": "running", + "state": "initializing", "error_message": "", "source": "DBGPT-WEB", "source_url": null, "version": "0.1.1", "define_type": "json", - "editable": true, + "editable": false, "user_name": null, "sys_code": null, - "dag_id": "flow_dag_knowledge_factory_workflow_fa8f01ab-fc7b-4e35-9533-f8e4cf045cce", + "dag_id": null, "gmt_created": "2024-12-14 15:57:44", "gmt_modified": "2024-12-14 15:57:44", "metadata": null, @@ -165,14 +165,14 @@ "id": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", "position": { "x": 604.5, - "y": 77, - "zoom": 0 + "y": 77.0, + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": 604.5, - "y": 77, - "zoom": 0 + "y": 77.0, + "zoom": 0.0 }, "data": { "label": "Knowledge Process Join Operator", @@ -231,7 +231,7 @@ ], "version": "v1", "type_name": "KnowledgeProcessJoinOperator", - "type_cls": "dbgpt.rag.operators.process_branch.KnowledgeProcessJoinOperator", + "type_cls": "dbgpt_ext.rag.operators.process_branch.KnowledgeProcessJoinOperator", "parameters": [] } }, @@ -242,13 +242,13 @@ "position": { "x": 174.16583729394188, "y": -131.63401513480102, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": 174.16583729394188, "y": -131.63401513480102, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Vector Storage Operator", @@ -295,7 +295,7 @@ ], "version": "v1", "type_name": "VectorStorageOperator", - "type_cls": "dbgpt.rag.operators.vector_store.VectorStorageOperator", + "type_cls": "dbgpt_ext.rag.operators.vector_store.VectorStorageOperator", "parameters": [ { "type_name": "VectorStoreBase", @@ -324,13 +324,13 @@ "position": { "x": 180.89103763027083, "y": 341.37174185366564, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": 180.89103763027083, "y": 341.37174185366564, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Knowledge Graph Operator", @@ -377,7 +377,7 @@ ], "version": "v1", "type_name": "KnowledgeGraphOperator", - "type_cls": "dbgpt.rag.operators.knowledge_graph.KnowledgeGraphOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge_graph.KnowledgeGraphOperator", "parameters": [ { "type_name": "KnowledgeGraphBase", @@ -406,13 +406,13 @@ "position": { "x": -1056.545824254249, "y": -163.01828337100258, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -1056.545824254249, "y": -163.01828337100258, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Chunk Manager Operator", @@ -463,7 +463,7 @@ "parameters": [ { "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", "dynamic": false, "dynamic_minimum": 0, "label": "Chunk Split Parameters", @@ -488,17 +488,17 @@ "position": { "x": -306.391788536534, "y": 491.0961943850906, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -306.391788536534, "y": 491.0961943850906, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "BuiltinKnowledgeGraph", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", "label": "Builtin Knowledge Graph", "custom_label": null, "name": "builtin_knowledge_graph", @@ -508,7 +508,7 @@ "flow_type": "resource", "icon": null, "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", "tags": { "ui_version": "flow2.0" }, @@ -521,7 +521,7 @@ "parameters": [ { "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", "dynamic": false, "dynamic_minimum": 0, "label": "Builtin Knowledge Graph Config.", @@ -546,17 +546,17 @@ "position": { "x": -813.7432345424928, "y": 328.2957752754239, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -813.7432345424928, "y": 328.2957752754239, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", "label": "Builtin Graph Config", "custom_label": null, "name": "knowledge_graph_config", @@ -566,7 +566,7 @@ "flow_type": "resource", "icon": null, "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", "tags": { "ui_version": "flow2.0" }, @@ -707,17 +707,17 @@ "position": { "x": -251.7635173402225, "y": -367.01602690631285, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -251.7635173402225, "y": -367.01602690631285, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "ChromaStore", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaStore", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaStore", "label": "Chroma Vector Store", "custom_label": null, "name": "chroma_vector_store", @@ -727,7 +727,7 @@ "flow_type": "resource", "icon": null, "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaStore_0", "tags": { "ui_version": "flow2.0" }, @@ -740,7 +740,7 @@ "parameters": [ { "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", "dynamic": false, "dynamic_minimum": 0, "label": "Chroma Config", @@ -765,17 +765,17 @@ "position": { "x": -684.4180723107158, "y": -934.1745886033843, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -684.4180723107158, "y": -934.1745886033843, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", "label": "Chroma Config", "custom_label": null, "name": "chroma_vector_config", @@ -785,7 +785,7 @@ "flow_type": "resource", "icon": null, "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig_0", "tags": { "ui_version": "flow2.0" }, @@ -926,13 +926,13 @@ "position": { "x": -1558.679801266548, "y": -149.61064934406164, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -1558.679801266548, "y": -149.61064934406164, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Knowledge Loader Operator", @@ -979,7 +979,7 @@ ], "version": "v1", "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", "parameters": [ { "type_name": "str", @@ -1044,13 +1044,13 @@ "position": { "x": -2015.3280350941911, "y": -603.9181210010445, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -2015.3280350941911, "y": -603.9181210010445, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Dict Http Trigger", @@ -1211,13 +1211,13 @@ "position": { "x": -1112.4932879687394, "y": -753.8648984316667, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -1112.4932879687394, "y": -753.8648984316667, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "DefaultEmbeddings", @@ -1250,13 +1250,13 @@ "position": { "x": -1350.535131696419, "y": 435.2340305150391, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -1350.535131696419, "y": 435.2340305150391, - "zoom": 0 + "zoom": 0.0 }, "data": { "type_name": "DefaultLLMClient", @@ -1307,13 +1307,13 @@ "position": { "x": -614.4846931519926, "y": -92.5163519851338, - "zoom": 0 + "zoom": 0.0 }, "type": "customNode", "position_absolute": { "x": -614.4846931519926, "y": -92.5163519851338, - "zoom": 0 + "zoom": 0.0 }, "data": { "label": "Knowledge Process Branch Operator", @@ -1384,11 +1384,11 @@ ], "version": "v1", "type_name": "KnowledgeProcessBranchOperator", - "type_cls": "dbgpt.rag.operators.process_branch.KnowledgeProcessBranchOperator", + "type_cls": "dbgpt_ext.rag.operators.process_branch.KnowledgeProcessBranchOperator", "parameters": [] } } ] } } -} +} \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/kg-knowledge-process-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/kg-knowledge-process-flow-template.json index 3d0d2fa1a..94f15bfe5 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/kg-knowledge-process-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/kg-knowledge-process-flow-template.json @@ -1,872 +1,829 @@ { - "flow": { - "uid": "e288c1c5-67f2-4dba-8288-99de289392b2", - "label": "Knowledge Graph Process Workflow", - "name": "knowledge_graph_process_workflow", - "flow_category": null, - "flow_data": { - "nodes": [ - { - "width": 320, - "height": 323, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "position": { - "x": 6.722768991652174, - "y": -225.32501282124363, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Knowledge Graph Operator", - "custom_label": null, - "name": "knowledge_graph_operator", - "description": "Extract Documents and persist into graph database.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "KnowledgeGraphBase", - "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Connector", - "name": "graph_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The knowledge graph.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "已组装的块,已持久化到向量存储中。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeGraphOperator", - "type_cls": "dbgpt.rag.operators.knowledge_graph.KnowledgeGraphOperator" - }, - "position_absolute": { - "x": 6.722768991652174, - "y": -225.32501282124363, - "zoom": 0 - } - }, - { - "width": 320, - "height": 321, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "position": { - "x": -812.1903428806644, - "y": -415.17234393736123, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Chunk Manager Operator", - "custom_label": null, - "name": "chunk_manager_operator", - "description": " Split Knowledge Documents into chunks.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chunk Split Parameters", - "name": "chunk_parameters", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Chunk Split Parameters.", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "knowledge", - "description": "The knowledge to be loaded.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Chunk", - "custom_label": null, - "name": "chunks", - "description": "The split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "ChunkManagerOperator", - "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator" - }, - "position_absolute": { - "x": -812.1903428806644, - "y": -415.17234393736123, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "position": { - "x": -446.7662140064656, - "y": 116.76439313193941, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraph", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "label": "Builtin Knowledge Graph", - "custom_label": null, - "name": "builtin_knowledge_graph", - "description": "Builtin Knowledge Graph.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Builtin Knowledge Graph Config.", - "name": "config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Builtin Knowledge Graph Config.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -446.7662140064656, - "y": 116.76439313193941, - "zoom": 0 - } - }, - { - "width": 320, - "height": 645, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "position": { - "x": -915.1247640485547, - "y": 148.92845384162234, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "label": "Builtin Graph Config", - "custom_label": null, - "name": "knowledge_graph_config", - "description": "knowledge graph config.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Graph Name", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "The name of Graph, if not set, will use the default name.", - "options": null, - "value": "dbgpt_collection_V1", - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的嵌入函数,如果未设置,将使用默认的嵌入函数。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "一次加载的最大块数", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "一次加载的最大块数。如果您的文档很大,可以将此值设置为较大的数字,以加快加载过程。默认值为 10。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大线程数", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "要使用的最大线程数。默认值为 1。如果您将此值设置为大于 1,请确保您的向量存储是线程安全的。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Type", - "name": "graph_store_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "graph store type.", - "options": null, - "value": "TuGraph", - "alias": null, - "ui": null - }, - { - "type_name": "LLMClient", - "type_cls": "dbgpt.core.interface.llm.LLMClient", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Client", - "name": "llm_client", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "llm client for extract graph triplets.", - "options": null, - "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Model Name", - "name": "model_name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "llm model name.", - "options": null, - "value": "zhipu_proxyllm", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -915.1247640485547, - "y": 148.92845384162234, - "zoom": 0 - } - }, - { - "width": 320, - "height": 431, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -1381.9120062303377, - "y": -370.57039313932444, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Document Knowledge Loader Operator", - "custom_label": null, - "name": "knowledge_operator", - "description": "Load knowledge from document.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": "https://github.com/openai/openai-python", - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Data Source", - "name": "datasource", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "默认数据源。", - "options": null, - "value": "../../docs/docs/awel/awel.md", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Type", - "name": "knowledge_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "DOCUMENT", - "placeholder": null, - "description": "Knowledge Type", - "options": [ + "flow": { + "uid": "fd5d843e-9ef5-4515-998b-b062d26edaf2", + "label": "Knowledge Graph Process Workflow", + "name": "knowledge_graph_process_workflow", + "flow_category": null, + "description": "Knowledge Graph Process Workflow", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-12-16 19:14:00", + "gmt_modified": "2024-12-16 19:14:00", + "metadata": { + "triggers": [ { - "label": "DOCUMENT", - "name": "DOCUMENT", - "value": "DOCUMENT", - "children": null - }, - { - "label": "URL", - "name": "URL", - "value": "URL", - "children": null - }, - { - "label": "TEXT", - "name": "TEXT", - "value": "TEXT", - "children": null + "trigger_type": "http" } - ], - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "Knowledge data source.", - "custom_label": null, - "name": "knowledge datasource", - "description": "Knowledge data source.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "Knowledge", - "custom_label": null, - "name": "Knowledge", - "description": "Knowledge", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator" + ], + "sse_output": false, + "streaming_output": false, + "tags": {} }, - "position_absolute": { - "x": -1381.9120062303377, - "y": -370.57039313932444, - "zoom": 0 - } - }, - { - "width": 320, - "height": 602, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -2020.527087889374, - "y": -445.3470107479735, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Dict HTTP Trigger", - "custom_label": null, - "name": "dict_http_trigger", - "description": "Dict HTTP Trigger.", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API 端点", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "Endpoint", - "options": null, - "value": "/rag/knowledge/kg/process", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP Method", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API Endpoint", - "options": [ + "variables": null, + "authors": null, + "flow_data": { + "edges": [ { - "label": "HTTP PUT Method", - "name": "http_put", - "value": "PUT", - "children": null + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_order": 0, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" }, { - "label": "HTTP POST Method", - "name": "http_post", - "value": "POST", - "children": null + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "target_order": 5, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", + "type": "buttonedge" + }, + { + "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" } - ], - "value": null, - "alias": null, - "ui": null + ], + "viewport": { + "x": 1030.0389432865575, + "y": 345.02642518836063, + "zoom": 0.4818017509272822 }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "Is Stream", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API Http Body", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "响应媒体类型", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Media", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP Status", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP Status", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API Http Body", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "DictHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger" - }, - "position_absolute": { - "x": -2020.527087889374, - "y": -445.3470107479735, - "zoom": 0 + "nodes": [ + { + "width": 320, + "height": 323, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "position": { + "x": 6.722768991652174, + "y": -225.32501282124363, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 6.722768991652174, + "y": -225.32501282124363, + "zoom": 0.0 + }, + "data": { + "label": "Knowledge Graph Operator", + "custom_label": null, + "name": "knowledge_graph_operator", + "description": "Extract Documents and persist into graph database.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to graph store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeGraphOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge_graph.KnowledgeGraphOperator", + "parameters": [ + { + "type_name": "KnowledgeGraphBase", + "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Knowledge Graph Connector", + "name": "graph_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The knowledge graph.", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 321, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "position": { + "x": -812.1903428806644, + "y": -415.17234393736123, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -812.1903428806644, + "y": -415.17234393736123, + "zoom": 0.0 + }, + "data": { + "label": "Chunk Manager Operator", + "custom_label": null, + "name": "chunk_manager_operator", + "description": " Split Knowledge Documents into chunks.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "knowledge", + "description": "The knowledge to be loaded.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "ChunkManagerOperator", + "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator", + "parameters": [ + { + "type_name": "ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chunk Split Parameters", + "name": "chunk_parameters", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Chunk Split Parameters.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "position": { + "x": -446.7662140064656, + "y": 116.76439313193941, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -446.7662140064656, + "y": 116.76439313193941, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraph", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "label": "Builtin Knowledge Graph", + "custom_label": null, + "name": "builtin_knowledge_graph", + "description": "Builtin Knowledge Graph.", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Builtin Knowledge Graph Config.", + "name": "config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Builtin Knowledge Graph Config.", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 645, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "position": { + "x": -915.1247640485547, + "y": 148.92845384162234, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -915.1247640485547, + "y": 148.92845384162234, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "label": "Builtin Graph Config", + "custom_label": null, + "name": "knowledge_graph_config", + "description": "knowledge graph config.", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Graph Name", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "The name of Graph, if not set, will use the default name.", + "value": "dbgpt_collection_V1", + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Embedding Function", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The embedding function of vector store, if not set, will use the default embedding function.", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Max Chunks Once Load", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "The max number of chunks to load at once. If your document is large, you can set this value to a larger number to speed up the loading process. Default is 10.", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Max Threads", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "The max number of threads to use. Default is 1. If you set this bigger than 1, please make sure your vector store is thread-safe.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Knowledge Graph Type", + "name": "graph_store_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "TuGraph", + "placeholder": null, + "description": "graph store type.", + "value": "TuGraph", + "options": null + }, + { + "type_name": "LLMClient", + "type_cls": "dbgpt.core.interface.llm.LLMClient", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM Client", + "name": "llm_client", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "llm client for extract graph triplets.", + "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM Model Name", + "name": "model_name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "llm model name.", + "value": "zhipu_proxyllm", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 431, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -1381.9120062303377, + "y": -370.57039313932444, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1381.9120062303377, + "y": -370.57039313932444, + "zoom": 0.0 + }, + "data": { + "label": "Knowledge Loader Operator", + "custom_label": null, + "name": "knowledge_operator", + "description": "The knowledge operator, which can create knowledge from datasource.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": "https://github.com/openai/openai-python", + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "knowledge datasource", + "custom_label": null, + "name": "knowledge datasource", + "description": "knowledge datasource, which can be a document, url, or text.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "Knowledge", + "description": "Knowledge object.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Default datasource", + "name": "datasource", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Default datasource.", + "value": "../../docs/docs/awel/awel.md", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Knowledge type", + "name": "knowledge_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "DOCUMENT", + "placeholder": null, + "description": "Knowledge type.", + "value": null, + "options": [ + { + "label": "DOCUMENT", + "name": "DOCUMENT", + "value": "DOCUMENT", + "children": null + }, + { + "label": "URL", + "name": "URL", + "value": "URL", + "children": null + }, + { + "label": "TEXT", + "name": "TEXT", + "value": "TEXT", + "children": null + } + ] + } + ] + } + }, + { + "width": 320, + "height": 602, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -2020.527087889374, + "y": -445.3470107479735, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -2020.527087889374, + "y": -445.3470107479735, + "zoom": 0.0 + }, + "data": { + "label": "Dict Http Trigger", + "custom_label": null, + "name": "dict_http_trigger", + "description": "Trigger your workflow by http request, and parse the request body as a dict", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "DictHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API Endpoint", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The API endpoint", + "value": "/rag/knowledge/kg/process", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Methods", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "The methods of the API endpoint", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Streaming Response", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "Whether the response is streaming", + "value": null, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Response Body", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response body of the API endpoint", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Response Media Type", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response media type", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Status Code", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "The http status code", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 272, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "position": { + "x": -1506.5067155518987, + "y": 313.0562898282468, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1506.5067155518987, + "y": 313.0562898282468, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultLLMClient", + "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", + "label": "Default LLM Client", + "custom_label": null, + "name": "default_llm_client", + "description": "Default LLM client(Connect to your DB-GPT model serving)", + "category": "llm_client", + "category_label": "LLM Client", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.model.cluster.client.DefaultLLMClient", + "dbgpt.core.interface.llm.LLMClient" + ], + "parameters": [ + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Auto Convert Message", + "name": "auto_convert_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": true, + "placeholder": null, + "description": "Whether to auto convert the messages that are not supported by the LLM to a compatible format", + "value": null, + "options": null + } + ] + } + } + ] } - }, - { - "width": 320, - "height": 272, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "position": { - "x": -1506.5067155518987, - "y": 313.0562898282468, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultLLMClient", - "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", - "label": "默认 LLM 客户端", - "custom_label": null, - "name": "default_llm_client", - "description": "默认 LLM 客户端(连接到您的 DB-GPT 模型服务)", - "category": "llm_client", - "category_label": "LLM Client", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "自动转换消息", - "name": "auto_convert_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": true, - "placeholder": null, - "description": "是否将 LLM 不支持的消息自动转换为兼容格式", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.model.cluster.client.DefaultLLMClient", - "dbgpt.core.interface.llm.LLMClient" - ] - }, - "position_absolute": { - "x": -1506.5067155518987, - "y": 313.0562898282468, - "zoom": 0 - } - } - ], - "edges": [ - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_order": 0, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "target_order": 5, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", - "type": "buttonedge" - }, - { - "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 1030.0389432865575, - "y": 345.02642518836063, - "zoom": 0.4818017509272822 } - }, - "description": "Knowledge Graph Process Workflow", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_knowledge_graph_process_workflow_e288c1c5-67f2-4dba-8288-99de289392b2", - "gmt_created": "2024-12-16 19:14:00", - "gmt_modified": "2024-12-16 19:14:00", - "metadata": { - "sse_output": false, - "streaming_output": false, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/rag/graph/process", - "methods": [ - "POST" - ], - "trigger_mode": "command" - } - ] - }, - "variables": null, - "authors": null -} } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/rag-chat-awel-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/rag-chat-awel-flow-template.json index 60ff5c911..19348661c 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/rag-chat-awel-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/en/rag-chat-awel-flow-template.json @@ -1,1088 +1,1083 @@ { - "flow": { - "uid": "21eb87d5-b63a-4f41-b2aa-28d01033344d", - "label": "RAG Chat AWEL flow template", - "name": "rag_chat_awel_flow_template", - "flow_category": "chat_flow", - "description": "An example of a RAG chat AWEL flow.", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_rag_chat_awel_flow_template_21eb87d5-b63a-4f41-b2aa-28d01033344d", - "gmt_created": "2024-08-30 10:48:56", - "gmt_modified": "2024-08-30 10:48:56", - "metadata": { - "sse_output": true, - "streaming_output": true, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/templates/flow_dag_rag_chat_awel_flow_template_21eb87d5-b63a-4f41-b2aa-28d01033344d", - "methods": [ - "POST" - ], - "trigger_mode": "chat" - } - ] - }, - "variables": null, - "authors": null, - "flow_data": { - "edges": [ - { - "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 0, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "source_order": 1, - "target": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|1", - "target_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 1, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|1", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_order": 0, - "target": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "target_order": 0, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "source_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|outputs|0", - "target_handle": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 900.5986504747431, - "y": 420.90015979869725, - "zoom": 0.6903331247004052 - }, - "nodes": [ - { - "width": 320, - "height": 632, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -1164.0000230376968, - "y": -501.9869760888273, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": -1164.0000230376968, - "y": -501.9869760888273, - "zoom": 0.0 - }, - "data": { - "label": "Common LLM Http Trigger", - "custom_label": null, - "name": "common_llm_http_trigger", - "description": "Trigger your workflow by http request, and parse the request body as a common LLM http body", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "CommonLLMHttpRequestBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", - "label": "Request Body", - "custom_label": null, - "name": "request_body", - "description": "The request body of the API endpoint, parse as a common LLM http body", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "Request String Messages", - "custom_label": null, - "name": "request_string_messages", - "description": "The request string messages of the API endpoint, parsed from 'messages' field of the request body", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": [ - "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger.MessagesOutputMapper" - ] - } - ], - "version": "v1", - "type_name": "CommonLLMHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger", - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API Endpoint", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "/example/{dag_id}", - "placeholder": null, - "description": "The API endpoint", - "value": "/templates/{dag_id}", - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Http Methods", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "The methods of the API endpoint", - "value": null, - "options": [ - { - "label": "HTTP Method PUT", - "name": "http_put", - "value": "PUT", - "children": null - }, - { - "label": "HTTP Method POST", - "name": "http_post", - "value": "POST", - "children": null - } - ] - }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Streaming Response", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "Whether the response is streaming", - "value": false, - "options": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Http Response Body", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "The response body of the API endpoint", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Response Media Type", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The response media type", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Http Status Code", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "The http status code", - "value": null, - "options": null - } - ] - } - }, - { - "width": 320, - "height": 910, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "position": { - "x": 661.094354143159, - "y": -368.93541722528227, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 661.094354143159, - "y": -368.93541722528227, - "zoom": 0.0 - }, - "data": { - "label": "Streaming LLM Operator", - "custom_label": null, - "name": "higher_order_streaming_llm_operator", - "description": "High-level streaming LLM operator, supports multi-round conversation (conversation window, token length and no multi-round).", - "category": "llm", - "category_label": "LLM", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "map", - "inputs": [ - { - "type_name": "CommonLLMHttpRequestBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", - "label": "Common LLM Request Body", - "custom_label": null, - "name": "common_llm_request_body", - "description": "The common LLM request body.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "HOContextBody", - "type_cls": "dbgpt.app.operators.llm.HOContextBody", - "label": "Extra Context", - "custom_label": null, - "name": "extra_context", - "description": "Extra context for building prompt(Knowledge context, database schema, etc), you can add multiple context.", - "dynamic": true, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "ModelOutput", - "type_cls": "dbgpt.core.interface.llm.ModelOutput", - "label": "Streaming Model Output", - "custom_label": null, - "name": "streaming_model_output", - "description": "The streaming model output.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "HOStreamingLLMOperator", - "type_cls": "dbgpt.app.operators.llm.HOStreamingLLMOperator", - "parameters": [ - { - "type_name": "ChatPromptTemplate", - "type_cls": "dbgpt.core.interface.prompt.ChatPromptTemplate", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Prompt Template", - "name": "prompt_template", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The prompt template for the conversation.", - "value": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Model Name", - "name": "model", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The model name.", - "value": null, - "options": null - }, - { - "type_name": "LLMClient", - "type_cls": "dbgpt.core.interface.llm.LLMClient", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Client", - "name": "llm_client", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The LLM Client, how to connect to the LLM model, if not provided, it will use the default client deployed by DB-GPT.", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "History Message Merge Mode", - "name": "history_merge_mode", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "none", - "placeholder": null, - "description": "The history merge mode, supports 'none', 'window' and 'token'. 'none': no history merge, 'window': merge by conversation window, 'token': merge by token length.", - "value": "window", - "options": [ - { - "label": "No History", - "name": "none", - "value": "none", - "children": null - }, - { - "label": "Message Window", - "name": "window", - "value": "window", - "children": null - }, - { - "label": "Token Length", - "name": "token", - "value": "token", - "children": null - } - ], - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "select", - "size": null, - "attr": null + "flow": { + "uid": "33709cab-6fb8-4b5a-a637-d5022bb82ee5", + "label": "RAG Chat AWEL flow template", + "name": "rag_chat_awel_flow_template", + "flow_category": "chat_flow", + "description": "An example of a RAG chat AWEL flow.", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-08-30 10:48:56", + "gmt_modified": "2024-08-30 10:48:56", + "metadata": { + "triggers": [ + { + "trigger_type": "http" } - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "User Message Key", - "name": "user_message_key", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "user_input", - "placeholder": null, - "description": "The key of the user message in your prompt, default is 'user_input'.", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "History Key", - "name": "history_key", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The chat history key, with chat history message pass to prompt template, if not provided, it will parse the prompt template to get the key.", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Keep Start Rounds", - "name": "keep_start_rounds", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The start rounds to keep in the chat history.", - "value": 0, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Keep End Rounds", - "name": "keep_end_rounds", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "The end rounds to keep in the chat history.", - "value": 10, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Max Token Limit", - "name": "max_token_limit", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 2048, - "placeholder": null, - "description": "The max token limit to keep in the chat history.", - "value": null, - "options": null - } - ] - } + ], + "sse_output": true, + "streaming_output": true, + "tags": {} }, - { - "width": 320, - "height": 774, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -781.3390803520426, - "y": 112.87665693387501, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": -781.3390803520426, - "y": 112.87665693387501, - "zoom": 0.0 - }, - "data": { - "label": "Knowledge Operator", - "custom_label": null, - "name": "higher_order_knowledge_operator", - "description": "Knowledge Operator, retrieve your knowledge(documents) from knowledge space", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "map", - "inputs": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "User question", - "custom_label": null, - "name": "query", - "description": "The user question to retrieve the knowledge", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "HOContextBody", - "type_cls": "dbgpt.app.operators.llm.HOContextBody", - "label": "Retrieved context", - "custom_label": null, - "name": "context", - "description": "The retrieved context from the knowledge space", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "Chunk", - "type_cls": "dbgpt.core.interface.knowledge.Chunk", - "label": "Chunks", - "custom_label": null, - "name": "chunks", - "description": "The retrieved chunks from the knowledge space", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": [ - "dbgpt.app.operators.rag.HOKnowledgeOperator.ChunkMapper" - ] - } - ], - "version": "v1", - "type_name": "HOKnowledgeOperator", - "type_cls": "dbgpt.app.operators.rag.HOKnowledgeOperator", - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Space Name", - "name": "knowledge_space", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The name of the knowledge space", - "value": "k_cmd2", - "options": [ - { - "label": "k_cmd2", - "name": "k_cmd2", - "value": "k_cmd2", - "children": null - }, - { - "label": "f5", - "name": "f5", - "value": "f5", - "children": null - }, - { - "label": "f4", - "name": "f4", - "value": "f4", - "children": null - }, - { - "label": "t333", - "name": "t333", - "value": "t333", - "children": null - }, - { - "label": "f3", - "name": "f3", - "value": "f3", - "children": null - }, - { - "label": "f1", - "name": "f1", - "value": "f1", - "children": null - }, - { - "label": "sdf", - "name": "sdf", - "value": "sdf", - "children": null - }, - { - "label": "sfsd", - "name": "sfsd", - "value": "sfsd", - "children": null - }, - { - "label": "hello", - "name": "hello", - "value": "hello", - "children": null - }, - { - "label": "k1", - "name": "k1", - "value": "k1", - "children": null - }, - { - "label": "f2", - "name": "f2", - "value": "f2", - "children": null - }, - { - "label": "test_f1", - "name": "test_f1", - "value": "test_f1", - "children": null - }, - { - "label": "SMMF", - "name": "SMMF", - "value": "SMMF", - "children": null - }, - { - "label": "docker_xxx", - "name": "docker_xxx", - "value": "docker_xxx", - "children": null - }, - { - "label": "t2", - "name": "t2", - "value": "t2", - "children": null - }, - { - "label": "t1", - "name": "t1", - "value": "t1", - "children": null - }, - { - "label": "test_graph", - "name": "test_graph", - "value": "test_graph", - "children": null - }, - { - "label": "small", - "name": "small", - "value": "small", - "children": null - }, - { - "label": "ttt", - "name": "ttt", - "value": "ttt", - "children": null - }, - { - "label": "bf", - "name": "bf", - "value": "bf", - "children": null - }, - { - "label": "new_big_file", - "name": "new_big_file", - "value": "new_big_file", - "children": null - }, - { - "label": "test_big_fild", - "name": "test_big_fild", - "value": "test_big_fild", - "children": null - }, - { - "label": "Greenplum", - "name": "Greenplum", - "value": "Greenplum", - "children": null - }, - { - "label": "Mytest", - "name": "Mytest", - "value": "Mytest", - "children": null - }, - { - "label": "dba", - "name": "dba", - "value": "dba", - "children": null - } - ] - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Context Key", - "name": "context", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "context", - "placeholder": null, - "description": "The key of the context, it will be used in building the prompt", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Top K", - "name": "top_k", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 5, - "placeholder": null, - "description": "The number of chunks to retrieve", - "value": null, - "options": null - }, - { - "type_name": "float", - "type_cls": "builtins.float", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Minimum Match Score", - "name": "score_threshold", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 0.3, - "placeholder": null, - "description": "The minimum match score for the retrieved chunks, it will be dropped if the match score is less than the threshold", - "value": null, - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "slider", - "size": null, - "attr": { - "disabled": false, - "min": 0.0, - "max": 1.0, - "step": 0.1 - }, - "show_input": false + "variables": null, + "authors": null, + "flow_data": { + "edges": [ + { + "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 0, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "source_order": 1, + "target": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|1", + "target_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 1, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|1", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_order": 0, + "target": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "target_order": 0, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "source_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|outputs|0", + "target_handle": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0|inputs|0", + "type": "buttonedge" } - }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Reranker Enabled", - "name": "reranker_enabled", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Whether to enable the reranker", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Reranker Top K", - "name": "reranker_top_k", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 3, - "placeholder": null, - "description": "The top k for the reranker", - "value": null, - "options": null - } - ] - } - }, - { - "width": 320, - "height": 884, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "position": { - "x": 195.5602050169747, - "y": 175.41495969060128, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 195.5602050169747, - "y": 175.41495969060128, - "zoom": 0.0 - }, - "data": { - "type_name": "CommonChatPromptTemplate", - "type_cls": "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", - "label": "Common Chat Prompt Template", - "custom_label": null, - "name": "common_chat_prompt_template", - "description": "The operator to build the prompt with static prompt.", - "category": "prompt", - "category_label": "Prompt", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0", - "ui_size": "large" - }, - "resource_type": "instance", - "parent_cls": [ - "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", - "dbgpt.core.interface.prompt.ChatPromptTemplate", - "dbgpt.core.interface.prompt.BasePromptTemplate", - "pydantic.main.BaseModel" ], - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "System Message", - "name": "system_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "You are a helpful AI Assistant.", - "placeholder": null, - "description": "The system message.", - "value": "You are a helpful AI assistant.\nBased on the known information below, provide users with professional and concise answers to their questions.\nconstraints:\n 1.Ensure to include original markdown formatting elements such as images, links, tables, or code blocks without alteration in the response if they are present in the provided information.\n For example, image format should be ![image.png](xxx), link format [xxx](xxx), table format should be represented with |xxx|xxx|xxx|, and code format with xxx.\n 2.If the information available in the knowledge base is insufficient to answer the question, state clearly: \"The content provided in the knowledge base is not enough to answer this question,\" and avoid making up answers.\n 3.When responding, it is best to summarize the points in the order of 1, 2, 3, And displayed in markdwon format.\n\nknown information: \n{context}\n\nuser question:\n{user_input}\n\nwhen answering, use the same language as the \"user\".", - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "text_area", - "size": "large", - "attr": { - "disabled": false, - "status": null, - "prefix": null, - "suffix": null, - "show_count": null, - "max_length": null, - "auto_size": { - "min_rows": 2, - "max_rows": 20 + "viewport": { + "x": 900.5986504747431, + "y": 420.90015979869725, + "zoom": 0.6903331247004052 + }, + "nodes": [ + { + "width": 320, + "height": 632, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -1164.0000230376968, + "y": -501.9869760888273, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1164.0000230376968, + "y": -501.9869760888273, + "zoom": 0.0 + }, + "data": { + "label": "Common LLM Http Trigger", + "custom_label": null, + "name": "common_llm_http_trigger", + "description": "Trigger your workflow by http request, and parse the request body as a common LLM http body", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "CommonLLMHttpRequestBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint, parse as a common LLM http body", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "Request String Messages", + "custom_label": null, + "name": "request_string_messages", + "description": "The request string messages of the API endpoint, parsed from 'messages' field of the request body", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": [ + "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger.MessagesOutputMapper" + ] + } + ], + "version": "v1", + "type_name": "CommonLLMHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API Endpoint", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "/example/{dag_id}", + "placeholder": null, + "description": "The API endpoint", + "value": "/templates/{dag_id}", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Methods", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "The methods of the API endpoint", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Streaming Response", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "Whether the response is streaming", + "value": false, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Response Body", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response body of the API endpoint", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Response Media Type", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The response media type", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Http Status Code", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "The http status code", + "value": null, + "options": null + } + ] } - }, - "editor": { - "width": 800, - "height": 400 - } - } - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Message placeholder", - "name": "message_placeholder", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "chat_history", - "placeholder": null, - "description": "The chat history message placeholder.", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Human Message", - "name": "human_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "{user_input}", - "placeholder": "{user_input}", - "description": "The human message.", - "value": null, - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "text_area", - "size": "large", - "attr": { - "disabled": false, - "status": null, - "prefix": null, - "suffix": null, - "show_count": null, - "max_length": null, - "auto_size": { - "min_rows": 2, - "max_rows": 20 + }, + { + "width": 320, + "height": 910, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "position": { + "x": 661.094354143159, + "y": -368.93541722528227, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 661.094354143159, + "y": -368.93541722528227, + "zoom": 0.0 + }, + "data": { + "label": "Streaming LLM Operator", + "custom_label": null, + "name": "higher_order_streaming_llm_operator", + "description": "High-level streaming LLM operator, supports multi-round conversation (conversation window, token length and no multi-round).", + "category": "llm", + "category_label": "LLM", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "CommonLLMHttpRequestBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", + "label": "Common LLM Request Body", + "custom_label": null, + "name": "common_llm_request_body", + "description": "The common LLM request body.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "HOContextBody", + "type_cls": "dbgpt_app.operators.llm.HOContextBody", + "label": "Extra Context", + "custom_label": null, + "name": "extra_context", + "description": "Extra context for building prompt(Knowledge context, database schema, etc), you can add multiple context.", + "dynamic": true, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "ModelOutput", + "type_cls": "dbgpt.core.interface.llm.ModelOutput", + "label": "Streaming Model Output", + "custom_label": null, + "name": "streaming_model_output", + "description": "The streaming model output.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "HOStreamingLLMOperator", + "type_cls": "dbgpt_app.operators.llm.HOStreamingLLMOperator", + "parameters": [ + { + "type_name": "ChatPromptTemplate", + "type_cls": "dbgpt.core.interface.prompt.ChatPromptTemplate", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Prompt Template", + "name": "prompt_template", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The prompt template for the conversation.", + "value": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Model Name", + "name": "model", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The model name.", + "value": null, + "options": null + }, + { + "type_name": "LLMClient", + "type_cls": "dbgpt.core.interface.llm.LLMClient", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM Client", + "name": "llm_client", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The LLM Client, how to connect to the LLM model, if not provided, it will use the default client deployed by DB-GPT.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "History Message Merge Mode", + "name": "history_merge_mode", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "none", + "placeholder": null, + "description": "The history merge mode, supports 'none', 'window' and 'token'. 'none': no history merge, 'window': merge by conversation window, 'token': merge by token length.", + "value": "window", + "options": [ + { + "label": "No History", + "name": "none", + "value": "none", + "children": null + }, + { + "label": "Message Window", + "name": "window", + "value": "window", + "children": null + }, + { + "label": "Token Length", + "name": "token", + "value": "token", + "children": null + } + ], + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "select", + "size": null, + "attr": null + } + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "User Message Key", + "name": "user_message_key", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "user_input", + "placeholder": null, + "description": "The key of the user message in your prompt, default is 'user_input'.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "History Key", + "name": "history_key", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The chat history key, with chat history message pass to prompt template, if not provided, it will parse the prompt template to get the key.", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Keep Start Rounds", + "name": "keep_start_rounds", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The start rounds to keep in the chat history.", + "value": 0, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Keep End Rounds", + "name": "keep_end_rounds", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "The end rounds to keep in the chat history.", + "value": 10, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Max Token Limit", + "name": "max_token_limit", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 2048, + "placeholder": null, + "description": "The max token limit to keep in the chat history.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 774, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -781.3390803520426, + "y": 112.87665693387501, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -781.3390803520426, + "y": 112.87665693387501, + "zoom": 0.0 + }, + "data": { + "label": "Knowledge Space Operator", + "custom_label": null, + "name": "higher_order_knowledge_operator", + "description": "Knowledge Space Operator, retrieve your knowledge from knowledge space", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "User question", + "custom_label": null, + "name": "query", + "description": "The user question to retrieve the knowledge", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "HOContextBody", + "type_cls": "dbgpt_app.operators.llm.HOContextBody", + "label": "Retrieved context", + "custom_label": null, + "name": "context", + "description": "The retrieved context from the knowledge space", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "Chunk", + "type_cls": "dbgpt.core.interface.knowledge.Chunk", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The retrieved chunks from the knowledge space", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": [ + "dbgpt_app.operators.rag.HOKnowledgeOperator.ChunkMapper" + ] + } + ], + "version": "v1", + "type_name": "HOKnowledgeOperator", + "type_cls": "dbgpt_app.operators.rag.HOKnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Knowledge Space Name", + "name": "knowledge_space", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "The name of the knowledge space", + "value": "k_cmd2", + "options": [ + { + "label": "k_cmd2", + "name": "k_cmd2", + "value": "k_cmd2", + "children": null + }, + { + "label": "f5", + "name": "f5", + "value": "f5", + "children": null + }, + { + "label": "f4", + "name": "f4", + "value": "f4", + "children": null + }, + { + "label": "t333", + "name": "t333", + "value": "t333", + "children": null + }, + { + "label": "f3", + "name": "f3", + "value": "f3", + "children": null + }, + { + "label": "f1", + "name": "f1", + "value": "f1", + "children": null + }, + { + "label": "sdf", + "name": "sdf", + "value": "sdf", + "children": null + }, + { + "label": "sfsd", + "name": "sfsd", + "value": "sfsd", + "children": null + }, + { + "label": "hello", + "name": "hello", + "value": "hello", + "children": null + }, + { + "label": "k1", + "name": "k1", + "value": "k1", + "children": null + }, + { + "label": "f2", + "name": "f2", + "value": "f2", + "children": null + }, + { + "label": "test_f1", + "name": "test_f1", + "value": "test_f1", + "children": null + }, + { + "label": "SMMF", + "name": "SMMF", + "value": "SMMF", + "children": null + }, + { + "label": "docker_xxx", + "name": "docker_xxx", + "value": "docker_xxx", + "children": null + }, + { + "label": "t2", + "name": "t2", + "value": "t2", + "children": null + }, + { + "label": "t1", + "name": "t1", + "value": "t1", + "children": null + }, + { + "label": "test_graph", + "name": "test_graph", + "value": "test_graph", + "children": null + }, + { + "label": "small", + "name": "small", + "value": "small", + "children": null + }, + { + "label": "ttt", + "name": "ttt", + "value": "ttt", + "children": null + }, + { + "label": "bf", + "name": "bf", + "value": "bf", + "children": null + }, + { + "label": "new_big_file", + "name": "new_big_file", + "value": "new_big_file", + "children": null + }, + { + "label": "test_big_fild", + "name": "test_big_fild", + "value": "test_big_fild", + "children": null + }, + { + "label": "Greenplum", + "name": "Greenplum", + "value": "Greenplum", + "children": null + }, + { + "label": "Mytest", + "name": "Mytest", + "value": "Mytest", + "children": null + }, + { + "label": "dba", + "name": "dba", + "value": "dba", + "children": null + } + ] + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Context Key", + "name": "context", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "context", + "placeholder": null, + "description": "The key of the context, it will be used in building the prompt", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Top K", + "name": "top_k", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 5, + "placeholder": null, + "description": "The number of chunks to retrieve", + "value": null, + "options": null + }, + { + "type_name": "float", + "type_cls": "builtins.float", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Minimum Match Score", + "name": "score_threshold", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 0.3, + "placeholder": null, + "description": "The minimum match score for the retrieved chunks, it will be dropped if the match score is less than the threshold", + "value": null, + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "slider", + "size": null, + "attr": { + "disabled": false, + "min": 0.0, + "max": 1.0, + "step": 0.1 + }, + "show_input": false + } + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Reranker Enabled", + "name": "reranker_enabled", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Whether to enable the reranker", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Reranker Top K", + "name": "reranker_top_k", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 3, + "placeholder": null, + "description": "The top k for the reranker", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 884, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "position": { + "x": 195.5602050169747, + "y": 175.41495969060128, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 195.5602050169747, + "y": 175.41495969060128, + "zoom": 0.0 + }, + "data": { + "type_name": "CommonChatPromptTemplate", + "type_cls": "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", + "label": "Common Chat Prompt Template", + "custom_label": null, + "name": "common_chat_prompt_template", + "description": "The operator to build the prompt with static prompt.", + "category": "prompt", + "category_label": "Prompt", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0", + "ui_size": "large" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", + "dbgpt.core.interface.prompt.ChatPromptTemplate", + "dbgpt.core.interface.prompt.BasePromptTemplate", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "System Message", + "name": "system_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "You are a helpful AI Assistant.", + "placeholder": null, + "description": "The system message.", + "value": "You are a helpful AI assistant.\nBased on the known information below, provide users with professional and concise answers to their questions.\nconstraints:\n 1.Ensure to include original markdown formatting elements such as images, links, tables, or code blocks without alteration in the response if they are present in the provided information.\n For example, image format should be ![image.png](xxx), link format [xxx](xxx), table format should be represented with |xxx|xxx|xxx|, and code format with xxx.\n 2.If the information available in the knowledge base is insufficient to answer the question, state clearly: \"The content provided in the knowledge base is not enough to answer this question,\" and avoid making up answers.\n 3.When responding, it is best to summarize the points in the order of 1, 2, 3, And displayed in markdwon format.\n\nknown information: \n{context}\n\nuser question:\n{user_input}\n\nwhen answering, use the same language as the \"user\".", + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "text_area", + "size": "large", + "attr": { + "disabled": false, + "status": null, + "prefix": null, + "suffix": null, + "show_count": null, + "max_length": null, + "auto_size": { + "min_rows": 2, + "max_rows": 20 + } + }, + "editor": { + "width": 800, + "height": 400 + } + } + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Message placeholder", + "name": "message_placeholder", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "chat_history", + "placeholder": null, + "description": "The chat history message placeholder.", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Human Message", + "name": "human_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "{user_input}", + "placeholder": "{user_input}", + "description": "The human message.", + "value": null, + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "text_area", + "size": "large", + "attr": { + "disabled": false, + "status": null, + "prefix": null, + "suffix": null, + "show_count": null, + "max_length": null, + "auto_size": { + "min_rows": 2, + "max_rows": 20 + } + }, + "editor": { + "width": 800, + "height": 400 + } + } + } + ] + } + }, + { + "width": 320, + "height": 235, + "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "position": { + "x": 1087.8490700167088, + "y": 389.9348086323575, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 1087.8490700167088, + "y": 389.9348086323575, + "zoom": 0.0 + }, + "data": { + "label": "OpenAI Streaming Output Operator", + "custom_label": null, + "name": "openai_streaming_output_operator", + "description": "The OpenAI streaming LLM operator.", + "category": "output_parser", + "category_label": "Output Parser", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "transform_stream", + "inputs": [ + { + "type_name": "ModelOutput", + "type_cls": "dbgpt.core.interface.llm.ModelOutput", + "label": "Upstream Model Output", + "custom_label": null, + "name": "model_output", + "description": "The model output of upstream.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "Model Output", + "custom_label": null, + "name": "model_output", + "description": "The model output after transformed to openai stream format.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "OpenAIStreamingOutputOperator", + "type_cls": "dbgpt.model.utils.chatgpt_utils.OpenAIStreamingOutputOperator", + "parameters": [] } - }, - "editor": { - "width": 800, - "height": 400 - } } - } ] - } - }, - { - "width": 320, - "height": 235, - "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "position": { - "x": 1087.8490700167088, - "y": 389.9348086323575, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 1087.8490700167088, - "y": 389.9348086323575, - "zoom": 0.0 - }, - "data": { - "label": "OpenAI Streaming Output Operator", - "custom_label": null, - "name": "openai_streaming_output_operator", - "description": "The OpenAI streaming LLM operator.", - "category": "output_parser", - "category_label": "Output Parser", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "transform_stream", - "inputs": [ - { - "type_name": "ModelOutput", - "type_cls": "dbgpt.core.interface.llm.ModelOutput", - "label": "Upstream Model Output", - "custom_label": null, - "name": "model_output", - "description": "The model output of upstream.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "Model Output", - "custom_label": null, - "name": "model_output", - "description": "The model output after transformed to openai stream format.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "OpenAIStreamingOutputOperator", - "type_cls": "dbgpt.model.utils.chatgpt_utils.OpenAIStreamingOutputOperator", - "parameters": [] - } } - ] } - } } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/embedded-knowledge-process-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/embedded-knowledge-process-flow-template.json index 84f83f3a5..209f9dd33 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/embedded-knowledge-process-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/embedded-knowledge-process-flow-template.json @@ -1,852 +1,811 @@ { - "flow": { - "uid": "04696207-4f91-4e7e-b70c-404ed6657f92", - "label": "Embedding 向量加工工作流", - "name": "embedding_process_workflow", - "flow_category": null, - "flow_data": { - "nodes": [ - { - "width": 320, - "height": 323, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "position": { - "x": -25.997695320590083, - "y": -90.04159277333981, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "向量抽取存储算子", - "custom_label": null, - "name": "vector_storage_operator", - "description": "Persist embeddings into vector storage.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "VectorStoreBase", - "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "向量存储连接器", - "name": "vector_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "已组装的块,已持久化到向量存储中。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "VectorStorageOperator", - "type_cls": "dbgpt.rag.operators.vector_store.VectorStorageOperator" - }, - "position_absolute": { - "x": -25.997695320590083, - "y": -90.04159277333981, - "zoom": 0 - } - }, - { - "width": 320, - "height": 321, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "position": { - "x": -913.571872386726, - "y": -61.6367538649408, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档Chunk切片算子", - "custom_label": null, - "name": "chunk_manager_operator", - "description": " Split Knowledge Documents into chunks.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chunk Split Parameters", - "name": "chunk_parameters", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Chunk Split Parameters.", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "knowledge", - "description": "The knowledge to be loaded.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "ChunkManagerOperator", - "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator" - }, - "position_absolute": { - "x": -913.571872386726, - "y": -61.6367538649408, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "position": { - "x": -256.96257013540503, - "y": -509.98997877383584, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaStore", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "label": "Chroma Vector Store", - "custom_label": null, - "name": "chroma_vector_store", - "description": "Chroma 向量存储。", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chroma Config", - "name": "vector_store_config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "the chroma config of vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "dbgpt.storage.vector_store.base.VectorStoreBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -256.96257013540503, - "y": -509.98997877383584, - "zoom": 0 - } - }, - { - "width": 320, - "height": 674, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "position": { - "x": -731.2095474673597, - "y": -879.5845342539665, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "label": "Chroma Config", - "custom_label": null, - "name": "chroma_vector_config", - "description": "Chroma vector store config.", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "集合名称", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "向量存储的名称,如果未设置,将使用默认名称。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "用户", - "name": "user", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的用户,如果未设置,将使用默认用户。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "密码", - "name": "password", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的密码,如果未设置,将使用默认密码。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的嵌入函数,如果未设置,将使用默认的嵌入函数。", - "options": null, - "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "一次加载的最大块数", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "一次加载的最大块数。如果您的文档很大,可以将此值设置为较大的数字,以加快加载过程。默认值为 10。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大线程数", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "要使用的最大线程数。默认值为 1。如果您将此值设置为大于 1,请确保您的向量存储是线程安全的。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Persist Path", - "name": "persist_path", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的持久化路径。", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dbgpt.storage.vector_store.base.VectorStoreConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -731.2095474673597, - "y": -879.5845342539665, - "zoom": 0 - } - }, - { - "width": 320, - "height": 431, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -1517.087378905087, - "y": -191.2030717055229, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档知识加载算子", - "custom_label": null, - "name": "knowledge_operator", - "description": "知识算子,可以从数据源创建知识。", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": "https://github.com/openai/openai-python", - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "默认数据源", - "name": "datasource", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "默认数据源。", - "options": null, - "value": "../../docs/docs/awel/awel.md", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "知识类型", - "name": "knowledge_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "DOCUMENT", - "placeholder": null, - "description": "知识类型。", - "options": [ + "flow": { + "uid": "9d47fbd8-420d-439a-bda7-7ff7f6fa01db", + "label": "Embedding 向量加工工作流", + "name": "embedding_process_workflow", + "flow_category": null, + "description": "Embedding知识加工工作流", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-12-16 15:20:10", + "gmt_modified": "2024-12-16 15:20:10", + "metadata": { + "triggers": [ { - "label": "DOCUMENT", - "name": "DOCUMENT", - "value": "DOCUMENT", - "children": null - }, - { - "label": "URL", - "name": "URL", - "value": "URL", - "children": null - }, - { - "label": "TEXT", - "name": "TEXT", - "value": "TEXT", - "children": null + "trigger_type": "http" } - ], - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "知识数据源", - "custom_label": null, - "name": "knowledge datasource", - "description": "知识数据源,可以是文档、网址或文本。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "Knowledge", - "description": "知识对象。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator" + ], + "sse_output": false, + "streaming_output": false, + "tags": {} }, - "position_absolute": { - "x": -1517.087378905087, - "y": -191.2030717055229, - "zoom": 0 - } - }, - { - "width": 320, - "height": 602, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "字典 HTTP 触发器", - "custom_label": null, - "name": "dict_http_trigger", - "description": "通过 HTTP 请求触发您的工作流,并将请求主体解析为字典", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API 端点", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "API 端点", - "options": null, - "value": "/rag/knowledge/embedding/process", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 方法", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API 端点的方法", - "options": [ + "variables": null, + "authors": null, + "flow_data": { + "edges": [ { - "label": "HTTP PUT 方法", - "name": "http_put", - "value": "PUT", - "children": null + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" }, { - "label": "HTTP POST 方法", - "name": "http_post", - "value": "POST", - "children": null + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "target_order": 3, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", + "type": "buttonedge" + }, + { + "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" } - ], - "value": null, - "alias": null, - "ui": null + ], + "viewport": { + "x": 831.8128405437491, + "y": 421.4753242151554, + "zoom": 0.3846854569072972 }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "响应是否为流式传输", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API 端点的响应主体", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "响应媒体类型", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "响应的媒体类型", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 状态码", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP 状态码", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API 端点的请求主体", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "DictHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger" - }, - "position_absolute": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 + "nodes": [ + { + "width": 320, + "height": 323, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "position": { + "x": -25.997695320590083, + "y": -90.04159277333981, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -25.997695320590083, + "y": -90.04159277333981, + "zoom": 0.0 + }, + "data": { + "label": "向量存储算子", + "custom_label": null, + "name": "vector_storage_operator", + "description": "将嵌入持久化到向量存储中。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to vector store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "VectorStorageOperator", + "type_cls": "dbgpt_ext.rag.operators.vector_store.VectorStorageOperator", + "parameters": [ + { + "type_name": "VectorStoreBase", + "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "向量存储连接器", + "name": "vector_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "向量存储。", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 321, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "position": { + "x": -913.571872386726, + "y": -61.6367538649408, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -913.571872386726, + "y": -61.6367538649408, + "zoom": 0.0 + }, + "data": { + "label": "Chunk Manager Operator", + "custom_label": null, + "name": "chunk_manager_operator", + "description": " Split Knowledge Documents into chunks.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "knowledge", + "description": "The knowledge to be loaded.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "ChunkManagerOperator", + "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator", + "parameters": [ + { + "type_name": "ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chunk Split Parameters", + "name": "chunk_parameters", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Chunk Split Parameters.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "position": { + "x": -256.96257013540503, + "y": -509.98997877383584, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -256.96257013540503, + "y": -509.98997877383584, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaStore", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaStore", + "label": "Chroma 向量存储", + "custom_label": null, + "name": "chroma_vector_store", + "description": "Chroma 向量存储。", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaStore_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaStore", + "dbgpt.storage.vector_store.base.VectorStoreBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chroma 配置", + "name": "vector_store_config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的 Chroma 配置。", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 674, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "position": { + "x": -731.2095474673597, + "y": -879.5845342539665, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -731.2095474673597, + "y": -879.5845342539665, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "label": "Chroma 配置", + "custom_label": null, + "name": "chroma_vector_config", + "description": "Chroma 向量存储配置。", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", + "dbgpt.storage.vector_store.base.VectorStoreConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "集合名称", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "向量存储的名称,如果不设置,将使用默认名称。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "用户", + "name": "user", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的用户,如果不设置,将使用默认用户。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "密码", + "name": "password", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的密码,如果不设置,将使用默认密码。", + "value": null, + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "嵌入函数", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的嵌入函数,如果不设置,将使用默认嵌入函数。", + "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "一次加载的最大块数", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "一次加载的最大块数。如果文档较大,可以将此值设置为较大的数字以加快加载过程,默认值为 10。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最大线程数", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "使用的最大线程数,默认值为 1。如果设置为大于 1,请确保向量存储是线程安全的。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "持久化路径", + "name": "persist_path", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的持久化路径。", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 431, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -1517.087378905087, + "y": -191.2030717055229, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1517.087378905087, + "y": -191.2030717055229, + "zoom": 0.0 + }, + "data": { + "label": "知识加载算子", + "custom_label": null, + "name": "knowledge_operator", + "description": "知识算子,可以从数据源创建知识。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": "https://github.com/openai/openai-python", + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "knowledge datasource", + "custom_label": null, + "name": "knowledge datasource", + "description": "knowledge datasource, which can be a document, url, or text.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "Knowledge", + "description": "Knowledge object.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "默认数据源", + "name": "datasource", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "默认数据源。", + "value": "../../docs/docs/awel/awel.md", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识类型", + "name": "knowledge_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "DOCUMENT", + "placeholder": null, + "description": "知识类型。", + "value": null, + "options": [ + { + "label": "DOCUMENT", + "name": "DOCUMENT", + "value": "DOCUMENT", + "children": null + }, + { + "label": "URL", + "name": "URL", + "value": "URL", + "children": null + }, + { + "label": "TEXT", + "name": "TEXT", + "value": "TEXT", + "children": null + } + ] + } + ] + } + }, + { + "width": 320, + "height": 602, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "data": { + "label": "字典 HTTP 触发器", + "custom_label": null, + "name": "dict_http_trigger", + "description": "通过 HTTP 请求触发工作流,并将请求体解析为字典", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "DictHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API 端点", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "API 端点", + "value": "/rag/knowledge/embedding/process", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 方法", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "API 端点的方法", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "流式响应", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "响应是否为流式", + "value": null, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 响应体", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "API 端点的响应体", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "响应媒体类型", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "响应媒体类型", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 状态码", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "HTTP 状态码", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 148, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "position": { + "x": -1297.0596621977236, + "y": -756.4644248292581, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1297.0596621977236, + "y": -756.4644248292581, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultEmbeddings", + "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "label": "Default Embeddings", + "custom_label": null, + "name": "default_embeddings", + "description": "Default embeddings(using default embedding model of current system)", + "category": "embeddings", + "category_label": "Embeddings", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "dbgpt.core.interface.embeddings.Embeddings" + ], + "parameters": [] + } + } + ] } - }, - { - "width": 320, - "height": 148, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "position": { - "x": -1297.0596621977236, - "y": -756.4644248292581, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultEmbeddings", - "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "label": "默认Embedding转换", - "custom_label": null, - "name": "default_embeddings", - "description": "默认嵌入式(使用当前系统的默认嵌入式模型)", - "category": "embeddings", - "category_label": "Embeddings", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "dbgpt.core.interface.embeddings.Embeddings" - ] - }, - "position_absolute": { - "x": -1297.0596621977236, - "y": -756.4644248292581, - "zoom": 0 - } - } - ], - "edges": [ - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "target_order": 3, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", - "type": "buttonedge" - }, - { - "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 831.8128405437491, - "y": 421.4753242151554, - "zoom": 0.3846854569072972 } - }, - "description": "Embedding知识加工工作流", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_embedding_process_workflow_04696207-4f91-4e7e-b70c-404ed6657f92", - "gmt_created": "2024-12-16 15:20:10", - "gmt_modified": "2024-12-16 15:20:10", - "metadata": { - "sse_output": false, - "streaming_output": false, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/rag/embdding/process", - "methods": [ - "POST" - ], - "trigger_mode": "command" - } - ] - }, - "variables": null, - "authors": null -} } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/hybrid-knowldge-process-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/hybrid-knowldge-process-flow-template.json index 09bb0e30d..020f4289a 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/hybrid-knowldge-process-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/hybrid-knowldge-process-flow-template.json @@ -1,1464 +1,1403 @@ { - "flow": { - "uid": "fa8f01ab-fc7b-4e35-9533-f8e4cf045cce", - "label": "Knowledge Process Workflow", - "name": "hybrid_knowledge_process_workflow_zh", - "flow_category": null, - "flow_data": { - "nodes": [ - { - "width": 320, - "height": 275, - "id": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "position": { - "x": 604.5, - "y": 77, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "Embedded & KG 结果聚合算子", - "custom_label": null, - "name": "knowledge_process_join_operator", - "description": "Join Branch the workflow based on the Knowledge Process Results.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [], - "operator_type": "join", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Knowledge Graph Storage Results", - "custom_label": null, - "name": "input_value", - "description": "knowledge graph storage results.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - }, - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Knowledge Graph Storage Results", - "custom_label": null, - "name": "input_value", - "description": "knowledge graph storage results.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "Knowledge Process Results.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeProcessJoinOperator", - "type_cls": "dbgpt.rag.operators.process_branch.KnowledgeProcessJoinOperator" - }, - "position_absolute": { - "x": 604.5, - "y": 77, - "zoom": 0 - } - }, - { - "width": 320, - "height": 323, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "position": { - "x": 174.16583729394188, - "y": -131.63401513480102, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "向量抽取存储算子", - "custom_label": null, - "name": "vector_storage_operator", - "description": "Persist embeddings into vector storage.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "VectorStoreBase", - "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "向量存储连接器", - "name": "vector_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "已组装的块,已持久化到向量存储中。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "VectorStorageOperator", - "type_cls": "dbgpt.rag.operators.vector_store.VectorStorageOperator" - }, - "position_absolute": { - "x": 174.16583729394188, - "y": -131.63401513480102, - "zoom": 0 - } - }, - { - "width": 320, - "height": 323, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "position": { - "x": 180.89103763027083, - "y": 341.37174185366564, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "知识图谱抽取算子", - "custom_label": null, - "name": "knowledge_graph_operator", - "description": "Extract Documents and persist into graph database.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "KnowledgeGraphBase", - "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Connector", - "name": "graph_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The knowledge graph.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "已组装的块,已持久化到向量存储中。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeGraphOperator", - "type_cls": "dbgpt.rag.operators.knowledge_graph.KnowledgeGraphOperator" - }, - "position_absolute": { - "x": 180.89103763027083, - "y": 341.37174185366564, - "zoom": 0 - } - }, - { - "width": 320, - "height": 321, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "position": { - "x": -1056.545824254249, - "y": -163.01828337100258, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档Chunk切片算子", - "custom_label": null, - "name": "chunk_manager_operator", - "description": " Split Knowledge Documents into chunks.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chunk Split Parameters", - "name": "chunk_parameters", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Chunk Split Parameters.", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "knowledge", - "description": "The knowledge to be loaded.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "ChunkManagerOperator", - "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator" - }, - "position_absolute": { - "x": -1056.545824254249, - "y": -163.01828337100258, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "position": { - "x": -306.391788536534, - "y": 491.0961943850906, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraph", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "label": "Builtin Knowledge Graph", - "custom_label": null, - "name": "builtin_knowledge_graph", - "description": "Builtin Knowledge Graph.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Builtin Knowledge Graph Config.", - "name": "config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Builtin Knowledge Graph Config.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -306.391788536534, - "y": 491.0961943850906, - "zoom": 0 - } - }, - { - "width": 320, - "height": 645, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "position": { - "x": -813.7432345424928, - "y": 328.2957752754239, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "label": "Builtin Graph Config", - "custom_label": null, - "name": "knowledge_graph_config", - "description": "knowledge graph config.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Graph Name", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "The name of Graph, if not set, will use the default name.", - "options": null, - "value": "dbgpt_collection_V1", - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的嵌入函数,如果未设置,将使用默认的嵌入函数。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "一次加载的最大块数", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "一次加载的最大块数。如果您的文档很大,可以将此值设置为较大的数字,以加快加载过程。默认值为 10。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大线程数", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "要使用的最大线程数。默认值为 1。如果您将此值设置为大于 1,请确保您的向量存储是线程安全的。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Type", - "name": "graph_store_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "graph store type.", - "options": null, - "value": "TuGraph", - "alias": null, - "ui": null - }, - { - "type_name": "LLMClient", - "type_cls": "dbgpt.core.interface.llm.LLMClient", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Client", - "name": "llm_client", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "llm client for extract graph triplets.", - "options": null, - "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Model Name", - "name": "model_name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "llm model name.", - "options": null, - "value": "zhipu_proxyllm", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -813.7432345424928, - "y": 328.2957752754239, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "position": { - "x": -251.7635173402225, - "y": -367.01602690631285, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaStore", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "label": "Chroma Vector Store", - "custom_label": null, - "name": "chroma_vector_store", - "description": "Chroma 向量存储。", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chroma Config", - "name": "vector_store_config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "the chroma config of vector store.", - "options": null, - "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaStore", - "dbgpt.storage.vector_store.base.VectorStoreBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -251.7635173402225, - "y": -367.01602690631285, - "zoom": 0 - } - }, - { - "width": 320, - "height": 674, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "position": { - "x": -684.4180723107158, - "y": -934.1745886033843, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "ChromaVectorConfig", - "type_cls": "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "label": "Chroma Config", - "custom_label": null, - "name": "chroma_vector_config", - "description": "Chroma vector store config.", - "category": "vector_store", - "category_label": "Vector Store", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "集合名称", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "向量存储的名称,如果未设置,将使用默认名称。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "用户", - "name": "user", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的用户,如果未设置,将使用默认用户。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "密码", - "name": "password", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的密码,如果未设置,将使用默认密码。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的嵌入函数,如果未设置,将使用默认的嵌入函数。", - "options": null, - "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "一次加载的最大块数", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "一次加载的最大块数。如果您的文档很大,可以将此值设置为较大的数字,以加快加载过程。默认值为 10。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大线程数", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "要使用的最大线程数。默认值为 1。如果您将此值设置为大于 1,请确保您的向量存储是线程安全的。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Persist Path", - "name": "persist_path", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的持久化路径。", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", - "dbgpt.storage.vector_store.base.VectorStoreConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -684.4180723107158, - "y": -934.1745886033843, - "zoom": 0 - } - }, - { - "width": 320, - "height": 431, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -1558.679801266548, - "y": -149.61064934406164, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档知识加载算子", - "custom_label": null, - "name": "knowledge_operator", - "description": "知识算子,可以从数据源创建知识。", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": "https://github.com/openai/openai-python", - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "默认数据源", - "name": "datasource", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "默认数据源。", - "options": null, - "value": "../../docs/docs/awel/awel.md", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "知识类型", - "name": "knowledge_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "DOCUMENT", - "placeholder": null, - "description": "知识类型。", - "options": [ + "flow": { + "uid": "382e5131-cabc-4665-bffc-8f83be2e8fa8", + "label": "Knowledge Process Workflow", + "name": "hybrid_knowledge_process_workflow_zh", + "flow_category": null, + "description": "结合Embedding和知识图谱抽取的混合知识加工工作流", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-12-14 15:57:44", + "gmt_modified": "2024-12-14 15:57:44", + "metadata": { + "triggers": [ { - "label": "DOCUMENT", - "name": "DOCUMENT", - "value": "DOCUMENT", - "children": null - }, - { - "label": "URL", - "name": "URL", - "value": "URL", - "children": null - }, - { - "label": "TEXT", - "name": "TEXT", - "value": "TEXT", - "children": null + "trigger_type": "http" } - ], - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "知识数据源", - "custom_label": null, - "name": "knowledge datasource", - "description": "知识数据源,可以是文档、网址或文本。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "Knowledge", - "description": "知识对象。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator" + ], + "sse_output": false, + "streaming_output": false, + "tags": {} }, - "position_absolute": { - "x": -1558.679801266548, - "y": -149.61064934406164, - "zoom": 0 - } - }, - { - "width": 320, - "height": 602, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "字典 HTTP 触发器", - "custom_label": null, - "name": "dict_http_trigger", - "description": "通过 HTTP 请求触发您的工作流,并将请求主体解析为字典", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API 端点", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "API 端点", - "options": null, - "value": "/rag/knowledge/hybrid/process", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 方法", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API 端点的方法", - "options": [ + "variables": null, + "authors": null, + "flow_data": { + "edges": [ { - "label": "HTTP PUT 方法", - "name": "http_put", - "value": "PUT", - "children": null + "source": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0|operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "source_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" }, { - "label": "HTTP POST 方法", - "name": "http_post", - "value": "POST", - "children": null + "source": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "target_order": 1, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0|inputs|1", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_order": 0, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "target_order": 0, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "source_order": 0, + "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "target_order": 3, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", + "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "target_order": 5, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_process_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_process_operator___$$___rag___$$___v1_0", + "source_order": 1, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|outputs|1", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_process_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_process_operator___$$___rag___$$___v1_0", + "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" } - ], - "value": null, - "alias": null, - "ui": null + ], + "viewport": { + "x": 862.7562630728534, + "y": 416.4952851718194, + "zoom": 0.3836649890553727 }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "响应是否为流式传输", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API 端点的响应主体", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "响应媒体类型", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "响应的媒体类型", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 状态码", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP 状态码", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API 端点的请求主体", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "DictHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger" - }, - "position_absolute": { - "x": -2015.3280350941911, - "y": -603.9181210010445, - "zoom": 0 + "nodes": [ + { + "width": 320, + "height": 275, + "id": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "position": { + "x": 604.5, + "y": 77.0, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 604.5, + "y": 77.0, + "zoom": 0.0 + }, + "data": { + "label": "知识处理合并算子", + "custom_label": null, + "name": "knowledge_process_join_operator", + "description": "根据知识处理结果合并工作流分支。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "join", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Knowledge Graph Storage Results", + "custom_label": null, + "name": "input_value", + "description": "knowledge graph storage results.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + }, + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Knowledge Graph Storage Results", + "custom_label": null, + "name": "input_value", + "description": "knowledge graph storage results.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "Knowledge Process Results.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeProcessJoinOperator", + "type_cls": "dbgpt_ext.rag.operators.process_branch.KnowledgeProcessJoinOperator", + "parameters": [] + } + }, + { + "width": 320, + "height": 323, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "position": { + "x": 174.16583729394188, + "y": -131.63401513480102, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 174.16583729394188, + "y": -131.63401513480102, + "zoom": 0.0 + }, + "data": { + "label": "向量存储算子", + "custom_label": null, + "name": "vector_storage_operator", + "description": "将嵌入持久化到向量存储中。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_vector_storage_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to vector store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "VectorStorageOperator", + "type_cls": "dbgpt_ext.rag.operators.vector_store.VectorStorageOperator", + "parameters": [ + { + "type_name": "VectorStoreBase", + "type_cls": "dbgpt.storage.vector_store.base.VectorStoreBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "向量存储连接器", + "name": "vector_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "向量存储。", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 323, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "position": { + "x": 180.89103763027083, + "y": 341.37174185366564, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 180.89103763027083, + "y": 341.37174185366564, + "zoom": 0.0 + }, + "data": { + "label": "知识图谱算子", + "custom_label": null, + "name": "knowledge_graph_operator", + "description": "提取文档并持久化到图数据库中。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to graph store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeGraphOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge_graph.KnowledgeGraphOperator", + "parameters": [ + { + "type_name": "KnowledgeGraphBase", + "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识图谱连接器", + "name": "graph_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "知识图谱。", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 321, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "position": { + "x": -1056.545824254249, + "y": -163.01828337100258, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1056.545824254249, + "y": -163.01828337100258, + "zoom": 0.0 + }, + "data": { + "label": "Chunk Manager Operator", + "custom_label": null, + "name": "chunk_manager_operator", + "description": " Split Knowledge Documents into chunks.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "knowledge", + "description": "The knowledge to be loaded.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "ChunkManagerOperator", + "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator", + "parameters": [ + { + "type_name": "ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chunk Split Parameters", + "name": "chunk_parameters", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Chunk Split Parameters.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "position": { + "x": -306.391788536534, + "y": 491.0961943850906, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -306.391788536534, + "y": 491.0961943850906, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraph", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "label": "内置知识图谱", + "custom_label": null, + "name": "builtin_knowledge_graph", + "description": "内置知识图谱。", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "内置知识图谱配置。", + "name": "config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "内置知识图谱配置。", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 645, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "position": { + "x": -813.7432345424928, + "y": 328.2957752754239, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -813.7432345424928, + "y": 328.2957752754239, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "label": "内置图配置", + "custom_label": null, + "name": "knowledge_graph_config", + "description": "知识图谱配置。", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "图名称", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "图的名称,如果不设置,将使用默认名称。", + "value": "dbgpt_collection_V1", + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "嵌入函数", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的嵌入函数,如果不设置,将使用默认嵌入函数。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "一次加载的最大块数", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "一次加载的最大块数。如果文档较大,可以将此值设置为较大的数字以加快加载过程,默认值为 10。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最大线程数", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "使用的最大线程数,默认值为 1。如果设置为大于 1,请确保向量存储是线程安全的。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识图谱类型", + "name": "graph_store_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "TuGraph", + "placeholder": null, + "description": "图存储类型。", + "value": "TuGraph", + "options": null + }, + { + "type_name": "LLMClient", + "type_cls": "dbgpt.core.interface.llm.LLMClient", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM 客户端", + "name": "llm_client", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "用于提取图三元组的 LLM 客户端。", + "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM 模型名称", + "name": "model_name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "LLM 模型名称。", + "value": "zhipu_proxyllm", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", + "position": { + "x": -251.7635173402225, + "y": -367.01602690631285, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -251.7635173402225, + "y": -367.01602690631285, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaStore", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaStore", + "label": "Chroma 向量存储", + "custom_label": null, + "name": "chroma_vector_store", + "description": "Chroma 向量存储。", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaStore_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaStore", + "dbgpt.storage.vector_store.base.VectorStoreBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chroma 配置", + "name": "vector_store_config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的 Chroma 配置。", + "value": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 674, + "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "position": { + "x": -684.4180723107158, + "y": -934.1745886033843, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -684.4180723107158, + "y": -934.1745886033843, + "zoom": 0.0 + }, + "data": { + "type_name": "ChromaVectorConfig", + "type_cls": "dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig", + "label": "Chroma 配置", + "custom_label": null, + "name": "chroma_vector_config", + "description": "Chroma 向量存储配置。", + "category": "vector_store", + "category_label": "Vector Store", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.vector_store.chroma_store.ChromaVectorConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig", + "dbgpt.storage.vector_store.base.VectorStoreConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "集合名称", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "向量存储的名称,如果不设置,将使用默认名称。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "用户", + "name": "user", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的用户,如果不设置,将使用默认用户。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "密码", + "name": "password", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的密码,如果不设置,将使用默认密码。", + "value": null, + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "嵌入函数", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的嵌入函数,如果不设置,将使用默认嵌入函数。", + "value": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "一次加载的最大块数", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "一次加载的最大块数。如果文档较大,可以将此值设置为较大的数字以加快加载过程,默认值为 10。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最大线程数", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "使用的最大线程数,默认值为 1。如果设置为大于 1,请确保向量存储是线程安全的。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "持久化路径", + "name": "persist_path", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的持久化路径。", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 431, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -1558.679801266548, + "y": -149.61064934406164, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1558.679801266548, + "y": -149.61064934406164, + "zoom": 0.0 + }, + "data": { + "label": "知识加载算子", + "custom_label": null, + "name": "knowledge_operator", + "description": "知识算子,可以从数据源创建知识。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": "https://github.com/openai/openai-python", + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "knowledge datasource", + "custom_label": null, + "name": "knowledge datasource", + "description": "knowledge datasource, which can be a document, url, or text.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "Knowledge", + "description": "Knowledge object.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "默认数据源", + "name": "datasource", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "默认数据源。", + "value": "../../docs/docs/awel/awel.md", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识类型", + "name": "knowledge_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "DOCUMENT", + "placeholder": null, + "description": "知识类型。", + "value": null, + "options": [ + { + "label": "DOCUMENT", + "name": "DOCUMENT", + "value": "DOCUMENT", + "children": null + }, + { + "label": "URL", + "name": "URL", + "value": "URL", + "children": null + }, + { + "label": "TEXT", + "name": "TEXT", + "value": "TEXT", + "children": null + } + ] + } + ] + } + }, + { + "width": 320, + "height": 602, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -2015.3280350941911, + "y": -603.9181210010445, + "zoom": 0.0 + }, + "data": { + "label": "字典 HTTP 触发器", + "custom_label": null, + "name": "dict_http_trigger", + "description": "通过 HTTP 请求触发工作流,并将请求体解析为字典", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "DictHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API 端点", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "API 端点", + "value": "/rag/knowledge/hybrid/process", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 方法", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "API 端点的方法", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "流式响应", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "响应是否为流式", + "value": null, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 响应体", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "API 端点的响应体", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "响应媒体类型", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "响应媒体类型", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 状态码", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "HTTP 状态码", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 148, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "position": { + "x": -1112.4932879687394, + "y": -753.8648984316667, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1112.4932879687394, + "y": -753.8648984316667, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultEmbeddings", + "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "label": "Default Embeddings", + "custom_label": null, + "name": "default_embeddings", + "description": "Default embeddings(using default embedding model of current system)", + "category": "embeddings", + "category_label": "Embeddings", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", + "dbgpt.core.interface.embeddings.Embeddings" + ], + "parameters": [] + } + }, + { + "width": 320, + "height": 272, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "position": { + "x": -1350.535131696419, + "y": 435.2340305150391, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1350.535131696419, + "y": 435.2340305150391, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultLLMClient", + "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", + "label": "默认 LLM 客户端", + "custom_label": null, + "name": "default_llm_client", + "description": "默认 LLM 客户端(连接到你的 DB-GPT 模型服务)", + "category": "llm_client", + "category_label": "LLM Client", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.model.cluster.client.DefaultLLMClient", + "dbgpt.core.interface.llm.LLMClient" + ], + "parameters": [ + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "自动转换消息", + "name": "auto_convert_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": true, + "placeholder": null, + "description": "是否自动将 LLM 不支持的消息转换为兼容格式", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 295, + "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0", + "position": { + "x": -614.4846931519926, + "y": -92.5163519851338, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -614.4846931519926, + "y": -92.5163519851338, + "zoom": 0.0 + }, + "data": { + "label": "知识处理分支算子", + "custom_label": null, + "name": "knowledge_process_operator", + "description": "根据请求的流标志分支工作流。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "branch", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Document Chunks", + "custom_label": null, + "name": "input_value", + "description": "The input value of the operator.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "Chunks for Full Text Connector.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + }, + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "Chunks for Full Text Connector.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + }, + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "Chunks for Full Text Connector.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeProcessBranchOperator", + "type_cls": "dbgpt_ext.rag.operators.process_branch.KnowledgeProcessBranchOperator", + "parameters": [] + } + } + ] } - }, - { - "width": 320, - "height": 148, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "position": { - "x": -1112.4932879687394, - "y": -753.8648984316667, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultEmbeddings", - "type_cls": "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "label": "默认Embedding转换", - "custom_label": null, - "name": "default_embeddings", - "description": "默认嵌入式(使用当前系统的默认嵌入式模型)", - "category": "embeddings", - "category_label": "Embeddings", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings", - "dbgpt.core.interface.embeddings.Embeddings" - ] - }, - "position_absolute": { - "x": -1112.4932879687394, - "y": -753.8648984316667, - "zoom": 0 - } - }, - { - "width": 320, - "height": 272, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "position": { - "x": -1350.535131696419, - "y": 435.2340305150391, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultLLMClient", - "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", - "label": "默认 LLM 客户端", - "custom_label": null, - "name": "default_llm_client", - "description": "默认 LLM 客户端(连接到您的 DB-GPT 模型服务)", - "category": "llm_client", - "category_label": "LLM Client", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "自动转换消息", - "name": "auto_convert_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": true, - "placeholder": null, - "description": "是否将 LLM 不支持的消息自动转换为兼容格式", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.model.cluster.client.DefaultLLMClient", - "dbgpt.core.interface.llm.LLMClient" - ] - }, - "position_absolute": { - "x": -1350.535131696419, - "y": 435.2340305150391, - "zoom": 0 - } - }, - { - "width": 320, - "height": 295, - "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0", - "position": { - "x": -614.4846931519926, - "y": -92.5163519851338, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "知识加工处理分支算子", - "custom_label": null, - "name": "knowledge_process_operator", - "description": "Branch the workflow based on the stream flag of the request.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [], - "operator_type": "branch", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "Document Chunks", - "custom_label": null, - "name": "input_value", - "description": "The input value of the operator.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "Chunks for Vector Storage Connector.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - }, - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "Chunks for Knowledge Graph Connector.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - }, - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "Chunks for Full Text Connector.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeProcessBranchOperator", - "type_cls": "dbgpt.rag.operators.process_branch.KnowledgeProcessBranchOperator" - }, - "position_absolute": { - "x": -614.4846931519926, - "y": -92.5163519851338, - "zoom": 0 - } - } - ], - "edges": [ - { - "source": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_vector_storage_operator___$$___rag___$$___v1_0|operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "source_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "target_order": 1, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|operator_knowledge_process_join_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_process_join_operator___$$___rag___$$___v1_0|inputs|1", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_order": 0, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "target_order": 0, - "id": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0", - "source_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaStore_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0", - "source_order": 0, - "target": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "target_order": 3, - "id": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0", - "source_handle": "resource_dbgpt.rag.embedding.embedding_factory.DefaultEmbeddings_0|outputs|0", - "target_handle": "resource_dbgpt.storage.vector_store.chroma_store.ChromaVectorConfig_0|parameters|3", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "target_order": 5, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_process_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_vector_storage_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0|operator_vector_storage_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_vector_storage_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_process_operator___$$___rag___$$___v1_0", - "source_order": 1, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_process_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|outputs|1", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_process_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_process_operator___$$___rag___$$___v1_0", - "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_process_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 862.7562630728534, - "y": 416.4952851718194, - "zoom": 0.3836649890553727 } - }, - "description": "结合Embedding和知识图谱抽取的混合知识加工工作流", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_knowledge_factory_workflow_fa8f01ab-fc7b-4e35-9533-f8e4cf045cce", - "gmt_created": "2024-12-14 15:57:44", - "gmt_modified": "2024-12-14 15:57:44", - "metadata": { - "sse_output": false, - "streaming_output": false, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/rag/knowledge/process", - "methods": [ - "POST" - ], - "trigger_mode": "command" - } - ] - }, - "variables": null, - "authors": null -} } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/kg-knowledge-process-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/kg-knowledge-process-flow-template.json index 8f8f4a67d..b55bdd3b8 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/kg-knowledge-process-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/kg-knowledge-process-flow-template.json @@ -1,872 +1,829 @@ { - "flow": { - "uid": "feb180ad-0f02-42c9-983d-70eb5ae9b346", - "label": "知识图谱加工工作流", - "name": "knowledge_graph_process_workflow", - "flow_category": null, - "flow_data": { - "nodes": [ - { - "width": 320, - "height": 323, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "position": { - "x": 6.722768991652174, - "y": -225.32501282124363, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "知识图谱抽取算子", - "custom_label": null, - "name": "knowledge_graph_operator", - "description": "Extract Documents and persist into graph database.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "KnowledgeGraphBase", - "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Connector", - "name": "graph_store", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "The knowledge graph.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The text split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "已组装的块,已持久化到向量存储中。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeGraphOperator", - "type_cls": "dbgpt.rag.operators.knowledge_graph.KnowledgeGraphOperator" - }, - "position_absolute": { - "x": 6.722768991652174, - "y": -225.32501282124363, - "zoom": 0 - } - }, - { - "width": 320, - "height": 321, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "position": { - "x": -812.1903428806644, - "y": -415.17234393736123, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档Chunk切片算子", - "custom_label": null, - "name": "chunk_manager_operator", - "description": " Split Knowledge Documents into chunks.", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "ChunkParameters", - "type_cls": "dbgpt.rag.chunk_manager.ChunkParameters", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Chunk Split Parameters", - "name": "chunk_parameters", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Chunk Split Parameters.", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "knowledge", - "description": "The knowledge to be loaded.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "List", - "type_cls": "typing.List", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "The split chunks by chunk manager.", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "ChunkManagerOperator", - "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator" - }, - "position_absolute": { - "x": -812.1903428806644, - "y": -415.17234393736123, - "zoom": 0 - } - }, - { - "width": 320, - "height": 234, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "position": { - "x": -446.7662140064656, - "y": 116.76439313193941, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraph", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "label": "Builtin Knowledge Graph", - "custom_label": null, - "name": "builtin_knowledge_graph", - "description": "Builtin Knowledge Graph.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Builtin Knowledge Graph Config.", - "name": "config", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "Builtin Knowledge Graph Config.", - "options": null, - "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", - "dbgpt.rag.index.base.IndexStoreBase" - ] - }, - "position_absolute": { - "x": -446.7662140064656, - "y": 116.76439313193941, - "zoom": 0 - } - }, - { - "width": 320, - "height": 645, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "position": { - "x": -915.1247640485547, - "y": 148.92845384162234, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "BuiltinKnowledgeGraphConfig", - "type_cls": "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "label": "Builtin Graph Config", - "custom_label": null, - "name": "knowledge_graph_config", - "description": "knowledge graph config.", - "category": "knowledge_graph", - "category_label": "Knowledge Graph", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Graph Name", - "name": "name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "dbgpt_collection", - "placeholder": null, - "description": "The name of Graph, if not set, will use the default name.", - "options": null, - "value": "dbgpt_collection_V1", - "alias": null, - "ui": null - }, - { - "type_name": "Embeddings", - "type_cls": "dbgpt.core.interface.embeddings.Embeddings", - "dynamic": false, - "dynamic_minimum": 0, - "label": "嵌入函数", - "name": "embedding_fn", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "向量存储的嵌入函数,如果未设置,将使用默认的嵌入函数。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "一次加载的最大块数", - "name": "max_chunks_once_load", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 10, - "placeholder": null, - "description": "一次加载的最大块数。如果您的文档很大,可以将此值设置为较大的数字,以加快加载过程。默认值为 10。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大线程数", - "name": "max_threads", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 1, - "placeholder": null, - "description": "要使用的最大线程数。默认值为 1。如果您将此值设置为大于 1,请确保您的向量存储是线程安全的。", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "Knowledge Graph Type", - "name": "graph_store_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "graph store type.", - "options": null, - "value": "TuGraph", - "alias": null, - "ui": null - }, - { - "type_name": "LLMClient", - "type_cls": "dbgpt.core.interface.llm.LLMClient", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Client", - "name": "llm_client", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "llm client for extract graph triplets.", - "options": null, - "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM Model Name", - "name": "model_name", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "llm model name.", - "options": null, - "value": "zhipu_proxyllm", - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", - "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", - "dbgpt.rag.index.base.IndexStoreConfig", - "pydantic.main.BaseModel" - ] - }, - "position_absolute": { - "x": -915.1247640485547, - "y": 148.92845384162234, - "zoom": 0 - } - }, - { - "width": 320, - "height": 431, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -1381.9120062303377, - "y": -370.57039313932444, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "文档知识加载算子", - "custom_label": null, - "name": "knowledge_operator", - "description": "知识算子,可以从数据源创建知识。", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": "https://github.com/openai/openai-python", - "id": "operator_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "默认数据源", - "name": "datasource", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "默认数据源。", - "options": null, - "value": "../../docs/docs/awel/awel.md", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "知识类型", - "name": "knowledge_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "DOCUMENT", - "placeholder": null, - "description": "知识类型。", - "options": [ + "flow": { + "uid": "5ffb9d22-f749-4338-8562-141d276b54c7", + "label": "知识图谱加工工作流", + "name": "knowledge_graph_process_workflow", + "flow_category": null, + "description": "知识图谱知识加工工作流", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-12-16 17:51:31", + "gmt_modified": "2024-12-16 17:51:31", + "metadata": { + "triggers": [ { - "label": "DOCUMENT", - "name": "DOCUMENT", - "value": "DOCUMENT", - "children": null - }, - { - "label": "URL", - "name": "URL", - "value": "URL", - "children": null - }, - { - "label": "TEXT", - "name": "TEXT", - "value": "TEXT", - "children": null + "trigger_type": "http" } - ], - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "map", - "inputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "知识数据源", - "custom_label": null, - "name": "knowledge datasource", - "description": "知识数据源,可以是文档、网址或文本。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "Knowledge", - "type_cls": "dbgpt.rag.knowledge.base.Knowledge", - "label": "知识", - "custom_label": null, - "name": "Knowledge", - "description": "知识对象。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "KnowledgeOperator", - "type_cls": "dbgpt.rag.operators.knowledge.KnowledgeOperator" + ], + "sse_output": false, + "streaming_output": false, + "tags": {} }, - "position_absolute": { - "x": -1381.9120062303377, - "y": -370.57039313932444, - "zoom": 0 - } - }, - { - "width": 320, - "height": 602, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -2020.527087889374, - "y": -445.3470107479735, - "zoom": 0 - }, - "type": "customNode", - "data": { - "label": "字典 HTTP 触发器", - "custom_label": null, - "name": "dict_http_trigger", - "description": "通过 HTTP 请求触发您的工作流,并将请求主体解析为字典", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API 端点", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "API 端点", - "options": null, - "value": "/rag/knowledge/kg/process", - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 方法", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API 端点的方法", - "options": [ + "variables": null, + "authors": null, + "flow_data": { + "edges": [ { - "label": "HTTP PUT 方法", - "name": "http_put", - "value": "PUT", - "children": null + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_order": 0, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", + "type": "buttonedge" }, { - "label": "HTTP POST 方法", - "name": "http_post", - "value": "POST", - "children": null + "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "target_order": 0, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "source_order": 0, + "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "target_order": 5, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", + "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", + "type": "buttonedge" + }, + { + "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" } - ], - "value": null, - "alias": null, - "ui": null + ], + "viewport": { + "x": 831.8128405437491, + "y": 421.4753242151554, + "zoom": 0.3846854569072972 }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "响应是否为流式传输", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API 端点的响应主体", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "响应媒体类型", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "响应的媒体类型", - "options": null, - "value": null, - "alias": null, - "ui": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 状态码", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP 状态码", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "dict", - "type_cls": "builtins.dict", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API 端点的请求主体", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "version": "v1", - "type_name": "DictHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger" - }, - "position_absolute": { - "x": -2020.527087889374, - "y": -445.3470107479735, - "zoom": 0 + "nodes": [ + { + "width": 320, + "height": 323, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "position": { + "x": 6.722768991652174, + "y": -225.32501282124363, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 6.722768991652174, + "y": -225.32501282124363, + "zoom": 0.0 + }, + "data": { + "label": "知识图谱算子", + "custom_label": null, + "name": "knowledge_graph_operator", + "description": "提取文档并持久化到图数据库中。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The text split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The assembled chunks, it has been persisted to graph store.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeGraphOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge_graph.KnowledgeGraphOperator", + "parameters": [ + { + "type_name": "KnowledgeGraphBase", + "type_cls": "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识图谱连接器", + "name": "graph_store", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "知识图谱。", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 321, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "position": { + "x": -812.1903428806644, + "y": -415.17234393736123, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -812.1903428806644, + "y": -415.17234393736123, + "zoom": 0.0 + }, + "data": { + "label": "Chunk Manager Operator", + "custom_label": null, + "name": "chunk_manager_operator", + "description": " Split Knowledge Documents into chunks.", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "knowledge", + "description": "The knowledge to be loaded.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "List", + "type_cls": "typing.List", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The split chunks by chunk manager.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "ChunkManagerOperator", + "type_cls": "dbgpt.rag.operators.chunk_manager.ChunkManagerOperator", + "parameters": [ + { + "type_name": "ChunkParameters", + "type_cls": "dbgpt_ext.rag.chunk_manager.ChunkParameters", + "dynamic": false, + "dynamic_minimum": 0, + "label": "Chunk Split Parameters", + "name": "chunk_parameters", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "Chunk Split Parameters.", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 234, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "position": { + "x": -446.7662140064656, + "y": 116.76439313193941, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -446.7662140064656, + "y": 116.76439313193941, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraph", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "label": "内置知识图谱", + "custom_label": null, + "name": "builtin_knowledge_graph", + "description": "内置知识图谱。", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphBase", + "dbgpt.rag.index.base.IndexStoreBase" + ], + "parameters": [ + { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dynamic": false, + "dynamic_minimum": 0, + "label": "内置知识图谱配置。", + "name": "config", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "内置知识图谱配置。", + "value": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 645, + "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "position": { + "x": -915.1247640485547, + "y": 148.92845384162234, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -915.1247640485547, + "y": 148.92845384162234, + "zoom": 0.0 + }, + "data": { + "type_name": "BuiltinKnowledgeGraphConfig", + "type_cls": "dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "label": "内置图配置", + "custom_label": null, + "name": "knowledge_graph_config", + "description": "知识图谱配置。", + "category": "knowledge_graph", + "category_label": "Knowledge Graph", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt_ext.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig", + "dbgpt.storage.knowledge_graph.base.KnowledgeGraphConfig", + "dbgpt.rag.index.base.IndexStoreConfig", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "图名称", + "name": "name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "dbgpt_collection", + "placeholder": null, + "description": "图的名称,如果不设置,将使用默认名称。", + "value": "dbgpt_collection_V1", + "options": null + }, + { + "type_name": "Embeddings", + "type_cls": "dbgpt.core.interface.embeddings.Embeddings", + "dynamic": false, + "dynamic_minimum": 0, + "label": "嵌入函数", + "name": "embedding_fn", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "向量存储的嵌入函数,如果不设置,将使用默认嵌入函数。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "一次加载的最大块数", + "name": "max_chunks_once_load", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 10, + "placeholder": null, + "description": "一次加载的最大块数。如果文档较大,可以将此值设置为较大的数字以加快加载过程,默认值为 10。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最大线程数", + "name": "max_threads", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 1, + "placeholder": null, + "description": "使用的最大线程数,默认值为 1。如果设置为大于 1,请确保向量存储是线程安全的。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识图谱类型", + "name": "graph_store_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "TuGraph", + "placeholder": null, + "description": "图存储类型。", + "value": "TuGraph", + "options": null + }, + { + "type_name": "LLMClient", + "type_cls": "dbgpt.core.interface.llm.LLMClient", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM 客户端", + "name": "llm_client", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "用于提取图三元组的 LLM 客户端。", + "value": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM 模型名称", + "name": "model_name", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "LLM 模型名称。", + "value": "zhipu_proxyllm", + "options": null + } + ] + } + }, + { + "width": 320, + "height": 431, + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -1381.9120062303377, + "y": -370.57039313932444, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1381.9120062303377, + "y": -370.57039313932444, + "zoom": 0.0 + }, + "data": { + "label": "知识加载算子", + "custom_label": null, + "name": "knowledge_operator", + "description": "知识算子,可以从数据源创建知识。", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": "https://github.com/openai/openai-python", + "id": "operator_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "knowledge datasource", + "custom_label": null, + "name": "knowledge datasource", + "description": "knowledge datasource, which can be a document, url, or text.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "Knowledge", + "type_cls": "dbgpt.rag.knowledge.base.Knowledge", + "label": "Knowledge", + "custom_label": null, + "name": "Knowledge", + "description": "Knowledge object.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "KnowledgeOperator", + "type_cls": "dbgpt_ext.rag.operators.knowledge.KnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "默认数据源", + "name": "datasource", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "默认数据源。", + "value": "../../docs/docs/awel/awel.md", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识类型", + "name": "knowledge_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "DOCUMENT", + "placeholder": null, + "description": "知识类型。", + "value": null, + "options": [ + { + "label": "DOCUMENT", + "name": "DOCUMENT", + "value": "DOCUMENT", + "children": null + }, + { + "label": "URL", + "name": "URL", + "value": "URL", + "children": null + }, + { + "label": "TEXT", + "name": "TEXT", + "value": "TEXT", + "children": null + } + ] + } + ] + } + }, + { + "width": 320, + "height": 602, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -2020.527087889374, + "y": -445.3470107479735, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -2020.527087889374, + "y": -445.3470107479735, + "zoom": 0.0 + }, + "data": { + "label": "字典 HTTP 触发器", + "custom_label": null, + "name": "dict_http_trigger", + "description": "通过 HTTP 请求触发工作流,并将请求体解析为字典", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "dict", + "type_cls": "builtins.dict", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "version": "v1", + "type_name": "DictHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.DictHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API 端点", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "API 端点", + "value": "/rag/knowledge/kg/process", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 方法", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "API 端点的方法", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "流式响应", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "响应是否为流式", + "value": null, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 响应体", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "API 端点的响应体", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "响应媒体类型", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "响应媒体类型", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 状态码", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "HTTP 状态码", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 272, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "position": { + "x": -1506.5067155518987, + "y": 313.0562898282468, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -1506.5067155518987, + "y": 313.0562898282468, + "zoom": 0.0 + }, + "data": { + "type_name": "DefaultLLMClient", + "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", + "label": "默认 LLM 客户端", + "custom_label": null, + "name": "default_llm_client", + "description": "默认 LLM 客户端(连接到你的 DB-GPT 模型服务)", + "category": "llm_client", + "category_label": "LLM Client", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", + "tags": { + "ui_version": "flow2.0" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.model.cluster.client.DefaultLLMClient", + "dbgpt.core.interface.llm.LLMClient" + ], + "parameters": [ + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "自动转换消息", + "name": "auto_convert_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": true, + "placeholder": null, + "description": "是否自动将 LLM 不支持的消息转换为兼容格式", + "value": null, + "options": null + } + ] + } + } + ] } - }, - { - "width": 320, - "height": 272, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "position": { - "x": -1506.5067155518987, - "y": 313.0562898282468, - "zoom": 0 - }, - "type": "customNode", - "data": { - "type_name": "DefaultLLMClient", - "type_cls": "dbgpt.model.cluster.client.DefaultLLMClient", - "label": "默认 LLM 客户端", - "custom_label": null, - "name": "default_llm_client", - "description": "默认 LLM 客户端(连接到您的 DB-GPT 模型服务)", - "category": "llm_client", - "category_label": "LLM Client", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "tags": { - "ui_version": "flow2.0" - }, - "parameters": [ - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "自动转换消息", - "name": "auto_convert_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": true, - "placeholder": null, - "description": "是否将 LLM 不支持的消息自动转换为兼容格式", - "options": null, - "value": null, - "alias": null, - "ui": null - } - ], - "resource_type": "instance", - "parent_cls": [ - "dbgpt.model.cluster.client.DefaultLLMClient", - "dbgpt.core.interface.llm.LLMClient" - ] - }, - "position_absolute": { - "x": -1506.5067155518987, - "y": 313.0562898282468, - "zoom": 0 - } - } - ], - "edges": [ - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_order": 0, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|outputs|0", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "target_order": 0, - "id": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0", - "source_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraph_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_knowledge_operator___$$___rag___$$___v1_0|operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_dict_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_dict_http_trigger___$$___trigger___$$___v1_0|operator_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_dict_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0", - "source_order": 0, - "target": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "target_order": 5, - "id": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0", - "source_handle": "resource_dbgpt.model.cluster.client.DefaultLLMClient_0|outputs|0", - "target_handle": "resource_dbgpt.storage.knowledge_graph.knowledge_graph.BuiltinKnowledgeGraphConfig_0|parameters|5", - "type": "buttonedge" - }, - { - "source": "operator_chunk_manager_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_chunk_manager_operator___$$___rag___$$___v1_0|operator_knowledge_graph_operator___$$___rag___$$___v1_0", - "source_handle": "operator_chunk_manager_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_knowledge_graph_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 831.8128405437491, - "y": 421.4753242151554, - "zoom": 0.3846854569072972 } - }, - "description": "知识图谱知识加工工作流", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_knowledge_graph_process_workflow_feb180ad-0f02-42c9-983d-70eb5ae9b346", - "gmt_created": "2024-12-16 17:51:31", - "gmt_modified": "2024-12-16 17:51:31", - "metadata": { - "sse_output": false, - "streaming_output": false, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/rag/graph/process", - "methods": [ - "POST" - ], - "trigger_mode": "command" - } - ] - }, - "variables": null, - "authors": null -} } \ No newline at end of file diff --git a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/rag-chat-awel-flow-template.json b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/rag-chat-awel-flow-template.json index d9eb0bba4..519a58106 100644 --- a/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/rag-chat-awel-flow-template.json +++ b/packages/dbgpt-serve/src/dbgpt_serve/flow/templates/zh/rag-chat-awel-flow-template.json @@ -1,1088 +1,1083 @@ { - "flow": { - "uid": "f947dc6d-a6e6-4f02-b794-14989944173d", - "label": "RAG Chat AWEL flow template", - "name": "rag_chat_awel_flow_template_zh", - "flow_category": "chat_flow", - "description": "知识库对话的 AWEL flow 模板", - "state": "running", - "error_message": "", - "source": "DBGPT-WEB", - "source_url": null, - "version": "0.1.1", - "define_type": "json", - "editable": true, - "user_name": null, - "sys_code": null, - "dag_id": "flow_dag_rag_chat_awel_flow_template_zh_f947dc6d-a6e6-4f02-b794-14989944173d", - "gmt_created": "2024-09-06 17:12:50", - "gmt_modified": "2024-09-06 17:12:50", - "metadata": { - "sse_output": true, - "streaming_output": true, - "tags": {}, - "triggers": [ - { - "trigger_type": "http", - "path": "/api/v1/awel/trigger/example/flow_dag_rag_chat_awel_flow_template_zh_f947dc6d-a6e6-4f02-b794-14989944173d", - "methods": [ - "POST" - ], - "trigger_mode": "chat" - } - ] - }, - "variables": null, - "authors": null, - "flow_data": { - "edges": [ - { - "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 0, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "source_order": 1, - "target": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "target_order": 0, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|1", - "target_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|inputs|0", - "type": "buttonedge" - }, - { - "source": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 1, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|1", - "type": "buttonedge" - }, - { - "source": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "source_order": 0, - "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "target_order": 0, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_handle": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|outputs|0", - "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|parameters|0", - "type": "buttonedge" - }, - { - "source": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "source_order": 0, - "target": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "target_order": 0, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "source_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|outputs|0", - "target_handle": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0|inputs|0", - "type": "buttonedge" - } - ], - "viewport": { - "x": 669.8345476335454, - "y": 80.57987544808663, - "zoom": 0.7037219281316303 - }, - "nodes": [ - { - "width": 320, - "height": 632, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "position": { - "x": -859.6394981135705, - "y": 19.187128710000025, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": -859.6394981135705, - "y": 19.187128710000025, - "zoom": 0.0 - }, - "data": { - "label": "常见 LLM Http 触发器", - "custom_label": null, - "name": "common_llm_http_trigger", - "description": "通过 HTTP 请求触发您的工作流,并将请求主体解析为常见的 LLM HTTP 主体", - "category": "trigger", - "category_label": "Trigger", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "input", - "inputs": [], - "outputs": [ - { - "type_name": "CommonLLMHttpRequestBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", - "label": "请求体", - "custom_label": null, - "name": "request_body", - "description": "API 端点的请求主体,解析为常见的 LLM HTTP 主体", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "Request String Messages", - "custom_label": null, - "name": "request_string_messages", - "description": "The request string messages of the API endpoint, parsed from 'messages' field of the request body", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": [ - "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger.MessagesOutputMapper" - ] - } - ], - "version": "v1", - "type_name": "CommonLLMHttpTrigger", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger", - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "API 端点", - "name": "endpoint", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "/example/{dag_id}", - "placeholder": null, - "description": "API 端点", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 方法", - "name": "methods", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "POST", - "placeholder": null, - "description": "API 端点的方法", - "value": null, - "options": [ - { - "label": "HTTP PUT 方法", - "name": "http_put", - "value": "PUT", - "children": null - }, - { - "label": "HTTP POST 方法", - "name": "http_post", - "value": "POST", - "children": null - } - ] - }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "流式响应", - "name": "streaming_response", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": false, - "placeholder": null, - "description": "响应是否为流式传输", - "value": false, - "options": null - }, - { - "type_name": "BaseHttpBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 响应主体", - "name": "http_response_body", - "is_list": false, - "category": "resource", - "resource_type": "class", - "optional": true, - "default": null, - "placeholder": null, - "description": "API 端点的响应主体", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "响应媒体类型", - "name": "response_media_type", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "响应的媒体类型", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "HTTP 状态码", - "name": "status_code", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 200, - "placeholder": null, - "description": "HTTP 状态码", - "value": null, - "options": null - } - ] - } - }, - { - "width": 320, - "height": 910, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "position": { - "x": 894.6387897331704, - "y": 11.20538256124324, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 894.6387897331704, - "y": 11.20538256124324, - "zoom": 0.0 - }, - "data": { - "label": "流式 LLM 算子", - "custom_label": null, - "name": "higher_order_streaming_llm_operator", - "description": "高级流式 LLM 算子,支持多轮对话(对话窗口、Token 长度和无多轮)。", - "category": "llm", - "category_label": "LLM", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "map", - "inputs": [ - { - "type_name": "CommonLLMHttpRequestBody", - "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", - "label": "通用 LLM 请求体", - "custom_label": null, - "name": "common_llm_request_body", - "description": "通用 LLM 请求体。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "HOContextBody", - "type_cls": "dbgpt.app.operators.llm.HOContextBody", - "label": "额外上下文", - "custom_label": null, - "name": "extra_context", - "description": "用于构建提示的额外上下文(知识上下文、数据库架构等),您可以添加多个上下文。", - "dynamic": true, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "ModelOutput", - "type_cls": "dbgpt.core.interface.llm.ModelOutput", - "label": "流式模型输出", - "custom_label": null, - "name": "streaming_model_output", - "description": "流式模型输出。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "HOStreamingLLMOperator", - "type_cls": "dbgpt.app.operators.llm.HOStreamingLLMOperator", - "parameters": [ - { - "type_name": "ChatPromptTemplate", - "type_cls": "dbgpt.core.interface.prompt.ChatPromptTemplate", - "dynamic": false, - "dynamic_minimum": 0, - "label": "提示模板", - "name": "prompt_template", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "对话的提示模板。", - "value": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "模型名称", - "name": "model", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "模型名称。", - "value": null, - "options": null - }, - { - "type_name": "LLMClient", - "type_cls": "dbgpt.core.interface.llm.LLMClient", - "dynamic": false, - "dynamic_minimum": 0, - "label": "LLM 客户端", - "name": "llm_client", - "is_list": false, - "category": "resource", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "LLM 客户端,如何连接到 LLM 模型,如果未提供,将使用 DB-GPT 部署的默认客户端。", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "历史消息合并模式", - "name": "history_merge_mode", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "none", - "placeholder": null, - "description": "历史合并模式,支持 'none','window' 和 'token'。'none':不合并历史,'window':按对话窗口合并,'token':按 Token 长度合并。", - "value": null, - "options": [ - { - "label": "No History", - "name": "none", - "value": "none", - "children": null - }, - { - "label": "Message Window", - "name": "window", - "value": "window", - "children": null - }, - { - "label": "Token Length", - "name": "token", - "value": "token", - "children": null - } - ], - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "select", - "size": null, - "attr": null + "flow": { + "uid": "0eb98752-5621-41c6-bd80-f8fc7519d69e", + "label": "RAG Chat AWEL flow template", + "name": "rag_chat_awel_flow_template_zh", + "flow_category": "chat_flow", + "description": "知识库对话的 AWEL flow 模板", + "state": "initializing", + "error_message": "", + "source": "DBGPT-WEB", + "source_url": null, + "version": "0.1.1", + "define_type": "json", + "editable": false, + "user_name": null, + "sys_code": null, + "dag_id": null, + "gmt_created": "2024-09-06 17:12:50", + "gmt_modified": "2024-09-06 17:12:50", + "metadata": { + "triggers": [ + { + "trigger_type": "http" } - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "用户消息键", - "name": "user_message_key", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "user_input", - "placeholder": null, - "description": "提示中用户消息的键,默认为 'user_input'。", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "历史键", - "name": "history_key", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "聊天历史键,将聊天历史消息传递给提示模板,如果未提供,它将解析提示模板以获取键。", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "保留起始轮数", - "name": "keep_start_rounds", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "在聊天历史中保留的起始轮数。", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "保留结束轮数", - "name": "keep_end_rounds", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "在聊天历史中保留的结束轮数。", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最大 Token 限制", - "name": "max_token_limit", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 2048, - "placeholder": null, - "description": "在聊天历史中保留的最大 Token 限制。", - "value": null, - "options": null - } - ] - } + ], + "sse_output": true, + "streaming_output": true, + "tags": {} }, - { - "width": 320, - "height": 774, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "position": { - "x": -490.28264249580883, - "y": 867.094350868951, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": -490.28264249580883, - "y": 867.094350868951, - "zoom": 0.0 - }, - "data": { - "label": "知识算子", - "custom_label": null, - "name": "higher_order_knowledge_operator", - "description": "知识算子,从知识空间检索您的知识(文档)", - "category": "rag", - "category_label": "RAG", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "map", - "inputs": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "用户问题", - "custom_label": null, - "name": "query", - "description": "用于检索知识的用户问题", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "HOContextBody", - "type_cls": "dbgpt.app.operators.llm.HOContextBody", - "label": "检索到的上下文", - "custom_label": null, - "name": "context", - "description": "从知识空间检索到的上下文", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": false, - "mappers": null - }, - { - "type_name": "Chunk", - "type_cls": "dbgpt.core.interface.knowledge.Chunk", - "label": "块", - "custom_label": null, - "name": "chunks", - "description": "从知识空间检索到的块", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": [ - "dbgpt.app.operators.rag.HOKnowledgeOperator.ChunkMapper" - ] - } - ], - "version": "v1", - "type_name": "HOKnowledgeOperator", - "type_cls": "dbgpt.app.operators.rag.HOKnowledgeOperator", - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "知识空间名称", - "name": "knowledge_space", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": false, - "default": null, - "placeholder": null, - "description": "知识空间的名称", - "value": "k_cmd2", - "options": [ - { - "label": "k_cmd2", - "name": "k_cmd2", - "value": "k_cmd2", - "children": null - }, - { - "label": "f5", - "name": "f5", - "value": "f5", - "children": null - }, - { - "label": "f4", - "name": "f4", - "value": "f4", - "children": null - }, - { - "label": "t333", - "name": "t333", - "value": "t333", - "children": null - }, - { - "label": "f3", - "name": "f3", - "value": "f3", - "children": null - }, - { - "label": "f1", - "name": "f1", - "value": "f1", - "children": null - }, - { - "label": "sdf", - "name": "sdf", - "value": "sdf", - "children": null - }, - { - "label": "sfsd", - "name": "sfsd", - "value": "sfsd", - "children": null - }, - { - "label": "hello", - "name": "hello", - "value": "hello", - "children": null - }, - { - "label": "k1", - "name": "k1", - "value": "k1", - "children": null - }, - { - "label": "f2", - "name": "f2", - "value": "f2", - "children": null - }, - { - "label": "test_f1", - "name": "test_f1", - "value": "test_f1", - "children": null - }, - { - "label": "SMMF", - "name": "SMMF", - "value": "SMMF", - "children": null - }, - { - "label": "docker_xxx", - "name": "docker_xxx", - "value": "docker_xxx", - "children": null - }, - { - "label": "t2", - "name": "t2", - "value": "t2", - "children": null - }, - { - "label": "t1", - "name": "t1", - "value": "t1", - "children": null - }, - { - "label": "test_graph", - "name": "test_graph", - "value": "test_graph", - "children": null - }, - { - "label": "small", - "name": "small", - "value": "small", - "children": null - }, - { - "label": "ttt", - "name": "ttt", - "value": "ttt", - "children": null - }, - { - "label": "bf", - "name": "bf", - "value": "bf", - "children": null - }, - { - "label": "new_big_file", - "name": "new_big_file", - "value": "new_big_file", - "children": null - }, - { - "label": "test_big_fild", - "name": "test_big_fild", - "value": "test_big_fild", - "children": null - }, - { - "label": "Greenplum", - "name": "Greenplum", - "value": "Greenplum", - "children": null - }, - { - "label": "Mytest", - "name": "Mytest", - "value": "Mytest", - "children": null - }, - { - "label": "dba", - "name": "dba", - "value": "dba", - "children": null - } - ] - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "上下文键", - "name": "context", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "context", - "placeholder": null, - "description": "上下文的键,将用于构建提示", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "前 K", - "name": "top_k", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 5, - "placeholder": null, - "description": "要检索的块数", - "value": null, - "options": null - }, - { - "type_name": "float", - "type_cls": "builtins.float", - "dynamic": false, - "dynamic_minimum": 0, - "label": "最低匹配分数", - "name": "score_threshold", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 0.3, - "placeholder": null, - "description": "检索到的块的最低匹配分数,如果匹配分数低于阈值,将被丢弃", - "value": null, - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "slider", - "size": null, - "attr": { - "disabled": false, - "min": 0.0, - "max": 1.0, - "step": 0.1 - }, - "show_input": false + "variables": null, + "authors": null, + "flow_data": { + "edges": [ + { + "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 0, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "source_order": 1, + "target": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "target_order": 0, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "source_handle": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0|outputs|1", + "target_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|inputs|0", + "type": "buttonedge" + }, + { + "source": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 1, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|inputs|1", + "type": "buttonedge" + }, + { + "source": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "source_order": 0, + "target": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "target_order": 0, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_handle": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0|outputs|0", + "target_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|parameters|0", + "type": "buttonedge" + }, + { + "source": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "source_order": 0, + "target": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "target_order": 0, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "source_handle": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0|outputs|0", + "target_handle": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0|inputs|0", + "type": "buttonedge" } - }, - { - "type_name": "bool", - "type_cls": "builtins.bool", - "dynamic": false, - "dynamic_minimum": 0, - "label": "启用重新排序器", - "name": "reranker_enabled", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": null, - "placeholder": null, - "description": "是否启用重新排序器", - "value": null, - "options": null - }, - { - "type_name": "int", - "type_cls": "builtins.int", - "dynamic": false, - "dynamic_minimum": 0, - "label": "重新排序器前 K", - "name": "reranker_top_k", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": 3, - "placeholder": null, - "description": "重新排序器的前 K", - "value": null, - "options": null - } - ] - } - }, - { - "width": 530, - "height": 774, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "position": { - "x": 215.72827911579407, - "y": 823.7825153084143, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 215.72827911579407, - "y": 823.7825153084143, - "zoom": 0.0 - }, - "data": { - "type_name": "CommonChatPromptTemplate", - "type_cls": "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", - "label": "常见聊天提示模板", - "custom_label": null, - "name": "common_chat_prompt_template", - "description": "用静态提示构建提示的原子。", - "category": "prompt", - "category_label": "Prompt", - "flow_type": "resource", - "icon": null, - "documentation_url": null, - "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0", - "ui_size": "large" - }, - "resource_type": "instance", - "parent_cls": [ - "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", - "dbgpt.core.interface.prompt.ChatPromptTemplate", - "dbgpt.core.interface.prompt.BasePromptTemplate", - "pydantic.main.BaseModel" ], - "parameters": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "系统消息", - "name": "system_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "You are a helpful AI Assistant.", - "placeholder": null, - "description": "系统消息。", - "value": "基于以下给出的已知信息, 准守规范约束,专业、简要回答用户的问题.\n规范约束:\n 1.如果已知信息包含的图片、链接、表格、代码块等特殊markdown标签格式的信息,确保在答案中包含原文这些图片、链接、表格和代码标签,不要丢弃不要修改,如:图片格式:![image.png](xxx), 链接格式:[xxx](xxx), 表格格式:|xxx|xxx|xxx|, 代码格式:```xxx```.\n 2.如果无法从提供的内容中获取答案, 请说: \"知识库中提供的内容不足以回答此问题\" 禁止胡乱编造.\n 3.回答的时候最好按照1.2.3.点进行总结, 并以markdwon格式显示.\n\n已知内容: \n{context}\n问题:\n{user_input}, 请使用和用户相同的语言进行回答.\n", - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "text_area", - "size": "large", - "attr": { - "disabled": false, - "status": null, - "prefix": null, - "suffix": null, - "show_count": null, - "max_length": null, - "auto_size": { - "min_rows": 2, - "max_rows": 20 + "viewport": { + "x": 669.8345476335454, + "y": 80.57987544808663, + "zoom": 0.7037219281316303 + }, + "nodes": [ + { + "width": 320, + "height": 632, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "position": { + "x": -859.6394981135705, + "y": 19.187128710000025, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -859.6394981135705, + "y": 19.187128710000025, + "zoom": 0.0 + }, + "data": { + "label": "通用 LLM HTTP 触发器", + "custom_label": null, + "name": "common_llm_http_trigger", + "description": "通过 HTTP 请求触发工作流,并将请求体解析为通用 LLM HTTP 请求体", + "category": "trigger", + "category_label": "Trigger", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_common_llm_http_trigger___$$___trigger___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "input", + "inputs": [], + "outputs": [ + { + "type_name": "CommonLLMHttpRequestBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", + "label": "Request Body", + "custom_label": null, + "name": "request_body", + "description": "The request body of the API endpoint, parse as a common LLM http body", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "Request String Messages", + "custom_label": null, + "name": "request_string_messages", + "description": "The request string messages of the API endpoint, parsed from 'messages' field of the request body", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": [ + "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger.MessagesOutputMapper" + ] + } + ], + "version": "v1", + "type_name": "CommonLLMHttpTrigger", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpTrigger", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "API 端点", + "name": "endpoint", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "/example/{dag_id}", + "placeholder": null, + "description": "API 端点", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 方法", + "name": "methods", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "POST", + "placeholder": null, + "description": "API 端点的方法", + "value": null, + "options": [ + { + "label": "HTTP Method PUT", + "name": "http_put", + "value": "PUT", + "children": null + }, + { + "label": "HTTP Method POST", + "name": "http_post", + "value": "POST", + "children": null + } + ] + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "流式响应", + "name": "streaming_response", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": false, + "placeholder": null, + "description": "响应是否为流式", + "value": false, + "options": null + }, + { + "type_name": "BaseHttpBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.BaseHttpBody", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 响应体", + "name": "http_response_body", + "is_list": false, + "category": "resource", + "resource_type": "class", + "optional": true, + "default": null, + "placeholder": null, + "description": "API 端点的响应体", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "响应媒体类型", + "name": "response_media_type", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "响应媒体类型", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "HTTP 状态码", + "name": "status_code", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 200, + "placeholder": null, + "description": "HTTP 状态码", + "value": null, + "options": null + } + ] } - }, - "editor": { - "width": 800, - "height": 400 - } - } - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "消息占位符", - "name": "message_placeholder", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "chat_history", - "placeholder": null, - "description": "聊天历史消息占位符。", - "value": null, - "options": null - }, - { - "type_name": "str", - "type_cls": "builtins.str", - "dynamic": false, - "dynamic_minimum": 0, - "label": "用户消息", - "name": "human_message", - "is_list": false, - "category": "common", - "resource_type": "instance", - "optional": true, - "default": "{user_input}", - "placeholder": "{user_input}", - "description": "用户消息。", - "value": null, - "options": null, - "ui": { - "refresh": false, - "refresh_depends": null, - "ui_type": "text_area", - "size": "large", - "attr": { - "disabled": false, - "status": null, - "prefix": null, - "suffix": null, - "show_count": null, - "max_length": null, - "auto_size": { - "min_rows": 2, - "max_rows": 20 + }, + { + "width": 320, + "height": 910, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "position": { + "x": 894.6387897331704, + "y": 11.20538256124324, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 894.6387897331704, + "y": 11.20538256124324, + "zoom": 0.0 + }, + "data": { + "label": "流式 LLM 算子", + "custom_label": null, + "name": "higher_order_streaming_llm_operator", + "description": "高级流式 LLM 算子,支持多轮对话(对话窗口、Token 长度和无多轮)。", + "category": "llm", + "category_label": "LLM", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_higher_order_streaming_llm_operator___$$___llm___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "CommonLLMHttpRequestBody", + "type_cls": "dbgpt.core.awel.trigger.http_trigger.CommonLLMHttpRequestBody", + "label": "Common LLM Request Body", + "custom_label": null, + "name": "common_llm_request_body", + "description": "The common LLM request body.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "HOContextBody", + "type_cls": "dbgpt_app.operators.llm.HOContextBody", + "label": "Extra Context", + "custom_label": null, + "name": "extra_context", + "description": "Extra context for building prompt(Knowledge context, database schema, etc), you can add multiple context.", + "dynamic": true, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "ModelOutput", + "type_cls": "dbgpt.core.interface.llm.ModelOutput", + "label": "Streaming Model Output", + "custom_label": null, + "name": "streaming_model_output", + "description": "The streaming model output.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "HOStreamingLLMOperator", + "type_cls": "dbgpt_app.operators.llm.HOStreamingLLMOperator", + "parameters": [ + { + "type_name": "ChatPromptTemplate", + "type_cls": "dbgpt.core.interface.prompt.ChatPromptTemplate", + "dynamic": false, + "dynamic_minimum": 0, + "label": "提示模板", + "name": "prompt_template", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "对话的提示模板。", + "value": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "模型名称", + "name": "model", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "模型名称。", + "value": null, + "options": null + }, + { + "type_name": "LLMClient", + "type_cls": "dbgpt.core.interface.llm.LLMClient", + "dynamic": false, + "dynamic_minimum": 0, + "label": "LLM 客户端", + "name": "llm_client", + "is_list": false, + "category": "resource", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "LLM 客户端,如何连接到 LLM 模型,如果未提供,则使用由 DB-GPT 部署的默认客户端。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "历史消息合并模式", + "name": "history_merge_mode", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "none", + "placeholder": null, + "description": "历史合并模式,支持 'none'、'window' 和 'token'。'none':不合并历史,'window':按对话窗口合并,'token':按 Token 长度合并。", + "value": null, + "options": [ + { + "label": "No History", + "name": "none", + "value": "none", + "children": null + }, + { + "label": "Message Window", + "name": "window", + "value": "window", + "children": null + }, + { + "label": "Token Length", + "name": "token", + "value": "token", + "children": null + } + ], + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "select", + "size": null, + "attr": null + } + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "用户消息键", + "name": "user_message_key", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "user_input", + "placeholder": null, + "description": "提示词中用户消息的键,默认为 'user_input'。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "历史键", + "name": "history_key", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "聊天历史键,用于将聊天历史消息传递给提示模板,如果未提供,它将解析提示模板以获取键。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "保留起始轮次", + "name": "keep_start_rounds", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "在聊天历史中保留的起始轮次。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "保留结束轮次", + "name": "keep_end_rounds", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "在聊天历史中保留的结束轮次。", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最大 Token 限制", + "name": "max_token_limit", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 2048, + "placeholder": null, + "description": "在聊天历史中保留的最大 Token 数量。", + "value": null, + "options": null + } + ] + } + }, + { + "width": 320, + "height": 774, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "position": { + "x": -490.28264249580883, + "y": 867.094350868951, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": -490.28264249580883, + "y": 867.094350868951, + "zoom": 0.0 + }, + "data": { + "label": "知识空间算子", + "custom_label": null, + "name": "higher_order_knowledge_operator", + "description": "知识空间算子,从知识空间检索知识", + "category": "rag", + "category_label": "RAG", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_higher_order_knowledge_operator___$$___rag___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "map", + "inputs": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "User question", + "custom_label": null, + "name": "query", + "description": "The user question to retrieve the knowledge", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "HOContextBody", + "type_cls": "dbgpt_app.operators.llm.HOContextBody", + "label": "Retrieved context", + "custom_label": null, + "name": "context", + "description": "The retrieved context from the knowledge space", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": false, + "mappers": null + }, + { + "type_name": "Chunk", + "type_cls": "dbgpt.core.interface.knowledge.Chunk", + "label": "Chunks", + "custom_label": null, + "name": "chunks", + "description": "The retrieved chunks from the knowledge space", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": [ + "dbgpt_app.operators.rag.HOKnowledgeOperator.ChunkMapper" + ] + } + ], + "version": "v1", + "type_name": "HOKnowledgeOperator", + "type_cls": "dbgpt_app.operators.rag.HOKnowledgeOperator", + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "知识空间名称", + "name": "knowledge_space", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": false, + "default": null, + "placeholder": null, + "description": "知识空间的名称", + "value": "k_cmd2", + "options": [ + { + "label": "k_cmd2", + "name": "k_cmd2", + "value": "k_cmd2", + "children": null + }, + { + "label": "f5", + "name": "f5", + "value": "f5", + "children": null + }, + { + "label": "f4", + "name": "f4", + "value": "f4", + "children": null + }, + { + "label": "t333", + "name": "t333", + "value": "t333", + "children": null + }, + { + "label": "f3", + "name": "f3", + "value": "f3", + "children": null + }, + { + "label": "f1", + "name": "f1", + "value": "f1", + "children": null + }, + { + "label": "sdf", + "name": "sdf", + "value": "sdf", + "children": null + }, + { + "label": "sfsd", + "name": "sfsd", + "value": "sfsd", + "children": null + }, + { + "label": "hello", + "name": "hello", + "value": "hello", + "children": null + }, + { + "label": "k1", + "name": "k1", + "value": "k1", + "children": null + }, + { + "label": "f2", + "name": "f2", + "value": "f2", + "children": null + }, + { + "label": "test_f1", + "name": "test_f1", + "value": "test_f1", + "children": null + }, + { + "label": "SMMF", + "name": "SMMF", + "value": "SMMF", + "children": null + }, + { + "label": "docker_xxx", + "name": "docker_xxx", + "value": "docker_xxx", + "children": null + }, + { + "label": "t2", + "name": "t2", + "value": "t2", + "children": null + }, + { + "label": "t1", + "name": "t1", + "value": "t1", + "children": null + }, + { + "label": "test_graph", + "name": "test_graph", + "value": "test_graph", + "children": null + }, + { + "label": "small", + "name": "small", + "value": "small", + "children": null + }, + { + "label": "ttt", + "name": "ttt", + "value": "ttt", + "children": null + }, + { + "label": "bf", + "name": "bf", + "value": "bf", + "children": null + }, + { + "label": "new_big_file", + "name": "new_big_file", + "value": "new_big_file", + "children": null + }, + { + "label": "test_big_fild", + "name": "test_big_fild", + "value": "test_big_fild", + "children": null + }, + { + "label": "Greenplum", + "name": "Greenplum", + "value": "Greenplum", + "children": null + }, + { + "label": "Mytest", + "name": "Mytest", + "value": "Mytest", + "children": null + }, + { + "label": "dba", + "name": "dba", + "value": "dba", + "children": null + } + ] + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "上下文键", + "name": "context", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "context", + "placeholder": null, + "description": "上下文的键,它将用于构建提示", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "前 K 项", + "name": "top_k", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 5, + "placeholder": null, + "description": "要检索的块数", + "value": null, + "options": null + }, + { + "type_name": "float", + "type_cls": "builtins.float", + "dynamic": false, + "dynamic_minimum": 0, + "label": "最小匹配分数", + "name": "score_threshold", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 0.3, + "placeholder": null, + "description": "检索到的块的最小匹配分数,如果匹配分数低于阈值,则会被丢弃", + "value": null, + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "slider", + "size": null, + "attr": { + "disabled": false, + "min": 0.0, + "max": 1.0, + "step": 0.1 + }, + "show_input": false + } + }, + { + "type_name": "bool", + "type_cls": "builtins.bool", + "dynamic": false, + "dynamic_minimum": 0, + "label": "是否启用重排序器", + "name": "reranker_enabled", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": null, + "placeholder": null, + "description": "是否启用重排序器", + "value": null, + "options": null + }, + { + "type_name": "int", + "type_cls": "builtins.int", + "dynamic": false, + "dynamic_minimum": 0, + "label": "重排序器的前 K 项", + "name": "reranker_top_k", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": 3, + "placeholder": null, + "description": "重排序器的前 K 项", + "value": null, + "options": null + } + ] + } + }, + { + "width": 530, + "height": 774, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "position": { + "x": 215.72827911579407, + "y": 823.7825153084143, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 215.72827911579407, + "y": 823.7825153084143, + "zoom": 0.0 + }, + "data": { + "type_name": "CommonChatPromptTemplate", + "type_cls": "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", + "label": "通用聊天提示模板", + "custom_label": null, + "name": "common_chat_prompt_template", + "description": "用于构建静态提示的算子。", + "category": "prompt", + "category_label": "Prompt", + "flow_type": "resource", + "icon": null, + "documentation_url": null, + "id": "resource_dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0", + "ui_size": "large" + }, + "resource_type": "instance", + "parent_cls": [ + "dbgpt.core.interface.operators.prompt_operator.CommonChatPromptTemplate", + "dbgpt.core.interface.prompt.ChatPromptTemplate", + "dbgpt.core.interface.prompt.BasePromptTemplate", + "pydantic.main.BaseModel" + ], + "parameters": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "系统消息", + "name": "system_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "You are a helpful AI Assistant.", + "placeholder": null, + "description": "系统消息。", + "value": "基于以下给出的已知信息, 准守规范约束,专业、简要回答用户的问题.\n规范约束:\n 1.如果已知信息包含的图片、链接、表格、代码块等特殊markdown标签格式的信息,确保在答案中包含原文这些图片、链接、表格和代码标签,不要丢弃不要修改,如:图片格式:![image.png](xxx), 链接格式:[xxx](xxx), 表格格式:|xxx|xxx|xxx|, 代码格式:```xxx```.\n 2.如果无法从提供的内容中获取答案, 请说: \"知识库中提供的内容不足以回答此问题\" 禁止胡乱编造.\n 3.回答的时候最好按照1.2.3.点进行总结, 并以markdwon格式显示.\n\n已知内容: \n{context}\n问题:\n{user_input}, 请使用和用户相同的语言进行回答.\n", + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "text_area", + "size": "large", + "attr": { + "disabled": false, + "status": null, + "prefix": null, + "suffix": null, + "show_count": null, + "max_length": null, + "auto_size": { + "min_rows": 2, + "max_rows": 20 + } + }, + "editor": { + "width": 800, + "height": 400 + } + } + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "消息占位符", + "name": "message_placeholder", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "chat_history", + "placeholder": null, + "description": "聊天历史消息占位符。", + "value": null, + "options": null + }, + { + "type_name": "str", + "type_cls": "builtins.str", + "dynamic": false, + "dynamic_minimum": 0, + "label": "用户消息", + "name": "human_message", + "is_list": false, + "category": "common", + "resource_type": "instance", + "optional": true, + "default": "{user_input}", + "placeholder": "{user_input}", + "description": "用户消息。", + "value": null, + "options": null, + "ui": { + "refresh": false, + "refresh_depends": null, + "ui_type": "text_area", + "size": "large", + "attr": { + "disabled": false, + "status": null, + "prefix": null, + "suffix": null, + "show_count": null, + "max_length": null, + "auto_size": { + "min_rows": 2, + "max_rows": 20 + } + }, + "editor": { + "width": 800, + "height": 400 + } + } + } + ] + } + }, + { + "width": 320, + "height": 235, + "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "position": { + "x": 1364.8014471050712, + "y": 723.8593282560083, + "zoom": 0.0 + }, + "type": "customNode", + "position_absolute": { + "x": 1364.8014471050712, + "y": 723.8593282560083, + "zoom": 0.0 + }, + "data": { + "label": "OpenAI 流式输出算子", + "custom_label": null, + "name": "openai_streaming_output_operator", + "description": "OpenAI 流式大语言模型算子。", + "category": "output_parser", + "category_label": "Output Parser", + "flow_type": "operator", + "icon": null, + "documentation_url": null, + "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", + "tags": { + "order": "higher-order", + "ui_version": "flow2.0" + }, + "operator_type": "transform_stream", + "inputs": [ + { + "type_name": "ModelOutput", + "type_cls": "dbgpt.core.interface.llm.ModelOutput", + "label": "Upstream Model Output", + "custom_label": null, + "name": "model_output", + "description": "The model output of upstream.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "outputs": [ + { + "type_name": "str", + "type_cls": "builtins.str", + "label": "Model Output", + "custom_label": null, + "name": "model_output", + "description": "The model output after transformed to openai stream format.", + "dynamic": false, + "dynamic_minimum": 0, + "is_list": true, + "mappers": null + } + ], + "version": "v1", + "type_name": "OpenAIStreamingOutputOperator", + "type_cls": "dbgpt.model.utils.chatgpt_utils.OpenAIStreamingOutputOperator", + "parameters": [] } - }, - "editor": { - "width": 800, - "height": 400 - } } - } ] - } - }, - { - "width": 320, - "height": 235, - "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "position": { - "x": 1364.8014471050712, - "y": 723.8593282560083, - "zoom": 0.0 - }, - "type": "customNode", - "position_absolute": { - "x": 1364.8014471050712, - "y": 723.8593282560083, - "zoom": 0.0 - }, - "data": { - "label": "OpenAI 流式输出算子", - "custom_label": null, - "name": "openai_streaming_output_operator", - "description": "OpenAI 流式 LLM 算子。", - "category": "output_parser", - "category_label": "Output Parser", - "flow_type": "operator", - "icon": null, - "documentation_url": null, - "id": "operator_openai_streaming_output_operator___$$___output_parser___$$___v1_0", - "tags": { - "order": "higher-order", - "ui_version": "flow2.0" - }, - "operator_type": "transform_stream", - "inputs": [ - { - "type_name": "ModelOutput", - "type_cls": "dbgpt.core.interface.llm.ModelOutput", - "label": "上游模型输出", - "custom_label": null, - "name": "model_output", - "description": "上游模型的输出。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "outputs": [ - { - "type_name": "str", - "type_cls": "builtins.str", - "label": "模型输出", - "custom_label": null, - "name": "model_output", - "description": "转换为 OpenAI 流格式后的模型输出。", - "dynamic": false, - "dynamic_minimum": 0, - "is_list": true, - "mappers": null - } - ], - "version": "v1", - "type_name": "OpenAIStreamingOutputOperator", - "type_cls": "dbgpt.model.utils.chatgpt_utils.OpenAIStreamingOutputOperator", - "parameters": [] - } } - ] } - } } \ No newline at end of file