Skip to content

Fix AI service lint regression in CI by restoring top-level import order and lazy LiteLLM call path#1

Merged
hoootan merged 2 commits intomainfrom
copilot/fix-lint-error-in-ci
Mar 30, 2026
Merged

Fix AI service lint regression in CI by restoring top-level import order and lazy LiteLLM call path#1
hoootan merged 2 commits intomainfrom
copilot/fix-lint-error-in-ci

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

CI lint was failing in server/src/flowforge_server/services/ai.py due to a non-top-level import (E402) and a direct litellm reference that bypassed the file’s lazy-loader pattern. This PR applies a minimal correction to align the module with existing import/lazy-load conventions.

  • Import ordering cleanup

    • Moves get_settings into the module import block so all imports are defined at top level.
  • Lazy-loaded LiteLLM usage consistency

    • Replaces direct litellm.acompletion(...) usage with _get_litellm().acompletion(...) in stream_completion, matching the existing lazy import/cache mechanism used elsewhere in the file.
  • Net effect

    • Removes the CI lint failure source without changing AI service behavior or API surface.
# before
response = await litellm.acompletion(**completion_params)

# after
response = await _get_litellm().acompletion(**completion_params)

Agent-Logs-Url: https://github.com/hoootan/flowforge/sessions/1cfc6501-ad98-42cd-b4d4-805a6959b14e

Co-authored-by: hoootan <15173179+hoootan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix lint error in CI workflow Fix AI service lint regression in CI by restoring top-level import order and lazy LiteLLM call path Mar 30, 2026
Copilot AI requested a review from hoootan March 30, 2026 23:16
@hoootan hoootan marked this pull request as ready for review March 30, 2026 23:17
Copilot AI review requested due to automatic review settings March 30, 2026 23:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a CI lint failure in the AI service by restoring top-level import ordering and ensuring LiteLLM calls consistently go through the module’s lazy-loader path.

Changes:

  • Moves get_settings into the module’s top-level import block to resolve E402 (import not at top of file).
  • Replaces direct litellm.acompletion(...) usage in complete_stream with _get_litellm().acompletion(...) to match the existing lazy-load/cache pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hoootan hoootan merged commit 312aac7 into main Mar 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants