fix(ai,coding-agent): omit undefined provider request options closes #3627
This commit is contained in:
@@ -456,16 +456,12 @@ export const streamAnthropic: StreamFunction<"anthropic-messages", AnthropicOpti
|
||||
if (nextParams !== undefined) {
|
||||
params = nextParams as MessageCreateParamsStreaming;
|
||||
}
|
||||
const response = await client.messages
|
||||
.create(
|
||||
{ ...params, stream: true },
|
||||
{
|
||||
signal: options?.signal,
|
||||
timeout: options?.timeoutMs,
|
||||
maxRetries: options?.maxRetries,
|
||||
},
|
||||
)
|
||||
.asResponse();
|
||||
const requestOptions = {
|
||||
...(options?.signal ? { signal: options.signal } : {}),
|
||||
...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
|
||||
...(options?.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
|
||||
};
|
||||
const response = await client.messages.create({ ...params, stream: true }, requestOptions).asResponse();
|
||||
await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
||||
stream.push({ type: "start", partial: output });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user