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: fixed encoders docs to use semantic router v 0.1.0 #504

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Joshua-Briggs
Copy link
Member

@Joshua-Briggs Joshua-Briggs commented Jan 7, 2025

User description

Note:

  • Bedrock cannot update as we do not have a API key available to update it.
  • Transformers cannot update as I cannot pull the [local] library reference

PR Type

Documentation, Enhancement


Description

  • Updated semantic-router version to 0.1.0 across encoder documentation.

  • Replaced RouteLayer with SemanticRouter for route handling.

  • Enhanced examples with updated outputs and execution details.

  • Standardized Python version to 3.12.7 in all notebooks.


Changes walkthrough 📝

Relevant files
Documentation
fastembed.ipynb
Updated FastEmbed encoder documentation for semantic-router v0.1.0

docs/encoders/fastembed.ipynb

  • Updated semantic-router version to 0.1.0.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted example outputs and execution counts.
  • Standardized Python version to 3.12.7.
  • +32/-20 
    google.ipynb
    Updated Google encoder documentation for semantic-router v0.1.0

    docs/encoders/google.ipynb

  • Replaced RouteLayer with SemanticRouter.
  • Updated execution counts for examples.
  • Standardized Python version to 3.12.7.
  • +5/-5     
    huggingface-endpoint.ipynb
    Updated HuggingFace endpoint encoder documentation for semantic-router
    v0.1.0

    docs/encoders/huggingface-endpoint.ipynb

  • Updated semantic-router version to 0.1.0.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted example outputs and execution counts.
  • Standardized Python version to 3.12.7.
  • +5/-14   
    huggingface.ipynb
    Updated HuggingFace encoder documentation for semantic-router v0.1.0

    docs/encoders/huggingface.ipynb

  • Updated semantic-router version to 0.1.0.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted example outputs and execution counts.
  • Standardized Python version to 3.12.7.
  • +4/-4     
    openai-embed-3.ipynb
    Updated OpenAI Embed-3 encoder documentation for semantic-router
    v0.1.0

    docs/encoders/openai-embed-3.ipynb

  • Updated semantic-router version to 0.1.0.
  • Replaced RouteLayer with SemanticRouter.
  • Adjusted example outputs and execution counts.
  • Standardized Python version to 3.12.7.
  • +47/-32 

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    github-actions bot commented Jan 7, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Possible Warning Handling

    The updated outputs include warnings related to symlink support and local index configuration. Ensure these warnings are either addressed or documented to avoid confusion for users.

    "execution_count": 4,
    "metadata": {},
    "outputs": [
     {
      "name": "stderr",
      "output_type": "stream",
      "text": [
       "Fetching 5 files:   0%|          | 0/5 [00:00<?, ?it/s]c:\\Users\\Joshu\\OneDrive\\Documents\\Aurelio\\agents-course\\07-pratical-ai\\.venv\\Lib\\site-packages\\huggingface_hub\\file_download.py:140: UserWarning: `huggingface_hub` cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\\Users\\Joshu\\AppData\\Local\\Temp\\fastembed_cache\\models--qdrant--bge-small-en-v1.5-onnx-q. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the `HF_HUB_DISABLE_SYMLINKS_WARNING` environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.\n",
       "To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development\n",
       "  warnings.warn(message)\n",
       "Fetching 5 files: 100%|██████████| 5/5 [00:06<00:00,  1.33s/it]\n"
      ]
     }
    
    HTTP Request Logging

    The new outputs include detailed HTTP request logs. Verify if this level of logging is necessary or if it should be adjusted to avoid excessive verbosity in user-facing examples.

    "execution_count": 5,
    "metadata": {},
    "outputs": [
     {
      "name": "stderr",
      "output_type": "stream",
      "text": [
       "2025-01-07 12:31:20 - semantic_router.utils.logger - WARNING - base.py:356 - _get_index() - No index provided. Using default LocalIndex.\n",
       "2025-01-07 12:31:20 - httpx - INFO - _client.py:1025 - _send_single_request() - HTTP Request: POST https://api.openai.com/v1/embeddings \"HTTP/1.1 200 OK\"\n",
       "2025-01-07 12:31:21 - httpx - INFO - _client.py:1025 - _send_single_request() - HTTP Request: POST https://api.openai.com/v1/embeddings \"HTTP/1.1 200 OK\"\n",
       "2025-01-07 12:31:21 - semantic_router.utils.logger - WARNING - local.py:148 - _write_config() - No config is written for LocalIndex.\n"
      ]
    

    Copy link

    github-actions bot commented Jan 7, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Add error handling for API requests to manage potential failures or rate limits

    Add error handling for HTTP requests made to the OpenAI API to gracefully manage
    potential failures or rate-limiting issues.

    docs/encoders/openai-embed-3.ipynb [215]

    -rl("don't you love politics?")
    +try:
    +    rl("don't you love politics?")
    +except Exception as e:
    +    print(f"Error: {e}")
    Suggestion importance[1-10]: 8

    Why: Adding error handling for API requests is a significant improvement to ensure the code can gracefully handle failures or rate-limiting issues. This enhances the reliability and robustness of the code.

    8
    General
    Ensure compatibility of the updated semantic-router version with other dependencies

    Verify that the updated version of semantic-router (0.1.0) is compatible with all
    other dependencies in the environment to prevent runtime errors or conflicts.

    docs/encoders/huggingface-endpoint.ipynb [44]

    -!pip install -qU "semantic-router==0.1.0"
    +!pip install -qU "semantic-router==0.1.0" && pip check
    Suggestion importance[1-10]: 7

    Why: Adding a pip check command to verify dependency compatibility is a good practice to prevent runtime errors or conflicts. This suggestion is actionable and improves the robustness of the environment setup.

    7
    Remove or review the auto_sync="local" parameter to avoid potential issues in distributed or production setups

    Ensure that the auto_sync="local" parameter in the SemanticRouter initialization is
    appropriate for the intended use case, as it may lead to unintended behavior or data
    synchronization issues in distributed or production environments.

    docs/encoders/fastembed.ipynb [168]

    -rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync="local")
    +rl = SemanticRouter(encoder=encoder, routes=routes)
    Suggestion importance[1-10]: 6

    Why: The suggestion to review or remove the auto_sync="local" parameter is valid as it may not be suitable for all environments, especially distributed or production setups. However, it is not a critical issue and depends on the intended use case, so the score reflects moderate importance.

    6
    Review the use of auto_sync="local" to ensure it matches the intended application context

    Confirm that the auto_sync="local" parameter in the SemanticRouter initialization
    aligns with the desired behavior, as it might not be suitable for all use cases.

    docs/encoders/huggingface.ipynb [575]

    -rl = SemanticRouter(encoder=encoder, routes=routes, auto_sync="local")
    +rl = SemanticRouter(encoder=encoder, routes=routes)
    Suggestion importance[1-10]: 6

    Why: The suggestion to confirm the appropriateness of the auto_sync="local" parameter is valid and relevant, as it may not align with all use cases. However, it is not a critical issue and depends on the specific application context.

    6

    @Joshua-Briggs Joshua-Briggs linked an issue Jan 7, 2025 that may be closed by this pull request
    Copy link

    codecov bot commented Jan 7, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 74.82%. Comparing base (9915053) to head (4749e6e).
    Report is 1 commits behind head on main.

    Additional details and impacted files
    @@            Coverage Diff             @@
    ##             main     #504      +/-   ##
    ==========================================
    - Coverage   74.84%   74.82%   -0.03%     
    ==========================================
      Files          43       43              
      Lines        3753     3753              
    ==========================================
    - Hits         2809     2808       -1     
    - Misses        944      945       +1     

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    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.

    Update all Jupyter notebooks for v0.1.0
    1 participant