Questions tagged [chatgpt-api]

Use for questions about the OpenAI ChatGPT (i.e., GPT-3.5) API. Do not use it for questions about any other OpenAI API (GPT-3, GPT-4, etc.).

377 questions
60
votes
5 answers

OpenAI ChatGPT (GPT-3.5) API error 429: "You exceeded your current quota, please check your plan and billing details"

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 #…
Unix
  • 1,358
  • 3
  • 14
  • 23
34
votes
3 answers

OpenAI API: How do I count tokens before(!) I send an API request?

OpenAI's text models have a context length, e.g.: Curie has a context length of 2049 tokens. They provide max_tokens and stop parameters to control the length of the generated sequence. Therefore the generation stops either when stop token is…
meliksahturker
  • 922
  • 2
  • 11
  • 20
26
votes
3 answers

OpenAI ChatGPT (GPT-3.5) API error: "InvalidRequestError: Unrecognized request argument supplied: messages"

I am currently trying to use OpenAI's most recent model: gpt-3.5-turbo. I am following a very basic tutorial. I am working from a Google Collab notebook. I have to make a request for each prompt in a list of prompts, which for sake of simplicity…
corvusMidnight
  • 518
  • 1
  • 4
  • 19
21
votes
4 answers

How to send longer text inputs to ChatGPT API?

We have a use case for ChatGPT in summarizing long pieces of text (speech-to-text conversations which can be over an hour). However we find that the 4k token limit tends to lead to a truncation of the input text to say half or so due to the token…
Brendan Hill
  • 3,406
  • 4
  • 32
  • 61
13
votes
5 answers

OpenAI ChatGPT (GPT-3.5) API error: "This is a chat model and not supported in the v1/completions endpoint"

import discord import openai import os openai.api_key = os.environ.get("OPENAI_API_KEY") #Specify the intent intents = discord.Intents.default() intents.members = True #Create Client client = discord.Client(intents=intents) async def…
RAFA 04128
  • 139
  • 1
  • 1
  • 3
10
votes
2 answers

How to continue incomplete response of openai API

In OpenAI API, how to programmatically check if the response is incomplete? If so, you can add another command like "continue" or "expand" or programmatically continue it perfectly. In my experience, I know that if the response is incomplete, the…
8
votes
4 answers

How do i add memory to RetrievalQA.from_chain_type? or, how do I add a custom prompt to ConversationalRetrievalChain?

How do i add memory to RetrievalQA.from_chain_type? or, how do I add a custom prompt to ConversationalRetrievalChain? For the past 2 weeks ive been trying to make a chatbot that can chat over documents (so not in just a semantic search/qa so with…
7
votes
1 answer

Markdown or formatting text in ChatGPT response

I just have confirmed that using the API with the chat completion, the response is in plain text. How to format the text from the response, for at least new line, tables, bullet point, heading...Something like that?
gaxiw36299
  • 99
  • 2
7
votes
3 answers

How to stream Agent's response in Langchain?

I am using Langchain with Gradio interface in Python. I have made a conversational agent and am trying to stream its responses to the Gradio chatbot interface. I have had a look at the Langchain docs and could not find an example that implements…
MRF
  • 455
  • 1
  • 6
  • 13
6
votes
4 answers

formatting of chat gpt responses

I am using chat gpt api on my react application. The problem i am facing is how to format the response coming from chat gpt. If is ask it to give me a response in table format it provides weird response I used pre tag to display text and response…
6
votes
2 answers

Using Vicuna + langchain + llama_index for creating a self hosted LLM model

I want to create a self hosted LLM model that will be able to have a context of my own custom data (Slack conversations for that matter). I've heard Vicuna is a great alternative to ChatGPT and so I made the below code: from llama_index import…
Ben
  • 421
  • 6
  • 19
5
votes
2 answers

How to incorporate context/chat history in OpenAI ChatBot using ChatGPT and langchain in Python?

Please bear with me as this is literally the first major code I have ever written and its for OpenAI's ChatGPT API. What I intend to do with this code is load a pdf document or a group of pdf documents. Then split them up so as to not use up my…
Ali Q
  • 51
  • 4
5
votes
2 answers

is there any way to stream response word by word of chatgpt api directly in react native (with javascript)

I want to use Chat GPT Turbo api directly in react native (expo) with word by word stream here is working example without stream fetch(`https://api.openai.com/v1/chat/completions`, { body: JSON.stringify({ model: 'gpt-3.5-turbo', …
Ibad Ur Rehman
  • 696
  • 1
  • 9
  • 16
5
votes
1 answer

OpenAI API 404 response

I'm trying to use ChatGPT for my Telegram bot. I used to use "text-davinci-003" model, and it was working fine (even now it's working fine), but I'm not satisfied with its responses. Now I'm trying to change the model to "gpt-3.5-turbo", and it's…
5
votes
2 answers

OpenAI ChatGPT (GPT-3.5) API error: "openai.createChatCompletion is not a function"

I have this in my MERN stack code file, and it works well. exports.chatbot = async (req, res) => { console.log("OpenAI Chatbot Post"); const { textInput } = req.body; try { const response = await openai.createCompletion({ model:…
WynMars
  • 53
  • 1
  • 5
1
2 3
24 25