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
5115a12a
Commit
5115a12a
authored
7 months ago
by
Vits
Browse files
Options
Downloads
Patches
Plain Diff
Merge with main
parent
4d6f6a1e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
semantic_router/index/pinecone.py
+1
-6
1 addition, 6 deletions
semantic_router/index/pinecone.py
semantic_router/layer.py
+0
-3
0 additions, 3 deletions
semantic_router/layer.py
with
1 addition
and
9 deletions
semantic_router/index/pinecone.py
+
1
−
6
View file @
5115a12a
...
@@ -11,7 +11,6 @@ from pydantic.v1 import BaseModel, Field
...
@@ -11,7 +11,6 @@ from pydantic.v1 import BaseModel, Field
from
semantic_router.index.base
import
BaseIndex
from
semantic_router.index.base
import
BaseIndex
from
semantic_router.utils.logger
import
logger
from
semantic_router.utils.logger
import
logger
from
semantic_router.route
import
Route
def
clean_route_name
(
route_name
:
str
)
->
str
:
def
clean_route_name
(
route_name
:
str
)
->
str
:
...
@@ -208,7 +207,6 @@ class PineconeIndex(BaseIndex):
...
@@ -208,7 +207,6 @@ class PineconeIndex(BaseIndex):
self
.
index
=
self
.
_init_index
(
force_create
=
True
)
self
.
index
=
self
.
_init_index
(
force_create
=
True
)
remote_routes
=
self
.
get_routes
()
remote_routes
=
self
.
get_routes
()
remote_dict
:
dict
=
{
route
:
set
()
for
route
,
_
in
remote_routes
}
remote_dict
:
dict
=
{
route
:
set
()
for
route
,
_
in
remote_routes
}
for
route
,
utterance
in
remote_routes
:
for
route
,
utterance
in
remote_routes
:
remote_dict
[
route
].
add
(
utterance
)
remote_dict
[
route
].
add
(
utterance
)
...
@@ -217,9 +215,6 @@ class PineconeIndex(BaseIndex):
...
@@ -217,9 +215,6 @@ class PineconeIndex(BaseIndex):
for
route
,
utterance
in
zip
(
local_route_names
,
local_utterances
):
for
route
,
utterance
in
zip
(
local_route_names
,
local_utterances
):
local_dict
[
route
].
add
(
utterance
)
local_dict
[
route
].
add
(
utterance
)
logger
.
info
(
f
"
Local routes:
{
local_dict
}
"
)
logger
.
info
(
f
"
Remote routes:
{
remote_dict
}
"
)
all_routes
=
set
(
remote_dict
.
keys
()).
union
(
local_dict
.
keys
())
all_routes
=
set
(
remote_dict
.
keys
()).
union
(
local_dict
.
keys
())
routes_to_add
=
[]
routes_to_add
=
[]
...
@@ -324,7 +319,7 @@ class PineconeIndex(BaseIndex):
...
@@ -324,7 +319,7 @@ class PineconeIndex(BaseIndex):
for
i
in
range
(
0
,
len
(
vectors_to_upsert
),
batch_size
):
for
i
in
range
(
0
,
len
(
vectors_to_upsert
),
batch_size
):
batch
=
vectors_to_upsert
[
i
:
i
+
batch_size
]
batch
=
vectors_to_upsert
[
i
:
i
+
batch_size
]
self
.
_batch_upsert
(
batch
)
self
.
_batch_upsert
(
batch
)
def
_remove_and_sync
(
self
,
routes_to_delete
:
dict
):
def
_remove_and_sync
(
self
,
routes_to_delete
:
dict
):
for
route
,
utterances
in
routes_to_delete
.
items
():
for
route
,
utterances
in
routes_to_delete
.
items
():
remote_routes
=
self
.
_get_routes_with_ids
(
route_name
=
route
)
remote_routes
=
self
.
_get_routes_with_ids
(
route_name
=
route
)
...
...
This diff is collapsed.
Click to expand it.
semantic_router/layer.py
+
0
−
3
View file @
5115a12a
...
@@ -497,9 +497,6 @@ class RouteLayer:
...
@@ -497,9 +497,6 @@ class RouteLayer:
dimensions
=
len
(
self
.
encoder
([
"
dummy
"
])[
0
])
dimensions
=
len
(
self
.
encoder
([
"
dummy
"
])[
0
])
)
)
logger
.
info
(
f
"
ROUTES TO ADD:
{
(
routes_to_add
)
}
"
)
logger
.
info
(
f
"
ROUTES TO DELETE:
{
(
routes_to_delete
)
}
"
)
layer_routes
=
[
layer_routes
=
[
Route
(
name
=
route
,
utterances
=
layer_routes_dict
[
route
])
Route
(
name
=
route
,
utterances
=
layer_routes_dict
[
route
])
for
route
in
layer_routes_dict
.
keys
()
for
route
in
layer_routes_dict
.
keys
()
...
...
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