langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Can't use gpt-4-32k model with ChatOpenAI

Open sagardspeed2 opened this issue 2 years ago • 2 comments

System Info

I am trying to use latest gpt-4-32k model with langchain ChatOpenAI

but I am getting the error

The model: `gpt-4-32k` does not exist.

so can we use other models except base model of openai ?

Who can help?

No response

Information

  • [x] The official example notebooks/scripts
  • [X] My own modified scripts

Related Components

  • [X] LLMs/Chat Models
  • [ ] Embedding Models
  • [ ] Prompts / Prompt Templates / Prompt Selectors
  • [ ] Output Parsers
  • [ ] Document Loaders
  • [ ] Vector Stores / Retrievers
  • [ ] Memory
  • [ ] Agents / Agent Executors
  • [ ] Tools / Toolkits
  • [x] Chains
  • [ ] Callbacks/Tracing
  • [ ] Async

Reproduction

from flask_socketio import emit
from urllib.parse import urlparse
from langchain.embeddings import OpenAIEmbeddings
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.vectorstores import Pinecone
from langchain.chat_models import ChatOpenAI
from langchain.chains import LLMChain
from langchain.chains.question_answering import load_qa_chain
from langchain.prompts import PromptTemplate
import openai
import pinecone
import os
import shutil
import uuid
import time
import json
import store.main as store
from controller.scrape import ScrapeSite
import services.calltype as CalltypeService
import services.organization as OrganizationService

# create completion process chain
def create_completion_llm_chain(self):
    llm = ChatOpenAI(temperature=0, model_name='gpt-4-32k', max_tokens=2048, request_timeout=120)
    chain = load_qa_chain(llm, chain_type='stuff')
    return chain
    
# generate llm chain
chain = self.create_completion_llm_chain()

query = 'here I added my query'

# process prompt with sources on gpt
response = chain.run(question=query, input_documents=sourceDocs)

using this token, you will get the error, The model: `gpt-4-32k` does not exist

Expected behavior

It should work with the any model that provides by the openAI

sagardspeed2 avatar May 11 '23 07:05 sagardspeed2

could you post the full error message

dev2049 avatar May 11 '23 19:05 dev2049

Similar to https://community.openai.com/t/gpt-4-32k-the-model-gpt-4-32k-does-not-exist/160459

Are you sure you access to that OpenAI model? It's still in limited beta

You can check if you access by hitting their models endpoint: https://platform.openai.com/docs/api-reference/models

AlpriElse avatar May 12 '23 03:05 AlpriElse

@AlpriElse is right, that model is not available yet.

paralin avatar Jun 01 '23 03:06 paralin

This should be closed. The model isn't available to all users, but works fine for those who do have access.

dmyoung9 avatar Aug 10 '23 16:08 dmyoung9

Hi, @sagardspeed2! I'm Dosu, and I'm here to help the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

From what I understand, you were encountering an error when trying to use the gpt-4-32k model with langchain ChatOpenAI. It seems that the gpt-4-32k model is still in limited beta and may not be accessible to all users. Some users have reported that it works fine for those who have access.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on this issue. Otherwise, feel free to close the issue yourself or it will be automatically closed in 7 days.

Thank you for your understanding!

dosubot[bot] avatar Nov 09 '23 16:11 dosubot[bot]