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

feat(agents-api): Add humanize_text function to supported PyExp functions #1187

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

HamadaSalhab
Copy link
Contributor

@HamadaSalhab HamadaSalhab commented Feb 25, 2025

PR Type

Enhancement, Documentation


Description

  • Introduced humanize_text function for advanced text transformations.

    • Includes back-translation, grammar correction, and stylistic modifications.
    • Utilizes APIs like Sapling, Copyleaks, and ZeroGPT for human-like text evaluation.
  • Added new utility functions for text processing and splitting.

  • Updated environment variables and dependencies to support humanize_text.

  • Documented humanize_text usage in the advanced Python expression guide.


Changes walkthrough 📝

Relevant files
Enhancement
humanization_utils.py
Introduced utilities for text humanization and evaluation

agents-api/agents_api/activities/humanization_utils.py

  • Added humanize_text related utility functions for text transformation.
  • Implemented API integrations for Sapling, Copyleaks, and ZeroGPT.
  • Included text processing methods like homoglyph replacement and
    em-dash insertion.
  • Added paragraph splitting and language translation utilities.
  • +362/-0 
    utils.py
    Added `humanize_text` function and utility integration     

    agents-api/agents_api/activities/utils.py

  • Added humanize_text function for text transformation.
  • Integrated process_paragraph and split_with_langchain utilities.
  • Registered humanize_text in the allowed functions list.
  • +34/-0   
    Configuration changes
    env.py
    Added API key environment variables                                           

    agents-api/agents_api/env.py

  • Added environment variables for Sapling, Copyleaks, and ZeroGPT API
    keys.
  • +6/-0     
    docker-compose.yml
    Updated Docker Compose with API key environment variables

    agents-api/docker-compose.yml

    • Included new API keys in the shared environment configuration.
    +2/-0     
    Documentation
    .env.example
    Added API key placeholders to `.env.example`                         

    .env.example

    • Documented new environment variables for API keys.
    +6/-1     
    python-expression.mdx
    Added documentation for `humanize_text` function                 

    documentation/docs/advanced/python-expression.mdx

  • Documented humanize_text function in the advanced Python expression
    guide.
  • Provided example usage and explanation of its features.
  • +16/-0   
    Dependencies
    pyproject.toml
    Updated dependencies for text processing                                 

    agents-api/pyproject.toml

  • Added langchain-text-splitters and deep-translator to dependencies.
  • +2/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.

  • EntelligenceAI PR Summary

    Purpose:

    • Introduce a utility for enhancing text humanization in the agents API.

    Changes:

    • New Feature: Added humanization_utils.py for text translation, grammatical correction, and stylistic modification.
    • Enhancement: Integrated humanize_text function into utilities; updated environment configurations with API keys.
    • Documentation: Revised documentation to include humanize_text function usage.
    • Chore: Updated and locked dependencies for new functionalities.

    Impact:

    • Enhances agents API by improving text readability and processing capabilities, enabling complex text manipulations.

    Important

    Introduces humanize_text function for text transformation, updates configurations, and documents usage in the agents API.

    • New Feature:
      • Added humanize_text function in utils.py for text transformation.
      • Introduced humanization_utils.py for text translation, grammatical correction, and stylistic modification.
    • Enhancements:
      • Integrated humanize_text into allowed functions in utils.py.
      • Updated env.py and docker-compose.yml with API key configurations for Sapling, Copyleaks, and ZeroGPT.
    • Documentation:
      • Documented humanize_text usage in python-expression.mdx.
      • Added API key placeholders in .env.example.
    • Dependencies:
      • Added langchain-text-splitters and deep-translator to pyproject.toml.

    This description was created by Ellipsis for 125adcb. It will automatically update as commits are pushed.

    Copy link

    gitguardian bot commented Feb 25, 2025

    ⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

    Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

    🔎 Detected hardcoded secrets in your pull request
    GitGuardian id GitGuardian status Secret Commit Filename
    15754213 Triggered Bearer Token 057afd5 agents-api/agents_api/activities/humanization_utils.py View secret
    15754214 Triggered Bearer Token 057afd5 agents-api/agents_api/activities/humanization_utils.py View secret
    🛠 Guidelines to remediate hardcoded secrets
    1. Understand the implications of revoking this secret by investigating where it is used in your code.
    2. Replace and store your secrets safely. Learn here the best practices.
    3. Revoke and rotate these secrets.
    4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

    To avoid such incidents in the future consider


    🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Feb 25, 2025

    CI Feedback 🧐

    (Feedback updated until commit 125adcb)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: Typecheck

    Failed stage: Typecheck [❌]

    Failed test name: agents_api.activities.humanization_utils

    Failure summary:

    The pytype check failed in the file humanization_utils.py due to a type error:

  • Line 349: Attempting to call a boolean value as if it were a function
  • Specifically, the error occurs in the process_paragraph function with the expression
    grammar(paragraph)
  • The variable grammar is a boolean value but is being used as a callable function

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1388:  [70/295] check agents_api.queries.docs.delete_doc
    1389:  [71/295] check agents_api.queries.agents.update_agent
    1390:  [72/295] check agents_api.queries.agents.list_agents
    1391:  [73/295] check agents_api.queries.agents.get_agent
    1392:  [74/295] check agents_api.queries.agents.delete_agent
    1393:  [75/295] check agents_api.queries.agents.create_agent
    1394:  [76/295] check agents_api.common.utils.yaml
    1395:  [77/295] check agents_api.activities.humanization_utils
    1396:  FAILED: /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/activities/humanization_utils.pyi 
    1397:  /home/runner/work/julep/julep/agents-api/.venv/bin/python -m pytype.main --disable pyi-error --imports_info /home/runner/work/julep/julep/agents-api/.pytype/imports/agents_api.activities.humanization_utils.imports --module-name agents_api.activities.humanization_utils --platform linux -V 3.12 -o /home/runner/work/julep/julep/agents-api/.pytype/pyi/agents_api/activities/humanization_utils.pyi --analyze-annotated --nofail --none-is-not-bool --quick --strict-none-binding /home/runner/work/julep/julep/agents-api/agents_api/activities/humanization_utils.py
    1398:  /home/runner/work/julep/julep/agents-api/agents_api/activities/humanization_utils.py:349:25: error: in process_paragraph: 'bool' object is not callable [not-callable]
    1399:  paragraph = grammar(paragraph)
    1400:  ~~~~~~~~~~~~~~~~~~
    1401:  For more details, see https://google.github.io/pytype/errors.html#not-callable
    ...
    
    1550:  [226/295] check agents_api.activities.logger
    1551:  [227/295] check agents_api.activities.__init__
    1552:  [228/295] check agents_api.queries.chat.__init__
    1553:  [229/295] check agents_api.common.exceptions.agents
    1554:  [230/295] check agents_api.common.exceptions.sessions
    1555:  [231/295] check agents_api.autogen.__init__
    1556:  [232/295] check agents_api.common.utils.json
    1557:  [233/295] check agents_api.workflows.__init__
    1558:  ninja: build stopped: cannot make progress due to previous errors.
    1559:  Computing dependencies
    1560:  Generated API key since not set in the environment: 88415806177870123757965780400054
    1561:  Sentry DSN not found. Sentry will not be enabled.
    1562:  Analyzing 285 sources with 0 local dependencies
    1563:  Leaving directory '.pytype'
    1564:  ##[error]Process completed with exit code 1.
    

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    API Key Exposure:
    The code contains a hardcoded bearer token in the is_human_copyleaks function (line 151). This token should be moved to environment variables to prevent exposure of sensitive credentials. Additionally, the code makes calls to multiple external APIs (Sapling, Copyleaks, ZeroGPT) which could potentially expose sensitive text data to third parties.

    ⚡ Recommended focus areas for review

    Security Risk

    The is_human_copyleaks function contains a hardcoded API bearer token that should be moved to environment variables

    "Authorization": "Bearer 2c5d9a33-5dac-4e4a-b047-cc15e295ab49",
    Error Handling

    The recursive call to is_human_zerogpt in case of failure could lead to infinite recursion as there's no base case

    except Exception:
        time.sleep(2)
        return is_human_zerogpt(input_text)
    Performance

    The process_paragraph function makes multiple API calls in a loop which could be expensive and slow

    def process_paragraph(
            paragraph: str,
            src_lang: str,
            target_lang: str,
            grammar: bool,
            is_chatgpt: bool,
            use_homoglyphs: bool,
            use_em_dashes: bool,
            max_tries: int) -> str:
    
        for i in range(max_tries):
            if paragraph.strip() == "":
                return paragraph
    
            if is_human_zerogpt(paragraph) > 90:
                return paragraph
    
            paragraph = mix_translate(paragraph, src_lang, target_lang)
            if (grammar):
                paragraph = grammer(paragraph)
    
            paragraph = humanize_openai(
                paragraph) if is_chatgpt else humanize(paragraph)
    
            # Apply homoglyphs and em dashes to a new paragraph in order not to mess up the original paragraph for the next iterations
            new_paragraph = paragraph
            if use_homoglyphs:
                new_paragraph = replace_with_homoglyphs(new_paragraph)
    
            if use_em_dashes:
                new_paragraph = process_long_words(new_paragraph)
    
            if is_human_zerogpt(new_paragraph) > 90:
                return new_paragraph
    
        # Apply homoglyphs and em dashes to the final paragraph after consuming max tries
        if use_homoglyphs:
            paragraph = replace_with_homoglyphs(paragraph)
    
        if use_em_dashes:
            paragraph = process_long_words(paragraph)
    
        return paragraph

    Copy link
    Contributor

    Walkthrough

    This PR introduces a new utility for text humanization within the agents API. A new file, humanization_utils.py, is added to provide functions for text translation, grammar correction, and stylistic modifications using external APIs. The humanize_text function is integrated into existing utilities, enhancing text processing capabilities. API keys for external services are configured in environment files, and dependencies are updated to support new functionalities. Documentation is updated to reflect the usage of the humanize_text function in advanced Python expressions.

    Changes

    File(s) Summary
    .env.example, agents-api/env.py, agents-api/docker-compose.yml Added placeholders and environment variables for SAPLING_API_KEY and COPYLEAKS_API_KEY to support the humanize_text method.
    agents-api/agents_api/activities/humanization_utils.py Introduced a new utility file for text translation, grammar correction, and humanization using external APIs.
    agents-api/agents_api/activities/utils.py Integrated humanize_text function into existing utilities for enhanced text processing capabilities.
    agents-api/pyproject.toml, agents-api/uv.lock Updated and locked dependencies for langchain-text-splitters and deep-translator.
    documentation/docs/advanced/python-expression.mdx Documented the humanize_text function and its application in advanced Python expressions.
    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 !
    

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Feb 25, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Add API request error handling
    Suggestion Impact:The commit implements basic error handling and retry mechanism for the ZeroGPT API calls, though with a simpler approach than suggested

    code diff:

    -def is_human_zerogpt(input_text):
    +def is_human_zerogpt(input_text, max_tries=3):
    +    if max_tries < 0:
    +        return None
     
         # Define headers with Content-Type
         headers = {
    @@ -204,10 +208,10 @@
             resp = json.loads(response.text)
             result = False
             try:
    -            result = int(resp["data"]["isHuman"])
    +            result = int(resp.get("data", {}).get("isHuman", None))
             except Exception:
                 time.sleep(2)
    -            return is_human_zerogpt(input_text)
    +            return is_human_zerogpt(input_text, max_tries - 1)
     
             return result
         return None

    Add error handling and rate limiting for API calls to prevent service
    disruption. The current implementation may overwhelm external services with
    rapid requests.

    agents-api/agents_api/activities/humanization_utils.py [174-184]

    -def is_human_zerogpt(input_text):
    -    response = requests.post(ZEROGPT_URL, data=json_payload, headers=headers)
    -    if response.status_code == 200:
    -        resp = json.loads(response.text)
    -        result = False
    +def is_human_zerogpt(input_text, max_retries=3, backoff_factor=2):
    +    for attempt in range(max_retries):
             try:
    -            result = int(resp["data"]["isHuman"])
    +            response = requests.post(ZEROGPT_URL, data=json_payload, headers=headers)
    +            if response.status_code == 200:
    +                resp = json.loads(response.text)
    +                return int(resp["data"]["isHuman"])
    +            elif response.status_code == 429:  # Too Many Requests
    +                time.sleep(backoff_factor ** attempt)
    +                continue
             except Exception:
    -            time.sleep(2)
    -            return is_human_zerogpt(input_text)
    +            if attempt == max_retries - 1:
    +                return None
    +            time.sleep(backoff_factor ** attempt)
    +    return None

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 8

    __

    Why: The suggestion adds crucial error handling and rate limiting for API requests, which is essential for preventing service disruptions and handling API failures gracefully. The improved implementation includes retries with exponential backoff.

    Medium
    General
    Fix function name spelling
    Suggestion Impact:The commit renamed the function from 'grammer' to 'grammar' and updated its usage in the code

    code diff:

    -def grammer(text):
    +def grammar(text):
         try:
             response = completion(
                 model=HUMANIZATION["model"],
    @@ -147,8 +150,7 @@
     
         # Define headers with Authorization and Content-Type
         headers = {
    -        # "Authorization": "Bearer 16ad4126-e8b1-40a0-b700-fd971b8d4d91",
    -        "Authorization": "Bearer 2c5d9a33-5dac-4e4a-b047-cc15e295ab49",
    +        "Authorization": f"Bearer {copyleaks_api_key}",
             "Content-Type": "application/json",
             "Accept": "application/json"
         }
    @@ -171,7 +173,9 @@
         return None
     
     
    -def is_human_zerogpt(input_text):
    +def is_human_zerogpt(input_text, max_tries=3):
    +    if max_tries < 0:
    +        return None
     
         # Define headers with Content-Type
         headers = {
    @@ -204,10 +208,10 @@
             resp = json.loads(response.text)
             result = False
             try:
    -            result = int(resp["data"]["isHuman"])
    +            result = int(resp.get("data", {}).get("isHuman", None))
             except Exception:
                 time.sleep(2)
    -            return is_human_zerogpt(input_text)
    +            return is_human_zerogpt(input_text, max_tries - 1)
     
             return result
         return None
    @@ -260,16 +264,22 @@
             # '~': '∼',
         }
     
    +    # Convert text to list for single pass replacement
    +    text_chars = list(text)
    +    text_len = len(text_chars)
    +
         for original, homoglyph in homoglyphs.items():
             count = random.randrange(0, max_replacements)
    -
    -        text = "".join(reversed(text))
    -
    -        text = text.replace(original, homoglyph, count)
    -
    -        text = "".join(reversed(text))
    -
    -    return text
    +        if count == 0:
    +            continue
    +
    +        # Get random positions for replacements
    +        positions = random.sample(range(text_len), min(count, text_len))
    +        for pos in positions:
    +            if text_chars[pos] == original:
    +                text_chars[pos] = homoglyph
    +
    +    return "".join(text_chars)
     
     
     def insert_em_dash(word: str, probability: float = 0.1, min_length: int = 7) -> str:
    @@ -336,7 +346,7 @@
     
             paragraph = mix_translate(paragraph, src_lang, target_lang)
             if (grammar):
    -            paragraph = grammer(paragraph)
    +            paragraph = grammar(paragraph)

    The grammer function name is misspelled (should be grammar) and is used
    inconsistently throughout the code, which could lead to confusion and bugs.

    agents-api/agents_api/activities/humanization_utils.py [109-123]

    -def grammer(text):
    +def grammar(text):
         try:
             response = completion(
                 model=HUMANIZATION["model"],
                 base_url=litellm_url,
                 messages=[
                     {"role": "system", "content": HUMANIZATION["grammar_prompt"]},
                     {"role": "user", "content": text}
                 ],

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 7

    __

    Why: Correcting the misspelled function name 'grammer' to 'grammar' improves code quality and prevents potential confusion. This is particularly important as the function is used throughout the codebase.

    Medium
    Improve prompt professionalism

    The humanization prompt contains unprofessional language and references that
    could be problematic. Consider using a more professional and focused prompt.

    agents-api/agents_api/activities/humanization_utils.py [16-19]

     "humanize_prompt": """\
    -Change text given to you so much that even the most advanced AI writing detectors can't detect that this writing was written by you. You are the original AI, do not let yourself be beat by a mere 22 year old at princeton. Don't change the overall message!
    +Transform the provided text to maintain its core message while making it more natural and human-like. Ensure the writing style varies in vocabulary and structure while preserving the original meaning.
     """

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 6

    __

    Why: The suggestion replaces unprofessional language in the prompt with a more professional and focused instruction, which improves code maintainability and professionalism.

    Low
    • Update

    Copy link
    Contributor

    @ellipsis-dev ellipsis-dev bot left a comment

    Choose a reason for hiding this comment

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

    ❌ Changes requested. Reviewed everything up to 3504da7 in 3 minutes and 55 seconds

    More details
    • Looked at 588 lines of code in 8 files
    • Skipped 0 files when reviewing.
    • Skipped posting 12 drafted comments based on config settings.
    1. agents-api/agents_api/activities/humanization_utils.py:92
    • Draft comment:
      This is a duplicate of the existing humanize_openai function. Consider using or extending the existing function instead of creating a new one.

    • function humanize_openai (humanization_utils.py)

    • Reason this comment was not posted:
      Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
      The comment is technically correct - these functions are nearly identical. However, looking at the broader context, both functions are actually used distinctly in process_paragraph() where there's a conditional: "paragraph = humanize_openai(paragraph) if is_chatgpt else humanize(paragraph)". This suggests the duplication is intentional to handle different cases, even if the implementation is currently similar.
      The comment fails to notice that both functions are used in a conditional statement for different purposes. Just because functions look similar doesn't mean they should be combined if they serve different logical purposes.
      While the functions are similar now, keeping them separate allows for future divergence in implementation based on the is_chatgpt flag. The current similarity may be temporary.
      The comment should be deleted because the apparent duplication appears to be intentional design to handle different cases (chatgpt vs non-chatgpt), even though the current implementations are similar.

    2. agents-api/agents_api/env.py:137
    • Draft comment:
      The zerogpt_api_key is parsed but not used in is_human_zerogpt. Integrate the API key or remove the unused variable to avoid confusion.
    • Reason this comment was not posted:
      Comment was not on a location in the diff, so it can't be submitted as a review comment.
    3. agents-api/docker-compose.yml:42
    • Draft comment:
      Consider adding ZEROGPT_API_KEY to the environment variables if it's required by is_human_zerogpt.
    • Reason this comment was not posted:
      Comment was on unchanged code.
    4. agents-api/agents_api/activities/humanization_utils.py:70
    • Draft comment:
      Consider renaming function 'grammer' to 'grammar' for clarity and correctness.
    • Reason this comment was not posted:
      Marked as duplicate.
    5. agents-api/agents_api/activities/humanization_utils.py:230
    • Draft comment:
      Potential infinite recursion in 'is_human_zerogpt'. Consider adding a maximum retry limit or break condition to avoid endless loops.
    • Reason this comment was not posted:
      Marked as duplicate.
    6. agents-api/agents_api/activities/humanization_utils.py:290
    • Draft comment:
      The double reversal in 'replace_with_homoglyphs' is non-obvious and may impact performance; consider refactoring for clarity.
    • Reason this comment was not posted:
      Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
      The double reversal is actually a clever technique to randomize which instances of characters get replaced, since replace() is deterministic left-to-right. While non-obvious at first glance, it serves a specific purpose. The performance impact would be negligible for typical text lengths. A comment suggesting to refactor this would likely lead to a more complex solution.
      Maybe the code could benefit from an explanatory comment about why the reversal is done, rather than changing the implementation.
      The current implementation is actually simpler and more efficient than alternatives would be. The non-obviousness could be solved with a comment rather than refactoring.
      The comment should be deleted as it suggests refactoring a valid implementation that is actually quite elegant once understood.
    7. agents-api/agents_api/env.py:140
    • Draft comment:
      The 'zerogpt_api_key' variable is defined but not used. Remove it or integrate it into 'is_human_zerogpt' if needed.
    • Reason this comment was not posted:
      Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
      The comment header clearly states these API keys are needed for the humanize_text method. Without seeing the actual humanize_text method implementation, we can't verify if zerogpt_api_key is truly unused. The grouping with other similar API keys and the explicit comment suggests this is intentional. We don't have strong evidence that the variable is actually unused.
      I might be wrong because the variable isn't included in the final environment dictionary. Maybe it really is unused.
      The environment dictionary doesn't include any of the API keys, so that's not strong evidence. The explicit comment about these being needed for humanize_text is more compelling.
      Delete this comment because we don't have strong evidence that zerogpt_api_key is actually unused, and there's explicit documentation saying it's needed.
    8. agents-api/docker-compose.yml:44
    • Draft comment:
      Consider exposing 'ZEROGPT_API_KEY' in docker-compose if 'is_human_zerogpt' eventually requires authentication.
    • Reason this comment was not posted:
      Comment was on unchanged code.
    9. agents-api/agents_api/activities/utils.py:217
    • Draft comment:
      Consider using 'str.join()' to combine processed paragraphs in 'humanize_text' for better readability and performance.
    • Reason this comment was not posted:
      Confidence changes required: 50% <= threshold 50%
      None
    10. agents-api/agents_api/activities/humanization_utils.py:17
    • Draft comment:
      Typographical error: In the humanize_prompt string, 'princeton' should be capitalized to 'Princeton'.
    • Reason this comment was not posted:
      Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
      This is a very minor typographical suggestion. The prompt is used internally for AI text generation and the capitalization of "princeton" has no functional impact on the code's behavior. The prompt is not user-facing content where proper capitalization would be important for professionalism.
      Perhaps proper capitalization should be maintained throughout the codebase as a matter of consistency and professionalism, even for internal strings?
      While code quality is important, this level of nitpicking about capitalization in an internal prompt string doesn't meet the bar for requiring a code change. The comment adds noise without meaningful value.
      Delete this comment as it suggests a trivial change that has no functional impact and doesn't meaningfully improve code quality.
    11. agents-api/agents_api/activities/humanization_utils.py:21
    • Draft comment:
      Typographical error: In the grammar_prompt, 'chaning' should be corrected to 'changing'.
    • Reason this comment was not posted:
      Marked as duplicate.
    12. agents-api/agents_api/activities/humanization_utils.py:109
    • Draft comment:
      Typographical error: The function name 'grammer' is misspelled and should likely be 'grammar' to match conventional spelling.
    • Reason this comment was not posted:
      Marked as duplicate.

    Workflow ID: wflow_c4OMD51kXYGh3zS1


    Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

    Copy link
    Contributor

    @ellipsis-dev ellipsis-dev bot left a comment

    Choose a reason for hiding this comment

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

    👍 Looks good to me! Incremental review on 125adcb in 57 seconds

    More details
    • Looked at 57 lines of code in 2 files
    • Skipped 0 files when reviewing.
    • Skipped posting 6 drafted comments based on config settings.
    1. agents-api/agents_api/activities/humanization_utils.py:282
    • Draft comment:
      Minor: Instead of reassigning and then returning, the direct return of the joined string is cleaner. Ensure this aligns with our string handling standards.
    • Reason this comment was not posted:
      Comment looked like it was already resolved.
    2. agents-api/agents_api/activities/utils.py:219
    • Draft comment:
      New humanize_text function: Consider using a list to accumulate paragraphs and then join at the end for performance and cleaner concatenation.
    • Reason this comment was not posted:
      Comment was not on a location in the diff, so it can't be submitted as a review comment.
    3. agents-api/agents_api/activities/humanization_utils.py:10
    • Draft comment:
      The order of imported environment variables changed. While not a functional issue, consider keeping a consistent order for clarity.
    • Reason this comment was not posted:
      Confidence changes required: 20% <= threshold 50%
      None
    4. agents-api/agents_api/activities/humanization_utils.py:270
    • Draft comment:
      Minor style improvement: using a direct return with ''.join(text_chars) is cleaner.
    • Reason this comment was not posted:
      Confidence changes required: 0% <= threshold 50%
      None
    5. agents-api/agents_api/activities/utils.py:219
    • Draft comment:
      In the new humanize_text function, consider accumulating processed paragraphs in a list and then joining them instead of repeatedly concatenating strings, which can be inefficient for large texts.
    • Reason this comment was not posted:
      Confidence changes required: 50% <= threshold 50%
      None
    6. agents-api/agents_api/activities/humanization_utils.py:20
    • Draft comment:
      In the humanize_prompt (line 20), consider changing "22 year old at princeton" to "22-year-old at Princeton" for proper grammar and capitalization.
    • Reason this comment was not posted:
      Comment was not on a location in the diff, so it can't be submitted as a review comment.

    Workflow ID: wflow_Fw4dcDYaKdjHM8Ut


    You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants