| 45 | ttlSeconds !== undefined ? new CacheHint({ type: "ephemeral", ttlSeconds }) : new CacheHint({ type: "ephemeral" }) |
| 46 | |
| 47 | const markLastTool = (tools: ReadonlyArray<ToolDefinition>, hint: CacheHint): ReadonlyArray<ToolDefinition> => { |
| 48 | if (tools.length === 0) return tools |
| 49 | const last = tools.length - 1 |
| 50 | if (tools[last]!.cache) return tools |
| 51 | return tools.map((tool, i) => (i === last ? new ToolDefinition({ ...tool, cache: hint }) : tool)) |
| 52 | } |
| 53 | |
| 54 | const markLastSystem = (system: LLMRequest["system"], hint: CacheHint): LLMRequest["system"] => { |
| 55 | if (system.length === 0) return system |