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 a direct interaction between the model and the user
- at the end of multiple interactions between the model and any available tools - 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. 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. - `<|image_start|>` and `<|image_end|>`: These tokens enclose the image data in the prompt.
- `<|patch|>`: This token represents a piece of the tile/ - `<|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 - `<|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( 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. - `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. - `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. - `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( Llama4UseCase(
title="Text completion - Paris information", title="Text completion - Paris information",
description="Text completion for Llama 4 base model uses this format.", 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( Llama4UseCase(
title="Text completion - The color of the sky", title="Text completion - The color of the sky",
description="Text completion for Llama 4 base model uses this format.", description="Text completion for Llama 4 base model uses this format.",
dialogs=[ 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="", 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.", description="Here is a regular multi-turn user assistant conversation and how its formatted.",
dialogs=[ dialogs=[
[ [
RawMessage(role="system", content="You are a helpful assistant"), RawMessage(
role="system", content="You are a helpful assistant"
),
RawMessage( RawMessage(
role="user", role="user",
content="Answer who are you in the form of jeopardy?", 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", role="user",
content=[ content=[
RawMediaItem(data=BytesIO(img_small_dog)), 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", role="user",
content=[ content=[
RawMediaItem(data=BytesIO(img_dog)), 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=[ content=[
RawMediaItem(data=BytesIO(img_dog)), RawMediaItem(data=BytesIO(img_dog)),
RawMediaItem(data=BytesIO(img_pasta)), RawMediaItem(data=BytesIO(img_pasta)),
RawTextItem(text="Describe these images in two sentences"), RawTextItem(
text="Describe these images in two sentences"
),
], ],
) )
] ]