Problem with Gemini Models pydantic_serializer

there is always erorr in docker with agent-api looks like pydantic_serializer__.to_json

2025-01-27 22:33:47 DEBUG    ---------- Gemini Response End ----------                              
2025-01-27 22:33:47 DEBUG    Added 3 Messages to AgentMemory                                        
2025-01-27 22:33:47 DEBUG    Added AgentChat to AgentMemory                                         
2025-01-27 22:33:47 DEBUG    --**-- Logging Agent Run                                               
2025-01-27 22:33:47 DEBUG    Could not create Agent run: Object of type RepeatedComposite is not    
2025-01-27 22:33:47          JSON serializable                                                      
2025-01-27 22:33:47 DEBUG    *********** Agent Run End: 6809d5a5-2c8c-4be2-9ce0-2ce16b53952b        
2025-01-27 22:33:47          ***********                                                            
2025-01-27 22:33:47 INFO:     172.18.0.1:46352 - "POST /v1/playground/agent/run HTTP/1.1" 500 Internal Server Error
2025-01-27 22:33:47 ERROR:    Exception in ASGI application
2025-01-27 22:33:47 Traceback (most recent call last):
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
2025-01-27 22:33:47     result = await app(  # type: ignore[func-returns-value]
2025-01-27 22:33:47              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
2025-01-27 22:33:47     return await self.app(scope, receive, send)
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
2025-01-27 22:33:47     await super().__call__(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
2025-01-27 22:33:47     await self.middleware_stack(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 187, in __call__
2025-01-27 22:33:47     raise exc
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in __call__
2025-01-27 22:33:47     await self.app(scope, receive, _send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in __call__
2025-01-27 22:33:47     await self.app(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
2025-01-27 22:33:47     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
2025-01-27 22:33:47     raise exc
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
2025-01-27 22:33:47     await app(scope, receive, sender)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
2025-01-27 22:33:47     await self.middleware_stack(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
2025-01-27 22:33:47     await route.handle(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
2025-01-27 22:33:47     await self.app(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
2025-01-27 22:33:47     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
2025-01-27 22:33:47     raise exc
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
2025-01-27 22:33:47     await app(scope, receive, sender)
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
2025-01-27 22:33:47     response = await f(request)
2025-01-27 22:33:47                ^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
2025-01-27 22:33:47     raw_response = await run_endpoint_function(
2025-01-27 22:33:47                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 214, in run_endpoint_function
2025-01-27 22:33:47     return await run_in_threadpool(dependant.call, **values)
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/starlette/concurrency.py", line 39, in run_in_threadpool
2025-01-27 22:33:47     return await anyio.to_thread.run_sync(func, *args)
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/anyio/to_thread.py", line 56, in run_sync
2025-01-27 22:33:47     return await get_async_backend().run_sync_in_worker_thread(
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2025-01-27 22:33:47     return await future
2025-01-27 22:33:47            ^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 943, in run
2025-01-27 22:33:47     result = context.run(func, *args)
2025-01-27 22:33:47              ^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/phi/playground/router.py", line 138, in agent_run
2025-01-27 22:33:47     return run_response.model_dump_json()
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47   File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 441, in model_dump_json
2025-01-27 22:33:47     return self.__pydantic_serializer__.to_json(
2025-01-27 22:33:47            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-01-27 22:33:47 pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'proto.marshal.collections.repeated.RepeatedComposite'>

in my agent prompt i ask model to make result in table it always erorr, after change the models to openai its work, please check it

i provide my code

import os
from typing import Optional
from phi.agent import Agent
from phi.model.google import Gemini

def get_police_agent(
    model_id: Optional[str] = None,
    user_id: Optional[str] = None,
    session_id: Optional[str] = None,
    debug_mode: bool = False,
) -> Agent:
    return Agent(
        name="Police Agent",
        agent_id="police-agent",
        model=Gemini(
            id="gemini-1.5-flash",
            api_key=os.environ["GOOGLE_API_KEY"]
        ),
        description="Anda adalah anggota kepolisian yang khusus melakukan analisa laporan atau kejadian.",
        instructions=[
            "Berikan analisis dalam format berikut:\n",
            "# Kronologi\n"
            "- Dokumentasikan waktu (tempus), lokasi (locus), dan urutan kejadian secara rinci\n"
            "- Identifikasi semua tindakan yang dilakukan oleh pihak terkait\n",
            
            "# Pihak yang Terlibat\n"
            "- Identitas dan peran pelapor, terlapor, dan saksi\n"
            "- Dokumentasi kontribusi setiap pihak\n",
            
            "# Barang Bukti dan Kerugian\n"
            "- Daftar barang bukti terkait kasus\n"
            "- Estimasi kerugian material dan non-material\n",
            
            "# Analisis Hukum\n"
            "- Kajian fakta dan keterlibatan pihak\n"
            "- Pokok permasalahan dan dampak hukum\n",
            
            "# Latar Belakang dan Motif\n"
            "- Hubungan antar pihak yang terlibat\n"
            "- Analisis kemungkinan motif\n",
            
            "# Rekomendasi\n"
            "- Tentukan ranah (lex specialis/pidana umum)\n"
            "- Arahkan ke Direktorat yang sesuai (Reskrim Khusus/Umum)\n",
        ],
        markdown=True,
        debug_mode=debug_mode,
    )

i think its fix after updating to latest phidata, the only problem is on agent api example, user must manually updating requirements to get latest phidata on exiting project

@isikepala Thank you for using Phidata. Happy to know you resolved your doubt - fantastic effort.
If you have more questions, please feel free to reach out to us