Add info about eom and tool role

This commit is contained in:
Suraj Subramanian 2025-04-07 10:55:44 -07:00
parent a2734d24e7
commit 8a76fb32f3

View file

@ -48,6 +48,7 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
- at the end of a direct interaction between the model and the user
- at the end of multiple interactions between the model and any available tools
This token signals to the executor that the model has finished generating a response.
- `<|eom|>`: End of message. This tag is used with the `tool` role, and is used at the end of the response from the executor.
- `<|image_start|>` and `<|image_end|>`: These tokens enclose the image data in the prompt.
- `<|patch|>`: This token represents a piece of the tile/
- `<|tile_y_separator|>` and `<|tile_x_separator|>`: These tokens are used to separate the y and x tiles of an image
@ -56,10 +57,11 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
),
textwrap.dedent(
"""
There are 3 different roles that are supported by Llama 4
There are 4 different roles that are supported by Llama 4
- `system`: Sets the context in which to interact with the AI model. It typically includes rules, guidelines, or necessary information that helps the model respond effectively.
- `user`: Represents the human interacting with the model. It includes the inputs, commands, and questions to the model.
- `assistant`: Represents the response generated by the AI model based on the context provided in the `system`, `tool` and `user` prompts.
- `tool`: Represents the output of a tool call when sent back to the model from the executor. (The actual token used by the model is `<|ipython|>`.)
"""
),
]
@ -72,13 +74,17 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
Llama4UseCase(
title="Text completion - Paris information",
description="Text completion for Llama 4 base model uses this format.",
dialogs=[TextCompletionContent(content="The capital of France is Paris")],
dialogs=[
TextCompletionContent(content="The capital of France is Paris")
],
),
Llama4UseCase(
title="Text completion - The color of the sky",
description="Text completion for Llama 4 base model uses this format.",
dialogs=[
TextCompletionContent(content="The color of the sky is blue but sometimes it can also be")
TextCompletionContent(
content="The color of the sky is blue but sometimes it can also be"
)
],
notes="",
),
@ -105,7 +111,9 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
description="Here is a regular multi-turn user assistant conversation and how its formatted.",
dialogs=[
[
RawMessage(role="system", content="You are a helpful assistant"),
RawMessage(
role="system", content="You are a helpful assistant"
),
RawMessage(
role="user",
content="Answer who are you in the form of jeopardy?",
@ -125,7 +133,9 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
role="user",
content=[
RawMediaItem(data=BytesIO(img_small_dog)),
RawTextItem(text="Describe this image in two sentences"),
RawTextItem(
text="Describe this image in two sentences"
),
],
)
]
@ -147,7 +157,9 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
role="user",
content=[
RawMediaItem(data=BytesIO(img_dog)),
RawTextItem(text="Describe this image in two sentences"),
RawTextItem(
text="Describe this image in two sentences"
),
],
)
]
@ -169,7 +181,9 @@ def usecases(base_model: bool = False) -> List[UseCase | str]:
content=[
RawMediaItem(data=BytesIO(img_dog)),
RawMediaItem(data=BytesIO(img_pasta)),
RawTextItem(text="Describe these images in two sentences"),
RawTextItem(
text="Describe these images in two sentences"
),
],
)
]