gemini: Send thought signatures back to API (#32064)
This is a follow-up to: - #31925 - #31902 Release Notes: - Support Gemini thought signatures
This commit is contained in:
parent
b749d9302f
commit
41e9f3148c
1 changed files with 23 additions and 3 deletions
|
@ -437,14 +437,29 @@ pub fn into_google(
|
||||||
content
|
content
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|content| match content {
|
.flat_map(|content| match content {
|
||||||
language_model::MessageContent::Text(text)
|
language_model::MessageContent::Text(text) => {
|
||||||
| language_model::MessageContent::Thinking { text, .. } => {
|
|
||||||
if !text.is_empty() {
|
if !text.is_empty() {
|
||||||
vec![Part::TextPart(google_ai::TextPart { text })]
|
vec![Part::TextPart(google_ai::TextPart { text })]
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
language_model::MessageContent::Thinking {
|
||||||
|
text: _,
|
||||||
|
signature: Some(signature),
|
||||||
|
} => {
|
||||||
|
if !signature.is_empty() {
|
||||||
|
vec![Part::ThoughtPart(google_ai::ThoughtPart {
|
||||||
|
thought: true,
|
||||||
|
thought_signature: signature,
|
||||||
|
})]
|
||||||
|
} else {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
language_model::MessageContent::Thinking { .. } => {
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
language_model::MessageContent::RedactedThinking(_) => vec![],
|
language_model::MessageContent::RedactedThinking(_) => vec![],
|
||||||
language_model::MessageContent::Image(image) => {
|
language_model::MessageContent::Image(image) => {
|
||||||
vec![Part::InlineDataPart(google_ai::InlineDataPart {
|
vec![Part::InlineDataPart(google_ai::InlineDataPart {
|
||||||
|
@ -664,7 +679,12 @@ impl GoogleEventMapper {
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
Part::FunctionResponsePart(_) => {}
|
Part::FunctionResponsePart(_) => {}
|
||||||
Part::ThoughtPart(_) => {}
|
Part::ThoughtPart(part) => {
|
||||||
|
events.push(Ok(LanguageModelCompletionEvent::Thinking {
|
||||||
|
text: "(Encrypted thought)".to_string(), // TODO: Can we populate this from thought summaries?
|
||||||
|
signature: Some(part.thought_signature),
|
||||||
|
}));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue