Questions tagged [openai-api]

OpenAI makes several AI products, including ChatGPT, Dall-E, Whisper. Use for questions about the OpenAI API, and not for general support.

Use for questions about using the OpenAI API. All question should be according to the scope of Stack Overflow and following the How to ask a good question and Expected Behavior guidelines.

Before asking a question, read the documentation.

If you will include non-original code, be sure to provide proper attribution.

Don't use for questions about using ChatGPT as an end-user. Don't use for questions about responses given by ChatGPT that aren't directly related to a programming issue using the OpenAI API.

Related tags:


OpenAI Community

https://community.openai.com/

1620 questions
7
votes
0 answers

How to combine ConversationalRetrievalQAChain, Agents, and Tools in LangChain

I'd like to combine a ConversationalRetrievalQAChain with - for example - the SerpAPI tool in LangChain. I'm using ConversationalRetrievalQAChain to search through product PDFs that have been ingested using OpenAI's embedding API and a local Chroma…
Johannes Fahrenkrug
  • 42,912
  • 19
  • 126
  • 165
7
votes
1 answer

How can I use LangChain Callbacks to log the model calls and answers into a variable

I'm using LangChain to build a NL application. I want the interactions with the LLM to be recorded in a variable I can use for logging and debugging purposes. I have created a very simple chain: from typing import Any, Dict from langchain import…
Pythonist
  • 1,937
  • 1
  • 14
  • 25
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
1 answer

How to add 'message history' to llama-index based GPT-3 in Python

I am fairly new to using llama-index library for training GPT-3 as well as using ChatGPT through the standard API (both in Python). I have noticed that standard ChatGPT API i could simply do the following code below to have ChatGPT get message…
Lawrd_Das
  • 71
  • 3
7
votes
2 answers

Using Chain and Parser together in langchain

The langchain docs include this example for configuring and invoking a PydanticOutputParser # Define your desired data structure. class Joke(BaseModel): setup: str = Field(description="question to set up a joke") punchline: str =…
Abe
  • 22,738
  • 26
  • 82
  • 111
7
votes
3 answers

How to work with sessions in GPT API using C#

By using sessions, developers can build chat applications that maintain context across multiple interactions with the user, which can lead to more engaging and natural conversations. The question: how can I make sessions with gpt-3.5-turbo API using…
Akram Al-Qaifi
  • 386
  • 1
  • 11
7
votes
1 answer

How can I use batch embeddings using OpenAI's API?

I am using the OpenAI API to get embeddings for a bunch of sentences. And by a bunch of sentences, I mean a bunch of sentences, like thousands. Is there a way to make it faster or make it do the embeddings concurrently or something? I tried Looping…
6
votes
2 answers

How to store chat history using langchain conversationalRetrievalQA chain in a Next JS app?

Im creating a text document QA chatbot, Im using Langchainjs along with OpenAI LLM for creating embeddings and Chat and Pinecone as my vector Store. See Diagram: After successfully uploading embeddings and creating an index on pinecone. I am using…
jasan
  • 11,475
  • 22
  • 57
  • 97
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
0 answers

Refer to specific files using LangChain & Question-Answering about differences/comparisons

I have not found documentation regarding Question-Answering based on multiple text files, while referencing the text files individually. Example: I have file1.txt through file20.txt. file1.txt is from April 2023 and file5.txt is from March…
Jay Jung
  • 1,805
  • 3
  • 23
  • 46
6
votes
2 answers

langchain: logprobs, best_of and echo parameters are not available on gpt-35-turbo model

I am trying to use langchain with gpt-35-turbo. It seems that the new gpt3.5 turbo is not using certain parameters anymore as per the link Learn how to work with the ChatGPT and GPT-4 models (preview) The following parameters aren't available with…
Sarah
  • 1,361
  • 2
  • 14
  • 20
6
votes
2 answers

OpenAI GPT-3 API error: "Request timed out"

I keep get an error as below Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out. (read timeout=600) when I run the code below def generate_gpt3_response(user_text, print_output=False): """ Query OpenAI…
opsv
  • 89
  • 1
  • 3
6
votes
4 answers

FastAPI StreamingResponse not streaming with generator function

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…
Robert Ritz
  • 63
  • 1
  • 1
  • 5
6
votes
2 answers

Accessing ChatGPT API through Firebase Cloud Function

Below is some code for a simple Firebase Cloud Function that hits the ChatGPT API. Deploying this code and accessing it from my app results in a CORS error. import * as functions from "firebase-functions"; import {defineString} from…
6
votes
3 answers

Dall E API error: "Invalid input image - format must be in ['RGBA', 'LA', 'L'], got RGB."

I have an image that I'm retrieving from an AWS S3 bucket and then passing to the Dall E/OpenAI API. When I attempt I get this error response: message: "Invalid input image - format must be in ['RGBA', 'LA', 'L'], got RGB.", I understand that RGB…
JimmyTheCode
  • 3,783
  • 7
  • 29
  • 71