fix
This commit is contained in:
@@ -16,27 +16,29 @@ Restart **both** `api` and `worker` after changing `OPENAI_*`. Worker logs shoul
|
||||
|
||||
## Product enhance model choice
|
||||
|
||||
Admin AI role for **product enhance** should prefer a **fast non-reasoning chat model** that emits `message.content` (JSON) under budget.
|
||||
Admin AI role for **product enhance** should prefer a model that emits `message.content` (JSON) under budget. Recommended OpenAI: **`gpt-5.6-luna`** (high-volume / cost-efficient GPT-5.6 tier).
|
||||
|
||||
Reasoning / “code-fast” style models often spend the entire `max_tokens` budget in `reasoning_content`, then return `finish_reason=length` with empty or truncated JSON. Descrybe retries once at `MaxTokensEnhanceRetry` and may synthesize formula HTML as salvage — that is **not** live LLM formula compliance.
|
||||
Reasoning / “code-fast” style models often spend the entire completion budget in `reasoning_content`, then return `finish_reason=length` with empty or truncated JSON. Descrybe retries once at `MaxTokensEnhanceRetry` and may synthesize formula HTML as salvage — that is **not** live LLM formula compliance.
|
||||
|
||||
If enhance logs show `finish_reason=length` with empty/truncated content even after the retry, switch Admin enhance to a non-reasoning model.
|
||||
For GPT-5 / o-series Chat Completions, the client sends `max_completion_tokens` (not `max_tokens`), omits custom `temperature`, and sets `reasoning_effort` (`none` for probes, `low` for long formula-HTML enhance) so visible HTML is not eaten by deep reasoning.
|
||||
|
||||
If enhance logs show `finish_reason=length` with empty/truncated content even after the retry, switch Admin enhance to a lower-reasoning or classic chat model (e.g. `gpt-4o-mini`).
|
||||
|
||||
## Hardening defaults (code)
|
||||
|
||||
| Constant | Value | Where |
|
||||
|----------|------:|-------|
|
||||
| `DefaultStructuredTemp` | `0.2` (capped ≤0.3) | `processing/llm_json.go`, `openai.go` |
|
||||
| `MaxTokensEnhance` | `16384` | product title/description (reasoning + formula HTML JSON) |
|
||||
| `MaxTokensEnhanceRetry` | `32768` | one-shot bump on `finish_reason=length` empty/truncated JSON |
|
||||
| `DefaultStructuredTemp` | `0.2` (capped ≤0.3; omitted on GPT-5/o-series) | `processing/llm_json.go`, `openai.go` |
|
||||
| `MaxTokensEnhance` | `24576` | product title + multi-section HTML description JSON |
|
||||
| `MaxTokensEnhanceRetry` | `40960` | one-shot bump on `finish_reason=length` empty/truncated JSON |
|
||||
| `MaxTokensSEO` | `180` | meta title/description |
|
||||
| `MaxTokensCampaign` | `650` | email JSON |
|
||||
| `MaxProductDescRunes` | `400` | user context |
|
||||
| `MaxProductDescRunes` | `3500` | source description in enhance user context |
|
||||
| `MaxAttrKeys` / `MaxAttrValueRunes` | `10` / `60` | attrs in enhance prompt |
|
||||
| `MaxBrandInjectRunes` | `500` | brand kit block |
|
||||
| `MaxCampaignProducts` | `8` | campaign product list |
|
||||
|
||||
OpenAI-compatible chat completions here use a single `max_tokens` completion budget (no separate reasoning vs content split on typical gateways). Length-cap handling lives in `OpenAIClient.doComplete` / `CompleteWithOptions`.
|
||||
Classic OpenAI-compatible chat completions use `max_tokens`. GPT-5 / o-series use `max_completion_tokens` (budget includes hidden reasoning tokens). Length-cap handling lives in `OpenAIClient.doComplete` / `CompleteWithOptions`.
|
||||
|
||||
## Prompt style
|
||||
|
||||
@@ -49,7 +51,7 @@ OpenAI-compatible chat completions here use a single `max_tokens` completion bud
|
||||
|
||||
`processing.CompleteJSON`:
|
||||
|
||||
1. Call Completer with `max_tokens` + low temperature
|
||||
1. Call Completer with completion budget + low temperature (classic) / GPT-5.6 param mapping
|
||||
2. `StripJSONFences` / isolate `{…}`
|
||||
3. On parse fail → **one retry** with `INVALID. Reply with ONLY one JSON object…`
|
||||
4. Call sites fall back to originals/templates instead of storing garbage prose as titles
|
||||
|
||||
Reference in New Issue
Block a user