Questions tagged [openai-api]

OpenAI makes several AI products, including ChatGPT, Dall-E, Whisper. Use for questions about the OpenAI API, and not for general support.

Use for questions about using the OpenAI API. All question should be according to the scope of Stack Overflow and following the How to ask a good question and Expected Behavior guidelines.

Before asking a question, read the documentation.

If you will include non-original code, be sure to provide proper attribution.

Don't use for questions about using ChatGPT as an end-user. Don't use for questions about responses given by ChatGPT that aren't directly related to a programming issue using the OpenAI API.

Related tags:


OpenAI Community

https://community.openai.com/

1620 questions
0
votes
1 answer

TypeError: openai__WEBPACK_IMPORTED_MODULE_1__.OpenAIAPI is not a constructor

I'm trying to recreate an idea using OpenAI Api with react. I'm using the official OpenAI Documentation here but got stuck and I'm hoping someone is able to help. The idea is to have an simple text-input and a button on a page. Reciving the user's…
lechnerio
  • 884
  • 1
  • 16
  • 44
0
votes
2 answers

slash commands not working with openai with discod bot

I have this command on my personnal bot that generates a image based on a discord users prompt but when i make it into a slash command, there is an error, i have done tests and the image is fine but it never sends the image back working…
Hoadi605
  • 15
  • 4
0
votes
1 answer

Open AI davinci does not produce any output (text or audio)

I have the following piece of code: import openai import pyttsx3 import speech_recognition as sr from api_key import API_KEY openai.api_key = API_KEY engine = pyttsx3.init() r = sr.Recognizer() mic =…
DZR
  • 195
  • 1
  • 2
  • 12
0
votes
0 answers

Define the reward function to minimize costs

I have a problem with my reinforcement learning model. I am trying to simulate an electric battery storage. The battery charges when the electricity prices are low and discharge ONLY to the user at fixed hours during the day, every day. Therefore,…
MiPre
  • 13
  • 2
0
votes
1 answer

How do I find out my fine-tunes models using Python?

Hi can anyone help me with Python code to list my fine-tunes models? Is there an equivalent to the openai.file.list() I have tried openai.models.list() openai.fine-tunes.list()
Christopher
  • 427
  • 1
  • 8
  • 18
0
votes
0 answers

Is there a tool to easily convert text files to JSONL documents?

I have several fairly large .txt files that I need to convert to JSONL documents so that I can prepare training data and upload files into an OpenAI environment. I searched for various free web-based sites and conversion tools and could not find…
SolaceSWL
  • 1
  • 2
0
votes
1 answer

Unity connecting to Dall-E API when using image param?

How would one use the Dall-E text-to-image API's image and mask parameters in Unity C#? For background, something like the following works for the other parameters like prompt (full code on GitHub): string apiMode = "generations"; string apiUrl =…
Philipp Lenssen
  • 8,818
  • 13
  • 56
  • 77
0
votes
0 answers

Fetching OpenAI Image Generator Issue

Good afternoon. I am trying to play with OpenAI. I am struggling to put n(number of images. n: 2) of generated images into the DOM. Using React const [image, setImage] = useState(""); const raw = JSON.stringify({ prompt: `${ImgTitle()}`, …
0
votes
0 answers

How to play LunarLander-v2 on Colab

This is my inference code for training and plotting the Lunar Lander by OpenAI. def plot_learning_curve(x, scores, figure_file): running_avg = np.zeros(len(scores)) for i in range(len(running_avg)): running_avg[i] =…
Onur-Andros Ozbek
  • 2,998
  • 2
  • 29
  • 78
0
votes
1 answer

why I am getting this error even though I have installed openai?

I tried to uninstall and reinstall it but still getting this errors
hush345
  • 9
  • 1
0
votes
1 answer

Running more than 1 prompt in OpenAI

In the OpenAI API, I would like to run 3 prompts, add the results to a variable called text, and display them all at once. Right now, the problem is that I can only do 1 prompt at a time. Is there a way to run 3 prompts at once? If so, please add…
frosty
  • 2,559
  • 8
  • 37
  • 73
0
votes
0 answers

Can I call a variable in a prompt to store the value of the variable into a prompt section

import os from urllib import response import openai def gpt3(stext): openai.api_key = 'my-kye-here' response = openai.Completion.create( model="text-davinci-002", prompt= stext, temperature=0.7, …
0
votes
0 answers

Save videos in every 500 episode in OpenAI Gym

I am trying to implement a code for saving videos every 500 episodes while using OpenAI gym and training. I was unable to get videos every 500 episodes. Code: from gym import wrappers import gym vidsavedir = "./video" vidsaveeachepi = 500 …
Ind
  • 377
  • 2
  • 6
  • 16
0
votes
0 answers

Unsure how to connect an api using nodejs

I'm trying to connect the openai api into my app but I'm not sure why it's not working. From my frontend, I have a createUserData that receives an input and then stores it to my MongoDB database. But now, I want to send that input that I received to…
Soccerball123
  • 741
  • 5
  • 17
0
votes
0 answers

Emoji not getting rendered by the OpenAI's API

I'm using OpenAI's API to convert Movie Titles to emojis. I'm using Flutter and Dart. I'm getting the response from API but Emojis are not rendered! The "movieController" is basically the user input and the "setState" prints the Emoji on Screen.…