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
1
vote
2 answers

Using PHP to access ChatGPT API

I'm writing a simple PHP script with no dependencies to access the ChatGPT API, but it's throwing an error I don't understand: Here's the script so far: $apiKey = "Your-API-Key"; $url = 'https://api.openai.com/v1/chat/completions'; …
Bangkokian
  • 6,548
  • 3
  • 19
  • 26
1
vote
2 answers

How Can I make openAI API respond to requests in specific categories only?

I have created an openAI API using python, to respond to any type of prompt. I want to make the API respond to requests that are only related to Ad from product description and greetings requests only and if the user sends a request that's not…
1
vote
1 answer

openAI api - is it possible save chat state \history by the api (without resending it)?

I want to develop a chat app using gpt-3.5-turbo. I'm using NodeJS. I would like it to save the state of the conversation with the user, so I won't have to send the whole conversation and the priming each time. What I want to accomplish is very…
yoty66
  • 390
  • 2
  • 12
1
vote
3 answers

OpenAI ChatGPT (GPT-3.5) API: Can I fine-tune the gpt-3.5-turbo model?

I have a SQL table containing huge data, need to train the SQL table data to ChatGPT using Chat Completion API. I tried of generating a SQL query using ChatGPT, but that doesn't work as expected. Sometimes it generates inappropriate query.
Kajol Mehta
  • 55
  • 1
  • 2
1
vote
1 answer

Chat GPT3.5-turbo API not printing chat response. No code errors

I built a basic chat tutor API in Repl but I am getting no chat response when running. My secret key is set up correctly in OpenAI, but set to personal - is this an issue? I have no code errors so I am unsure what's going wrong if there is an issue…
1
vote
0 answers

How can I send back partial GPT-3.5-turbo responses, to an ajax call, to display response in real time

I have the following PHP code and am struggling to correctly access the partial messages as they are delivered from the API call and send them back to the ajax call, so that the messages can appear on in a div, in real time. What have I done wrong…
sw123456
  • 3,339
  • 1
  • 24
  • 42
1
vote
1 answer

OpenAI ChatGPT (GPT-3.5) API: Why do I get NULL response?

I am trying to carry out API calls to the newly release gpt-3.5-turbo model and have the following code, which should send a query (via the $query variable) to the API and then extract the content of a responding message from the API. But I am…
sw123456
  • 3,339
  • 1
  • 24
  • 42
0
votes
1 answer

How to stub/mock a streamed response from ChatGPT?

In my testing environment I'm trying to intercept my request to ChatGPT (shown below) and replace it with a mock response. The fetch api returns a Response.body as a ReadableStream of content. In my implementation, I use the…
kevin
  • 2,707
  • 4
  • 26
  • 58
0
votes
1 answer

how to convert langchain documents back to strings?

i have built a splitter function with langchain library that splits a series of python files. At another point in the code I need to convert these documents back into python code. Only I do not know how to do this def index_repo(repo_url): …
alpa
  • 35
  • 3
0
votes
1 answer

I having a problem with destructuring the response object received from ChatGpt 3.5 turbo. Where am i going wrong?

import openai from "@/openai"; import { NextResponse } from "next/server"; export async function POST(request: Request){ const {todos} = await request.json(); //communicate with openai api const response = await…
0
votes
0 answers

How to create a fine-tune job in GPT-3.5 turbo?

I upload a file to create a job with official API: $fineTuned = $client->fineTuning()->createJob([ 'training_file' => 'file-bdj...W2', 'validation_file' => null, 'model' => 'gpt-3.5-turbo', 'suffix' => null, ]); resulting in…
IceIceIce
  • 1
  • 1
0
votes
1 answer

how to assign code to a file after TextSplitter (langchain)?

i am using the RecursiveCharacterTextSplitter from Langchain to split python files. in doing so i lose the information which chunk belongs to which file. How can I keep track and assign the individual chunks to a file name afterwards? def…
alpa
  • 35
  • 3
0
votes
0 answers

Delete memory of openai queries

I have these lines of code to get an answer from OpenAi which gets data from a query and a document. However, when responding, it uses data from previous queries, which I don't want, since the response should only be based on the data from my…
Lukas
  • 1
0
votes
0 answers

The beginning of the response from api GPT is eaten during an asynchronous request

I am writing a bot through aiogram and attached gpt to it, but with asynchronous requests, the beginning of the text began to eat up. Such a thing is only with an asynchronous request, through the Openai module. I also tried using aiohttp and it…
0
votes
1 answer

AttributeError: module ‘openai’ has no attribute ‘FineTuneingJob’

I am attempting to start a fine-tuning job using GPT 3.5-turbo via a Python call, using the format listed in the fine-tuning reference, essentially: import os import openai openai.api_key =…
DJAMA Med
  • 1
  • 1