Support thinking to ChatGoogleAI#354
Conversation
|
I’m almost done, but I’m currently facing an issue when merging deltas =
[
%LangChain.MessageDelta{
content: %LangChain.Message.ContentPart{
type: :thinking,
content:
"**Refining the Questions**\n\nI'm now zeroing in on the core philosophical questions. I'm expanding my initial list to include a deeper dive into the implications for ethics and agency in AI systems. The structure is taking form. I am exploring consciousness, ethics, agency, and personhood, as these are the main aspects.\n\n\n",
options: []
},
merged_content: [],
status: :incomplete,
index: 0,
role: :assistant,
tool_calls: nil,
},
%LangChain.MessageDelta{
content: %LangChain.Message.ContentPart{
type: :text,
content: "Okay, here is a deeply",
options: []
},
merged_content: [],
status: :incomplete,
index: 0,
role: :assistant,
tool_calls: nil,
}
]
LangChain.MessageDelta.merge_deltas(deltas)Looking at If that’s the case, when a I’d like to hear your thoughts on the best way to handle this. |
|
Hi @nallwhy! Thanks for your work on this, it's looking good! To answer your question, yes, we do not merge a thinking and text content part. It could also be an image or file. Other APIs like ChatOpenAI and ChatAnthropic both return an index in the delta for a content part to indicate which content part (one or more) it is connected to. So a single API response can return a single message with multiple content parts where some are thinking related (Anthropic includes thinking signatures to prevent and detect tampering with it) which is separate from a displayed text response. Without having looked into it, I would expect some type of index for the content part to come from Google API. |
# Conflicts: # lib/chat_models/chat_google_ai.ex
|
Implemented message delta separation so that the output matches the behavior observed in ChatAnthropic’s results. |
|
Thanks @nallwhy! |
No description provided.