Fixes prompty pattern matching. Closes #1325#1326
Merged
garrytrinder merged 2 commits intoJul 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes prompty pattern matching by generalizing message conversions from arrays to IEnumerable<ChatMessage> and updating the empty‐check logic.
- Updated
ConvertMessagessignature in OpenAI and Ollama clients to acceptIEnumerable<ChatMessage>instead ofChatMessage[]. - Updated the abstract
ConvertMessagesmethod inBaseLanguageModelClientaccordingly. - Changed the prompty.Empty check from array‐based (
Length == 0) to LINQ’s.Any()onIEnumerable.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| DevProxy.Abstractions/LanguageModel/OpenAILanguageModelClient.cs | Changed ConvertMessages parameter from ChatMessage[] to IEnumerable<ChatMessage>. |
| DevProxy.Abstractions/LanguageModel/OllamaLanguageModelClient.cs | Changed ConvertMessages parameter from ChatMessage[] to IEnumerable<ChatMessage>. |
| DevProxy.Abstractions/LanguageModel/BaseLanguageModelClient.cs | Updated abstract ConvertMessages signature and empty‐check from array to IEnumerable with .Any(). |
Comments suppressed due to low confidence (1)
DevProxy.Abstractions/LanguageModel/BaseLanguageModelClient.cs:107
- There’s no existing test covering the case when
prompty.Prepare(parameters)returns an emptyIEnumerable. Adding unit tests for both empty and non-empty prompt scenarios would ensure this change behaves as expected.
var prompty = Prompt.FromMarkdown(promptContents);
garrytrinder
approved these changes
Jul 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes prompty pattern matching. Closes #1325