* Resolves the configured model and computes model parameters * (max tokens, temperature, reasoning effort) from the merged model info. * * The wire format is derived from the model ID via * isOpencodeGoAnthropicFormatModel: Anthropic-format models compute * parameters with the `an
()
| 113 | * parameter computation — mirroring the original `fetchModel()` flow. |
| 114 | */ |
| 115 | private async resolveModel() { |
| 116 | const { id, info } = await this.fetchModel() |
| 117 | const isAnthropic = isOpencodeGoAnthropicFormatModel(id) |
| 118 | // getModelParams is overloaded on a literal `format`, so branch the call |
| 119 | // rather than passing a union — this keeps the returned params typed as a |
| 120 | // single concrete shape per branch. |
| 121 | const params = isAnthropic |
| 122 | ? getModelParams({ |
| 123 | format: "anthropic", |
| 124 | modelId: id, |
| 125 | model: info, |
| 126 | settings: this.options, |
| 127 | defaultTemperature: OPENCODE_GO_DEFAULT_TEMPERATURE, |
| 128 | }) |
| 129 | : getModelParams({ |
| 130 | format: "openai", |
| 131 | modelId: id, |
| 132 | model: info, |
| 133 | settings: this.options, |
| 134 | defaultTemperature: OPENCODE_GO_DEFAULT_TEMPERATURE, |
| 135 | }) |
| 136 | return { |
| 137 | id, |
| 138 | info, |
| 139 | format: isAnthropic ? ("anthropic" as const) : ("openai" as const), |
| 140 | maxTokens: params.maxTokens, |
| 141 | temperature: params.temperature, |
| 142 | reasoningEffort: params.reasoningEffort, |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * Streams a chat completion response, yielding typed chunks for text, |
no test coverage detected