Skip to content

Conversation

@omkarjoshi0304
Copy link
Contributor

@omkarjoshi0304 omkarjoshi0304 commented Jun 11, 2025

## Description

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Copy link

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

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

Really solid start!:) 💪 You were really quick with proposing the PR. Let's iterate on this:).

Also, two tips:

  • How to write a good commit message -> https://cbea.ms/git-commit/
  • You should add a proof of testing comment that showcases how you tested your change. I've learnt this from Chris. He writes nice proofs of testing comments [1]. It is a requirement for this repo:

image

[1] openstack-lightspeed/rag-content#35 (comment)

@@ -0,0 +1 @@
{"user_id": "user_id_placeholder", "timestamp": "2025-06-09 22:19:56.810345+00:00", "conversation_id": "12345678-abcd-0000-0123-456789abcdef", "user_question": "sasddfghlljhkgfdghjkl;kjhgfdfghjklkjhiugyftdsfghjkliuyftdrsadtfyuiopiuytrsdfghj", "llm_response": "bar", "sentiment": 1, "user_feedback": "Great service!"} No newline at end of file

Choose a reason for hiding this comment

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

We probably do not want to include the /data folder:).

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, needs to be removed from the commit

Comment on lines 182 to 189
with pytest.raises(ValidationError) as exc_info:
FeedbackRequest(
conversation_id="123e4567-e89b-12d3-a456-426614174000",
user_question="What is OpenStack?",
llm_response="OpenStack is a cloud computing platform.",
user_feedback="x" * 4097,
)
assert "should have at most 4096 characters" in str(exc_info.value)

Choose a reason for hiding this comment

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

Indentation needs to be fixed:). Also, you can probably use match in pytest.rases() . You can check out the test above [1].

[1] https://github.com/lightspeed-core/lightspeed-stack/pull/93/files#diff-49fd4c68eb1f80b46e87791cc49551a3138b7106dc9b3ed416dcbf21fbcbaabcR170

src/app/main.py Outdated
async def startup_event() -> None:
"""Perform logger setup on service startup."""
get_logger("app.endpoints.handlers")
get_logger("app.endpoints.handlers")

Choose a reason for hiding this comment

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

Indent should be fixed and new line at the end of the file is missing.

min_length=1,
max_length=4096,
description="Maximum length of user feedback is 4096 characters long.",
examples=["How to Set Up Kubernetes?"],

Choose a reason for hiding this comment

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

The example field should most likely contain something like this:

Suggested change
examples=["How to Set Up Kubernetes?"],
examples=["I'm not satisfied with the response because it is too vague."],

You can of course come up with something else. Just an idea:)

default=None,
min_length=1,
max_length=4096,
description="Maximum length of user feedback is 4096 characters long.",

Choose a reason for hiding this comment

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

I think the descriptions field is mostly meant to be used for describing the purpose of the field. I think we can drop the information about the maximum length here. What do you think?

Suggested change
description="Maximum length of user feedback is 4096 characters long.",
description="Feedback on the LLM response.",

Copy link
Contributor

Choose a reason for hiding this comment

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

++

# Optional user feedback limited to 1–4096 characters to prevent abuse.
user_feedback: Optional[str] = Field(
default=None,
min_length=1,

Choose a reason for hiding this comment

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

From where I stand, I think we shouldn't be enforcing a min_length on the user_feedback. Maybe the lightspeed-core team has a different opinion on this but for now I would probably remove it.

Suggested change
min_length=1,

Copy link
Contributor

Choose a reason for hiding this comment

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

++

@@ -1,5 +1,5 @@
import pytest

from pydantic import ValidationError

Choose a reason for hiding this comment

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

I would keep the empty line here:).

Suggested change
from pydantic import ValidationError
import pytest
from pydantic import ValidationError
from models.requests import QueryRequest, Attachment, FeedbackRequest

From PEP-8:

Imports should be grouped in the following order:

    1. Standard library imports.
    2. Related third party imports.
    3. Local application/library specific imports.

You should put a blank line between each group of imports.

https://peps.python.org/pep-0008/#imports

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @lpiwowar for review! Agree with your comments

Copy link
Contributor

@tisnik tisnik left a comment

Choose a reason for hiding this comment

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

pls. remove those /data/* files. TYVM

Copy link
Contributor

@umago umago left a comment

Choose a reason for hiding this comment

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

Thanks Omkar, comments inline

@@ -0,0 +1 @@
{"user_id": "user_id_placeholder", "timestamp": "2025-06-09 22:19:56.810345+00:00", "conversation_id": "12345678-abcd-0000-0123-456789abcdef", "user_question": "sasddfghlljhkgfdghjkl;kjhgfdfghjklkjhiugyftdsfghjkliuyftdrsadtfyuiopiuytrsdfghj", "llm_response": "bar", "sentiment": 1, "user_feedback": "Great service!"} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, needs to be removed from the commit

default=None,
min_length=1,
max_length=4096,
description="Maximum length of user feedback is 4096 characters long.",
Copy link
Contributor

Choose a reason for hiding this comment

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

++


def test_user_feedback_too_short(self) -> None:
"""Test that user_feedback shorter than 1 character raises ValidationError."""
with pytest.raises(ValidationError) as exc_info:
Copy link
Contributor

Choose a reason for hiding this comment

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

Identation here is off.

Btw, unit-tests can be run locally as:

$ pdm test-unit

# Optional user feedback limited to 1–4096 characters to prevent abuse.
user_feedback: Optional[str] = Field(
default=None,
min_length=1,
Copy link
Contributor

Choose a reason for hiding this comment

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

++

@tisnik
Copy link
Contributor

tisnik commented Jun 12, 2025

now it's much better. Pls just rerun black on your sources to have them reformatted, and you are done

src/app/main.py Outdated
async def startup_event() -> None:
"""Perform logger setup on service startup."""
get_logger("app.endpoints.handlers")
get_logger("app.endpoints.handlers")
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is outside the scope of the change

@umago
Copy link
Contributor

umago commented Jun 12, 2025

now it's much better. Pls just rerun black on your sources to have them reformatted, and you are done

And get rid of the data/feedback pls (-:

@tisnik tisnik merged commit 1580a29 into lightspeed-core:main Jun 13, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants