flare / prompt_builder.py
ciyidogan's picture
Update prompt_builder.py
b232328 verified
raw
history blame
1.09 kB
"""
Flare – Prompt Builder helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karmaşık şablonlar Spark tarafında derinleştirilecek ama
ilk versiyon için basit string concat yeterli.
"""
from __future__ import annotations
from typing import List
from config_provider import IntentConfig, ParameterConfig
def build_detection_prompt(general: str, intent: IntentConfig) -> str:
examples = "\n".join(f"- {e}" for e in intent.examples)
return f"{general}\nÖrnekler:\n{examples}\nBu mesaj yukarıdaki niyetlerden hangisine ait?"
def build_param_extract_prompt(general: str, intent: IntentConfig, missing: List[ParameterConfig]) -> str:
names = ", ".join(p.name for p in missing)
return f"{general}\nIntent: {intent.name}\nEksik parametreleri çıkar: {names}"
def build_missing_param_prompt(missing: List[str]) -> str:
list_ = ", ".join(missing)
return f"{list_} değer(ler)ine ihtiyacım var, paylaşır mısın?"
def build_api_humanize_prompt(general: str, response_prompt: str, api_json: str) -> str:
return f"{general}\n{response_prompt}\nJSON:\n{api_json}"