Skip to content

Commit

Permalink
Fixed types in models
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Feb 9, 2025
1 parent ee2835d commit 774f696
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ols/app/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ def __init__(self, *args: Any, **kwargs: Any):
super().__init__(object_hook=self._decode_message, *args, **kwargs)

def _decode_message(
self, dct: Dict[str, Any]
) -> Union[HumanMessage, AIMessage, Dict[str, Any]]:
self, dct: dict[str, Any]
) -> Union[HumanMessage, AIMessage, dict[str, Any]]:
"""Decode JSON dictionary into Message objects if applicable.
Args:
Expand All @@ -771,6 +771,8 @@ def _decode_message(
Union[HumanMessage, AIMessage, dict]: A Message object if the input
dictionary represents a message, otherwise returns the original dictionary.
"""
message: BaseMessage

if "type" in dct:
if dct["type"] == "human":
message = HumanMessage(content=dct["content"])
Expand Down

0 comments on commit 774f696

Please sign in to comment.