From ae43789911a01028e828b2511a607a0fb1a2a0e5 Mon Sep 17 00:00:00 2001 From: Mark Sze Date: Wed, 20 Nov 2024 22:55:16 +0000 Subject: [PATCH] Testing LlamaIndex test fix --- .github/workflows/contrib-tests.yml | 4 ---- .../agentchat/contrib/llamaindex_conversable_agent.py | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.yml index b86f2ffd2..9e93490ea 100644 --- a/.github/workflows/contrib-tests.yml +++ b/.github/workflows/contrib-tests.yml @@ -253,10 +253,6 @@ jobs: - name: Install packages and dependencies for WebSurfer run: | pip install -e .[websurfer] - - name: Upgrade NumPy for Python 3.13 support - run: | - pip install --upgrade "numpy>=2.1.0" - python -c "import numpy; print(f'NumPy version: {numpy.__version__}')" - name: Set AUTOGEN_USE_DOCKER based on OS shell: bash run: | diff --git a/autogen/agentchat/contrib/llamaindex_conversable_agent.py b/autogen/agentchat/contrib/llamaindex_conversable_agent.py index b5bc79dec..e883e7671 100644 --- a/autogen/agentchat/contrib/llamaindex_conversable_agent.py +++ b/autogen/agentchat/contrib/llamaindex_conversable_agent.py @@ -16,6 +16,15 @@ from llama_index.core.agent.runner.base import AgentRunner from llama_index.core.base.llms.types import ChatMessage from llama_index.core.chat_engine.types import AgentChatResponse + from pydantic import BaseModel + + # 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: logger.fatal("Failed to import llama-index. Try running 'pip install llama-index'") raise e