assistant2: Include some text in the tool result messages (#25825)
This PR makes it so we include some textual content in the user messages that as used to send up tool results. I observed that when sending up the tool results with no text, it would lead the model to start replying with no text, which would then result in an error when attaching later tool results. I think there's a deeper issue at play here, but for now we just include some text to keep the model on track. Release Notes: - N/A
This commit is contained in:
parent
0c2bbb3aa9
commit
71866d6314
1 changed files with 10 additions and 6 deletions
|
@ -270,8 +270,15 @@ impl ActiveThread {
|
|||
let model_registry = LanguageModelRegistry::read_global(cx);
|
||||
if let Some(model) = model_registry.active_model() {
|
||||
self.thread.update(cx, |thread, cx| {
|
||||
// Insert an empty user message to contain the tool results.
|
||||
thread.insert_user_message("", Vec::new(), cx);
|
||||
// Insert a user message to contain the tool results.
|
||||
thread.insert_user_message(
|
||||
// TODO: Sending up a user message without any content results in the model sending back
|
||||
// responses that also don't have any content. We currently don't handle this case well,
|
||||
// so for now we provide some text to keep the model on track.
|
||||
"Here are the tool results.",
|
||||
Vec::new(),
|
||||
cx,
|
||||
);
|
||||
thread.send_to_model(model, RequestKind::Chat, true, cx);
|
||||
});
|
||||
}
|
||||
|
@ -295,10 +302,7 @@ impl ActiveThread {
|
|||
let colors = cx.theme().colors();
|
||||
|
||||
// Don't render user messages that are just there for returning tool results.
|
||||
if message.role == Role::User
|
||||
&& message.text.is_empty()
|
||||
&& self.thread.read(cx).message_has_tool_results(message_id)
|
||||
{
|
||||
if message.role == Role::User && self.thread.read(cx).message_has_tool_results(message_id) {
|
||||
return Empty.into_any();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue