samir12321's picture
Replace promotion-predictor with NegOptim AI chatbot service
72bb57a
|
Raw
History Blame Contribute Delete
1.2 kB
metadata
title: NegOptim AI Service
emoji: πŸ€–
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
pinned: false

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 mode
  • GET /models β€” selectable models (Groq + OpenRouter)
  • GET /usage?model=<id> β€” daily usage for the selected model
  • POST /chat β€” one agent step (final answer or tool calls for Salesforce)

Configuration (Space secrets β†’ Settings β†’ Variables and secrets)

  • OPENROUTER_API_KEY β€” required for OpenRouter models
  • GROQ_API_KEY β€” required for Groq models (preferred)
  • SERVICE_API_KEY β€” shared secret; must match the Salesforce custom setting
  • OPENROUTER_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.