Skip to content

docs: improve type hints and documentation in Python SDK#1126

Open
hiSandog wants to merge 3 commits intolangflow-ai:mainfrom
hiSandog:optimize/utils-enhancements
Open

docs: improve type hints and documentation in Python SDK#1126
hiSandog wants to merge 3 commits intolangflow-ai:mainfrom
hiSandog:optimize/utils-enhancements

Conversation

@hiSandog
Copy link

@hiSandog hiSandog commented Mar 13, 2026

Summary

This PR improves the Python SDK with better type hints and documentation:

Changes

  • client.py:

    • Added module docstring
    • Added proper type annotations for __aexit__ method parameters
    • Added from __future__ import annotations for forward references
  • models.py:

    • Added module docstring
    • Improved IngestTaskStatus class with detailed attribute docstrings
    • Changed files: dict to files: dict[str, Any] = Field(default_factory=dict) for better type safety

Benefits

  • Better IDE autocomplete and type checking support
  • Improved code documentation for developers
  • More consistent with Python type hinting best practices

- Add comprehensive JSDoc-style docstrings to all functions
- Add new utilities: get_env_bool, get_env_str, get_env_list, get_env_dict
- Add require_env function for mandatory environment variables
- Add safe_bool function with support for common truthy/falsy values
- Add type annotations to settings.py configuration variables
- Organize settings.py with section comments for better readability
- Export utilities from utils/__init__.py for easier imports
- Improve error messages with descriptive information
@github-actions github-actions bot added community backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) enhancement 🔵 New feature or request labels Mar 13, 2026
- Add module docstrings to client.py and models.py
- Add proper type annotations for __aexit__ method
- Improve IngestTaskStatus docstring and use Field for files dict
- Add from __future__ import annotations for forward references
@github-actions github-actions bot added enhancement 🔵 New feature or request and removed enhancement 🔵 New feature or request labels Mar 13, 2026
@hiSandog hiSandog changed the title feat(utils): enhance environment utilities and add type hints docs: improve type hints and documentation in Python SDK Mar 13, 2026
@github-actions github-actions bot added documentation 📘 Improvements or additions to documentation and removed enhancement 🔵 New feature or request labels Mar 13, 2026
…ility

- Enhanced error detection for OpenSearch 3.0 KNN field bug
- Added specific error message when KNNMethodConfigContext error occurs
- Provided helpful workaround suggestion in error response
- Improved logging for KNN compatibility issues
- Changed TODO comment to informative note about the limitation

This helps users understand and work around the OpenSearch 3.0 bug
with document-level monitors on indexes containing KNN fields.
@github-actions github-actions bot added documentation 📘 Improvements or additions to documentation and removed documentation 📘 Improvements or additions to documentation labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 🔷 Issues related to backend services (OpenSearch, Langflow, APIs) community documentation 📘 Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant