-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: add reasoning_details support #12916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,6 +205,14 @@ export type Message = { | |
| usage?: Usage | ||
| metrics?: Metrics | ||
|
|
||
| /** | ||
| * Raw reasoning details from OpenRouter. | ||
| * When present, this should be saved and sent back in subsequent requests | ||
| * to allow models like Claude/Gemini to correctly resume encrypted reasoning. | ||
| * Has higher priority than other reasoning fields. | ||
| */ | ||
| reasoning_details?: any[] | ||
|
|
||
|
Comment on lines
+208
to
+215
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. provider specific的数据不应该额外添加字段,应该放到providerMetadata字段中 |
||
| // UI相关 | ||
| multiModelMessageStyle?: 'horizontal' | 'vertical' | 'fold' | 'grid' | ||
| foldSelected?: boolean | ||
|
|
@@ -226,6 +234,13 @@ export type Message = { | |
| export interface Response { | ||
| text?: string | ||
| reasoning_content?: string | ||
| /** | ||
| * Raw reasoning details from OpenRouter. | ||
| * When present, this should be saved and sent back in subsequent requests | ||
| * to allow models like Claude/Gemini to correctly resume encrypted reasoning. | ||
| * Has higher priority than other reasoning fields. | ||
| */ | ||
| reasoning_details?: any[] | ||
|
Comment on lines
+237
to
+243
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里同样,不要额外添加字段。我们目前所有provider specific的数据都依赖上游providerMetadata处理,你可以看看openrouter aisdk provider的类型定义是否已更新 |
||
| usage?: Usage | ||
| metrics?: Metrics | ||
| webSearch?: WebSearchResponse | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reasoningdetails有类型我没记错的话
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实是有的(https://openrouter.ai/docs/guides/best-practices/reasoning-tokens#reasoning_details-array-structure),不过在通用字段外,3种子类型有各自特殊字段,未来其他模型供应商也可能会带来新的类型。我觉得如果不会对客户端造成什么安全性风险,用Any或许没什么问题?因为使用
reasoning_details时,我们已经相信OpenRouter会对数据的合法性、格式对接负责了。