Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
cd6c924a
Commit
cd6c924a
authored
1 year ago
by
Simonas
Browse files
Options
Downloads
Patches
Plain Diff
fix: PIL Image type
parent
e5183afb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
semantic_router/route.py
+8
-2
8 additions, 2 deletions
semantic_router/route.py
with
8 additions
and
2 deletions
semantic_router/route.py
+
8
−
2
View file @
cd6c924a
...
@@ -2,14 +2,20 @@ import json
...
@@ -2,14 +2,20 @@ import json
import
re
import
re
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
from
PIL.Image
import
Image
from
pydantic.v1
import
BaseModel
from
pydantic.v1
import
BaseModel
from
typing_extensions
import
TypeAlias
from
semantic_router.llms
import
BaseLLM
from
semantic_router.llms
import
BaseLLM
from
semantic_router.schema
import
Message
,
RouteChoice
from
semantic_router.schema
import
Message
,
RouteChoice
from
semantic_router.utils
import
function_call
from
semantic_router.utils
import
function_call
from
semantic_router.utils.logger
import
logger
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
:
def
is_valid
(
route_config
:
str
)
->
bool
:
try
:
try
:
...
@@ -41,7 +47,7 @@ def is_valid(route_config: str) -> bool:
...
@@ -41,7 +47,7 @@ def is_valid(route_config: str) -> bool:
class
Route
(
BaseModel
):
class
Route
(
BaseModel
):
name
:
str
name
:
str
utterances
:
Union
[
List
[
str
],
List
[
Image
]]
utterances
:
Union
[
List
[
str
],
List
[
PIL
Image
]]
description
:
Optional
[
str
]
=
None
description
:
Optional
[
str
]
=
None
function_schema
:
Optional
[
Dict
[
str
,
Any
]]
=
None
function_schema
:
Optional
[
Dict
[
str
,
Any
]]
=
None
llm
:
Optional
[
BaseLLM
]
=
None
llm
:
Optional
[
BaseLLM
]
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment