mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
* Fix remaining VCR live-call leaks * test(vcr): dedupe live-test helpers and drop spurious kwargs Extract the duplicated isVertexQuotaError/runVertexRequestOrSkip Vertex quota-skip helpers into tests/pass_through_tests/vertex_test_helpers.js and the duplicated _skip_live_prompt_caching_test guard into tests/_live_test_helpers.py so each lives in one place. In test_aarun_thread_litellm, build a separate message_data carrying role/content for add_message and a thread_data without them for run_thread/run_thread_stream/get_messages, which no longer receive the spurious message fields. * test(overhead): assert mock transport is exercised in non-streaming and stream tests
27 lines
762 B
JavaScript
27 lines
762 B
JavaScript
function isVertexQuotaError(error) {
|
|
const message = [
|
|
error && error.message,
|
|
error && error.stack,
|
|
error && error.cause && JSON.stringify(error.cause),
|
|
].filter(Boolean).join('\n');
|
|
|
|
return (
|
|
message.includes('429') ||
|
|
message.includes('Too Many Requests') ||
|
|
message.includes('RESOURCE_EXHAUSTED')
|
|
);
|
|
}
|
|
|
|
async function runVertexRequestOrSkip(requestFn) {
|
|
try {
|
|
return await requestFn();
|
|
} catch (error) {
|
|
if (isVertexQuotaError(error)) {
|
|
console.warn('Vertex AI quota exhausted; skipping live provider assertions for this run');
|
|
return null;
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
module.exports = { isVertexQuotaError, runVertexRequestOrSkip };
|