Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
'Refactored by Sourcery'
  • Loading branch information
Sourcery AI committed Jul 30, 2023
commit 5b2c804b6aa53639aea5ae701928f0e6f86c37cd
7 changes: 3 additions & 4 deletions chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
# Load embeddings and DeepLake database
def load_embeddings_and_database(active_loop_data_set_path):
embeddings = OpenAIEmbeddings()
db = DeepLake(
return DeepLake(
dataset_path=active_loop_data_set_path,
read_only=True,
embedding_function=embeddings
embedding_function=embeddings,
)
return db
Comment on lines -28 to -33
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function load_embeddings_and_database refactored with the following changes:


# Transcribe audio using OpenAI Whisper API
def transcribe_audio(audio_file_path, openai_key):
Expand Down Expand Up @@ -88,7 +87,7 @@ def search_db(user_input, db):
# Display conversation history using Streamlit messages
def display_conversation(history):
for i in range(len(history["generated"])):
message(history["past"][i], is_user=True, key=str(i) + "_user")
message(history["past"][i], is_user=True, key=f"{str(i)}_user")
Comment on lines -91 to +90
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function display_conversation refactored with the following changes:

message(history["generated"][i],key=str(i))
#Voice using Eleven API
voice= "Bella"
Expand Down
4 changes: 1 addition & 3 deletions scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ def split_docs(docs):
def load_vectors_into_deeplake(dataset_path, source_chunks):
# Initialize the DeepLake database with the dataset path and embedding function
deeplake_db = DeepLake(dataset_path=dataset_path, embedding_function=embeddings)
# Add the text chunks to the database
deeplakedb=deeplake_db.add_texts(source_chunks)
return deeplakedb
return deeplake_db.add_texts(source_chunks)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function load_vectors_into_deeplake refactored with the following changes:

This removes the following comments ( why? ):

# Add the text chunks to the database



# Define the main function
Expand Down