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

chore(agents-api): linters checks and upgraded package versions #1203

Merged
merged 14 commits into from
Mar 3, 2025

Conversation

Vedantsahai18
Copy link
Member

@Vedantsahai18 Vedantsahai18 commented Mar 2, 2025

User description


EntelligenceAI PR Summary

This update introduces minor modifications by adding trailing commas to enhance code readability and maintain consistency across various files. These changes do not affect the functionality of the code.


PR Type

Enhancement, Tests, Formatting, Documentation, Configuration changes, Dependencies


Description

  • Refactored multiple modules across the codebase to improve readability, maintainability, and consistency by adding trailing commas, reformatting multiline arguments, and enhancing logic.

  • Enhanced recall options and MMR logic in session models, queries, and workflows to handle edge cases and improve functionality.

  • Updated and added test cases to align with new formatting standards and improve test coverage for various modules.

  • Improved documentation for session recall options and hybrid search parameters.

  • Updated JSON schemas for agent and task creation, removing outdated references and improving definitions.

  • Updated dependencies across multiple pyproject.toml files for flexibility and consistency.

  • Adjusted configuration files, including Ruff and environment variable settings, for better maintainability.


Changes walkthrough 📝

Relevant files
Enhancement
35 files
sync.py
Refactor sync logic and improve argument formatting.         

