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

fix(cli): Improve cli wrapper and fix init command behavior #1214

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Mar 5, 2025

  • refactor(agents-api): Refactor text_to_tsquery -> text_to_keywords
  • feat(agents-api,migrations): Add trigram search to FTS
  • fix(agents-api): Remove too-long magic number
  • fix(agents-api): Renamed confusing is_conversation_snippet flag
  • fix(cli): Improve cli wrapper and fix init command behavior

EntelligenceAI PR Summary

Purpose:

  • Enhance full-text search and improve CLI modularity and usability.

Changes:

  • Enhancement: Refined keyword extraction in NLP for better search.
  • New Feature: Added template selection in CLI init command.
  • Refactor: Reorganized imports for improved code clarity.
  • Style: Implemented a new custom prompt style in CLI.

Impact:

  • Streamlined CLI experience, improved search features, and increased code manageability.

Copy link
Contributor

Walkthrough

This PR enhances the NLP module by refining keyword extraction functions and introducing a new parameter for improved full-text search capabilities. The CLI has been refactored for better modularity, including new utility functions, a custom prompt style, and template selection support in the init command. Import reorganization across various files improves code clarity.

Changes

File(s) Summary
agents-api/agents_api/common/nlp.py Refactored text_to_tsvector_query to text_to_keywords, changing return type to a set for keyword extraction. Updated keyword filtering logic.
agents-api/agents_api/common/utils/get_doc_search.py Added extract_keywords parameter to get_search_fn_and_params for enhanced keyword extraction.
cli/src/julep_cli/init.py Enhanced init command with template selection and improved error handling.
cli/src/julep_cli/style.py Introduced custom style for CLI prompts.
cli/src/julep_cli/templates.py Added template fetching logic from GitHub repository.
Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @bot + *your message*
Example: @bot Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @bot + *feedback*
Example: @bot Do not comment on `save_auth` function !

Comment on lines 153 to 156
keywords = extract_keywords(sent_doc, top_n, split_chunks=split_chunks)
keywords = [kw for kw in keywords if len(kw) > 1]
if len(keywords) < min_keywords:
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Filtering keywords with len(kw) > 1 after extraction could return fewer keywords than min_keywords, making the minimum check ineffective. Move length check before the minimum check.

📝 Committable Code Suggestion

‼️ Ensure you review the code suggestion before committing it to the branch. Make sure it replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
keywords = extract_keywords(sent_doc, top_n, split_chunks=split_chunks)
keywords = [kw for kw in keywords if len(kw) > 1]
if len(keywords) < min_keywords:
continue
keywords = [kw for kw in extract_keywords(sent_doc, top_n, split_chunks=split_chunks) if len(kw) > 1]
if len(keywords) < min_keywords:
continue

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.

1 participant