Handle FinishReason.NO_IMAGE and fix optional chaining
- Add NO_IMAGE to error finish reasons in Google provider - Fix non-null assertion after optional chaining in Anthropic provider - Migrate biome config to 2.3.5 - Ignore Tailwind CSS file from biome checks - Bump all packages to version 0.6.0
This commit is contained in:
@@ -111,7 +111,8 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
||||
};
|
||||
|
||||
try {
|
||||
const { client, isOAuthToken } = createClient(model, options?.apiKey!);
|
||||
const apiKey = options?.apiKey ?? getApiKey(model.provider);
|
||||
const { client, isOAuthToken } = createClient(model, apiKey);
|
||||
const params = buildParams(model, context, isOAuthToken, options);
|
||||
const anthropicStream = client.messages.stream({ ...params, stream: true }, { signal: options?.signal });
|
||||
stream.push({ type: "start", partial: output });
|
||||
|
||||
@@ -466,6 +466,7 @@ function mapStopReason(reason: FinishReason): StopReason {
|
||||
case FinishReason.LANGUAGE:
|
||||
case FinishReason.MALFORMED_FUNCTION_CALL:
|
||||
case FinishReason.UNEXPECTED_TOOL_CALL:
|
||||
case FinishReason.NO_IMAGE:
|
||||
return "error";
|
||||
default: {
|
||||
const _exhaustive: never = reason;
|
||||
|
||||
Reference in New Issue
Block a user