From b26a43532e979cb23b7de98d3bebcc1e1c697713 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 26 Nov 2024 11:21:49 -0600 Subject: [PATCH] Avoid using is_typeddict --- shiny/ui/_chat_normalize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shiny/ui/_chat_normalize.py b/shiny/ui/_chat_normalize.py index 710e23691..5a2edefc3 100644 --- a/shiny/ui/_chat_normalize.py +++ b/shiny/ui/_chat_normalize.py @@ -1,6 +1,6 @@ import sys from abc import ABC, abstractmethod -from typing import TYPE_CHECKING, Any, Optional, cast, is_typeddict +from typing import TYPE_CHECKING, Any, Optional, cast from htmltools import HTML @@ -236,7 +236,7 @@ def can_normalize(self, message: Any) -> bool: # Ollama<0.4 used TypedDict (now it uses pydantic) # https://github.com/ollama/ollama-python/pull/276 - if is_typeddict(ChatResponse): + if isinstance(ChatResponse, dict): return "message" in message and super().can_normalize( message["message"] )