mirror of
https://github.com/OpenSPG/openspg.git
synced 2025-11-06 04:52:49 +00:00
fix(knext): add params in init method of AutoPrompt (#246)
This commit is contained in:
parent
a7592a639d
commit
7280befe89
@ -1 +1 @@
|
|||||||
0.0.3-beta2
|
0.0.3-beta3
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
__package_name__ = "openspg-knext"
|
__package_name__ = "openspg-knext"
|
||||||
__version__ = "0.0.3-beta2"
|
__version__ = "0.0.3-beta3"
|
||||||
|
|
||||||
from knext.common.env import init_env
|
from knext.common.env import init_env
|
||||||
|
|
||||||
|
|||||||
@ -12,16 +12,15 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
import uuid
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import List, Dict, Tuple
|
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.client import SchemaClient
|
||||||
from knext.schema.model.base import BaseSpgType
|
from knext.schema.model.base import BaseSpgType
|
||||||
from knext.schema.model.schema_helper import SPGTypeName, PropertyName, RelationName
|
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):
|
class AutoPrompt(PromptOp, ABC):
|
||||||
@ -119,6 +118,12 @@ input:${input}
|
|||||||
|
|
||||||
self._init_render_variables()
|
self._init_render_variables()
|
||||||
self._render()
|
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:
|
def build_prompt(self, variables: Dict[str, str]) -> str:
|
||||||
return self.template.replace("${input}", variables.get("input"))
|
return self.template.replace("${input}", variables.get("input"))
|
||||||
@ -292,6 +297,12 @@ class EEPrompt(AutoPrompt):
|
|||||||
|
|
||||||
self._init_render_variables()
|
self._init_render_variables()
|
||||||
self._render()
|
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:
|
def build_prompt(self, variables: Dict[str, str]) -> str:
|
||||||
return self.template.replace("${input}", variables.get("input"))
|
return self.template.replace("${input}", variables.get("input"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user