cli/src/julep_cli/sync.py

  • Added trailing commas to function calls for consistency.
  • Improved readability by reformatting multiline function arguments.
  • Enhanced error messages with better formatting.
  • Adjusted logic for handling YAML changes in watch mode.
  • +103/-78
    gather_messages.py
    Refactor gather_messages recall logic and MMR handling.   

    agents-api/agents_api/queries/chat/gather_messages.py

  • Refactored recall logic to improve readability and maintainability.
  • Simplified handling of recall options and search parameters.
  • Enhanced MMR logic to handle edge cases with fewer embeddings.
  • +87/-100
    Sessions.py
    Enhance recall options in session models.                               

    agents-api/agents_api/autogen/Sessions.py

  • Updated recall options to support multiple search modes.
  • Changed alpha default value for hybrid mode.
  • Improved type annotations for recall options.
  • +15/-13 
    agents.py
    Refactor agent CLI commands for readability.                         

    cli/src/julep_cli/agents.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved error messages and progress bar descriptions.
  • +32/-16 
    browserbase.py
    Refactor Browserbase models for readability.                         

    integrations-service/integrations/models/browserbase.py

  • Reformatted field definitions for better readability.
  • Added trailing commas to field descriptions.
  • Improved consistency in model definitions.
  • +26/-13 
    Sessions.py
    Enhance recall options in session models.                               

    integrations-service/integrations/autogen/Sessions.py

  • Updated recall options to support multiple search modes.
  • Changed alpha default value for hybrid mode.
  • Improved type annotations for recall options.
  • +15/-13 
    __init__.py
    Refactor task execution workflow for consistency.               

    agents-api/agents_api/workflows/task_execution/init.py

  • Added trailing commas to function calls for consistency.
  • Improved readability by reformatting multiline function arguments.
  • Enhanced logging messages with better formatting.
  • +12/-12 
    tasks.py
    Refactor task CLI commands for readability.                           

    cli/src/julep_cli/tasks.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved error messages and progress bar descriptions.
  • +31/-13 
    browserbase.py
    Refactor Browserbase integration utilities.                           

    integrations-service/integrations/utils/integrations/browserbase.py

  • Reformatted function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved error handling in session management functions.
  • +21/-9   
    utils.py
    Refactor CLI utilities for consistency.                                   

    cli/src/julep_cli/utils.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved utility functions for lock file management.
  • +24/-8   
    helpers.py
    Refactor task execution helpers for readability.                 

    agents-api/agents_api/workflows/task_execution/helpers.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved helper functions for workflow execution.
  • +23/-9   
    search_docs.py
    Refactor document search logic and MMR handling.                 

    agents-api/agents_api/routers/docs/search_docs.py

  • Enhanced MMR logic to handle edge cases with fewer embeddings.
  • Improved readability of search logic.
  • Refactored filtering of documents with embeddings.
  • +26/-15 
    logs.py
    Refactor CLI log display for consistency.                               

    cli/src/julep_cli/logs.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved log fetching and display logic.
  • +13/-8   
    importt.py
    Refactor import CLI command for readability.                         

    cli/src/julep_cli/importt.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved error messages and progress bar descriptions.
  • +11/-9   
    tools.py
    Refactor tool CLI commands for readability.                           

    cli/src/julep_cli/tools.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved error messages and progress bar descriptions.
  • +20/-8   
    db_exceptions.py
    Refactor database exception handling.                                       

    agents-api/agents_api/common/utils/db_exceptions.py

  • Added trailing commas to function calls for consistency.
  • Improved readability of exception handling logic.
  • +5/-5     
    remote_browser.py
    Refactor remote browser integration utilities.                     

    integrations-service/integrations/utils/integrations/remote_browser.py

  • Reformatted function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved initialization logic for Playwright actions.
  • +8/-4     
    litellm.py
    Refactor LiteLLM client for readability.                                 

    agents-api/agents_api/clients/litellm.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved API request handling logic.
  • +7/-2     
    tasks.py
    Refactor task protocol for consistency.                                   

    agents-api/agents_api/common/protocol/tasks.py

  • Added trailing commas to function calls for consistency.
  • Improved readability of task tool handling logic.
  • +4/-2     
    interceptors.py
    Refactor interceptors for workflows and activities.           

    agents-api/agents_api/common/interceptors.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved interceptor logic for workflows and activities.
  • +6/-3     
    list_executions.py
    Refactor execution listing query for consistency.               

    agents-api/agents_api/queries/executions/list_executions.py

  • Added trailing commas to function calls for consistency.
  • Improved readability of exception handling logic.
  • +6/-2     
    humanization_utils.py
    Refactor humanization utilities for consistency.                 

    agents-api/agents_api/activities/humanization_utils.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved utility functions for humanization tasks.
  • +5/-2     
    cloudinary.py
    Refactor Cloudinary integration utilities.                             

    integrations-service/integrations/utils/integrations/cloudinary.py

  • Reformatted function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved media upload and edit logic.
  • +6/-3     
    codec.py
    Refactor worker codec for consistency.                                     

    agents-api/agents_api/worker/codec.py

  • Added trailing commas to function calls for consistency.
  • Improved logging for serialization and deserialization.
  • +2/-2     
    chat.py
    Refactor chat session router for consistency.                       

    agents-api/agents_api/routers/sessions/chat.py

  • Added trailing commas to function calls for consistency.
  • Improved readability of chat session handling logic.
  • +5/-3     
    cloudinary.py
    Refactor Cloudinary models for readability.                           

    integrations-service/integrations/models/cloudinary.py

  • Reformatted field definitions for better readability.
  • Added trailing commas to field descriptions.
  • Improved consistency in model definitions.
  • +6/-3     
    utils.py
    Refactor activity utilities for consistency.                         

    agents-api/agents_api/activities/utils.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved utility functions for activity handling.
  • +3/-2     
    temporal.py
    Refactor Temporal client for consistency.                               

    agents-api/agents_api/clients/temporal.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved Temporal client configuration logic.
  • +4/-2     
    list_sessions.py
    Enhanced session listing with transformation logic.           

    agents-api/agents_api/queries/sessions/list_sessions.py

    • Added a transform lambda to the @wrap_in_class decorator.
    +6/-1     
    get_session.py
    Enhanced session retrieval with transformation logic.       

    agents-api/agents_api/queries/sessions/get_session.py

    • Added a transform lambda to the @wrap_in_class decorator.
    +7/-1     
    sessions.py
    Enhanced type annotations in session protocol.                     

    agents-api/agents_api/common/protocol/sessions.py

    • Updated type annotations for data parameter in make_session.
    +1/-1     
    create_agent_request.json
    Updated JSON schema for agent creation.                                   

    schemas/create_agent_request.json

  • Updated schema definitions for Message and Tools.
  • Removed VectorDocSearch and TextOnlyDocSearch references.
  • +230/-246
    create_task_request.json
    Updated JSON schema for task creation.                                     

    schemas/create_task_request.json

  • Updated schema definitions for Message and Tools.
  • Removed VectorDocSearch and TextOnlyDocSearch references.
  • +230/-246
    openapi-1.0.0.yaml
    Enhanced OpenAPI schema for session recall options.           

    typespec/tsp-output/@typespec/openapi3/openapi-1.0.0.yaml

  • Updated recall_options schema to use anyOf.
  • Adjusted default values for hybrid search parameters.
  • +29/-12 
    models.tsp
    Improved TypeSpec models for session recall options.         

    typespec/sessions/models.tsp

  • Updated mode properties to use literal types.
  • Adjusted default values for hybrid search parameters.
  • +7/-7     
    Tests
    7 files
    test_task_execution_workflow.py
    Update task execution workflow tests for consistency.       

    agents-api/tests/test_task_execution_workflow.py

  • Added trailing commas to function calls for consistency.
  • Improved readability by reformatting multiline function arguments.
  • Updated test cases to align with new formatting standards.
  • +39/-39 
    test_prepare_for_step.py
    Improve readability in test_prepare_for_step.                       

    agents-api/tests/test_prepare_for_step.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Updated test cases to align with new formatting standards.
  • +61/-19 
    test_chat_routes.py
    Add tests for recall options in chat routes.                         

    agents-api/tests/test_chat_routes.py

  • Added new test cases to validate recall options for different modes.
  • Improved test structure for session creation and recall validation.
  • Enhanced test coverage for hybrid, text, and vector modes.
  • +173/-9 
    test_base_evaluate.py
    Improve readability in test_base_evaluate.                             

    agents-api/tests/test_base_evaluate.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Updated test cases to align with new formatting standards.
  • +26/-7   
    test_workflow_helpers.py
    Improve readability in test_workflow_helpers.                       

    agents-api/tests/test_workflow_helpers.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Updated test cases to align with new formatting standards.
  • +14/-5   
    utils.py
    Refactor test utilities for consistency.                                 

    agents-api/tests/utils.py

  • Reformatted multiline function arguments for better readability.
  • Added trailing commas to function calls for consistency.
  • Improved utility functions for testing.
  • +7/-5     
    test_execution_workflow.py
    Update execution workflow tests for consistency.                 

    agents-api/tests/test_execution_workflow.py

  • Added trailing commas to function calls for consistency.
  • Improved readability by reformatting multiline function arguments.
  • Updated test cases to align with new formatting standards.
  • +6/-6     
    Configuration changes
    2 files
    env.py
    Refactor environment variable configurations.                       

    agents-api/agents_api/env.py

  • Reformatted multiline environment variable definitions.
  • Added trailing commas for consistency.
  • Improved readability of configuration settings.
  • +15/-10 
    ruff.toml
    Updated Ruff configuration for ignored rules.                       

    ruff.toml

    • Added UP046 to ignored rules.
    • Removed unused configuration.
    +1/-1     
    Formatting
    62 files
    chat.py
    Improved formatting and consistency in CLI chat module.   

    cli/src/julep_cli/chat.py

  • Added trailing commas to function parameters for consistency.
  • Adjusted formatting of Panel and Text calls for better readability.
  • +5/-4     
    test_docs_queries.py
    Improved formatting in test functions for documentation queries.

    agents-api/tests/test_docs_queries.py

    • Added trailing commas to function parameters for consistency.
    +8/-2     
    entities.py
    Improved formatting in entity prompt generation.                 

    agents-api/agents_api/rec_sum/entities.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    models.py
    Improved formatting in protocol model functions.                 

    agents-api/agents_api/common/protocol/models.py

    • Added trailing commas to function parameters for consistency.
    +4/-2     
    llama_parse.py
    Improved formatting in LlamaParse integration utility.     

    integrations-service/integrations/utils/integrations/llama_parse.py

    • Added trailing commas to function parameters for consistency.
    +4/-2     
    delete_file.py
    Improved formatting in file deletion router.                         

    agents-api/agents_api/routers/files/delete_file.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    execute_integration.py
    Improved formatting in integration execution utility.       

    integrations-service/integrations/utils/execute_integration.py

    • Added trailing commas to function parameters for consistency.
    +4/-2     
    mmr.py
    Improved formatting in MMR query logic.                                   

    agents-api/agents_api/queries/docs/mmr.py

    • Added trailing commas to logging message for consistency.
    +1/-1     
    execute.py
    Improved formatting in execution router.                                 

    integrations-service/integrations/routers/execution/execute.py

    • Added trailing commas to function parameters for consistency.
    +7/-2     
    delete_agent.py
    Improved formatting in agent deletion router.                       

    agents-api/agents_api/routers/agents/delete_agent.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    transition.py
    Improved formatting in task execution transition workflow.

    agents-api/agents_api/workflows/task_execution/transition.py

    • Added trailing commas to function parameters for consistency.
    +4/-2     
    patch_tool.py
    Improved formatting in tool patch query.                                 

    agents-api/agents_api/queries/tools/patch_tool.py

    • Added trailing commas to function parameters for consistency.
    +5/-1     
    create_or_update_agent.py
    Improved formatting in agent creation or update query.     

    agents-api/agents_api/queries/agents/create_or_update_agent.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    generate_changelog.py
    Improved formatting in changelog generation script.           

    scripts/generate_changelog.py

    • Added trailing commas to function parameters for consistency.
    +5/-2     
    list_execution_transitions.py
    Improved formatting in execution transitions query.           

    agents-api/agents_api/queries/executions/list_execution_transitions.py

    • Added trailing commas to exception handling logic for consistency.
    +6/-2     
    nlp.py
    Improved formatting in NLP utility functions.                       

    agents-api/agents_api/common/nlp.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    get_user.py
    Improved formatting in user retrieval query.                         

    agents-api/agents_api/queries/users/get_user.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    json.py
    Improved formatting in JSON utility functions.                     

    agents-api/agents_api/common/utils/json.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    update_agent.py
    Improved formatting in agent update query.                             

    agents-api/agents_api/queries/agents/update_agent.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    test_task_routes.py
    Improved formatting in task routes test cases.                     

    agents-api/tests/test_task_routes.py

    • Added trailing commas to dictionary definitions for consistency.
    +3/-3     
    list_agents.py
    Improved formatting in agent listing router.                         

    agents-api/agents_api/routers/agents/list_agents.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    patch_user.py
    Improved formatting in user patch query.                                 

    agents-api/agents_api/queries/users/patch_user.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    get_agent.py
    Improved formatting in agent retrieval query.                       

    agents-api/agents_api/queries/agents/get_agent.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    create_or_update_user.py
    Improved formatting in user creation or update query.       

    agents-api/agents_api/queries/users/create_or_update_user.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    get_doc_search.py
    Improved formatting in document search utility.                   

    agents-api/agents_api/common/utils/get_doc_search.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    update_user.py
    Improved formatting in user update query.                               

    agents-api/agents_api/queries/users/update_user.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    transition_step.py
    Improved formatting in task transition step activity.       

    agents-api/agents_api/activities/task_steps/transition_step.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    pg.py
    Improved formatting in PostgreSQL client utility.               

    agents-api/agents_api/clients/pg.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    delete_entries.py
    Improved formatting in entry deletion query.                         

    agents-api/agents_api/queries/entries/delete_entries.py

    • Added trailing commas to function parameters for consistency.
    +4/-1     
    get_file.py
    Improved formatting in file retrieval router.                       

    agents-api/agents_api/routers/files/get_file.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    trim.py
    Improved formatting in message trimming logic.                     

    agents-api/agents_api/rec_sum/trim.py

    • Added trailing commas to JSON parsing logic for consistency.
    +1/-1     
    list_agents.py
    Improved formatting in agent listing query.                           

    agents-api/agents_api/queries/agents/list_agents.py

    • Added trailing commas to query formatting logic for consistency.
    +1/-1     
    list_tasks.py
    Improved formatting in task listing query.                             

    agents-api/agents_api/queries/tasks/list_tasks.py

    • Added trailing commas to query formatting logic for consistency.
    +1/-1     
    list_docs.py
    Improved formatting in document listing router.                   

    agents-api/agents_api/routers/docs/list_docs.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    delete_session.py
    Improved formatting in session deletion router.                   

    agents-api/agents_api/routers/sessions/delete_session.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    delete_user.py
    Improved formatting in user deletion router.                         

    agents-api/agents_api/routers/users/delete_user.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    test_agent_queries.py
    Improved formatting in agent query test cases.                     

    agents-api/tests/test_agent_queries.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    exceptions.py
    Improved formatting in exception definitions.                       

    agents-api/agents_api/exceptions.py

    • Added trailing commas to exception messages for consistency.
    +1/-1     
    prompt_step.py
    Improved formatting in task prompt step activity.               

    agents-api/agents_api/activities/task_steps/prompt_step.py

    • Added trailing commas to dictionary operations for consistency.
    +2/-1     
    get_session_history.py
    Improved formatting in session history retrieval router. 

    agents-api/agents_api/routers/sessions/get_session_history.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    test_get_doc_search.py
    Improved formatting in document search test cases.             

    agents-api/tests/test_get_doc_search.py

    • Added trailing commas to dictionary definitions for consistency.
    +4/-1     
    summarize.py
    Improved formatting in message summarization logic.           

    agents-api/agents_api/rec_sum/summarize.py

    • Added trailing commas to JSON parsing logic for consistency.
    +1/-1     
    get_session.py
    Improved formatting in session retrieval router.                 

    agents-api/agents_api/routers/sessions/get_session.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    exceptions.py
    Improved formatting in session exception definitions.       

    agents-api/agents_api/routers/sessions/exceptions.py

    • Added trailing commas to exception messages for consistency.
    +1/-1     
    ffmpeg.py
    Improved formatting in FFmpeg integration utility.             

    integrations-service/integrations/utils/integrations/ffmpeg.py

    • Added trailing commas to dictionary definitions for consistency.
    +3/-1     
    test_activities_utils.py
    Improved formatting in activity utility test cases.           

    agents-api/tests/test_activities_utils.py

    • Added trailing commas to mock return values for consistency.
    +3/-3     
    app.py
    Improved formatting in application initialization.             

    agents-api/agents_api/app.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    spider.py
    Improved formatting in Spider integration utility.             

    integrations-service/integrations/utils/integrations/spider.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    list_sessions.py
    Improved formatting in session listing router.                     

    agents-api/agents_api/routers/sessions/list_sessions.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    wrapper.py
    Improved formatting in CLI wrapper utility.                           

    cli/src/julep_cli/wrapper.py

    • Added trailing commas to function parameters for consistency.
    +3/-1     
    list_users.py
    Improved formatting in user listing router.                           

    agents-api/agents_api/routers/users/list_users.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    init.py
    Improved formatting in CLI initialization logic.                 

    cli/src/julep_cli/init.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    get_integration_tool.py
    Improved formatting in integration tool retrieval.             

    integrations-service/integrations/routers/integrations/get_integration_tool.py

    • Added trailing commas to function parameters for consistency.
    +2/-1     
    executions.py
    Improved formatting in CLI execution logic.                           

    cli/src/julep_cli/executions.py

    • Added trailing commas to string formatting for consistency.
    +1/-1     
    utils.py
    Improved formatting in query utility functions.                   

    agents-api/agents_api/queries/utils.py

    • Added trailing commas to exception handling logic for consistency.
    +2/-1     
    update_execution.py
    Improved formatting in task execution update router.         

    agents-api/agents_api/routers/tasks/update_execution.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    execute_system.py
    Improved formatting in system execution activity.               

    agents-api/agents_api/activities/execute_system.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    execute_api_call.py
    Improved formatting in API call execution activity.           

    agents-api/agents_api/activities/execute_api_call.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    execute_integration.py
    Improved formatting in integration execution activity.     

    agents-api/agents_api/activities/execute_integration.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    demo.py
    Improved formatting in demo activity.                                       

    agents-api/agents_api/activities/demo.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    render.py
    Improved formatting in session rendering logic.                   

    agents-api/agents_api/routers/sessions/render.py

    • Added trailing commas to function parameters for consistency.
    +1/-1     
    wikipedia.py
    Improved formatting in Wikipedia integration model.           

    integrations-service/integrations/models/wikipedia.py

    • Added trailing commas to dictionary definitions for consistency.
    +2/-1     
    Dependencies
    3 files
    pyproject.toml
    Updated dependencies and cleaned configuration.                   

    agents-api/pyproject.toml

  • Updated dependency versions to use >= for flexibility.
  • Removed commented-out configuration.
  • +39/-43 
    pyproject.toml
    Updated CLI dependencies for flexibility.                               

    cli/pyproject.toml

    • Updated dependency versions to use >= for flexibility.
    +9/-9     
    pyproject.toml
    Updated dependencies and formatting in integrations service.

    integrations-service/pyproject.toml

  • Updated ruff dependency version.
  • Adjusted formatting for consistency.
  • +2/-2     
    Documentation
    2 files
    sessions.mdx
    Improved documentation for session recall options.             

    documentation/docs/concepts/sessions.mdx

  • Updated default values and descriptions for recall options.
  • Clarified behavior when recall_options is not set.
  • +14/-11 
    docs.mdx
    Updated documentation for hybrid search parameters.           

    documentation/docs/concepts/docs.mdx

    • Adjusted default value for alpha in hybrid search.
    +1/-1     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @Vedantsahai18 Vedantsahai18 linked an issue Mar 2, 2025 that may be closed by this pull request
    1 task
    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Mar 2, 2025

    CI Feedback 🧐

    (Feedback updated until commit fd34113)

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

    Action: Lint-And-Format

    Failed stage: Lint and format [❌]

    Failure summary:

    The action failed during the linting process because:

  • The ruff configuration file (ruff.toml) contains an invalid rule selector UP046
  • The error occurred at line 50 in the ruff.toml file where a [lint] section is defined
  • Ruff was unable to parse the configuration file due to this invalid rule

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    360:  �[36;1mcd integrations-service�[0m
    361:  �[36;1muv run poe format�[0m
    362:  �[36;1muv run poe lint�[0m
    363:  shell: /usr/bin/bash -e {0}
    364:  env:
    365:  UV_CACHE_DIR: /home/runner/work/_temp/setup-uv-cache
    366:  ##[endgroup]
    367:  �[37mPoe =>�[0m �[94mruff format�[0m
    368:  ruff failed
    369:  Cause: Failed to parse /home/runner/work/julep/julep/ruff.toml
    370:  Cause: TOML parse error at line 50, column 1
    371:  |
    372:  50 | [lint]
    373:  | ^^^^^^
    374:  Unknown rule selector: `UP046`
    375:  ##[error]Process completed with exit code 2.
    

    Copy link
    Contributor

    Walkthrough

    The PR consists of minor changes, primarily adding trailing commas to function calls and list definitions across multiple files for improved code readability and consistency. No significant impact on functionality.

    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 !
    

    @Vedantsahai18 Vedantsahai18 marked this pull request as ready for review March 2, 2025 07:02
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Refactoring

    The gather_messages function was significantly refactored with new logic for handling recall options and MMR. Verify that the new implementation properly handles edge cases and maintains existing functionality.

    # If recall is disabled, return early
    if not recall:
        return past_messages, []
    
    # Get recall config
    recall_options = chat_context.session.recall_options
    
    # Get messages to search from
    search_messages = [
        msg
        for msg in (past_messages + new_raw_messages)[-(recall_options.num_search_messages) :]
        if isinstance(msg["content"], str) and msg["role"] in ["user", "assistant"]
    ]
    
    if not search_messages:
        return past_messages, []
    
    # Build search text and get embedding if needed
    embed_text = "\n\n".join(
        f"{msg.get('name') or msg['role']}: {msg['content']}" for msg in search_messages
    ).strip()
    
    query_embedding = None
    if recall_options.mode != "text":
        [query_embedding, *_] = await litellm.aembedding(
            inputs=embed_text[-(recall_options.max_query_length) :],
            embed_instruction="Represent the query for retrieving supporting documents: ",
        )
    
    # Get query text from last message
    query_text = search_messages[-1]["content"].strip()[: recall_options.max_query_length]
    
    # Get owners to search docs from
    active_agent_id = chat_context.get_active_agent().id
    owners = [("user", user.id) for user in chat_context.users]
    owners.append(("agent", active_agent_id))
    
    # Build search params based on mode
    search_params = None
    if recall_options.mode == "vector":
        search_params = VectorDocSearchRequest(
            lang=recall_options.lang,
            limit=recall_options.limit,
            metadata_filter=recall_options.metadata_filter,
            confidence=recall_options.confidence,
            mmr_strength=recall_options.mmr_strength,
            vector=query_embedding,
        )
    elif recall_options.mode == "hybrid":
        search_params = HybridDocSearchRequest(
            lang=recall_options.lang,
            limit=recall_options.limit,
            metadata_filter=recall_options.metadata_filter,
            confidence=recall_options.confidence,
            mmr_strength=recall_options.mmr_strength,
            alpha=recall_options.alpha,
            text=query_text,
            vector=query_embedding,
        )
    elif recall_options.mode == "text":
        search_params = TextOnlyDocSearchRequest(
            lang=recall_options.lang,
            limit=recall_options.limit,
            metadata_filter=recall_options.metadata_filter,
            text=query_text,
        )
    else:
        # Invalid mode, return early
        return past_messages, []
    
    # Execute search
    search_fn, params = get_search_fn_and_params(search_params)
    doc_references: list[DocReference] = await search_fn(
        developer_id=developer.id,
        owners=owners,
        connection_pool=connection_pool,
        **params,
    )
    
    # Apply MMR if enabled and applicable
    if (
        recall_options.mmr_strength > 0
        and len(doc_references) > recall_options.limit
        and recall_options.mode != "text"
    ):
        # Filter docs with embeddings
        docs_with_embeddings = [
            doc for doc in doc_references if doc.snippet.embedding is not None
        ]
    
        if len(docs_with_embeddings) >= 2:
            # Apply MMR
            indices = maximal_marginal_relevance(
                np.asarray(query_embedding),
                [doc.snippet.embedding for doc in docs_with_embeddings],
                k=min(recall_options.limit, len(docs_with_embeddings)),
                lambda_mult=1 - recall_options.mmr_strength,
            )
            doc_references = [
                doc for i, doc in enumerate(docs_with_embeddings) if i in set(indices)
            ]
    API Changes

    Major changes to session recall options types and defaults. Verify that these changes are backwards compatible and properly validated.

        recall_options: VectorDocSearch | TextOnlyDocSearch | HybridDocSearch | None = None
        """
        Recall options for the session
        """
        metadata: dict[str, Any] | None = None
    
    
    class HybridDocSearch(BaseDocSearch):
        model_config = ConfigDict(
            populate_by_name=True,
        )
        mode: Literal["hybrid"] = "hybrid"
        """
        The mode to use for the search.
        """
        confidence: Annotated[float, Field(ge=-1.0, le=1.0)] = 0
        """
        The confidence cutoff level
        """
        alpha: Annotated[float, Field(ge=0.0, le=1.0)] = 0.5
        """
        The weight to apply to BM25 vs Vector search results. 0 => pure BM25; 1 => pure vector;
        """
        mmr_strength: Annotated[float, Field(ge=0.0, lt=1.0)] = 0.5
        """
        MMR Strength (mmr_strength = 1 - mmr_lambda)
        """
    
    
    class HybridDocSearchUpdate(BaseDocSearchUpdate):
        model_config = ConfigDict(
            populate_by_name=True,
        )
        mode: Literal["hybrid"] = "hybrid"
        """
        The mode to use for the search.
        """
        confidence: Annotated[float, Field(ge=-1.0, le=1.0)] = 0
        """
        The confidence cutoff level
        """
        alpha: Annotated[float, Field(ge=0.0, le=1.0)] = 0.5
        """
        The weight to apply to BM25 vs Vector search results. 0 => pure BM25; 1 => pure vector;
        """

    Copy link
    Contributor

    ellipsis-dev bot commented Mar 2, 2025

    ⚠️ This PR is too big for Ellipsis, but support for larger PRs is coming soon. If you want us to prioritize this feature, let us know at [email protected]


    Generated with ❤️ by ellipsis.dev

    Copy link
    Contributor

    qodo-merge-pro-for-open-source bot commented Mar 2, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Add error handling for embeddings

    Add error handling for empty or invalid query_embedding when using vector or
    hybrid search modes. Currently, if litellm.aembedding() fails, the code will
    crash without graceful fallback.

    agents-api/agents_api/queries/chat/gather_messages.py [96-100]

     if recall_options.mode != "text":
    -    [query_embedding, *_] = await litellm.aembedding(
    -        inputs=embed_text[-(recall_options.max_query_length) :],
    -        embed_instruction="Represent the query for retrieving supporting documents: ",
    -    )
    +    try:
    +        [query_embedding, *_] = await litellm.aembedding(
    +            inputs=embed_text[-(recall_options.max_query_length) :],
    +            embed_instruction="Represent the query for retrieving supporting documents: ",
    +        )
    +    except Exception as e:
    +        logger.error(f"Failed to generate embedding: {e}")
    +        return past_messages, []
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    __

    Why: The suggestion adds critical error handling for the embedding generation process, which could fail due to API issues or invalid inputs. Without this, the application would crash instead of gracefully handling the error.

    Medium
    Review hybrid search weight change

    The default alpha value for hybrid search mode was changed from 0.75 to 0.5
    without clear justification. This could significantly impact search behavior.
    Consider documenting the rationale for this change or reverting if
    unintentional.

    integrations-service/integrations/autogen/Sessions.py [111]

    -alpha: Annotated[float, Field(ge=0.0, le=1.0)] = 0.5
    +alpha: Annotated[float, Field(ge=0.0, le=1.0)] = 0.75  # Default weight favors vector search for better semantic matching

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 8

    __

    Why: Changing the default alpha value from 0.75 to 0.5 could significantly impact search behavior by giving equal weight to BM25 and vector search instead of favoring vector search. This change requires careful review.

    Medium
    Validate search messages content

    Add validation for empty or whitespace-only search_messages content before
    generating embeddings to prevent potential issues with empty inputs.

    agents-api/agents_api/queries/chat/gather_messages.py [91-93]

     embed_text = "\n\n".join(
         f"{msg.get('name') or msg['role']}: {msg['content']}" for msg in search_messages
    +    if msg['content'].strip()
     ).strip()
    +if not embed_text:
    +    return past_messages, []
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion adds important validation to prevent issues with empty or whitespace-only message content, which could cause problems in the embedding generation process. This improves robustness and prevents potential runtime errors.

    Medium
    General
    Remove duplicate error handling code

    Remove duplicate error handling code for watch and force_remote check. The same
    check and error message is repeated twice unnecessarily.

    cli/src/julep_cli/sync.py [103-116]

    -# if watch is true and force_remote is true, we raise an error
    -if watch and force_remote:
    -    error_console.print(
    -        Text("Error: Cannot use both --watch and --force-remote", style="bold red"),
    -    )
    -    raise typer.Exit(1)
    -
     # When watch mode is enabled, force a local sync and disable remote forcing.
     if watch:
         if force_remote:
             error_console.print(
                 Text("Error: Cannot use both --watch and --force-remote", style="bold red"),
             )
             raise typer.Exit(1)
    +    console.print(
    +        Text(
    +            "Watch mode enabled. Forcing local sync and disabling force_remote.",
    +            style="bold green",
    +        ),
    +    )
    +    force_local = True
    +    force_remote = False

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies and removes redundant error handling code that checks for the same condition twice. This improves code maintainability and reduces duplication.

    Medium
    Replace lambda with proper function

    The lambda function definition uses a noqa comment to suppress E731
    (lambda-assignment). Instead of suppressing the warning, refactor this into a
    proper function definition for better readability and maintainability.

    agents-api/agents_api/workflows/task_execution/helpers.py [85-89]

    -run = lambda *args, **kwargs: workflow.execute_child_workflow(  # noqa: E731
    -    info.workflow_type,
    -    *args,
    -    **kwargs,
    -)
    +def run(*args, **kwargs):
    +    return workflow.execute_child_workflow(
    +        info.workflow_type,
    +        *args,
    +        **kwargs,
    +    )

    [To ensure code accuracy, apply this suggestion manually]

    Suggestion importance[1-10]: 5

    __

    Why: Converting the lambda to a proper function would improve code readability and maintainability, though the functional impact is minimal since both approaches work equivalently.

    Low
    • Update

    @creatorrr
    Copy link
    Contributor

    @whiterabbit1983 there are basically 3 files to review here (the rest are autogenerated):
    // in increasing order of complexity

    • agents-api/tests/test_chat_routes.py
    • agents-api/agents_api/routers/docs/search_docs.py
    • agents-api/agents_api/queries/chat/gather_messages.py

    Co-authored-by: entelligence-ai-pr-reviews[bot] <174136889+entelligence-ai-pr-reviews[bot]@users.noreply.github.com>
    @Vedantsahai18 Vedantsahai18 merged commit e849e5c into dev Mar 3, 2025
    17 checks passed
    @Vedantsahai18 Vedantsahai18 deleted the x/version-updates branch March 3, 2025 08:09
    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.

    [Bug]: julep-cli depends on old versions of beartype and environs
    4 participants