(feat): Conversation Harness - #23
Merged
Merged
Conversation
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
There was a problem hiding this comment.
🟡 Changes recommended
Critical request-shape and endpoint issues, along with lifecycle defects, remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a conversation-testing harness integrating Dapr with Ollama.
Changes:
- Adds Ollama container lifecycle and model management.
- Adds Dapr conversation integration and
ConversationHarness. - Adds tests, exports, constants, and documentation.
File summaries
| File | Summary |
|---|---|
src/OllamaContainer.ts |
Ollama container and model utilities |
src/OllamaContainer.test.ts |
Ollama behavior tests |
src/index.ts |
Public API exports |
src/DaprContainer.ts |
Dapr conversation and Ollama integration |
src/ConversationHarness.ts |
Conversation harness implementation |
src/ConversationHarness.test.ts |
Harness and integration tests |
src/Constants.ts |
Ollama defaults |
README.md |
Conversation harness documentation |
Review details
Suppressed comments (6)
src/ConversationHarness.ts:209
temperatureis being serialized as a top-level request field, but Dapr conversation generation settings belong in theparametersobject. As a result, the integration test'stemperature: 0(and callers' other convenience values) are ignored or rejected by the sidecar; merge these values intoparametersinstead of placing them alongsideinputs.
if (options.contextId !== undefined) body.contextId = options.contextId;
if (options.temperature !== undefined) body.temperature = options.temperature;
if (options.scrubPii !== undefined) body.scrubPii = options.scrubPii;
if (options.metadata !== undefined) body.metadata = options.metadata;
if (options.parameters !== undefined) body.parameters = options.parameters;
src/ConversationHarness.ts:230
- The method accepts
contextIdand models acontextIdon the response, but only returns the text content here. When Dapr creates a context for the first turn, callers cannot obtain that ID to send the next turn, so the advertised context support cannot be used; return the context ID alongside the content or expose the full response.
const result = (await response.json()) as ConversationResult;
const content = result.outputs?.[0]?.choices?.[0]?.message?.content;
if (content === undefined) {
throw new Error("Conversation response did not contain message content.");
}
return content;
src/ConversationHarness.ts:97
- The value is validated with
trim()byuseModel()but the original string is stored and later emitted as component metadata, whileOllamaContainer.ensureModel()trims before pulling. For example,useModel(" smollm2:135m ")pulls one model but configures Dapr with a whitespace-padded name, so the component cannot resolve it; normalize the model value before storing it (and apply the same normalization to the constructor option).
this.modelName = modelName;
src/DaprContainer.ts:175
- A port-only configuration is inconsistent with the managed container: when
ollamaPortis set withoutollamaHostorollamaEndpoint, this branch still creates an Ollama container that listens on/exposes only 11434, while the component is later configured forollama:<custom-port>/v1(lines 275-277). Conversations will fail to connect; either reject port-only configuration or make the managed container listen on and expose that port.
if (!this.ollamaContainer && !this.conversationOptions?.ollamaEndpoint && !this.conversationOptions?.ollamaHost) {
const container = new OllamaContainer().withNetwork(this.startedNetwork).withNetworkAliases(this.ollamaService);
src/OllamaContainer.ts:134
ensureModel("llama3")will not recognize the normal Ollama tagllama3:latestbecause availability is checked by exact name. That causes an unnecessary pull on every start for valid untagged model names; treat an omitted tag as equivalent to:latestwhen matching/api/tags.
const target = model.toLowerCase();
return (
data.models?.some((entry) => {
const names = [entry.name, entry.model].filter((value): value is string => value !== undefined);
return names.some((name) => name.toLowerCase() === target);
src/OllamaContainer.ts:33
- A listening TCP port does not guarantee that Ollama's HTTP API is ready.
start()immediately calls/api/tagsand then possibly/api/pull, so this wait can race server initialization and make harness startup fail with a transient connection/5xx error; wait for an API endpoint such as/api/tagsinstead.
.withWaitStrategy(Wait.forListeningPorts())
- Files reviewed: 8/8 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bsHarness Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Description
Implemented conversation harness.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: