mirror of
https://github.com/openai/harmony.git
synced 2025-08-29 10:19:06 -04:00
fix: render channel before recipient
as according to docs https://cookbook.openai.com/articles/openai-harmony#handling-tool-calls empirically this is also what the model outputs
This commit is contained in:
parent
3efbf74253
commit
f573ab5f52
2 changed files with 7 additions and 7 deletions
|
@ -820,6 +820,12 @@ impl Render<Message> for HarmonyEncoding {
|
|||
}
|
||||
};
|
||||
|
||||
// next header channel
|
||||
if let Some(channel) = &message.channel {
|
||||
self.render_formatting_token_into(FormattingToken::Channel, into)?;
|
||||
self.render_text_into(channel, into)?;
|
||||
}
|
||||
|
||||
// next render the header recipient, if there is one
|
||||
if let Some(recipient) = &message.recipient {
|
||||
if recipient != "all" {
|
||||
|
@ -827,12 +833,6 @@ impl Render<Message> for HarmonyEncoding {
|
|||
}
|
||||
}
|
||||
|
||||
// next header channel
|
||||
if let Some(channel) = &message.channel {
|
||||
self.render_formatting_token_into(FormattingToken::Channel, into)?;
|
||||
self.render_text_into(channel, into)?;
|
||||
}
|
||||
|
||||
// finally content type
|
||||
if let Some(content_type) = &message.content_type {
|
||||
self.render_text_into(format!(" {content_type}"), into)?;
|
||||
|
|
|
@ -1 +1 @@
|
|||
<|start|>user<|message|>What is the weather in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>User asks: “What is the weather in SF?” We need to use lookup_weather tool.<|end|><|start|>assistant to=functions.lookup_weather<|channel|>commentary <|constrain|>json<|message|>{"location": "San Francisco"}<|call|><|start|>functions.lookup_weather<|message|>{"temperature": 20, "description": "sunny"}<|end|><|start|>assistant
|
||||
<|start|>user<|message|>What is the weather in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>User asks: “What is the weather in SF?” We need to use lookup_weather tool.<|end|><|start|>assistant<|channel|>commentary to=functions.lookup_weather <|constrain|>json<|message|>{"location": "San Francisco"}<|call|><|start|>functions.lookup_weather<|message|>{"temperature": 20, "description": "sunny"}<|end|><|start|>assistant
|
Loading…
Add table
Add a link
Reference in a new issue