Repository navigation
Commit f592289
authored
fix: correct Ollama batches, AG-UI IDs, and Bedrock SDK setup (#553)
## Problem
The current Ollama SDK could not read `/api/embed` responses, and
recorded batches collapsed to one vector. Recordings also flattened
different input shapes and reused responses across dimensions and
embedding operations. AG-UI convenience helpers replaced caller IDs.
Bedrock examples omitted the HTTP/1 handler required by current AWS SDK
versions.
## Why
SDK clients need the right response shape and request identity. A saved
batch must not answer a different width or operation. Concurrent AG-UI
requests need their own IDs, and Bedrock clients need the transport
aimock supports.
## Fix
- Return Ollama's ordered `embeddings` matrix, preserve distinct vectors
and metadata through record/replay, and honor fallback dimensions. New
Ollama and OpenAI-compatible recordings persist `match.embeddingRequest`
with the operation, original input and requested dimensions, plus the
model. Keep fixture sequence counters separate for those criteria.
Handwritten generic fixtures keep broad matching; re-record older
captures to add the new match keys.
- Build AG-UI text/tool/state/reasoning convenience events per request
with caller thread/run/parent IDs and fresh content IDs. Explicit event
fixtures keep their authored IDs.
- Correct Bedrock setup docs and test Invoke, Converse, and both binary
streams with `NodeHttpHandler`. **Default HTTP/2 remains unsupported.**
Python’s `add_fixture(..., embeddingRequest=...)` routes the field under
`match`, so width, input shape and operation constraints reach the
server. Three public HTTP regressions cover both Ollama operations and
OpenAI; the full Python suite passes 251 tests on Python 3.13.9 with
Node 24.
Matching metadata stays private: predicates and request journals retain
their old request shape. The A7 test checks the exact new saved fields,
then compares all prior fields with its unchanged frozen baseline.
CLI test helpers await child processes so slow commands leave the Vitest
worker free to report results. The controlled 104-test suite reproduces
the reporting timeout before this change and passes under the identical
slowdown afterward. That suite keeps its assertions, test count, child
limits and test deadlines. Two validate CLI checks now distinguish a
success status from `OK` inside a file path; filenames containing `OK`
make that regression deterministic.
Validation on Node 24.21.0: 17,483 tests passed across 430 files, with
11 existing skips. Format, lint, typecheck, build, package exports and
workflow lint passed. All 14 generated API reports match the new
optional fixture field; `public-api-addition` marks that change for
review. The unchanged memory guard passed after freeing RAM.
The added regressions cover successive batch/string/width/model
requests, reverse cache hits, offline reload, both legacy/OpenAI
recording orders, changed widths after another operation's recording,
strict misses and independent fixture sequences. Focused suites passed
776 tests. Independent Node 24.11.0 and Bun 1.4.3 consumers each passed
235 expanded checks and nine review-specific checks, plus 12
transform/privacy checks. These use local fixtures, not fresh
authenticated all-provider calls; counts overlap.
Native stack #552: #542 → #551 → #553. Header enforcement stays opt-in.
Merge after required checks pass, in stack order.42 files changed
Lines changed: 1087 additions & 75 deletions
File tree
- docs
- agui-mock
- aws-bedrock
- fixtures
- ollama
- record-replay
- etc
- packages/aimock-pytest
- src/aimock_pytest
- tests
- src
- __tests__
- response
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
126 | 135 | | |
127 | 136 | | |
128 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
| 191 | + | |
| 192 | + | |
184 | 193 | | |
| 194 | + | |
185 | 195 | | |
186 | 196 | | |
187 | 197 | | |
| |||
258 | 268 | | |
259 | 269 | | |
260 | 270 | | |
| 271 | + | |
| 272 | + | |
261 | 273 | | |
| 274 | + | |
262 | 275 | | |
263 | 276 | | |
264 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
131 | 142 | | |
132 | 143 | | |
133 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| |||
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
86 | 120 | | |
87 | 121 | | |
88 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1045 | 1045 | | |
1046 | 1046 | | |
1047 | 1047 | | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1048 | 1055 | | |
1049 | 1056 | | |
1050 | 1057 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments