Files
skillfactor-pipeline/adapters/openai/build_openai.py
skillfactor-pipeline 5c03e07ded fix(homepage): chat example in English, simpler case, real chat bubbles
Simpler story (slide decks unread -> three-bullet status email), proper
Claude-chat look with avatars and bubbles on both sides. Canonical trigger
prompt switched to English everywhere (homepage, architecture, both
adapter generators rebuilt) - V7 consistency green, all checks pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PDKeXvpT6tENSvyQGLV1Uq
2026-07-10 06:01:43 +02:00

70 lines
2.9 KiB
Python

"""ChatGPT adapter scaffold — instruction + knowledge bundle per profession.
Runnable without any OpenAI account: it only produces the upload artifacts.
"""
import os
import shutil
import sys
A = os.path.dirname(os.path.abspath(__file__))
BASE = os.path.dirname(os.path.dirname(A))
K = os.path.join(BASE, "knowledge")
sys.path.insert(0, os.path.join(K, "pipeline"))
from se_compile import PROFESSIONS # noqa: E402
TRIGGER_PROMPT = ("Save the key insight from this chat as a lesson learned "
"in my SkillFactor repo.")
INSTRUCTION = """You are the SkillFactor occupational skill for the
profession "{TITLE}". You start with this profession's experience: use the
uploaded knowledge files (competence explanations, curated practitioner
Q&A, vocabulary) as your primary reference before answering from general
knowledge. Retrieval cascade when the SkillFactor gateway is connected:
community profile -> the user's org overlay -> active project lessons;
more specific beats more general.
Contributing knowledge back: offer to save a lesson ONLY when the chat
solved something non-trivial, transferable, with a real insight. The user
can always trigger it manually with:
"{TRIGGER}"
Then: propose up to TWO distillates (project distillate with customer
reference -> private org repo; generalized anonymized distillate -> public
community layer as pull request) and ask "Both, just one, or neither?".
Always show the complete final text; only confirmed text is submitted —
word for word. Check the target folder for similar lessons first and
propose an update instead of a duplicate. Toward the community layer:
no names, no company/customer/project references, roles instead of
persons, only the transferable pattern. Submission is always a pull
request via the propose_lesson action, never a direct commit.
"""
def main():
dist = os.path.join(A, "dist")
if os.path.isdir(dist):
shutil.rmtree(dist)
for prof in PROFESSIONS:
src = os.path.join(K, "professions", prof["slug"])
if not os.path.isdir(src):
continue
out = os.path.join(dist, prof["slug"])
os.makedirs(os.path.join(out, "knowledge"), exist_ok=True)
open(os.path.join(out, "instructions.md"), "w", encoding="utf-8",
newline="\n").write(
INSTRUCTION.replace("{TITLE}", prof["title"])
.replace("{TRIGGER}", TRIGGER_PROMPT))
for f in ("knowledge.md", "vocabulary.json"):
p = os.path.join(src, f)
if os.path.exists(p):
shutil.copy(p, os.path.join(out, "knowledge", f))
cdir = os.path.join(src, "competences")
if os.path.isdir(cdir):
for f in sorted(os.listdir(cdir))[:20]: # GPT knowledge cap
shutil.copy(os.path.join(cdir, f),
os.path.join(out, "knowledge", f))
print(f"bundle: {prof['slug']}")
if __name__ == "__main__":
main()