Skip to content
Snippets Groups Projects
Unverified Commit d29263d2 authored by Siraj R Aizlewood's avatar Siraj R Aizlewood
Browse files

Removed Debugging Statements

parent 53ae469f
Branches
Tags
No related merge requests found
...@@ -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]
......
...@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment