-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChatGPT's API model, gpt-3.5-turbo, doesn't appear to work for summarization tasks #1643
Comments
I was having a similar issue for class SneakyOpenAIChat(OpenAIChat):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def _get_chat_params(
self, prompts: List[str], stop: Optional[List[str]] = None
) -> Tuple:
# HACK STARTS
if len(prompts) > 1:
logger.warning(
f"WARNING: OpenAIChat currently only supports single prompt, got {len(prompts)}. "
f"Joining the prompts, but this could result in unexpected behavior"
)
prompt = " ".join(prompts)
messages = self.prefix_messages + [{"role": "user", "content": prompt}]
# HACK ENDS
params: Dict[str, Any] = {**{"model": self.model_name}, **self._default_params}
if stop is not None:
if "stop" in params:
raise ValueError("`stop` found in both the input and default params.")
params["stop"] = stop
if params.get("max_tokens") == -1:
# for ChatGPT api, omitting max_tokens is equivalent to having no limit
del params["max_tokens"]
return messages, params Perhaps this could be a flag when configuring |
I have the same issue |
@vbarda , if you look at
It appears to come from the openai library, not langchain, but |
great question, it does seem to come from openai lib. you'll probably need to inspect underlying summarization prompts to see what the total length of resulting prompt is, but i am not sure (also, I believe that OpenAIChat interface is bound by the same context length limits as the underlying API itself). and I should have been more precise in my response: i only had a similar issue to the error you referenced above |
The solution was to switch from
import
|
Hey @CMobley7, this worked for me, but for some reason, 3.5-turbo takes 5x more than davinci-003 |
It is not parallelised. Quoting @hwchase17: "the OpenAI endpoint allows for batching, so we use that. the ChatOpenAI endpoint does not". |
anyone else having a 'module not found' error when trying to import langchain.chat_models? |
@bathrobe make sure you're on the latest version: |
I am using v.0.0.119 this way: from langchain.chat_models import ChatOpenAI but it is not using 3.5 turbo, instead it's using text-embedding-ada-002-v2 for embeddings and text-davinci for completion, or at least this is what OpenAI's Daily usage breakdown shows. |
i am using chatopenai as llm for the summarize chain, but it's super slow and somehow the usage bill says i am using gpt-3.5-turbo-0301 |
Can the summarization chain be used with ChatGPT's API,
gpt-3.5-turbo
? I have tried the following two code snippets, but they result in this error.Trial 1
Trial 2
I changed the Trial 1 snippet to the following but got the error below due to a list of prompts provided to the endpoint. Also, it appears that OpenAIChat doesn't have a
llm.modelname_to_contextsize
despite the endpoint not accepting more than4097
tokens.Trial 3
Do you have any ideas on what needs to be changed to allow OpenAI's ChatGPT to work for summarization? Happy to help if I can.
The text was updated successfully, but these errors were encountered: