Skip to content

fix: extract prompt merging into dedicated function - #2310

Open
marikaner wants to merge 4 commits into
mainfrom
refactor-merge-prompt-with-messages
Open

marikaner wants to merge 4 commits into
mainfrom
refactor-merge-prompt-with-messages

Conversation

@marikaner

Copy link
Copy Markdown
Contributor
  • Extract prompt merging logic from buildCompletionModulesConfig into a dedicated mergePromptWithMessages function
  • Fix bug where the validation error for missing prompt template or messages was silently skipped when no prompt was configured
  • The new function is pure (no mutation of input)

@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Title: Fix prompt/message merging validation in orchestration config

Context

No related issue provided.

What this PR does and why it is needed

Category: Bug Fix / Refactor

This PR extracts prompt/message merging from buildCompletionModulesConfig into a dedicated mergePromptWithMessages helper.

The change fixes a validation gap where missing prompt templates and missing request messages were not detected when no prompt was configured. The new helper initializes an empty template for validation purposes, merges request messages without mutating the input configuration, and preserves template references unchanged.

Changes

  • Adds mergePromptWithMessages to centralize prompt/message handling.
  • Ensures an error is thrown when neither a prompt template nor messages are provided.
  • Guards against unparsed string prompts being merged.
  • Updates buildCompletionModulesConfig to use the new helper.
  • Adds a patch changeset for @sap-ai-sdk/orchestration.

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.37

  • Correlation ID: 72a46ff0-b1a7-11f1-9e2a-d9761777f80c
  • File Content Strategy: Full file content
  • Event Trigger: pull_request.opened
  • LLM: gpt-5.5
  • Summary Prompt: Default Prompt
  • Output Template: Repository PR Template

marikaner and others added 3 commits September 16, 2026 10:48
resolvePromptTemplate was returning a plain `{ template: [...] }` object,
discarding other properties like `tools` and `response_format` that
mergeOrchestrationConfig had already set on the prompt.
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.

1 participant