mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Add thinking to Requesty provider (#4041)
This commit is contained in:
parent
9d4b4ebff0
commit
4ea75629e9
3 changed files with 32 additions and 1 deletions
5
.changeset/new-shoes-flow.md
Normal file
5
.changeset/new-shoes-flow.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"roo-cline": patch
|
||||
---
|
||||
|
||||
Add thinking controls for Requesty
|
||||
|
|
@ -19,12 +19,17 @@ export async function getRequestyModels(apiKey?: string): Promise<Record<string,
|
|||
const rawModels = response.data.data
|
||||
|
||||
for (const rawModel of rawModels) {
|
||||
const reasoningBudget = rawModel.supports_reasoning && rawModel.id.includes("claude")
|
||||
const reasoningEffort = rawModel.supports_reasoning && rawModel.id.includes("openai")
|
||||
|
||||
const modelInfo: ModelInfo = {
|
||||
maxTokens: rawModel.max_output_tokens,
|
||||
contextWindow: rawModel.context_window,
|
||||
supportsPromptCache: rawModel.supports_caching,
|
||||
supportsImages: rawModel.supports_vision,
|
||||
supportsComputerUse: rawModel.supports_computer_use,
|
||||
supportsReasoningBudget: reasoningBudget,
|
||||
supportsReasoningEffort: reasoningEffort,
|
||||
inputPrice: parseApiPrice(rawModel.input_price),
|
||||
outputPrice: parseApiPrice(rawModel.output_price),
|
||||
description: rawModel.description,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ type RequestyChatCompletionParams = OpenAI.Chat.ChatCompletionCreateParams & {
|
|||
mode?: string
|
||||
}
|
||||
}
|
||||
thinking?: {
|
||||
type: string
|
||||
budget_tokens?: number
|
||||
}
|
||||
}
|
||||
|
||||
export class RequestyHandler extends BaseProvider implements SingleCompletionHandler {
|
||||
|
|
@ -94,10 +98,25 @@ export class RequestyHandler extends BaseProvider implements SingleCompletionHan
|
|||
]
|
||||
|
||||
let maxTokens = undefined
|
||||
if (this.options.includeMaxTokens) {
|
||||
if (this.options.modelMaxTokens) {
|
||||
maxTokens = this.options.modelMaxTokens
|
||||
} else if (this.options.includeMaxTokens) {
|
||||
maxTokens = model.info.maxTokens
|
||||
}
|
||||
|
||||
let reasoningEffort = undefined
|
||||
if (this.options.reasoningEffort) {
|
||||
reasoningEffort = this.options.reasoningEffort
|
||||
}
|
||||
|
||||
let thinking = undefined
|
||||
if (this.options.modelMaxThinkingTokens) {
|
||||
thinking = {
|
||||
type: "enabled",
|
||||
budget_tokens: this.options.modelMaxThinkingTokens,
|
||||
}
|
||||
}
|
||||
|
||||
const temperature = this.options.modelTemperature
|
||||
|
||||
const completionParams: RequestyChatCompletionParams = {
|
||||
|
|
@ -107,6 +126,8 @@ export class RequestyHandler extends BaseProvider implements SingleCompletionHan
|
|||
temperature: temperature,
|
||||
stream: true,
|
||||
stream_options: { include_usage: true },
|
||||
reasoning_effort: reasoningEffort,
|
||||
thinking: thinking,
|
||||
requesty: {
|
||||
trace_id: metadata?.taskId,
|
||||
extra: {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue