openai-api

load jsonl File with OpenAI API request results to pandas data.frame

load jsonl File with OpenAI API request results to pandas data.frame Question: I have a large data set containing around 500k observation. It has a string variable that I want to create an embedding for. I used the OpenAI API to create the embedding and because of the large number of observations I used their …

Total answers: 1

warning C4996: 'Py_OptimizeFlag': deprecated in 3.12 aiohttp/_websocket.c(3042): error C2039: 'ob_digit': is not a member of '_longobject'

warning C4996: 'Py_OptimizeFlag': deprecated in 3.12 aiohttp/_websocket.c(3042): error C2039: 'ob_digit': is not a member of '_longobject' Question: Newbie here. I have been trying to installen the openai library into python, but I keep running into problems. I have already installed C++ libraries. It seems to have problems specific with aio http, and I get the …

Total answers: 2

Is there a better way to strip and get OpenAI responses?

Is there a better way to strip and get OpenAI responses? Question: I’m trying to get at least 1 response for each keyword that is looped to be included in the text prompt, however when I run the python code to generate responses I get the following error: PS C:Users…DocumentsArticle-gen> & C:/Users/…/AppData/Local/Microsoft/WindowsApps/python3.11.exe c:/Users/…/Documents/Article-gen/createArticle.py ChatGPT API …

Total answers: 1

OpenAI API returns error (quota exceeded) when it's new account

OpenAI ChatGPT (GPT-3.5) API error 429: "You exceeded your current quota, please check your plan and billing details" Question: I’m making a Python script to use OpenAI via its API. However, I’m getting this error: openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details My script is the following: #!/usr/bin/env python3.8 …

Total answers: 2

Create function for `openai` and `ChatCompletion` in Python

Create function for `openai` and `ChatCompletion` in Python Question: I am trying to create a simple function that will take a message (string) and pass it through to openai.ChatCompletion.create(), but when I use an F-string, it returns an object error. Not super familiar with debugging Python, so I am a bit stuck here. def get_response(message): …

Total answers: 3

Can't access gpt-4 model via python API although gpt-3.5 works

Can't access gpt-4 model via python API although gpt-3.5 works Question: I’m able to use the gpt-3.5-turbo-0301 model to access the ChatGPT API, but not any of the gpt-4 models. Here is the code I am using to test this (it excludes my openai API key). The code runs as written, but when I replace …

Total answers: 2

FastAPI StreamingResponse not streaming with generator function

FastAPI StreamingResponse not streaming with generator function Question: I have a relatively simple FastAPI app that accepts a query and streams back the response from ChatGPT’s API. ChatGPT is streaming back the result and I can see this being printed to console as it comes in. What’s not working is the StreamingResponse back via FastAPI. …

Total answers: 4