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

ENG-879 ENG-882 Move cli logic into its own folder #198

Merged
merged 9 commits into from
Jun 27, 2024
Merged

Conversation

kxtran
Copy link
Collaborator

@kxtran kxtran commented Jun 25, 2024

Description:

When accessing the Feedback, FeedbackTask, or Autofeedback objects in the SDK, users currently need to install CLI-related modules due to the existing code structure. To streamline this and keep the package lightweight, we can move the CLI code logic into its own folder.

  • Refactor cli code into its own folder
  • Group cli modules in pyproject.toml to make it easy to install the modules
  • Update poetry.lock file
  • Add tests for cli

@kxtran kxtran changed the title Move cli logic into its own folder ENG-879 Move cli logic into its own folder Jun 25, 2024
@kxtran kxtran requested a review from wenzhe-log10 June 26, 2024 19:52
@kxtran kxtran changed the title ENG-879 Move cli logic into its own folder ENG-879 ENG-882 Move cli logic into its own folder Jun 26, 2024
@kxtran kxtran marked this pull request as ready for review June 26, 2024 19:52
pyproject.toml Outdated Show resolved Hide resolved
Comment on lines 101 to 105
if not response:
tool_calls = first_choice["message"].get("tool_calls", [])
if tool_calls:
last_tool_call = tool_calls[-1]
response = last_tool_call.get("function", {}).get("arguments", "")
Copy link
Contributor

@wenzhe-log10 wenzhe-log10 Jun 26, 2024

Choose a reason for hiding this comment

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

could we simplify the ifs within if "message" in first_choice?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated. Does it look better?

Copy link
Contributor

Choose a reason for hiding this comment

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

I found function _render_completions_table is used for cli. so could be moved to cli/completions.py. Then we could remove the import rich, pandas, etc. in log10/completions/completions.py.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I also moved _render_comparison_table and _create_dataframe_from_comparison_data function because they also use rich and pandas

@kxtran kxtran requested a review from wenzhe-log10 June 27, 2024 02:59
Copy link
Contributor

@wenzhe-log10 wenzhe-log10 left a comment

Choose a reason for hiding this comment

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

LGTM

@kxtran kxtran merged commit cf1ab62 into main Jun 27, 2024
2 checks passed
@kxtran kxtran deleted the kt/test-modules branch June 27, 2024 17:51
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.

2 participants