skip to Main Content

Javascript – Learning FLask: Stuck at OpenAI api

from flask import Flask, request, jsonify, send_from_directory import openai from openai import OpenAI import os app = Flask(__name__) openai.api_key = 'sk-' # I added my key here. @app.route('/') def index(): return send_from_directory('.', 'index.html') @app.route('/analyze', methods=['POST']) def analyze_cv(): if 'cv' not…

VIEW QUESTION

Protect OpenAI key using Firebase function

I have an app that uses OpenAI and like many others my key was recently compromised. I have this simple code: const functions = require('firebase-functions'); const OpenAI = require("openai"); const openai = new OpenAI({ apiKey: functions.config().openai.key, }); exports.generateText = functions.https.onCall(async…

VIEW QUESTION

OpenAI api in node.js, javascript

I am using openai API on javascript. Below is my code. require('dotenv').config(); const OpenAI_Api = process.env.OpenAIApi || 'Mykey'; const { Configuration, OpenAIApi } = require('openai'); const configuration = new Configuration({ apiKey: OpenAI_Api }); const openai = new OpenAIApi(configuration); const createChatCompletion…

VIEW QUESTION
Back To Top
Search