From f5627d1566f90f9ac2202bd90bdf5fafcdd726e4 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Thu, 11 Jan 2024 16:32:53 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20don't=20add=20/v1=20for=20perple?= =?UTF-8?q?xity=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/llm/llms/OpenAI.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 859cb0a27..6ea7ecc99 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -72,7 +72,7 @@ class OpenAI extends BaseLLM { if (url.endsWith("/")) { url = url.slice(0, -1); } - if (!url.endsWith("/v1")) { + if (!url.endsWith("/v1") && !url.includes("api.perplexity.ai")) { url += "/v1"; } return url + "/completions"; @@ -138,7 +138,7 @@ class OpenAI extends BaseLLM { url = url.slice(0, -1); } - if (!url.includes("/v1")) { + if (!url.includes("/v1") && !url.includes("api.perplexity.ai")) { // includes instead of endsWith becuase DeepInfra uses /v1/openai/chat/completions url += "/v1"; }