From 7280befe899f99a41e9a07219d150fce35ab14f6 Mon Sep 17 00:00:00 2001 From: Qu Date: Thu, 1 Aug 2024 11:27:35 +0800 Subject: [PATCH] fix(knext): add params in init method of AutoPrompt (#246) --- python/knext/KNEXT_VERSION | 2 +- python/knext/knext/__init__.py | 2 +- .../builder/operator/builtin/auto_prompt.py | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/python/knext/KNEXT_VERSION b/python/knext/KNEXT_VERSION index 2821b694..0688919c 100644 --- a/python/knext/KNEXT_VERSION +++ b/python/knext/KNEXT_VERSION @@ -1 +1 @@ -0.0.3-beta2 +0.0.3-beta3 diff --git a/python/knext/knext/__init__.py b/python/knext/knext/__init__.py index a3cab32e..d1236169 100644 --- a/python/knext/knext/__init__.py +++ b/python/knext/knext/__init__.py @@ -11,7 +11,7 @@ __package_name__ = "openspg-knext" -__version__ = "0.0.3-beta2" +__version__ = "0.0.3-beta3" from knext.common.env import init_env diff --git a/python/knext/knext/builder/operator/builtin/auto_prompt.py b/python/knext/knext/builder/operator/builtin/auto_prompt.py index ace424dd..5a49db48 100644 --- a/python/knext/knext/builder/operator/builtin/auto_prompt.py +++ b/python/knext/knext/builder/operator/builtin/auto_prompt.py @@ -12,16 +12,15 @@ import json import re +import uuid from abc import ABC from typing import List, Dict, Tuple - +from knext.builder.operator.op import PromptOp +from knext.builder.operator.spg_record import SPGRecord from knext.schema.client import SchemaClient from knext.schema.model.base import BaseSpgType from knext.schema.model.schema_helper import SPGTypeName, PropertyName, RelationName -from knext.builder.operator.op import PromptOp -from knext.builder.operator.spg_record import SPGRecord -import uuid class AutoPrompt(PromptOp, ABC): @@ -119,6 +118,12 @@ input:${input} self._init_render_variables() self._render() + self.params = { + "spg_type_name": spg_type_name, + "property_names": property_names, + "relation_names": relation_names, + "with_description": with_description, + } def build_prompt(self, variables: Dict[str, str]) -> str: return self.template.replace("${input}", variables.get("input")) @@ -292,6 +297,12 @@ class EEPrompt(AutoPrompt): self._init_render_variables() self._render() + self.params = { + "event_type_name": event_type_name, + "property_names": property_names, + "relation_names": relation_names, + "with_description": with_description, + } def build_prompt(self, variables: Dict[str, str]) -> str: return self.template.replace("${input}", variables.get("input"))