From 4b5dcbf1c7d6ab3b6a36c45e5c65ebf2beab630a Mon Sep 17 00:00:00 2001 From: Lazaros Toumanidis Date: Mon, 2 Dec 2024 08:39:16 +0200 Subject: [PATCH] restore: llamaindex_conversable_agent.py --- .../contrib/llamaindex_conversable_agent.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/autogen/agentchat/contrib/llamaindex_conversable_agent.py b/autogen/agentchat/contrib/llamaindex_conversable_agent.py index f8dcf17aa3..e883e76714 100644 --- a/autogen/agentchat/contrib/llamaindex_conversable_agent.py +++ b/autogen/agentchat/contrib/llamaindex_conversable_agent.py @@ -17,20 +17,12 @@ from llama_index.core.base.llms.types import ChatMessage from llama_index.core.chat_engine.types import AgentChatResponse from pydantic import BaseModel - from pydantic import __version__ as pydantic_version - - # let's Avoid: AttributeError: type object 'Config' has no attribute 'copy' - if pydantic_version >= "2.0": - from pydantic import ConfigDict - - Config = ConfigDict(arbitrary_types_allowed=True) - else: - - class Config: - arbitrary_types_allowed = True # Add Pydantic configuration to allow arbitrary types # Added to mitigate PydanticSchemaGenerationError + class Config: + arbitrary_types_allowed = True + BaseModel.model_config = Config except ImportError as e: