Skip to content
Snippets Groups Projects
Unverified Commit d04df2c6 authored by Simonas Jakubonis's avatar Simonas Jakubonis Committed by GitHub
Browse files

Merge pull request #176 from aurelio-labs/simonas/fix-image-type

fix: PIL Image type
parents e5183afb cd6c924a
No related branches found
No related tags found
No related merge requests found
......@@ -2,14 +2,20 @@ import json
import re
from typing import Any, Callable, Dict, List, Optional, Union
from PIL.Image import Image
from pydantic.v1 import BaseModel
from typing_extensions import TypeAlias
from semantic_router.llms import BaseLLM
from semantic_router.schema import Message, RouteChoice
from semantic_router.utils import function_call
from semantic_router.utils.logger import logger
PILImage: TypeAlias = Union[Any, "Image"]
try:
from PIL.Image import Image
except ImportError:
pass
def is_valid(route_config: str) -> bool:
try:
......@@ -41,7 +47,7 @@ def is_valid(route_config: str) -> bool:
class Route(BaseModel):
name: str
utterances: Union[List[str], List[Image]]
utterances: Union[List[str], List[PILImage]]
description: Optional[str] = None
function_schema: Optional[Dict[str, Any]] = None
llm: Optional[BaseLLM] = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment