fix(gtm): Resolve f-string SyntaxError and helpers.py incompatibility in orchestrator
This commit is contained in:
@@ -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`).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user