Skip to content

Commit 4376edc

Browse files
authored
Refactor: Unify get weather function name for consistency
1 parent 2fa591f commit 4376edc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

articles/openai-harmony.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ convo = Conversation.from_messages(
100100
Message.from_role_and_content(Role.USER, "What is the weather in Tokyo?"),
101101
Message.from_role_and_content(
102102
Role.ASSISTANT,
103-
'User asks: "What is the weather in Tokyo?" We need to use get_weather tool.',
103+
'User asks: "What is the weather in Tokyo?" We need to use get_current_weather tool.',
104104
).with_channel("analysis"),
105105
Message.from_role_and_content(Role.ASSISTANT, '{"location": "Tokyo"}')
106106
.with_channel("commentary")
107-
.with_recipient("functions.get_weather")
107+
.with_recipient("functions.get_current_weather")
108108
.with_content_type("json"),
109109
Message.from_author_and_content(
110-
Author.new(Role.TOOL, "functions.lookup_weather"),
110+
Author.new(Role.TOOL, "functions.get_current_weather"),
111111
'{ "temperature": 20, "sunny": true }',
112112
).with_recipient("assistant").with_channel("commentary"),
113113
]
@@ -383,7 +383,7 @@ If the model decides to call a tool it will define a `recipient` in the header o
383383
The model might also specify a `<|constrain|>` token to indicate the type of input for the tool call. In this case since it’s being passed in as JSON the `<|constrain|>` is set to `json`.
384384

385385
```
386-
<|channel|>analysis<|message|>Need to use function get_weather.<|end|><|start|>assistant<|channel|>commentary to=functions.get_weather <|constrain|>json<|message|>{"location":"San Francisco"}<|call|>
386+
<|channel|>analysis<|message|>Need to use function get_current_weather.<|end|><|start|>assistant<|channel|>commentary to=functions.get_current_weather <|constrain|>json<|message|>{"location":"San Francisco"}<|call|>
387387
```
388388

389389
#### Handling tool calls
@@ -399,7 +399,7 @@ A tool message has the following format:
399399
So in our example above
400400

401401
```
402-
<|start|>functions.get_weather to=assistant<|channel|>commentary<|message|>{"sunny": true, "temperature": 20}<|end|>
402+
<|start|>functions.get_current_weather to=assistant<|channel|>commentary<|message|>{"sunny": true, "temperature": 20}<|end|>
403403
```
404404

405405
Once you have gathered the output for the tool calls you can run inference with the complete content:
@@ -439,10 +439,10 @@ locations: string[],
439439
format?: "celsius" | "fahrenheit", // default: celsius
440440
}) => any;
441441
442-
} // namespace functions<|end|><|start|>user<|message|>What is the weather like in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>Need to use function get_weather.<|end|><|start|>assistant<|channel|>commentary to=functions.get_weather <|constrain|>json<|message|>{"location":"San Francisco"}<|call|><|start|>functions.get_weather to=assistant<|channel|>commentary<|message|>{"sunny": true, "temperature": 20}<|end|><|start|>assistant
442+
} // namespace functions<|end|><|start|>user<|message|>What is the weather like in SF?<|end|><|start|>assistant<|channel|>analysis<|message|>Need to use function get_current_weather.<|end|><|start|>assistant<|channel|>commentary to=functions.get_current_weather <|constrain|>json<|message|>{"location":"San Francisco"}<|call|><|start|>functions.get_current_weather to=assistant<|channel|>commentary<|message|>{"sunny": true, "temperature": 20}<|end|><|start|>assistant
443443
```
444444

445-
As you can see above we are passing not just the function out back into the model for further sampling but also the previous chain-of-thought (“Need to use function get_weather.”) to provide the model with the necessary information to continue its chain-of-thought or provide the final answer.
445+
As you can see above we are passing not just the function out back into the model for further sampling but also the previous chain-of-thought (“Need to use function get_current_weather.”) to provide the model with the necessary information to continue its chain-of-thought or provide the final answer.
446446

447447
#### Preambles
448448

0 commit comments

Comments
 (0)