samir12321/negoptim-promotion-predictor
0
NegOptim AI Service
Stateless FastAPI backend for the negOptimChatExternal Salesforce LWC. It wraps Groq and OpenRouter LLMs with a schema-grounded NegOptim catalog, an embedding router, three Salesforce tools (executed by Apex, not here), a per-query usage report and a canned-response cache for small talk.
Endpoints
GET /health— liveness, active models, router modeGET /models— selectable models (Groq + OpenRouter)GET /usage?model=<id>— daily usage for the selected modelPOST /chat— one agent step (final answer or tool calls for Salesforce)
Configuration (Space secrets → Settings → Variables and secrets)
OPENROUTER_API_KEY— required for OpenRouter modelsGROQ_API_KEY— required for Groq models (preferred)SERVICE_API_KEY— shared secret; must match the Salesforce custom settingOPENROUTER_MODEL/GROQ_MODEL— optional primary-model overrides
No Salesforce credentials live here — the org calls this service via a Named Credential, and the LLM's tool requests are executed inside Salesforce.
