Use this tag with Generative Pre-trained Transformer 4 (GPT-4). Do not use it with GPT-2/3 or the ad tagging library (GPT).
Questions tagged [gpt-4]
55 questions
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
15
votes
4 answers
Can't access gpt-4 model via python API although gpt-3.5 works
I'm able to use the gpt-3.5-turbo-0301 model to access the ChatGPT API, but not any of the gpt-4 models. Here is the code I am using to test this (it excludes my openai API key). The code runs as written, but when I replace "gpt-3.5-turbo-0301" with…

AllAmericanBreakfast
- 325
- 1
- 3
- 10
8
votes
1 answer
OpenAI GPT-4 API: What is the difference between gpt-4 and gpt-4-0314 or gpt-4-0613?
Note: The question was originally asking about the difference between the gpt-4 and gpt-4-0314. As of June 15, 2023, there are new snapshot models available (e.g., gpt-4-0613) so the question and its answer are also relevant for any future snapshot…

Christopher
- 427
- 1
- 8
- 18
4
votes
2 answers
How do I change the default 4 documents that LangChain returns?
I have the following code that implements LangChain + ChatGPT to answer questions from given data:
import { PineconeStore } from 'langchain/vectorstores/pinecone';
import { ConversationalRetrievalQAChain } from 'langchain/chains';
const…

imjesr
- 89
- 4
4
votes
2 answers
OpenAI Chat Completions API: How do I customize answers from GPT-3.5 or GPT-4 models if I can't fine-tune them?
We have seen some companies use GPT-3.5 or GPT-4 models to train their own data and provide customized answers. But GPT-3.5 and GPT-4 models are not available for fine-tuning.
I've seen the document from OpenAI about this issue, but I had seen…

Lucien
- 43
- 3
3
votes
1 answer
Using GPT 4 or GPT 3.5 with SQL Database Agent throws OutputParserException: Could not parse LLM output:
I am using the SQL Database Agent to query a postgres database. I want to use gpt 4 or gpt 3.5 models in the OpenAI llm passed to the agent, but it says I must use ChatOpenAI. Using ChatOpenAI throws parsing errors.
The reason for wanting to switch…

RamlahAziz
- 47
- 10
3
votes
1 answer
Finetuning a LM vs prompt-engineering an LLM
Is it possible to finetune a much smaller language model like Roberta on say, a customer service dataset and get results as good as one might get with prompting GPT-4 with parts of the dataset?
Can a fine-tuned Roberta model learn to follow…

Tolu
- 1,081
- 1
- 8
- 23
3
votes
1 answer
Comparing methods for a QA system on a 1,000-document Markdown dataset: Indexes and embeddings with GPT-4 vs. retraining GPT4ALL (or similar)
I am working on a project to build a question-answering system for a documentation portal containing over 1,000 Markdown documents, with each document consisting of approximately 2,000-4,000 tokens.
I am considering the following two options:
Using…

Vasil Remeniuk
- 20,519
- 6
- 71
- 81
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
0 answers
How to queue API calls to Azure OpenAI service (with a token per minute rate limit) the most efficiently?
How can we implement an efficient queue using Azure serverless technologies (e.g. Azure Servicebus) to call Azure OpenAI service concurrently but guarantee earlier messages are processed first?
The complexity is that the rate limit is not based on X…

Bonen
- 23
- 3
2
votes
0 answers
Using OpenAI LLMs for classification. Asking for classification vs. asking for probabilities
I'm using LLMs for classifying products into specific categories. Multi-Class.
One way to do it would it to ask if it's a yes/no for a specific category and loop through the categories.
Another way would be to ask for a probability that that…

FAD
- 31
- 2
2
votes
1 answer
Image to text using Azure OpenAI GPT4
I have an Azure open AI Account and GPT4 model deployed. Can I use its API for image-to-text description? If yes, how I will give it the image? I am using this code. But it throws me an error.
import openai
# open ai key
openai.api_type =…

Zohaib Ramzan
- 31
- 5
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
0 answers
import Image as PIL_Image ModuleNotFoundError: No module named 'Image' while running langchain with DirectoryLoader('source', glob='*.pdf')
from langchain.document_loaders import UnstructuredPDFLoader, OnlinePDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.document_loaders import DirectoryLoader
import openai
loader = DirectoryLoader('source',…

Ravi Prakash
- 66
- 2
2
votes
7 answers
An error occurred: module 'openai' has no attribute 'ChatCompletion'
I'm trying to build a discord bot that uses the GPT-4 API to function as a chatbot on discord. I have the most recent version of the OpenAI library but when I run my code it tells me "An error occurred: module 'openai' has no attribute…

Anthony
- 21
- 1
- 2