Skip to content

Commit

Permalink
Avoid using is_typeddict
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Nov 26, 2024
1 parent 9efe068 commit b26a435
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions shiny/ui/_chat_normalize.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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"]
)
Expand Down

0 comments on commit b26a435

Please sign in to comment.