From 315850ea81761aa2478639ad32302d7a55f8181b Mon Sep 17 00:00:00 2001 From: you-n-g Date: Wed, 19 Nov 2025 19:41:49 +0800 Subject: [PATCH] fix: (to main) litellm's Timeout error is not picklable (#1294) --- rdagent/oai/backend/litellm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rdagent/oai/backend/litellm.py b/rdagent/oai/backend/litellm.py index d3ead499..514c5aaa 100644 --- a/rdagent/oai/backend/litellm.py +++ b/rdagent/oai/backend/litellm.py @@ -3,7 +3,6 @@ from typing import Any, Literal, Optional, Type, TypedDict, Union, cast import numpy as np from litellm import ( - BadRequestError, completion, completion_cost, embedding, @@ -12,6 +11,7 @@ from litellm import ( supports_response_schema, token_counter, ) +from litellm.exceptions import BadRequestError, Timeout from pydantic import BaseModel from rdagent.log import LogColors @@ -28,7 +28,8 @@ def _reduce_no_init(exc: Exception) -> tuple: # suppose you want to apply this to MyError -copyreg.pickle(BadRequestError, _reduce_no_init) +for cls in [BadRequestError, Timeout]: + copyreg.pickle(cls, _reduce_no_init) class LiteLLMSettings(LLMSettings):