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
d29263d2
Unverified
Commit
d29263d2
authored
1 year ago
by
Siraj R Aizlewood
Browse files
Options
Downloads
Patches
Plain Diff
Removed Debugging Statements
parent
53ae469f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
semantic_router/splitters/cumulative_sim.py
+0
-5
0 additions, 5 deletions
semantic_router/splitters/cumulative_sim.py
semantic_router/text.py
+0
-35
0 additions, 35 deletions
semantic_router/text.py
with
0 additions
and
40 deletions
semantic_router/splitters/cumulative_sim.py
+
0
−
5
View file @
d29263d2
...
@@ -3,10 +3,6 @@ from semantic_router.splitters.base import BaseSplitter
...
@@ -3,10 +3,6 @@ from semantic_router.splitters.base import BaseSplitter
import
numpy
as
np
import
numpy
as
np
from
semantic_router.schema
import
DocumentSplit
from
semantic_router.schema
import
DocumentSplit
from
semantic_router.encoders
import
BaseEncoder
from
semantic_router.encoders
import
BaseEncoder
# DEBUGGING: Start.
import
time
# DEBUGGING: End.
class
CumulativeSimSplitter
(
BaseSplitter
):
class
CumulativeSimSplitter
(
BaseSplitter
):
...
@@ -36,7 +32,6 @@ class CumulativeSimSplitter(BaseSplitter):
...
@@ -36,7 +32,6 @@ class CumulativeSimSplitter(BaseSplitter):
if
idx
+
1
<
total_docs
:
if
idx
+
1
<
total_docs
:
curr_split_docs
=
"
\n
"
.
join
(
docs
[
curr_split_start_idx
:
idx
+
1
])
curr_split_docs
=
"
\n
"
.
join
(
docs
[
curr_split_start_idx
:
idx
+
1
])
next_doc
=
docs
[
idx
+
1
]
next_doc
=
docs
[
idx
+
1
]
time
.
sleep
(
30
)
curr_split_docs_embed
=
self
.
encoder
([
curr_split_docs
])[
0
]
curr_split_docs_embed
=
self
.
encoder
([
curr_split_docs
])[
0
]
next_doc_embed
=
self
.
encoder
([
next_doc
])[
0
]
next_doc_embed
=
self
.
encoder
([
next_doc
])[
0
]
...
...
This diff is collapsed.
Click to expand it.
semantic_router/text.py
+
0
−
35
View file @
d29263d2
...
@@ -42,28 +42,9 @@ class Conversation(BaseModel):
...
@@ -42,28 +42,9 @@ class Conversation(BaseModel):
if
self
.
splitter
is
None
:
if
self
.
splitter
is
None
:
raise
ValueError
(
"
Splitter is not configured. Please call configure_splitter first.
"
)
raise
ValueError
(
"
Splitter is not configured. Please call configure_splitter first.
"
)
new_topics
=
[]
new_topics
=
[]
# DEBUGGING: Start.
print
(
'
#
'
*
50
)
print
(
'
self.topics
'
)
print
(
self
.
topics
)
print
(
'
#
'
*
50
)
# DEBUGGING: End.
# DEBUGGING: Start.
print
(
'
#
'
*
50
)
print
(
'
self.messages
'
)
print
(
self
.
messages
)
print
(
'
#
'
*
50
)
# DEBUGGING: End.
# Get the messages that haven't been clustered into topics yet
# Get the messages that haven't been clustered into topics yet
unclustered_messages
=
self
.
messages
[
len
(
self
.
topics
):]
unclustered_messages
=
self
.
messages
[
len
(
self
.
topics
):]
# DEBUGGING: Start.
print
(
'
#
'
*
50
)
print
(
'
unclustered_messages
'
)
print
(
unclustered_messages
)
print
(
'
#
'
*
50
)
# DEBUGGING: End.
# If there are no unclustered messages, return early
# If there are no unclustered messages, return early
if
not
unclustered_messages
:
if
not
unclustered_messages
:
...
@@ -81,30 +62,14 @@ class Conversation(BaseModel):
...
@@ -81,30 +62,14 @@ class Conversation(BaseModel):
# Add the unclustered messages to the docs
# Add the unclustered messages to the docs
docs
.
extend
([
f
"
{
m
.
role
}
:
{
m
.
content
}
"
for
m
in
unclustered_messages
])
docs
.
extend
([
f
"
{
m
.
role
}
:
{
m
.
content
}
"
for
m
in
unclustered_messages
])
# DEBUGGING: Start.
print
(
'
#
'
*
50
)
print
(
'
docs
'
)
print
(
docs
)
print
(
'
#
'
*
50
)
# DEBUGGING: End.
# Use the splitter to split the documents
# Use the splitter to split the documents
new_topics
=
self
.
splitter
(
docs
)
new_topics
=
self
.
splitter
(
docs
)
# DEBUGGING: Start.
print
(
'
#
'
*
50
)
print
(
'
new_topics
'
)
print
(
new_topics
)
print
(
'
#
'
*
50
)
# DEBUGGING: End.
# Ensure there are new topics before proceeding
# Ensure there are new topics before proceeding
if
not
new_topics
:
if
not
new_topics
:
return
self
.
topics
,
[]
return
self
.
topics
,
[]
# Check if there are any previously assigned topics
# Check if there are any previously assigned topics
if
self
.
topics
and
new_topics
:
if
self
.
topics
and
new_topics
:
# Check if the first new topic includes the last message that was assigned a topic in the previous splitting.
# Check if the first new topic includes the last message that was assigned a topic in the previous splitting.
...
...
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