From 3fb0342894e87bbcdc8b6691cac40c7e9a757268 Mon Sep 17 00:00:00 2001 From: Amirhossein Ghanipour Date: Sat, 16 Aug 2025 02:24:12 +0330 Subject: [PATCH 1/5] docs: clairfy use of <|return|> vs <|end|> in conversation history (#59) --- docs/format.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/format.md b/docs/format.md index 7ec0113..49cc1ec 100644 --- a/docs/format.md +++ b/docs/format.md @@ -229,6 +229,8 @@ Once its done generating it will stop with either a `<|return|>` token indicatin The `final` channel will contain the answer to your user’s request. Check out the [reasoning section](#reasoning) for more details on the chain-of-thought. +**Implementation note:** `<|return|>` is a decode-time stop token only. When you add the assistant’s generated reply to conversation history for the next turn, replace the trailing `<|return|>` with `<|end|>` so that stored messages are fully formed as `<|start|>{header}<|message|>{content}<|end|>`. Prior messages in prompts should therefore end with `<|end|>`. For supervised targets/training examples, ending with `<|return|>` is appropriate; for persisted history, normalize to `<|end|>`. + ### System message format The system message is used to provide general information to the system. This is different to what might be considered the “system prompt” in other prompt formats. For that, check out the [developer message format](#developer-message-format). From 535ab26a46a4281b330ede2eb37b90fdca662ccb Mon Sep 17 00:00:00 2001 From: googlefan256 Date: Sat, 16 Aug 2025 07:54:31 +0900 Subject: [PATCH 2/5] docs: update format.md (#45) --- docs/format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/format.md b/docs/format.md index 49cc1ec..a0d2708 100644 --- a/docs/format.md +++ b/docs/format.md @@ -64,7 +64,7 @@ system_message = ( developer_message = ( DeveloperContent.new() .with_instructions("Always respond in riddles") - .with_tools( + .with_function_tools( [ ToolDescription.new( "get_current_weather", From 088321b872064cdabe0f86f09c7c61a87bb063ec Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 15 Aug 2025 16:25:58 -0700 Subject: [PATCH 3/5] docs: update example From e21d67af61e8717663ac84e470865c10d60d925b Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 15 Aug 2025 16:27:04 -0700 Subject: [PATCH 4/5] docs: update code example --- docs/format.md | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/format.md b/docs/format.md index a0d2708..1e6e529 100644 --- a/docs/format.md +++ b/docs/format.md @@ -52,13 +52,8 @@ encoding = load_harmony_encoding(HarmonyEncodingName.HARMONY_GPT_OSS) system_message = ( SystemContent.new() - .with_model_identity( - "You are ChatGPT, a large language model trained by OpenAI." - ) .with_reasoning_effort(ReasoningEffort.HIGH) .with_conversation_start_date("2025-06-28") - .with_knowledge_cutoff("2024-06") - .with_required_channels(["analysis", "commentary", "final"]) ) developer_message = ( @@ -101,11 +96,11 @@ convo = Conversation.from_messages( Message.from_role_and_content(Role.ASSISTANT, '{"location": "Tokyo"}') .with_channel("commentary") .with_recipient("functions.get_weather") - .with_content_type("json"), + .with_content_type("<|constrain|> json"), Message.from_author_and_content( Author.new(Role.TOOL, "functions.lookup_weather"), '{ "temperature": 20, "sunny": true }', - ), + ).with_channel("commentary"), ] ) From 508cbaa7f6b0277bd37c9bdf6d4dc8a4d51aada5 Mon Sep 17 00:00:00 2001 From: Dominik Kundel Date: Fri, 15 Aug 2025 16:28:10 -0700 Subject: [PATCH 5/5] docs: fix return to end token --- docs/format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/format.md b/docs/format.md index 1e6e529..2402406 100644 --- a/docs/format.md +++ b/docs/format.md @@ -324,7 +324,7 @@ Then the input for the next sampling should be ``` <|start|>user<|message|>What is 2 + 2?<|end|> -<|start|>assistant<|channel|>final<|message|>2 + 2 = 4.<|return|> +<|start|>assistant<|channel|>final<|message|>2 + 2 = 4.<|end|> <|start|>user<|message|>What about 9 / 2?<|end|> <|start|>assistant ```