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
3
votes
1 answer

Does chatgpt-3.5-turbo API recounts the tokens in billing when sending the conversation history in api

When creating a chat app using chatgpt-3.5-turbo model. Does the API consider the whole tokens (including the assistant messages and old set of messages) in billing or just the last message from the user is counted in billing whenever I resend the…
akzarma
  • 179
  • 11
3
votes
0 answers

adding chatgpt's api to a discord command in discord.js

i have this code which is fine as far as i know but it keeps hitting me with error below, the api key is correct and the code is all good and the api is working so why am i getting this error. Code: const { SlashCommandBuilder } =…
Mahdi
  • 31
  • 7
3
votes
1 answer

OpenAI API: openai.api_key = os.getenv() not working

I am just trying some simple functions in Python with OpenAI APIs but running into an error: I have a valid API secret key which I am using. Code: >>> import os >>> import openai >>> openai.api_key = os.getenv("I have placed the key here") >>>…
Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45
2
votes
1 answer

Is there a way I can handle context and general questions in Langchain QA Retrieval?

I want to make a chatbot, that should answer questions from the context, in my case, a vector database. It is doing that perfectly. But I also want it to answer questions, which are not in the vector database. But it is unable to do so. It only is…
Usman Afridi
  • 179
  • 1
  • 11
2
votes
1 answer

LangChain ConversationalRetrieval with JSONloader

I modified the data loader of this source code https://github.com/techleadhd/chatgpt-retrieval for ConversationalRetrievalChain to accept data as JSON. I created a dummy JSON file and according to the LangChain documentation, it fits JSON structure…
Utku Can
  • 683
  • 3
  • 12
2
votes
1 answer

OpenAI Function Calling Error ---- openai.error.InvalidRequestError:

I am creating a chatbot which can query all 'Views' in my database based on user query. I tried many other methods but didn't succeed so now I thought I should try OpenAI's function calling. What I did: I created a function for one of the view. In…
2
votes
2 answers

Is there a way to reduce the number of tokens sent to chatgpt (as context)?

I'm using chatgpt's API to discuss book topics. In order for chatgpt to understand the whole story I had to add context. This means that all user questions and chatgpt replies are sent with the same request. Thus very quickly reaching the maximum…
CDN
  • 394
  • 6
  • 15
2
votes
2 answers

How to check the validity of the OpenAI key from python?

https://pypi.org/project/openai/ "The library needs to be configured with your account's secret key which is available on the website. [...] Set it as the OPENAI_API_KEY environment variable" When I ask Chat GPT to complete a message import…
Paul Rougieux
  • 10,289
  • 4
  • 68
  • 110
2
votes
2 answers

add memory to create_pandas_dataframe_agent in Langchain

I am trying to add memory to create_pandas_dataframe_agent to perform post processing on a model that I trained using Langchain. I am using the following code at the moment. from langchain.llms import OpenAI import pandas as pd df =…
Matt
  • 85
  • 6
2
votes
3 answers

How can I add the "system" message into my prompt?

I've been trying to integrate gpt-3.5-turbo in my Flutter app while maintaining the chat history. I used FlutterFlow to generate the boilerplate code and then downloaded the code to further edit it. I have successfully integrated the model while…
Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133
2
votes
1 answer

What is the use case of System role

This is from the official documentation from ChatGPT chat completion: openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who…
cyz3a5c0v1
  • 119
  • 1
  • 5
2
votes
1 answer

ChatGPT API - creating longer JSON response bigger than gpt-3.5-turbo token limit

I have some use case for ChatGPT API which I don't know how to handle. I'm creating Python app and I have method which creates request with some instructions and some data to rewrite for ChatGPT. It looks like this (instructions and data are just…
hvma411
  • 349
  • 2
  • 17
2
votes
0 answers

I want to train a open source LLM model on my custom dataset [don't want to use openai]

I am trying to use a open source LLM model ggml-gpt4all-l13b-snoozy.bin (it is downloaded from https://gpt4all.io/index.html). I want to use the same model embeddings and create a ques answering chat bot for my custom data (using the lanchain and…
ankitmhjn5
  • 89
  • 5
2
votes
2 answers

How can i update my chatbot with chatgpt from "text-davinci-003" to "gpt-3.5-turbo" in python

I'm new in python and i want a little hand into this code. I'm developing a smart chatbot using the openai API and using it in what's app. I have this piece of my code that is responsible for the chatgpt response in my code. At the moment, this code…
2
votes
0 answers

Payload clarification for Langchain Embeddings with OpenAI and Chroma

I have created the following piece of code using Jupyter Notebook and langchain==0.0.134 (which in my case comes with openai==0.27.2). The code takes a CSV file and loads it in Chroma using OpenAI…
Edu
  • 159
  • 1
  • 14
1 2
3
24 25