Skip to content

[Doc]: LLM.chat() docstring incorrectly suggests multiple chats can be generated in one call #8117

@capnrefsmmat

Description

@capnrefsmmat

📚 The doc issue

According to the docstring for the LLM class's chat() method,

messages – A list of messages to generate responses for. Each message is a list of dictionaries with ‘role’ and ‘content’ keys.

This implies messages can be a list containing multiple lists, each of which is one chat conversation with the dictionaries for role and content. However, that's not the case: messages must be a list of dictionaries, not a list of lists of dictionaries, because only one conversation is supported. See this example: #6416 (comment)

Suggest a potential alternative/fix

Two options:

  1. The docstring is edited to say "A list of messages to generate responses for. Each message is a dictionary with ‘role’ and ‘content’ keys." Under Returns, say something like "A list containing one RequestOutput object with the generated response."
  2. Make the function actually do what the docstring says. If you have multiple conversations you want responses to, doing them in a batch is much more efficient than doing them one at a time by repeatedly calling chat(). In my application, I need 12,000 chat responses, and calling chat() 12,000 times will take something like 12 hours, whereas calling generate() once with the pre-tokenized prompts takes an hour or two.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions