language_model: Add tool results to message content (#17363)
This PR updates the message content for an LLM request to allow it contain tool results. Release Notes: - N/A
This commit is contained in:
parent
74907cb3e6
commit
30b2133336
3 changed files with 73 additions and 38 deletions
|
@ -261,12 +261,15 @@ pub fn count_anthropic_tokens(
|
|||
|
||||
for content in message.content {
|
||||
match content {
|
||||
MessageContent::Text(string) => {
|
||||
string_contents.push_str(&string);
|
||||
MessageContent::Text(text) => {
|
||||
string_contents.push_str(&text);
|
||||
}
|
||||
MessageContent::Image(image) => {
|
||||
tokens_from_images += image.estimate_tokens();
|
||||
}
|
||||
MessageContent::ToolResult(tool_result) => {
|
||||
string_contents.push_str(&tool_result.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue