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

Creating the load_summarize_chain for Langchain,specified chain_type=map_reduce. get an error when using the prompts

I'm trying to create the load_summarize_chain for Langchain using prompts that I created myself. llm = ChatOpenAI(model_name="gpt-3.5-turbo", temperature=0.7) PROMPT = PromptTemplate(template=prompt_template, input_variables=["text"]) chain =…
Mick
  • 21
  • 1
  • 2
2
votes
1 answer

Error: PineconeClient: Project name not set, v0.0.10

Downloaded GitHub - mayooear/gpt4-pdf-chatbot-langchain: GPT4 & LangChain Chatbot for large PDF docs When I try to run the app, I get following error PineconeClient: Error getting project name: TypeError: fetch failed error - [Error:…
Rohit
  • 6,941
  • 17
  • 58
  • 102
2
votes
2 answers

How can I stream in a Vercel Serverless function? It's working in local, but not once deployed

I'm testing some ChatGPT functionalities, and found out how to stream the responses as if they were typed in real-time. While I'm able to reproduce this correctly in my local, for some reason when I deploy this, the response only shows once the full…
2
votes
0 answers

How can i migrate from text-davinci-003 model to gpt-3.5-turbo model using OpenAI API?

I tried to change my code to be able to use the new OpenAI model but my application stops working, BEFORE: In Bold are parts of the code that I changed and where working using text-davinci-003 model **var url =…
1
vote
1 answer

When using GPT-4 API, do I need to send the entire conversation back each time?

I'm new to OpenAI API. I work with GPT-3.5-Turbo, using this code: messages = [ {"role": "system", "content": "You’re a helpful assistant"} ] while True: content = input("User: ") if content == 'end': …
Realchini
  • 11
  • 2
1
vote
1 answer

Most similar words for ChatGPT Word Embeddings

I am extracting the word embeddings corresponding to a list of words from ChatGPT API. I was wondering if there is a way similar to Gensim most_similar method to extract the n words that are most similar to my desired terms in the entire model.
Marj
  • 25
  • 5
1
vote
1 answer

OpenAI ChatGPT (GPT-3.5) API error 400: "Bad Request" when adding multiple questions

In the following code, it always works fine the first time. As you can see I'm trying to keep the list of previous questions and answers to keep context with the _items List. So the second time it fails with error 400 bad request, but to test I…
Jay Croghan
  • 445
  • 3
  • 16
1
vote
0 answers

PHP - Having a long conversation with GPT 3.5 API

I am using GPT 3.5 Chat Completion API to write a 2000 words article, but it produces only about 1000 words response regardless of the topic. So I am trying to get it to write one half of the article in 1000 words at a time, but it only responds…
Grey Lover
  • 31
  • 1
  • 1
  • 11
1
vote
0 answers

Langchain streaming process in python

thank you for your looking for me. I'm going to implement Streaming process in langchain, but I can't display tokenized message in frontend. This is my code: def generate_message(query, history, behavior, temp, chat): # load_dotenv() …
Andy Wood
  • 11
  • 4
1
vote
3 answers

Getting ClientException: XMLHttpRequest error while trying to call OpenAI API in backend

Here's server.js: const express = require("express"); const cors = require("cors"); const axios = require("axios"); const app = express(); app.use(cors()); app.use(express.json()); app.post("/", async (req, res) => { try { const apiKey =…
Hammad Nasir
  • 2,889
  • 7
  • 52
  • 133
1
vote
2 answers

Azure OpenAI gpt-35-turbo nondeterministic with temperature 0

I have noticed that my deployment of gpt-35-turbo on "Azure AI Studio" is not giving consistent responses to my chat completion prompts even when I set the temperature to 0. The longer the prompt, the more inconsistency I see. I thought the idea…
alex9311
  • 1,230
  • 1
  • 18
  • 42
1
vote
0 answers

How to Set Role of the System Help - OpenAI API + Langchain

Hi I'm working on a project to create a conversation agent to help with critical literacy using OpenAI's API. I want the model (currently using gpt-3.5-turbo) to call from data stored in a directory, which is where I'm using modules from langchain.…
1
vote
0 answers

How to fix chatGPT API producing bad request error?

I'm trying to simply print an answer in terminal to the "say hello" prompt, but it logs Error: Request failed with status code 400 to the terminal. Here's the code that tries to use the ChatGPT API: const axios = require('axios'); async function…
Jonas
  • 83
  • 5
1
vote
1 answer

Issue in ChatGPT OpenAI with API

I'm trying to integrate ChatGPT (OpenAI) into my website so that it can respond to user questions. However, I'm encountering an issue where ChatGPT doesn't provide any responses. I've provided the relevant code snippets below. I also received the…
1
vote
0 answers

I am not getting the required response as output

import 'package:http/http.dart' as http; import 'dart:convert'; import '../constants/api_constant.dart'; class ApiService{ static Future sendMessage ({required String prompt}) async { var response = await…