{"record":{"id":"24e3b620652e2599","repo":"Mintplex-Labs/anything-llm","slug":"ppio-chat-this-model-is-not-valid-for-chat-com","errorCode":null,"errorMessage":"PPIO chat: ${this.model} is not valid for chat completion!","messagePattern":"PPIO chat: (.+?) is not valid for chat completion!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/ppio/index.js","lineNumber":159,"sourceCode":"  }\n\n  constructPrompt({\n    systemPrompt = \"\",\n    contextTexts = [],\n    chatHistory = [],\n    userPrompt = \"\",\n    // attachments = [], - not supported\n  }) {\n    const prompt = {\n      role: \"system\",\n      content: `${systemPrompt}${this.#appendContext(contextTexts)}`,\n    };\n    return [prompt, ...chatHistory, { role: \"user\", content: userPrompt }];\n  }\n\n  async getChatCompletion(messages = null, { temperature = 0.7 }) {\n    if (!(await this.isValidChatCompletionModel(this.model)))\n      throw new Error(\n        `PPIO chat: ${this.model} is not valid for chat completion!`\n      );\n\n    const result = await LLMPerformanceMonitor.measureAsyncFunction(\n      this.openai.chat.completions\n        .create({\n          model: this.model,\n          messages,\n          temperature,\n        })\n        .catch((e) => {\n          throw new Error(e.message);\n        })\n    );\n\n    if (\n      !Object.prototype.hasOwnProperty.call(result.output, \"choices\") ||\n      result.output.choices.length === 0","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/f92433b4ea0598492a1e6645ea22addbb4dd1287/server/utils/AiProviders/ppio/index.js#L141-L177","documentation":"Model validation in PPIOLLM.getChatCompletion: the configured this.model is not in PPIO's list of chat-capable models, so a chat completion request would fail upstream; it is rejected before the API call.","triggerScenarios":"Thrown when the configured PPIO model is not a chat model.","commonSituations":"Model preference set to an invalid model.","solutions":["Select a PPIO model valid for chat completion."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f92433b4ea0598492a1e6645ea22addbb4dd1287","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}