ciyidogan commited on
Commit
c5de5b2
ยท
verified ยท
1 Parent(s): 763f577

Delete prompy_engine.py

Browse files
Files changed (1) hide show
  1. prompy_engine.py +0 -60
prompy_engine.py DELETED
@@ -1,60 +0,0 @@
1
- from utils import log
2
-
3
- class PromptEngine:
4
- def __init__(self, service_config):
5
- self.service_config = service_config
6
-
7
- def build_intent_prompt(self, project_name):
8
- project = self.service_config.get_project(project_name)
9
- if not project:
10
- raise Exception(f"Project not found: {project_name}")
11
-
12
- system_prompt = self.service_config.system_prompt
13
- intent_examples = []
14
-
15
- for intent in project["intents"]:
16
- examples = intent.get("examples", [])
17
- intent_examples.append(f"Intent: {intent['name']}\nExamples:\n" + "\n".join(f"- {ex}" for ex in examples))
18
-
19
- full_prompt = f"{system_prompt}\n\nIntent Definitions:\n" + "\n\n".join(intent_examples)
20
- log("๐Ÿ›  Built intent detection prompt.")
21
- return full_prompt
22
-
23
- def build_parameter_prompt(self, project_name, intent_name, missing_parameters):
24
- project = self.service_config.get_project(project_name)
25
- if not project:
26
- raise Exception(f"Project not found: {project_name}")
27
-
28
- intent = next((i for i in project["intents"] if i["name"] == intent_name), None)
29
- if not intent:
30
- raise Exception(f"Intent not found: {intent_name}")
31
-
32
- system_prompt = self.service_config.system_prompt
33
- prompts = []
34
-
35
- for param in intent.get("parameters", []):
36
- if param["name"] in missing_parameters:
37
- prompts.append(f"Extract the value for parameter '{param['name']}': {param['extraction_prompt']}")
38
-
39
- if not prompts:
40
- raise Exception("No extraction prompts found for missing parameters.")
41
-
42
- full_prompt = f"{system_prompt}\n\nParameter Extraction:\n" + "\n".join(prompts)
43
- log("๐Ÿ›  Built parameter extraction prompt.")
44
- return full_prompt
45
-
46
- def build_humanization_prompt(self, project_name, intent_name):
47
- project = self.service_config.get_project(project_name)
48
- if not project:
49
- raise Exception(f"Project not found: {project_name}")
50
-
51
- intent = next((i for i in project["intents"] if i["name"] == intent_name), None)
52
- if not intent:
53
- raise Exception(f"Intent not found: {intent_name}")
54
-
55
- system_prompt = self.service_config.system_prompt
56
- humanization_instruction = intent.get("humanization_prompt", "")
57
-
58
- full_prompt = f"{system_prompt}\n\nHumanization Instruction:\n{humanization_instruction}"
59
- log("๐Ÿ›  Built humanization prompt.")
60
- return full_prompt