fix(gtm): Resolve f-string SyntaxError and helpers.py incompatibility in orchestrator

This commit is contained in:
2025-12-31 14:20:30 +00:00
parent 9a8762ef10
commit a625e9e811
2 changed files with 41 additions and 19 deletions

View File

@@ -50,7 +50,19 @@ Das Projekt nutzt ein geteiltes `helpers.py`, das auf der alten OpenAI Python Li
```text
openai==0.28.1
# weitere deps...
### 1.5 Python Syntax & F-Strings
Multi-Line f-Strings mit JSON-Beispielen (`{...}`) sind extrem fehleranfällig (Escaping, Einrückung).
* **Best Practice:** Komplexe JSON-Daten oder Strings **vorher** in Variablen speichern und dann einfügen.
```python
# Schlecht:
prompt = f"""Daten: {json.dumps(data.get('nested'))}"""
# Gut:
nested_json = json.dumps(data.get('nested'))
prompt = f"""Daten: {nested_json}"""
```
* **Signaturen prüfen:** Shared Libraries (`helpers.py`) haben oft ältere Signaturen.
* Beispiel: `call_openai_chat` unterstützt oft kein `system_message` Argument. Stattdessen Prompt manuell zusammenbauen (`sys_instr + "\n\n" + prompt`).
---