Commit e10fc07
authored
Add retrieval-provider embedding capability (#196)
* Add retrieval-provider embedding capability
Add the embedding surface of the new retrieval-provider capability: an
EmbeddingProvider protocol, the EmbeddingResponse / EmbeddingUsage /
EmbeddingRuntimeConfig types, and an OpenAIEmbeddingProvider reference
impl posting to an OpenAI-compatible /v1/embeddings. Typed
EmbeddingEvent / EmbeddingFailedEvent join the observer event union,
dispatched on every embed(); the bundled OTel and Langfuse observers
safely skip them for now (the embedding span and Embedding observation
are a follow-up).
The provider rejects malformed responses (missing, empty, or non-numeric
vectors and non-permutation indices), guards a trailing /v1 on base_url,
and offers a configurable readiness probe defaulting to a universal
one-input embed so it works against backends without a /v1/models
catalog (e.g. TEI's OpenAI surface). Conformance fixtures 001-005 pass;
unit tests cover the guard, the readiness modes, and the observer
safe-handling.
conformance.toml keeps 0059 not-yet; the observability rendering
(074-083), the cross-provider helper cleanups, and the docs are v0.16.0
follow-ups.
* Address embedding-capability review findings
Fix the issues from the PR #196 re-review:
- Build the embeddings request body extras-first so a caller's
undeclared runtime-config extra cannot clobber the bound model or the
input list.
- Reject non-numeric vector values (JSON strings, bools) and bool usage
counts strictly rather than coercing them, so a non-numeric vector is
treated as malformed.
- Dedup the observer event union: correlation and both observers now
reference the single ObserverEvent alias instead of repeating the
member list, so a new event widens the contract in one place.
- Move a stray spec section ref out of a docstring into a comment and
reword em-dash substitutes in docstrings.
- Strengthen the tests: the Langfuse safe-handling test asserts no trace
is created, and the conformance runner tolerates a fixture without a
stores_response_in key instead of raising KeyError.
- Refresh the observer dispatch docstrings to point at ObserverEvent
rather than a hardcoded variant count.
* Raise invalid-response on malformed model catalog
From the PR #196 review:
- _probe_models now raises ProviderInvalidResponse when the /v1/models
body is not a JSON object or its data field is missing or not a list,
mirroring _parse_response. A malformed catalog was being degraded to an
empty list and misreported as a missing model (ProviderInvalidModel);
that category is now reserved for a well-formed catalog that genuinely
lacks the bound model. Covered by a new unit test.
- Align the _classify_embedding_http_error docstring with the code: the
catch-all maps every other status (not just 5xx) to unavailable, the
same as the sibling classify_http_error.
* Fix Observer docstring example annotation
The Observer protocol docstring example annotated its log_observer with
NodeEvent | MetadataAugmentationEvent, which would be a structural
conformance error now that the protocol delivers the full ObserverEvent
union (embedding, tool, and provider events included). Annotate the
example with ObserverEvent so copied observers type-check.1 parent 620b010 commit e10fc07
12 files changed
Lines changed: 1263 additions & 135 deletions
File tree
- src/openarmature
- graph
- observability
- langfuse
- otel
- retrieval
- providers
- tests
- conformance
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
749 | 750 | | |
750 | 751 | | |
751 | 752 | | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
752 | 872 | | |
753 | 873 | | |
754 | 874 | | |
| |||
905 | 1025 | | |
906 | 1026 | | |
907 | 1027 | | |
| 1028 | + | |
| 1029 | + | |
908 | 1030 | | |
909 | 1031 | | |
910 | 1032 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
88 | | - | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
| |||
104 | 110 | | |
105 | 111 | | |
106 | 112 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
110 | 116 | | |
111 | 117 | | |
112 | 118 | | |
| |||
778 | 784 | | |
779 | 785 | | |
780 | 786 | | |
781 | | - | |
| 787 | + | |
782 | 788 | | |
783 | 789 | | |
784 | 790 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
52 | 46 | | |
53 | 47 | | |
54 | 48 | | |
| |||
221 | 215 | | |
222 | 216 | | |
223 | 217 | | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
262 | 224 | | |
263 | 225 | | |
264 | 226 | | |
| |||
272 | 234 | | |
273 | 235 | | |
274 | 236 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
| 237 | + | |
309 | 238 | | |
310 | 239 | | |
311 | 240 | | |
312 | 241 | | |
313 | 242 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 243 | + | |
334 | 244 | | |
335 | 245 | | |
336 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
432 | 435 | | |
433 | 436 | | |
434 | 437 | | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
| 438 | + | |
447 | 439 | | |
448 | 440 | | |
449 | 441 | | |
| |||
484 | 476 | | |
485 | 477 | | |
486 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
487 | 485 | | |
488 | 486 | | |
489 | 487 | | |
| |||
0 commit comments