Skip to content

Commit 7867cf8

Browse files
committed
refactor(continue-watsonx-ai-provider): extract model info earlier to avoid redundant call
1 parent 777ca91 commit 7867cf8

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/api/providers/ibm-watsonx.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class WatsonxAIHandler extends BaseProvider implements SingleCompletionHa
141141
messages: Anthropic.Messages.MessageParam[],
142142
metadata?: ApiHandlerCreateMessageMetadata,
143143
): ApiStream {
144-
const { id: modelId } = this.getModel()
144+
const { id: modelId, info: modelInfo } = this.getModel()
145145

146146
try {
147147
// Convert messages to WatsonX format with system prompt
@@ -164,7 +164,6 @@ export class WatsonxAIHandler extends BaseProvider implements SingleCompletionHa
164164
const usageInfo = response.result.usage || {}
165165
const inputTokens = usageInfo.prompt_tokens || 0
166166
const outputTokens = usageInfo.completion_tokens || 0
167-
const modelInfo = this.getModel().info
168167
const totalCost = calculateApiCostOpenAI(modelInfo, inputTokens, outputTokens)
169168

170169
yield {

0 commit comments

Comments
 (0)