/
embedding-reference.html
680 lines (656 loc) · 22.8 KB
/
embedding-reference.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
262
263
264
265
266
267
268
269
270
271
272
273
274
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
---
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
title: "Embedding Reference"
redirect_from:
- /documentation/reference/embedding-reference.html
---
<p>Reference configuration for <a href="../embedding.html">embedders</a>.</p>
<h2 id="model-config-reference">Model config reference</h2>
<p>
Embedder models uses the <a href="config-files.html#model">model</a> type configuration.
The <em>model</em> type configuration accepts attributes <code>model-id</code>, <code>url</code> or <code>path</code>,
and multiple of these can be specified as a single config value, where one is used depending on the deployment environment:
</p>
<ul>
<li>If a <code>model-id</code> is specified and the application is deployed on Vespa Cloud, the <code>model-id</code> is used.</li>
<li>Otherwise, if a <code>url</code> is specified, it is used</li>
<li>Otherwise, <code>path</code> is used.</li>
</ul>
<p>
When using <code>path</code>, the model files must be supplied in the
Vespa <a href="../application-packages.html#deploying-remote-models">application package</a>.
</p>
<h2 id="huggingface-embedder">Huggingface Embedder</h2>
<p>
An embedder using any <a href="https://huggingface.co/docs/tokenizers/index">Huggingface tokenizer</a>,
including multilingual tokenizers,
to produce tokens which is then input to a supplied transformer model in ONNX model format.
</p>
<p>
The Huggingface embedder is configured in <a href="services.html">services.xml</a>,
within the <code>container</code> tag:
</p>
<pre>{% highlight xml %}
<container id="default" version="1.0">
<component id="hf-embedder" type="hugging-face-embedder">
<transformer-model path="my-models/model.onnx"/>
<tokenizer-model path="my-models/tokenizer.json"/>
<prepend>
<query>query:</query>
<document>passage:</document>
</prepend>
</component>
...
</container>
{% endhighlight %}</pre>
<h3 id="huggingface-embedder-reference-config">Huggingface embedder reference config</h3>
<p>In addition to <a href="#embedder-onnx-reference-config">embedder ONNX parameters</a>:</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>transformer-model</td>
<td>One</td>
<td>Use to point to the transformer ONNX model file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>tokenizer-model</td>
<td>One</td>
<td>Use to point to the <code>tokenizer.json</code> Huggingface tokenizer configuration file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>max-tokens</td>
<td>One</td>
<td>The maximum number of tokens accepted by the transformer model</td>
<td>numeric</td>
<td>512</td>
</tr>
<tr>
<td>transformer-input-ids</td>
<td>One</td>
<td>The name or identifier for the transformer input IDs</td>
<td>string</td>
<td>input_ids</td>
</tr>
<tr>
<td>transformer-attention-mask</td>
<td>One</td>
<td>The name or identifier for the transformer attention mask</td>
<td>string</td>
<td>attention_mask</td>
</tr>
<tr>
<td>transformer-token-type-ids</td>
<td>One</td>
<td>The name or identifier for the transformer token type IDs. If the model does not use <code>token_type_ids</code> use <code><transformer-token-type-ids/></code></td>
<td>string</td>
<td>token_type_ids</td>
</tr>
<tr>
<td>transformer-output</td>
<td>One</td>
<td>The name or identifier for the transformer output</td>
<td>string</td>
<td>last_hidden_state</td>
</tr>
<tr>
<td>pooling-strategy</td>
<td>One</td>
<td>How the output vectors of the ONNX model is pooled to obtain a single vector representation. Valid values are <code>mean</code> and <code>cls</code></td>
<td>string</td>
<td>mean</td>
</tr>
<tr>
<td>normalize</td>
<td>One</td>
<td>A boolean indicating whether to normalize the output embedding vector to unit length (length 1). Useful for <code>prenormalized-angular</code>
<a href="schema-reference.html#distance-metric">distance-metric</a></td>
<td>boolean</td>
<td>false</td>
</tr>
<tr>
<td>prepend</td>
<td>Optional</td>
<td>Prepend instructions that are prepended to the text input before tokenization and inference. Useful
for models that have been trained with specific prompt instructions. The instructions are prepended to the input text.
<ul>
<li>Element <query> - Optional query prepend instruction.</li>
<li>Element <document> - Optional document prepend instruction.</li>
</ul>
<pre>{% highlight xml %}
<prepend>
<query>query:</query>
<document>passage:</document>
</prepend>{% endhighlight %}</pre>
</td>
<td>Optional <query> <document> elements.</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="bert-embedder">Bert embedder</h2>
<p>
The Bert embedder is configured in <a href="services.html">services.xml</a>,
within the <code>container</code> tag:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="myBert" type="bert-embedder">
<transformer-model path="models/e5-small-v2.onnx"/>
<tokenizer-vocab url="https://huggingface.co/intfloat/e5-small-v2/raw/main/vocab.txt"/>
</component>
</container>
{% endhighlight %}</pre>
<h3 id="bert-embedder-reference-config">Bert embedder reference config</h3>
<p>In addition to <a href="#embedder-onnx-reference-config">embedder ONNX parameters</a>:</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>transformer-model</td>
<td>One</td>
<td>Use to point to the transformer ONNX model file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>tokenizer-vocab</td>
<td>One</td>
<td>Use to point to the Huggingface <code>vocab.txt</code> tokenizer file with valid wordpiece tokens. Does not support <code>tokenizer.json</code> format.</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>max-tokens</td>
<td>One</td>
<td>The maximum number of tokens allowed in the input</td>
<td>integer</td>
<td>384</td>
</tr>
<tr>
<td>transformer-input-ids</td>
<td>One</td>
<td>The name or identifier for the transformer input IDs</td>
<td>string</td>
<td>input_ids</td>
</tr>
<tr>
<td>transformer-attention-mask</td>
<td>One</td>
<td>The name or identifier for the transformer attention mask</td>
<td>string</td>
<td>attention_mask</td>
</tr>
<tr>
<td>transformer-token-type-ids</td>
<td>One</td>
<td>The name or identifier for the transformer token type IDs. If the model does not use <code>token_type_ids</code> use <code><transformer-token-type-ids/></code></td>
<td>string</td>
<td>token_type_ids</td>
</tr>
<tr>
<td>transformer-output</td>
<td>One</td>
<td>The name or identifier for the transformer output</td>
<td>string</td>
<td>output_0</td>
</tr>
<tr>
<td>transformer-start-sequence-token</td>
<td>One</td>
<td>The start of sequence token</td>
<td>numeric</td>
<td>101</td>
</tr>
<tr>
<td>transformer-end-sequence-token</td>
<td>One</td>
<td>The start of sequence token</td>
<td>numeric</td>
<td>102</td>
</tr>
<tr>
<td>pooling-strategy</td>
<td>One</td>
<td>How the output vectors of the ONNX model is pooled to obtain a single vector representation. Valid values are <code>mean</code> and <code>cls</code></td>
<td>string</td>
<td>mean</td>
</tr>
</tbody>
</table>
<h2 id="colbert-embedder">colbert embedder</h2>
<p>
The colbert embedder is configured in <a href="services.html">services.xml</a>,
within the <code>container</code> tag:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="colbert" type="colbert-embedder">
<transformer-model path="models/colbertv2.onnx"/>
<tokenizer-model url="https://huggingface.co/colbert-ir/colbertv2.0/raw/main/tokenizer.json"/>
<max-query-tokens>32</max-query-tokens>
<max-document-tokens>256</max-document-tokens>
</component>
</container>
{% endhighlight %}</pre>
<p>The Vespa colbert implementation works with default configurations for transformer models that use WordPiece tokenization.
</p>
<h3 id="colbert-embedder-reference-config">colbert embedder reference config</h3>
<p>In addition to <a href="#embedder-onnx-reference-config">embedder ONNX parameters</a>:</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>transformer-model</td>
<td>One</td>
<td>Use to point to the transformer ColBERT ONNX model file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>tokenizer-model</td>
<td>One</td>
<td>Use to point to the <code>tokenizer.json</code> Huggingface tokenizer configuration file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>max-tokens</td>
<td>One</td>
<td>Max length of token sequence the transformer-model can handle </td>
<td>numeric</td>
<td>512</td>
</tr>
<tr>
<td>max-query-tokens</td>
<td>One</td>
<td>The maximum number of ColBERT query token embeddings. Queries are padded to this length. Must be lower than max-tokens</td>
<td>numeric</td>
<td>32</td>
</tr>
<tr>
<td>max-document-tokens</td>
<td>One</td>
<td>The maximum number of ColBERT document token embeddings. Documents are not padded. Must be lower than max-tokens</td>
<td>numeric</td>
<td>512</td>
</tr>
<tr>
<td>transformer-input-ids</td>
<td>One</td>
<td>The name or identifier for the transformer input IDs</td>
<td>string</td>
<td>input_ids</td>
</tr>
<tr>
<td>transformer-attention-mask</td>
<td>One</td>
<td>The name or identifier for the transformer attention mask</td>
<td>string</td>
<td>attention_mask</td>
</tr>
<tr>
<td>transformer-mask-token</td>
<td>One</td>
<td>The mask token id used for ColBERT query padding</td>
<td>numeric</td>
<td>103</td>
</tr>
<tr>
<td>transformer-start-sequence-token</td>
<td>One</td>
<td>The start of sequence token id</td>
<td>numeric</td>
<td>101</td>
</tr>
<tr>
<td>transformer-end-sequence-token</td>
<td>One</td>
<td>The end of sequence token id</td>
<td>numeric</td>
<td>102</td>
</tr>
<tr>
<td>transformer-pad-token</td>
<td>One</td>
<td>The pad sequence token id</td>
<td>numeric</td>
<td>0</td>
</tr>
<tr>
<td>query-token-id</td>
<td>One</td>
<td>The colbert query token marker id</td>
<td>numeric</td>
<td>1</td>
</tr>
<tr>
<td>document-token-id</td>
<td>One</td>
<td>The colbert document token marker id</td>
<td>numeric</td>
<td>2</td>
</tr>
<tr>
<td>transformer-output</td>
<td>One</td>
<td>The name or identifier for the transformer output</td>
<td>string</td>
<td>contextual</td>
</tr>
</tbody>
</table>
<p>The Vespa colbert-embedder uses <code>[unused0]</code>token id 1 for <code>query-token-id</code>, and <code>[unused1]</code>,
token id 2 for <code> document-token-id</code>document marker. Document punctuation chars are filtered (not configurable).
The following characters are removed <code>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</code>.
</p>
<h3 id="splade-embedder-reference-config">splade embedder reference config</h3>
<p>In addition to <a href="#embedder-onnx-reference-config">embedder ONNX parameters</a>:</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>transformer-model</td>
<td>One</td>
<td>Use to point to the transformer ONNX model file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>tokenizer-model</td>
<td>One</td>
<td>Use to point to the <code>tokenizer.json</code> Huggingface tokenizer configuration file</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
<tr>
<td>term-score-threshold</td>
<td>One</td>
<td>An optional threshold to increase sparseness, tokens/terms with a score lower than this is not retained.</td>
<td>numeric</td>
<td>N/A</td>
</tr>
<tr>
<td>max-tokens</td>
<td>One</td>
<td>The maximum number of tokens accepted by the transformer model</td>
<td>numeric</td>
<td>512</td>
</tr>
<tr>
<td>transformer-input-ids</td>
<td>One</td>
<td>The name or identifier for the transformer input IDs</td>
<td>string</td>
<td>input_ids</td>
</tr>
<tr>
<td>transformer-attention-mask</td>
<td>One</td>
<td>The name or identifier for the transformer attention mask</td>
<td>string</td>
<td>attention_mask</td>
</tr>
<tr>
<td>transformer-token-type-ids</td>
<td>One</td>
<td>The name or identifier for the transformer token type IDs. If the model does not use <code>token_type_ids</code> use <code><transformer-token-type-ids/></code></td>
<td>string</td>
<td>token_type_ids</td>
</tr>
<tr>
<td>transformer-output</td>
<td>One</td>
<td>The name or identifier for the transformer output</td>
<td>string</td>
<td>logits</td>
</tr>
</tbody>
</table>
<h2 id="huggingface-tokenizer-embedder">Huggingface tokenizer embedder</h2>
<p>
The Huggingface tokenizer embedder is configured in <a href="services.html">services.xml</a>,
within the <code>container</code> tag:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="tokenizer" type="hugging-face-tokenizer">
<model url="https://huggingface.co/bert-base-uncased/raw/main/tokenizer.json"/>
</component>
</container>
{% endhighlight %}</pre>
<h3 id="huggingface-tokenizer-reference-config">Huggingface tokenizer reference config</h3>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>model</td>
<td>One To Many</td>
<td>Use to point to the <code>tokenizer.json</code> Huggingface tokenizer configuration file.
Also supports <code>language</code>, which is only relevant if one wants to tokenize differently based on the document language.
Use "unknown" for a model to be used for any language (i.e. by default).</td>
<td><a href="#model-config-reference">model-type</a></td>
<td>N/A</td>
</tr>
</tbody>
</table>
<h2 id="embedder-onnx-reference-config">Embedder ONNX reference config</h2>
<p>
Vespa uses <a href="https://onnxruntime.ai/">ONNX Runtime</a> to accelerate inference of embedding models.
These parameters are valid for both <a href="#bert-embedder">Bert embedder</a> and
<a href="#huggingface-embedder">Huggingface embedder</a>.
</p>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Occurrence</th>
<th>Description</th>
<th>Type</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td>onnx-execution-mode</td>
<td>One</td>
<td>Low level ONNX execution model. Valid values are <code>parallel</code> or <code>sequential</code>.
Only relevant for inference on CPU.
See <a href="https://onnxruntime.ai/docs/performance/tune-performance/threading.html">ONNX runtime documentation</a> on threading.
</td>
<td>string</td>
<td>sequential</td>
</tr>
<tr>
<td>onnx-interop-threads</td>
<td>One</td>
<td>Low level ONNX setting.Only relevant for inference on CPU.</td>
<td>numeric</td>
<td>1</td>
</tr>
<tr>
<td>onnx-intraop-threads</td>
<td>One</td>
<td>Low level ONNX setting. Only relevant for inference on CPU.</td>
<td>numeric</td>
<td>4</td>
</tr>
<tr>
<td>onnx-gpu-device</td>
<td>One</td>
<td>The GPU device to run the model on.
See <a href="/en/operations-selfhosted/vespa-gpu-container.html">configuring GPU for Vespa container image</a>. Use <code>-1</code> to not use GPU for the model, even
if the instance has available GPUs.
</td>
<td>numeric</td>
<td>0</td>
</tr>
</tbody>
</table>
<h2 id="sentencepiece-embedder">SentencePiece embedder</h2>
<p>
A native Java implementation of <a href="https://github.com/google/sentencepiece">SentencePiece</a>.
SentencePiece breaks text into chunks independent of spaces,
which is robust to misspellings and works with CJK languages.
Prefer the <a href="#huggingface-tokenizer-embedder">Huggingface tokenizer embedder</a> over this
for better compatibility with Huggingface models.
</p>
<p>
This is suitable to use in conjunction with <a href="../jdisc/container-components.html">custom components</a>,
or the resulting tensor can be used in <a href="../ranking.html">ranking</a>.
</p>
<p>
To use the
<a href="https://github.com/vespa-engine/vespa/blob/master/linguistics-components/src/main/java/com/yahoo/language/sentencepiece/SentencePieceEmbedder.java">
SentencePiece embedder</a>, add it to <a href="services.html">services.xml</a>:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="mySentencePiece"
class="com.yahoo.language.sentencepiece.SentencePieceEmbedder"
bundle="linguistics-components">
<config name="language.sentencepiece.sentence-piece">;
<model>
<item>
<language>unknown</language>
<path>model/en.wiki.bpe.vs10000.model</path>
</item>
</model>
</config>
</component>
</container>
{% endhighlight %}</pre>
<p>
See the options available for configuring SentencePiece in
<a href="https://github.com/vespa-engine/vespa/blob/master/linguistics-components/src/main/resources/configdefinitions/language.sentencepiece.sentence-piece.def">
the full configuration definition</a>.
</p>
<h2 id="wordpiece-embedder">WordPiece embedder</h2>
<p>
A native Java implementation of
<a href="https://github.com/google-research/bert#tokenization">WordPiece</a>,
which is commonly used with BERT models.
Prefer the <a href="#huggingface-tokenizer-embedder">Huggingface tokenizer embedder</a>
over this for better compatibility with Huggingface models.
</p>
<p>
This is suitable to use in conjunction with <a href="../jdisc/container-components.html">custom components</a>,
or the resulting tensor can be used in <a href="../ranking.html">ranking</a>.
</p>
<p>
To use the
<a href="https://github.com/vespa-engine/vespa/blob/master/linguistics-components/src/main/java/com/yahoo/language/wordpiece/WordPieceEmbedder.java">
WordPiece embedder</a>,
add it to <a href="services.html">services.xml</a> within the <code>container</code> tag:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="myWordPiece">
class="com.yahoo.language.wordpiece.WordPieceEmbedder"
bundle="linguistics-components">
<config name="language.wordpiece.word-piece">
<model>
<item>
<language>unknown</language>
<path>models/bert-base-uncased-vocab.txt</path>
</item>
</model>
</config>
</component>
</container>
{% endhighlight %}</pre>
<p>
See the options available for configuring WordPiece in
<a href="https://github.com/vespa-engine/vespa/blob/master/linguistics-components/src/main/resources/configdefinitions/language.wordpiece.word-piece.def">
the full configuration definition</a>.
</p>
<p>
WordPiece is suitable to use in conjunction with custom components,
or the resulting tensor can be used in <a href="../ranking.html">ranking</a>.
</p>
<h2 id="using-an-embedder-from-java">Using an embedder from Java</h2>
<p>
When writing custom Java components (such as <a href="../searcher-development.html">Searchers</a>
or <a href="../document-processing.html#document-processors">Document processors</a>),
use embedders you have configured by
<a href="../jdisc/injecting-components.html">having them injected in the constructor</a>,
just as any other component:
</p>
<pre>{% highlight java %}
class MyComponent {
@Inject
public MyComponent(ComponentRegistry<Embedder> embedders) {
// embedders contains all the embedders configured in your services.xml
}
}
{% endhighlight %}</pre>
<p>See a concrete example of using an embedder in a custom searcher in
<a href="https://github.com/vespa-cloud/vespa-documentation-search/blob/main/src/main/java/ai/vespa/cloud/docsearch/LLMSearcher.java">LLMSearcher</a>.
</p>
<h2 id="custom-embedders">Custom Embedders</h2>
<p>Vespa provides a Java interface for defining components which can provide embeddings of text:
<a href="https://github.com/vespa-engine/vespa/blob/master/linguistics/src/main/java/com/yahoo/language/process/Embedder.java">
com.yahoo.language.process.Embedder</a>.</p>
<p>
To define a custom embedder in an application and make it usable by Vespa
(see <a href="../embedding.html#embedding-a-query-text">embedding a query text</a>),
implement this interface and add it as a <a href="../developer-guide.html#developing-components">component</a> to
<a href="services-container.html">services.xml</a>:
</p>
<pre>{% highlight xml %}
<container version="1.0">
<component id="myEmbedder"
class="com.example.MyEmbedder"
bundle="the name in artifactId in pom.xml">
<config name='com.example.my-embedder'>
<model model-id="minilm-l6-v2"/>
<vocab path="files/vocab.txt"/>
<myValue>foo</myValue>
</config>
</component>
</container>
{% endhighlight %}</pre>