langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

Add "reasoning" attribute to AIMessage

Open afirstenberg opened this issue 10 months ago • 3 comments

Privileged issue

  • [x] I am a LangChain maintainer, or was asked directly by a LangChain maintainer to create an issue here.

Issue Content

Proposal is to add an attribute to AIMessage:

  reasoning?: MessageContent;

See discussion on Slack (https://langchaincommunity.slack.com/archives/C07EHF3HC87/p1737150066310499) and discussion in #7434 and #7564

cc: @jacoblee93

afirstenberg avatar Jan 25 '25 23:01 afirstenberg

We are going to put reasoning_content in additional_kwargs for now but will upgrade the schema in the future:

https://github.com/langchain-ai/langchainjs/pull/7604

jacoblee93 avatar Jan 27 '25 18:01 jacoblee93

@jacoblee93 - What is the format of reasoning_content? Whatever the model returns or should we be defining a specific type?

afirstenberg avatar Jan 27 '25 18:01 afirstenberg

For now whatever the model defines (Deepseek makes it a string)

Would imagine in the future it'll be content blocks or string but would prefer to wait for the dust to settle a bit

jacoblee93 avatar Jan 28 '25 04:01 jacoblee93

@dosu Any update on this ?

allweonedev avatar Jul 30 '25 14:07 allweonedev

This was addressed in a different way in #8051.

See this post on medium or my blog with how to use reasoning with Gemini.

afirstenberg avatar Jul 30 '25 15:07 afirstenberg