Skip to content

chore: chunk processing refactoring#202

Open
VinShurik wants to merge 15 commits intointegration-0.7from
chore/chunk_processing_refactoring
Open

chore: chunk processing refactoring#202
VinShurik wants to merge 15 commits intointegration-0.7from
chore/chunk_processing_refactoring

Conversation

@VinShurik
Copy link
Copy Markdown
Collaborator

@VinShurik VinShurik commented Mar 26, 2026

Description of changes

This PR unifies OpenAI-compatible chat completion streaming between the orchestrator and deployment tooling, and cleans up related DI and dead code.

Streaming

  • Introduces ChatCompletionStreamHandler with orchestrator vs deployment strategies (config via Pydantic models with callables / arbitrary types where needed).
  • Shared parsing and consumption remain in chat_completion_stream (parse, driver, models, stream_result).
  • Orchestrator: stream main text to Choice; propagate thinking/reasoning stages when enabled, including incremental stage deltas (index → stage name cache so content-only chunks still route correctly). Deployment: shallow-merge custom_content.state, extend attachments, stream to BaseStageWrapper when present.
  • Adds explicit stream-related exceptions (ChatStreamHandlerError and subclasses) for clearer top-level handling.

DI / clients

  • Splits AsyncAzureOpenAI bindings by use case: orchestrator client vs deployment client (typed Annotated aliases), so deployment calls are not pinned to the orchestrator deployment name.

Structure / readability

  • Moves AccumulatedToolCall to common/chat_completion_stream/tool_call.py and removes the agent/_models package.
  • Empties chat_completion_stream/__init__.py (no barrel re-exports); imports use explicit submodules.
  • Removes legacy ChunkProcessor and its unit tests (superseded by ChatCompletionStreamHandler).

Tests

  • Updates unit tests for new constructors, fixtures (azure_client vs stale dial_client), and request payload shape (model + extra_body).

Checklist

  • Title of the pull request follows Conventional Commits specification
  • Changes are tested on review environment
  • App schema changes are backward compatible, or breaking changes are documented with a migration guide
  • Integration tests pass

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@VinShurik VinShurik requested a review from ypldan as a code owner March 26, 2026 14:19
@VinShurik
Copy link
Copy Markdown
Collaborator Author

VinShurik commented Mar 26, 2026

/deploy-review

GitHub actions run: 23599458090

Stage Status
deploy-review Success ✅
matrix.application Skipped ➖

@VinShurik VinShurik force-pushed the chore/chunk_processing_refactoring branch from c00abab to 0790588 Compare March 27, 2026 14:16
@VinShurik VinShurik changed the title chore/chunk processing refactoring chore: chunk processing refactoring Mar 27, 2026
@VinShurik
Copy link
Copy Markdown
Collaborator Author

VinShurik commented Mar 27, 2026

/deploy-review

GitHub actions run: 23653046040

Stage Status
deploy-review Success ✅
matrix.application Skipped ➖

…ctoring

# Conflicts:
#	src/quickapp/agent/agent_module.py
#	src/quickapp/agent/assistant_invoker.py
#	src/quickapp/agent/tool_executor.py
@VinShurik VinShurik changed the base branch from development to integration-0.7 March 30, 2026 09:58
@VinShurik VinShurik requested a review from korotaav48 March 30, 2026 15:55
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.

2 participants