fix(knext): add params in init method of AutoPrompt (#246)

This commit is contained in:
Qu 2024-08-01 11:27:35 +08:00 committed by GitHub
parent a7592a639d
commit 7280befe89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 6 deletions

View File

@ -1 +1 @@
0.0.3-beta2
0.0.3-beta3

View File

@ -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

View File

@ -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"))