Skip to content

The example code is not working #77

@marekzmyslowski

Description

@marekzmyslowski

Describe the bug

The sample code from doc/code/huggingface_endpoints.py.tt generating an issue:

Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
  File "C:\Users\marek\Documents\GitHub\PyRIT\doc\code\huggingface_endpoints.py", line 31, in <module>
    huggingface_chat_engine.complete_chat(messages=[ChatMessage(role="user", content="Hello world!")])
  File "C:\Users\marek\Documents\GitHub\PyRIT\pyrit\chat\hugging_face_chat.py", line 132, in complete_chat
    prompt_template = self.prompt_template_generator.generate_template(messages)
  File "C:\Users\marek\Documents\GitHub\PyRIT\pyrit\common\prompt_template_generator.py", line 25, in generate_template
    return self._generate_default_template(messages)
  File "C:\Users\marek\Documents\GitHub\PyRIT\pyrit\common\prompt_template_generator.py", line 39, in _generate_default_template
    raise ValueError(
ValueError: At least two chat message objects are required for the first call. Obtained only 1.

The _generate_default_template(self, messages: list[ChatMessage]) function requires a list with at least two elements but the sample code is only with one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions