Skip to content
Merged
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
3 changes: 1 addition & 2 deletions llm-service/app/services/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def generate_suggested_questions(
),
[],
)

suggested_questions = process_response(response.response)
return suggested_questions

Expand All @@ -250,7 +249,7 @@ def process_response(response: str | None) -> list[str]:
sentences = map(lambda x: x.removeprefix("*").strip(), sentences)
sentences = map(lambda x: x.removeprefix("-").strip(), sentences)
sentences = map(lambda x: x.strip("*"), sentences)
sentences = filter(lambda x: len(x.split()) <= 15, sentences)
sentences = filter(lambda x: len(x.split()) <= 60, sentences)
sentences = filter(lambda x: x != "Empty Response", sentences)
sentences = filter(lambda x: x != "", sentences)
return list(sentences)[:5]
Expand Down
2 changes: 1 addition & 1 deletion llm-service/app/tests/services/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_process_response(self, response: str) -> None:

assert not suggested_question.endswith("*")

assert len(suggested_question.split()) <= 15
assert len(suggested_question.split()) <= 60

assert suggested_question != "Empty Response"
assert suggested_question != ""