Use openpipe optionally in app
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import { env } from "~/env.mjs";
|
||||
|
||||
// import OpenAI from "openai";
|
||||
import { default as OriginalOpenAI } from "openai";
|
||||
import { OpenAI } from "openpipe";
|
||||
|
||||
const openAIConfig = { apiKey: env.OPENAI_API_KEY ?? "dummy-key" };
|
||||
|
||||
// Set a dummy key so it doesn't fail at build time
|
||||
export const openai = new OpenAI.OpenAI({ apiKey: env.OPENAI_API_KEY ?? "dummy-key" });
|
||||
export const openai = env.USE_OPENPIPE
|
||||
? new OpenAI.OpenAI(openAIConfig)
|
||||
: new OriginalOpenAI(openAIConfig);
|
||||
|
||||
Reference in New Issue
Block a user