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
b87a4912
Commit
b87a4912
authored
1 year ago
by
“Daniel Griffiths”
Browse files
Options
Downloads
Patches
Plain Diff
fix: schema file restored
parent
ec77a1a5
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/schema.py
+43
-0
43 additions, 0 deletions
semantic_router/schema.py
with
43 additions
and
0 deletions
semantic_router/schema.py
0 → 100644
+
43
−
0
View file @
b87a4912
from
enum
import
Enum
from
pydantic
import
BaseModel
from
pydantic.dataclasses
import
dataclass
from
semantic_router.encoders
import
(
BaseEncoder
,
CohereEncoder
,
OpenAIEncoder
,
)
class
EncoderType
(
Enum
):
HUGGINGFACE
=
"
huggingface
"
OPENAI
=
"
openai
"
COHERE
=
"
cohere
"
class
RouteChoice
(
BaseModel
):
name
:
str
|
None
=
None
function_call
:
dict
|
None
=
None
@dataclass
class
Encoder
:
type
:
EncoderType
name
:
str
|
None
model
:
BaseEncoder
def
__init__
(
self
,
type
:
str
,
name
:
str
|
None
):
self
.
type
=
EncoderType
(
type
)
self
.
name
=
name
if
self
.
type
==
EncoderType
.
HUGGINGFACE
:
raise
NotImplementedError
elif
self
.
type
==
EncoderType
.
OPENAI
:
self
.
model
=
OpenAIEncoder
(
name
)
elif
self
.
type
==
EncoderType
.
COHERE
:
self
.
model
=
CohereEncoder
(
name
)
else
:
raise
ValueError
def
__call__
(
self
,
texts
:
list
[
str
])
->
list
[
list
[
float
]]:
return
self
.
model
(
texts
)
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