Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 8dbff63

Browse files
committed
Create pipeline instance when creating the SequentialPipelineProcessor not for every process
A pipeline instance is what binds the pipeline steps with the context. Create the instance sooner, not when processing the request.
1 parent 4f97215 commit 8dbff63

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/codegate/pipeline/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,9 @@ def __init__(
340340
self.pipeline_steps = pipeline_steps
341341
self.secret_manager = secret_manager
342342
self.is_fim = is_fim
343+
self.instance = self._create_instance()
343344

344-
def create_instance(self) -> InputPipelineInstance:
345+
def _create_instance(self) -> InputPipelineInstance:
345346
"""Create a new pipeline instance for processing a request"""
346347
return InputPipelineInstance(self.pipeline_steps, self.secret_manager, self.is_fim)
347348

@@ -356,7 +357,6 @@ async def process_request(
356357
is_copilot: bool = False,
357358
) -> PipelineResult:
358359
"""Create a new pipeline instance and process the request"""
359-
instance = self.create_instance()
360-
return await instance.process_request(
360+
return await self.instance.process_request(
361361
request, provider, model, api_key, api_base, extra_headers, is_copilot
362362
)

0 commit comments

Comments
 (0)