File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
packages/types/src/providers
src/api/providers/fetchers Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ export const ioIntelligenceDefaultModelId: IOIntelligenceModelId = "meta-llama/L
1010
1111export const ioIntelligenceDefaultBaseUrl = "https://api.intelligence.io.solutions/api/v1"
1212
13+ export const IO_INTELLIGENCE_CACHE_DURATION = 1000 * 60 * 60 // 1 hour
14+
1315export const ioIntelligenceModels = {
1416 "deepseek-ai/DeepSeek-R1-0528" : {
1517 maxTokens : 8192 ,
Original file line number Diff line number Diff line change 11import axios from "axios"
22import { z } from "zod"
33import type { ModelInfo } from "@roo-code/types"
4+ import { IO_INTELLIGENCE_CACHE_DURATION } from "@roo-code/types"
45import type { ModelRecord } from "../../../shared/api"
56
67/**
@@ -53,7 +54,6 @@ interface CacheEntry {
5354}
5455
5556let cache : CacheEntry | null = null
56- const CACHE_DURATION = 5 * 60 * 1000 // 5 minutes
5757
5858/**
5959 * Model context length mapping based on the documentation
@@ -80,7 +80,8 @@ const VISION_MODELS = new Set([
8080 */
8181function parseIOIntelligenceModel ( model : IOIntelligenceModel ) : ModelInfo {
8282 const contextLength = MODEL_CONTEXT_LENGTHS [ model . id ] || 8192
83- const maxTokens = Math . min ( contextLength , Math . ceil ( contextLength * 0.2 ) )
83+ // Cap maxTokens at 32k for very large context windows, or 20% of context length, whichever is smaller
84+ const maxTokens = Math . min ( contextLength , Math . ceil ( contextLength * 0.2 ) , 32768 )
8485 const supportsImages = VISION_MODELS . has ( model . id )
8586
8687 return {
@@ -101,7 +102,7 @@ export async function getIOIntelligenceModels(apiKey?: string): Promise<ModelRec
101102 const now = Date . now ( )
102103
103104 // Check cache
104- if ( cache && now - cache . timestamp < CACHE_DURATION ) {
105+ if ( cache && now - cache . timestamp < IO_INTELLIGENCE_CACHE_DURATION ) {
105106 return cache . data
106107 }
107108
You can’t perform that action at this time.
0 commit comments