Skip to content

Commit

Permalink
lint: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gventuri committed Oct 16, 2024
1 parent 5839328 commit 779aa41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 3 additions & 9 deletions pandasai/ee/vectorstores/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Milvus(VectorStore):
default=384, description="default embedding model dimension"
)

# Initializes the Milvus object with collection names, a URI for the Milvus database,
# Initializes the Milvus object with collection names, a URI for the Milvus database,
# a logger, and the embedding function.
def __init__(
self,
Expand Down Expand Up @@ -86,10 +86,7 @@ def add_question_answer(
collection_name=self.qa_collection_name,
data=data,
)

return milvus_ids



# Adds documents to the Milvus collection.
# It accepts documents, optional IDs, and metadata, and stores them in the document collection.
Expand Down Expand Up @@ -124,7 +121,7 @@ def add_docs(
collection_name=self.docs_collection_name,
data=data,
)

return milvus_ids

# Retrieves the most relevant question-answer pairs from the QA collection
Expand All @@ -146,7 +143,6 @@ def get_relevant_question_answers(self, question: str, k: int = 1) -> List[Dict]
filter="",
output_fields=[DOCUMENT],
)

return self._convert_search_response(response)

# Retrieves the most relevant documents from the document collection
Expand All @@ -166,7 +162,6 @@ def get_relevant_docs(self, question: str, k: int = 1) -> List[Dict]:
limit=k,
output_fields=[DOCUMENT],
)

return self._convert_search_response(response)

# Converts the search response returned by Milvus into a list of dictionaries
Expand Down Expand Up @@ -271,7 +266,6 @@ def get_relevant_question_answers_by_id(self, ids: Iterable[str]) -> List[Dict]:
ids=milvus_ids,
output_fields=[DOCUMENT, ID, "distance", "entity"],
)

return self._convert_search_response(response)["documents"]

# Deletes documents from the document collection based on a list of document IDs.
Expand Down Expand Up @@ -388,4 +382,4 @@ def _is_valid_uuid(self, id: str):

# Generates a list of random UUIDs.
def generate_random_uuids(self, n):
return [str(uuid.uuid4()) for _ in range(n)]
return [str(uuid.uuid4()) for _ in range(n)]
5 changes: 4 additions & 1 deletion pandasai/pipelines/chat/code_cleaning.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ def _is_malicious_code(self, code) -> bool:
"(chr",
"b64decode",
]
return any(re.search(r'\b'+re.escape(module)+r'\b',code) for module in dangerous_modules)
return any(
re.search(r"\b" + re.escape(module) + r"\b", code)
for module in dangerous_modules
)

def _is_jailbreak(self, node: ast.stmt) -> bool:
"""
Expand Down

0 comments on commit 779aa41

Please sign in to comment.