Skip to content

Conversation

@blanch0t
Copy link
Collaborator

No description provided.

@blanch0t blanch0t requested a review from leoguillaume October 20, 2025 13:18
Comment on lines 38 to 44
return {
"status_code": 200,
"client": client.as_schema(censored=False).model_dump(),
"cycle_offset": router._cycle.offset,
"requeue_count": self.request.retries,
"performance_indicator": performance_indicator,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pas en lien direct avec cette PR, mais je trouve que ça pourrait être mieux typé ici.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

tu veux dire au niveau du type de retour ? Faire un schéma dédié ?

Julien Almarcha and others added 5 commits October 24, 2025 15:02
…ution

- Introduced a new `priority` field in the User model to manage user priorities for scheduling and rate limiting.
- Updated the IdentityAccessManager to handle user priority during user creation and updates.
- Enhanced the BaseModelRouter to implement a least-loaded routing strategy for model invocation, selecting the provider with the fewest inflight requests.
- Added Celery configuration for asynchronous task execution, allowing model invocations to be processed in the background.
- Implemented a new `invoke_model_request` function to handle both eager and Celery-based invocations based on configuration.
- Updated API schemas to include priority in user-related requests and responses.
- Added necessary database migrations to support the new priority field in the User table.
- Enhanced unit tests to cover new functionality and ensure proper integration with Celery.

fix iam tests

update config to run test without workers

Update coverage badge

Update configuration documentation

update alembic

add least loaded router

Add documentation

Update diagram

Refactor Redis connection handling for thread safety and performance

Refactor chat completions to use invoke_model_request for non-streaming responses

fix : base model router lock

fix: lock release

feat: add additional_data parameter to invoke_model_request and invoke_model_task

fix: handle SoftTimeLimitExceeded in invoke_model_task for structured response

refactor: enhance streaming response handling with safe client access routing

fix: ensure client lock is released properly in delete_client method

aristote dispatcher philosophy (untested

fix celery task

fix round robin

fix receive task result

task failure handling

fix requeuing

remarques pr

tests

simplify celery task by removing async
@blanch0t blanch0t force-pushed the celery-usage-metrics branch from a4bb0c2 to 3026bcb Compare October 24, 2025 13:07


# revision identifiers, used by Alembic.
revision: str = "4d42cbcaecff"

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'revision' is not used.

Copilot Autofix

AI about 2 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.


# revision identifiers, used by Alembic.
revision: str = "4d42cbcaecff"
down_revision: Union[str, None] = "a1b2c3d4e5f6"

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'down_revision' is not used.

Copilot Autofix

AI about 2 months ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

# revision identifiers, used by Alembic.
revision: str = "4d42cbcaecff"
down_revision: Union[str, None] = "a1b2c3d4e5f6"
branch_labels: Union[str, Sequence[str], None] = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'branch_labels' is not used.

Copilot Autofix

AI about 2 months ago

To resolve the issue, the global variable branch_labels should be removed from the file since it is not used anywhere in the module and does not serve any documented purpose. Delete line 18 assigning branch_labels—while ensuring that nothing else in the file references it. No additional imports or definitions are required for this fix, and nothing else needs to change.


Suggested changeset 1
api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py b/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
--- a/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
+++ b/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
@@ -15,7 +15,6 @@
 # revision identifiers, used by Alembic.
 revision: str = "4d42cbcaecff"
 down_revision: Union[str, None] = "a1b2c3d4e5f6"
-branch_labels: Union[str, Sequence[str], None] = None
 depends_on: Union[str, Sequence[str], None] = None
 
 
EOF
@@ -15,7 +15,6 @@
# revision identifiers, used by Alembic.
revision: str = "4d42cbcaecff"
down_revision: Union[str, None] = "a1b2c3d4e5f6"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


Copilot is powered by AI and may make mistakes. Always verify output.
revision: str = "4d42cbcaecff"
down_revision: Union[str, None] = "a1b2c3d4e5f6"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'depends_on' is not used.

Copilot Autofix

AI about 2 months ago

The best way to fix the problem is simply to remove the depends_on variable assignment on line 19 in api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py. Doing so will not alter the migration's functionality, especially as there is no explicit dependency declared. No other changes (imports, structural changes, etc.) are required.


Suggested changeset 1
api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py b/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
--- a/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
+++ b/api/alembic/versions/2025_10_10_1807-4d42cbcaecff_add_observability_usage_metrics.py
@@ -16,7 +16,6 @@
 revision: str = "4d42cbcaecff"
 down_revision: Union[str, None] = "a1b2c3d4e5f6"
 branch_labels: Union[str, Sequence[str], None] = None
-depends_on: Union[str, Sequence[str], None] = None
 
 
 def upgrade() -> None:
EOF
@@ -16,7 +16,6 @@
revision: str = "4d42cbcaecff"
down_revision: Union[str, None] = "a1b2c3d4e5f6"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
Copilot is powered by AI and may make mistakes. Always verify output.
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