Skip to content

Feature/scaleway glm litellm dispatching#119

Merged
Tibo2403 merged 10 commits into
mainfrom
feature/scaleway-glm-litellm-dispatching
Jul 5, 2026
Merged

Feature/scaleway glm litellm dispatching#119
Tibo2403 merged 10 commits into
mainfrom
feature/scaleway-glm-litellm-dispatching

Conversation

@Tibo2403

@Tibo2403 Tibo2403 commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Validation

  • PowerShell syntax checked
  • Bash syntax checked
  • ShellCheck/PSScriptAnalyzer reviewed
  • Sensitive scripts tested with --dry-run or -WhatIf

Safety

  • No credentials, tenant identifiers, scan output, packet captures, or customer data committed
  • High-risk script changes keep authorization checks or dry-run behavior intact

Copilot AI review requested due to automatic review settings July 5, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a small, self-contained Python helper module for dispatching LiteLLM completions through Scaleway’s OpenAI-compatible GLM endpoint, with a fallback mechanism to alternate LiteLLM model IDs, plus accompanying documentation and tests.

Changes:

  • Added ScalewayGLMConfig (env-driven config + validation) and message normalization helpers.
  • Added scaleway_glm_completion() wrapper and dispatch_with_fallback() retry/fallback logic.
  • Added a README and a unit test file covering payload construction and fallback behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
litellm_scaleway_dispatching/scaleway_glm_dispatcher.py New Scaleway GLM config + LiteLLM completion wrapper + fallback dispatch logic.
tests/test_scaleway_glm_dispatcher.py New unit tests validating normalization, config validation, payload construction, and fallback behavior.
litellm_scaleway_dispatching/README.md Usage and environment-variable documentation, including test-running instructions.

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

Comment thread litellm_scaleway_dispatching/scaleway_glm_dispatcher.py
Comment on lines +151 to +153
for model in fallback_models:
try:
return completion_func(messages=messages, model=model, **kwargs)
Comment thread tests/test_scaleway_glm_dispatcher.py Outdated
Comment on lines +1 to +10
import pytest

from litellm_scaleway_dispatching.scaleway_glm_dispatcher import (
DEFAULT_MODEL,
ScalewayGLMConfig,
ScalewayGLMConfigurationError,
dispatch_with_fallback,
normalize_messages,
scaleway_glm_completion,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rewrote the tests as unittest.TestCase and moved them to scripts/python/tests/test_scaleway_glm_dispatcher.py so they are picked up by the existing CI command (python -m unittest discover -s scripts/python/tests -v). The old pytest file under tests/ has been removed, and the README test instructions have been updated accordingly. All 68 tests pass.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Addressed in 658cf39. The tests have been rewritten using unittest.TestCase (replacing all pytest.raises with self.assertRaises/self.assertRaisesRegex, monkeypatch.setenv with unittest.mock.patch.dict, and the parametrized error-classification test with individual test methods) and moved to scripts/python/tests/test_scaleway_glm_dispatcher.py. All 68 tests pass via python -m unittest discover -s scripts/python/tests -v.

Comment on lines +22 to +26
## Run tests

pip install pytest litellm
pytest -q tests/test_scaleway_glm_dispatcher.py

@Tibo2403 Tibo2403 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ok

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@Tibo2403 Tibo2403 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ok

@Tibo2403 Tibo2403 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ok

@Tibo2403 Tibo2403 merged commit adde669 into main Jul 5, 2026
3 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