renamed dataclass
This commit is contained in:
@@ -10,7 +10,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PromptResult:
|
||||
class ManagedPrompt:
|
||||
"""Smart result object that holds template and can fill variables on demand."""
|
||||
template: str
|
||||
name: str
|
||||
@@ -181,7 +181,6 @@ class PromptManager:
|
||||
# Default to 'prompts' directory in the current working directory
|
||||
return Path.cwd() / 'prompts'
|
||||
|
||||
|
||||
def _extract_variables(self, template: str) -> Set[str]:
|
||||
"""Extract all {{variable}} placeholders from template"""
|
||||
pattern = r'\{\{(\w+)\}\}'
|
||||
@@ -242,7 +241,7 @@ class PromptManager:
|
||||
instance.prompt_variables.clear()
|
||||
|
||||
@classmethod
|
||||
def get_prompt(cls, prompt_name: str, **kwargs) -> PromptResult:
|
||||
def get_prompt(cls, prompt_name: str, **kwargs) -> ManagedPrompt:
|
||||
"""
|
||||
Get a PromptResult that can be filled with variables.
|
||||
|
||||
@@ -278,7 +277,7 @@ class PromptManager:
|
||||
schema = instance.schemas.get(prompt_name)
|
||||
|
||||
# Create the result object
|
||||
result = PromptResult(
|
||||
result = ManagedPrompt(
|
||||
template=template,
|
||||
name=prompt_name,
|
||||
variables=variables,
|
||||
@@ -330,7 +329,7 @@ class PromptManager:
|
||||
return prompt_name in instance.schemas
|
||||
|
||||
@classmethod
|
||||
def get_prompt_with_schema(cls, prompt_name: str, **kwargs) -> PromptResult:
|
||||
def get_prompt_with_schema(cls, prompt_name: str, **kwargs) -> ManagedPrompt:
|
||||
"""
|
||||
Get both the processed prompt and its schema (if available)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user