Repository navigation
refactor: improve docling option serialization, VLM helpers and metrics formatting - #237
Conversation
…cs formatting Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
…ility, and verify e2e live pipeline
概要 (Overview)
Doclingライブラリの最新コード(
docling 2.113.0/docling-core 2.87.1)を活用し、コード品質の向上、責務分離、パフォーマンス最適化を目的とした反復的なリファクタリングを実施しました。ステップごとの変更内容 (Changes by Step)
tests/test_refactor_docling_latest.pyを追加し、変換オプションの辞書変換、画像シリアライザのページ番号・インデックスキャッシュ、VLMヘルパー、プロメテウスメトリクス生成の挙動をテストで固定。DocumentConversionOptionsにto_dict()およびfrom_dict()を追加し、server.pyおよびpool.pyで重複していた辞書生成ロジックを一元化。CustomMarkdownPictureSerializerで未使用の_get_closing_delimを削除し、ドキュメントのインデックス作成時にpage_noマッピング(_pic_ref_to_page_no)も事前計算してキャッシュ化。vlm.pyに_compute_backoff_delayヘルパーを抽出してジッター付指数バックオフ計算を共通化。server.pyの_MetricsRegistryに_format_conversions_totalや_format_memory_usedなどのプライベートメソッドを抽出し、プロメテウス形式出力の可読性を向上。pytest(410 passed)、mypy(0 errors)、ruff(0 errors)をすべてパス。リファクタリング前後の設計比較 (Design Comparison)
server.py,pool.py)でオプション辞書の手動マッピングが重複して存在していましたが、DocumentConversionOptions.to_dict() / from_dict()に集約し、単一責任原則(SRP)およびDRYを徹底しました。_compute_backoff_delayに分離し、非同期・同期の重複コードを解消しました。テスト実行結果 (Test Results)
uv run --extra test pytest: 410 passed, 3 skippeduv run --extra test mypy --ignore-missing-imports src: 0 errorsuv run ruff check src tests: 0 errorsPR created automatically by Jules for task 17989042495812980440 started by @chottokun