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 the new ChatGPT and GPT-4 models:
logprobs
,best_of
, andecho
. If you set any of these parameters, you'll get an error.
Now each time I initialise an LLM model through langchain with gpt-3.5-turbo, it gives me this error:
InvalidRequestError: logprobs, best_of and echo parameters are not available on gpt-35-turbo model. Please remove the parameter and try again. For more details, see https://go.microsoft.com/fwlink/?linkid=2227346.
I don't know how to 'unset' these parameters in langchain.
This is my code:
from langchain.chains.llm import LLMChain
from langchain.llms.openai import OpenAI
from langchain.prompts.prompt import PromptTemplate
llm = OpenAI(temperature=0, engine=deployment_name)
template = """
You are a helpful assistant that translates English to French. Translate this sentence from English to French: {text}
"""
prompt = PromptTemplate(input_variables=["text"], template=template)
llm_chain = LLMChain(llm=llm, prompt=prompt)
response = llm_chain.generate([
{"text": "I love AI"},
{"text": "I love the ocean"},
])
for g in response.generations:
print(g[0].text)
Note that I am using openAI in Azure, I also tried this code and it's still giving me the same error
deployment_name = "my-deployment-name"
from langchain.llms import AzureOpenAI
llm = AzureOpenAI(deployment_name=deployment_name )
print(llm)
llm("Tell me a joke")