mirror of
https://github.com/openai/harmony.git
synced 2025-08-23 01:17:09 -04:00
Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
|
508cbaa7f6 | ||
|
e21d67af61 | ||
|
088321b872 | ||
|
535ab26a46 | ||
|
3fb0342894 | ||
|
52176bfbec |
3 changed files with 15 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -70,3 +70,6 @@ docs/_build/
|
|||
|
||||
# Pyenv
|
||||
.python-version
|
||||
|
||||
# Avoid ignoring shadcn utils
|
||||
!demo/harmony-demo/src/lib
|
||||
|
|
6
demo/harmony-demo/src/lib/utils.ts
Normal file
6
demo/harmony-demo/src/lib/utils.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
|
@ -52,19 +52,14 @@ 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 = (
|
||||
DeveloperContent.new()
|
||||
.with_instructions("Always respond in riddles")
|
||||
.with_tools(
|
||||
.with_function_tools(
|
||||
[
|
||||
ToolDescription.new(
|
||||
"get_current_weather",
|
||||
|
@ -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"),
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -229,6 +224,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).
|
||||
|
@ -327,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
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue