a70f0c52a9
CI / test (pull_request) Failing after 8s
- Added CORS handling for the create-chat-conversation function. - Implemented health check endpoint for the function. - Created endpoints for managing conversations and messages with OpenAI. - Added error handling and response formatting for better API usability. - Introduced utility functions for environment variable management and Supabase client creation. - Enhanced schema handling for structured responses from OpenAI. - Implemented conversation archiving and retrieval logic.
10 lines
272 B
TypeScript
10 lines
272 B
TypeScript
import OpenAI from "npm:openai@6.16.0";
|
|
import { mustGetEnv } from "./env.ts";
|
|
|
|
export function getOpenAI() {
|
|
// OpenAI lib toma OPENAI_API_KEY de env automáticamente,
|
|
// pero lo validamos para fallar rápido:
|
|
mustGetEnv("OPENAI_API_KEY");
|
|
return new OpenAI();
|
|
}
|