Skip to content

Commit 9fbafb0

Browse files
committed
fix: improve optional chaining for API request parameters
1 parent 9e287e7 commit 9fbafb0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/api/providers/mistral.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ export class MistralHandler implements ApiHandler {
8080

8181
async *createMessage(systemPrompt: string, messages: Anthropic.Messages.MessageParam[]): ApiStream {
8282
this.logDebug(`Creating message with system prompt: ${systemPrompt}`)
83+
8384
const response = await this.client.chat.stream({
84-
model: this.options.apiModelId || mistralDefaultModelId,
85-
maxTokens: this.options.includeMaxTokens ? this.getModel().info.maxTokens : undefined,
85+
model: this.options?.apiModelId || mistralDefaultModelId,
86+
maxTokens: this.options?.includeMaxTokens ? this.getModel().info.maxTokens : undefined,
8687
messages: [{ role: "system", content: systemPrompt }, ...convertToMistralMessages(messages)],
87-
temperature: this.options.modelTemperature ?? MISTRAL_DEFAULT_TEMPERATURE,
88-
stream: this.options.mistralModelStreamingEnabled ?? undefined,
88+
temperature: this.options?.modelTemperature ?? MISTRAL_DEFAULT_TEMPERATURE,
89+
...(this.options?.mistralModelStreamingEnabled === true && { stream: true }),
8990
})
9091

9192
let completeContent = ""

0 commit comments

Comments
 (0)