> For the complete documentation index, see [llms.txt](https://docs.aimlapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aimlapi.com/api-references/embedding-models/anthropic/voyage-law-2.md).

# voyage-law-2

{% columns %}
{% column width="66.66666666666666%" %}
{% hint style="info" %}
This documentation is valid for the following list of our models:

* `voyage-law-2`
  {% endhint %}
  {% endcolumn %}

{% column width="33.33333333333334%" %} <a href="https://aimlapi.com/app/voyage-law-2" class="button primary">Try in Playground</a>
{% endcolumn %}
{% endcolumns %}

## Model Overview

This model leads the MTEB leaderboard for legal retrieval by a significant margin, outperforming OpenAI v3 large by an average of 6% across eight legal retrieval datasets and by over 10% on three key benchmarks (LeCaRDv2, LegalQuAD, and GerDaLIR). With a 16K context length and training on extensive long-context legal documents, voyage-law-2 excels in retrieving information across lengthy texts. Notably, it also matches or surpasses performance on general-purpose corpora across domains.

## Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our [Quickstart guide](https://docs.aimlapi.com/quickstart/setting-up).

## API Schema

{% openapi src="/files/yrzPzpvgE3AR3NQzNS4y" path="/v1/embeddings" method="post" %}
[voyage-law-2.json](https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-1e2f1017f077054fa361a442474bde8bccafcd62%2Fvoyage-law-2.json?alt=media\&token=ac5bd267-e25a-4c01-9380-073d2544341a)
{% endopenapi %}

## Code Example

{% tabs %}
{% tab title="Python" %}

```python
import openai

# Initialize the API client
client = openai.OpenAI(
    # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
    api_key="<YOUR_AIMLAPI_KEY>",
    base_url="https://api.aimlapi.com/v1",
)

# Define the text for which to generate an embedding
text = "Laura is a DJ."

# Request the embedding
response = client.embeddings.create(
    input=text,
    model="voyage-law-2"
)

# Print the embedding
print(response)
```

{% endtab %}

{% tab title="JS" %}

```javascript
import OpenAI from "openai";
import util from "util";

// Initialize the API client
const client = new OpenAI({
  // Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
  apiKey: "<YOUR_AIMLAPI_KEY>",
  baseURL: "https://api.aimlapi.com/v1",
});

// Define the text for which to generate an embedding
const text = "Laura is a DJ.";

const response = await client.embeddings.create({
  input: text,
  model: "voyage-law-2",
});

// Convert embedding to a regular array (not TypedArray)
const pythonLikeResponse = {
  ...response,
  data: response.data.map(item => ({
    ...item,
    embedding: Array.from(item.embedding),
  })),
};

// Python-like print
console.log(
  util.inspect(pythonLikeResponse, {
    depth: null,
    maxArrayLength: null,
    compact: true,
  })
);
```

{% endtab %}
{% endtabs %}

This example shows how to set up an API client, send text to the embedding API, and print the response with the embedding vector. See how large a vector response the model generates from just a single short input phrase.

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json
CreateEmbeddingResponse(data=[Embedding(embedding=[0.001145921996794641, -0.014177074655890465, 0.03125114366412163, -0.004943643696606159, 0.040808435529470444, -0.04112643748521805, -0.002148799132555723, 0.022367684170603752, -0.005523522850126028, 0.03991401568055153, 0.0011472610058262944, -0.04464377462863922, -0.008764686062932014, 0.007735587190836668, -0.04927933216094971, -0.07220178842544556, 0.014300036244094372, -0.01632966846227646, -0.006595244165509939, -0.010660311207175255, -0.029766302555799484, -0.006220588460564613, -0.010902494192123413, -0.0033697024919092655, 0.03782792389392853, -0.025107743218541145, -0.019067829474806786, -0.024837607517838478, -0.03289186581969261, -0.019047968089580536, 0.029241429641842842, 0.03866409882903099, -0.004571191035211086, 0.0077200778760015965, -0.02732025273144245, -0.011416708119213581, 0.0006872184458188713, 0.004462233744561672, 0.004217428155243397, -0.0007986027630977333, -0.05442861467599869, 0.022397488355636597, -0.005475934129208326, -0.037046920508146286, 0.010534225963056087, 0.015138332732021809, -0.05938263610005379, -0.048910342156887054, 0.022915763780474663, -0.004510896280407906, -0.006746992468833923, -0.0086869141086936, -0.04371240735054016, -0.030562087893486023, -0.055399250239133835, -0.018822578713297844, 0.03140883520245552, 0.031007511541247368, 0.017470723018050194, 0.04167608171701431, 0.07282128185033798, 0.0258940439671278, -0.02182808518409729, -0.02368309535086155, 0.016176050528883934, -0.04326698184013367, -0.023447105661034584, 0.020617222413420677, -0.039187632501125336, 0.005500593222677708, 0.014478061348199844, 0.01988079771399498, 0.03360508382320404, 0.017932424321770668, 0.014319449663162231, 0.008472152054309845, -0.014332504943013191, 0.02586214616894722, -0.010057111270725727, -0.013000803999602795, -0.06030115857720375, 0.008836403489112854, -0.04745791107416153, -0.0003351849736645818, 0.0237923301756382, 0.0034919935278594494, -0.021912749856710434, -0.03563828393816948, 0.009686946868896484, 0.0323210284113884, 0.05512520670890808, -0.049066439270973206, 0.04279444366693497, -0.02676391787827015, -0.02919680066406727, -0.02514258213341236, -0.0061471969820559025, -0.01868845894932747, 0.011692197993397713, 0.040878452360630035, -0.031926482915878296, -0.008131025359034538, 0.009284088388085365, 0.012242062017321587, -0.004513811320066452, -0.03036213479936123, 0.01390973012894392, -0.018667036667466164, -0.05612540617585182, 0.04489113390445709, 0.024045953527092934, -0.032889802008867264, -0.01676337793469429, 0.08109244704246521, 0.025806788355112076, 0.038225702941417694, -0.005312497727572918, 0.03547114133834839, -0.021163517609238625, -0.013856060802936554, 0.03299630433320999, -0.042760856449604034, -0.016620444133877754, 0.008736232295632362, 0.017832087352871895, 0.04396145045757294, 0.023309526965022087, -0.0372849777340889, 0.017267437651753426, 0.030474606901407242, -0.019216230139136314, 0.05698663368821144, 0.02362808585166931, -0.051865749061107635, 0.04558917507529259, -0.014644593000411987, -0.0513453409075737, 0.015795020386576653, -0.008818913251161575, 0.016578935086727142, 0.007790931034833193, 0.015594187192618847, 0.045005835592746735, -0.003380358451977372, 0.02321702614426613, -0.018220271915197372, -0.004278629552572966, -0.0014467405853793025, -0.0013903927756473422, -0.004719369113445282, -0.021359004080295563, 0.02700124680995941, 0.022842232137918472, -0.04729723557829857, -0.027205772697925568, -0.0015674695605412126, 0.005131990183144808, -0.020173583179712296, 0.0022734194062650204, 0.0478912852704525, -0.0037952112033963203, -0.01200149580836296, 0.022421687841415405, -0.014169319532811642, -0.020144572481513023, -0.0017975465161725879, 0.08082287013530731, 0.04061228036880493, -0.026470687240362167, -0.003165121655911207, -0.0149068059399724, -0.02975313365459442, 0.03477265313267708, -0.012908861972391605, -0.01772407814860344, -0.04324979707598686, -0.03684401512145996, 0.03385474160313606, -0.02443435974419117, 0.018713898956775665, -0.048338938504457474, -0.0035805876832455397, 0.04770606383681297, -0.0052773780189454556, 0.0648009404540062, 0.024685973301529884, 0.004514229949563742, 0.022826053202152252, 0.030599577352404594, 0.002245203824713826, 0.019117817282676697, -0.02834968827664852, 0.013400258496403694, -0.0006651815492659807, -0.010280939750373363, -0.021007083356380463, 0.0011670105159282684, 0.040681906044483185, 0.02264975756406784, -0.006151492241770029, 0.04752608388662338, 0.0045180232264101505, -0.046775933355093, -0.04549678787589073, -0.017195971682667732, 0.016514107584953308, 0.029807137325406075, 0.03702923655509949, -0.03762640804052353, -0.014497531577944756, 0.04359368607401848, 0.019200609996914864, -0.013383966870605946, 0.02121027000248432, -0.003820037702098489, 0.03453565761446953, -0.00039186739013530314, 0.016617320477962494, -0.074774369597435, -0.02964133210480213, 0.024574726819992065, 0.0033100773580372334, -0.022461123764514923, 0.006639764178544283, -0.016722315922379494, -0.00557551858946681, -0.050562500953674316, -0.0009685105760581791, 0.0719875618815422, 0.029112668707966805, 0.028127865865826607, -0.018853290006518364, 0.039433106780052185, -0.0413379929959774, 0.044096238911151886, 0.04763464629650116, 0.03127128630876541, 0.012388900853693485, 0.028565704822540283, 0.020139440894126892, -0.029545597732067108, 0.004291349556297064, -0.05138104408979416, 0.060420773923397064, 0.009102324955165386, -0.03176669776439667, -0.052843183279037476, 0.0010598942171782255, -0.015904327854514122, -0.0012955466518178582, -0.028982121497392654, 0.039887458086013794, 0.0076407166197896, -0.04452269524335861, -0.035921476781368256, 0.00841443706303835, -0.008878106251358986, -0.00961302500218153, -0.032018423080444336, -0.024133987724781036, -0.00779667729511857, 0.005153636448085308, 0.07313369959592819, -0.00231906957924366, 0.018437398597598076, 0.04072999581694603, -0.033586785197257996, -0.03613291680812836, -0.021996792405843735, 0.01946929469704628, 0.015166339464485645, 0.027449017390608788, 0.029560547322034836, -0.008007395081222057, -0.009391727857291698, 0.005254894960671663, 0.03553050011396408, 0.03271780163049698, -0.00063377182232216, -0.049005743116140366, 0.025775544345378876, 0.01592240110039711, 0.03430044651031494, -0.0027016198728233576, -0.0330306738615036, 0.017405852675437927, -0.024000762030482292, 0.013561156578361988, 0.0647188201546669, 0.00016179034719243646, -0.017831752076745033, -0.014222655445337296, 0.008091302588582039, -0.043333929032087326, 0.03521093726158142, 0.014284470118582249, -0.03012179397046566, -0.014894223771989346, 0.012823614291846752, 0.02397453971207142, -0.042740099132061005, -0.03365696966648102, 0.012233917601406574, -0.013851150870323181, -0.0018768239533528686, -0.02254054695367813, 0.06436800956726074, -0.06637822836637497, 0.034709274768829346, 0.1046348363161087, -0.029792798683047295, 0.009003856219351292, 0.012787909246981144, -0.025163866579532623, -0.014081227593123913, 0.004209338687360287, 0.014923987910151482, -0.0256761834025383, -0.0023837299086153507, 0.024450652301311493, -0.028263993561267853, -0.03331988677382469, -0.009718021377921104, 0.02328149974346161, -0.037767112255096436, 0.014227368868887424, -0.015668446198105812, 0.0019476209999993443, 0.00867475289851427, -0.0765937864780426, -0.01449129730463028, 0.01003167126327753, 0.025557519868016243, 0.003770272945985198, -0.020493371412158012, -0.019638223573565483, 0.0034754800144582987, -0.03740191459655762, 0.03549502044916153, -0.015144553035497665, -0.018000012263655663, 0.031627897173166275, 0.05309870094060898, 0.03878309950232506, 0.028096932917833328, -0.03140696510672569, 0.013281871564686298, 0.010418071411550045, 0.013049005530774593, 0.008618460968136787, 0.02183656580746174, -0.0011184734757989645, 0.04332857206463814, 0.002970861503854394, -0.014222376048564911, 0.058815814554691315, -0.028239835053682327, -0.040106602013111115, 0.03317505866289139, -0.0274976659566164, -0.028349855914711952, 0.016879532486200333, 0.020028026774525642, -0.010273575782775879, 0.03750992193818092, -0.027580905705690384, -0.06074658781290054, -0.045263249427080154, 0.06115184351801872, 0.024669792503118515, -0.00264156237244606, -0.04330313205718994, 0.010373049415647984, -0.014033137820661068, -0.006179219577461481, -0.014256074093282223, -0.018487950786948204, -0.03582105413079262, 0.016275886446237564, -0.0006182623328641057, 0.008128626272082329, -0.03364524990320206, 0.02086797170341015, -0.012031623162329197, -0.06193959340453148, -0.02423909492790699, 0.022682951763272285, -0.06499285995960236, -0.011272882111370564, -0.008638237603008747, 0.04466685652732849, -0.0005295565933920443, -0.035249099135398865, 0.011713622137904167, -0.015474745072424412, -0.0013205440482124686, 0.05763039365410805, -0.017460638657212257, -0.05613969266414642, 0.009500217624008656, 0.07699882239103317, 0.028761640191078186, 0.010898030363023281, -0.011327109299600124, -0.018325602635741234, -0.03216414526104927, -0.009655035100877285, 0.007208541501313448, -0.0722571313381195, 0.03097604773938656, -0.027253251522779465, -0.014299142174422741, -0.015868397429585457, 0.05007243901491165, -0.0348423607647419, -0.027945322915911674, -0.012210652232170105, 0.035499636083841324, -0.05380544811487198, -0.03254016861319542, 0.002633500611409545, 0.005806042347103357, 0.048660289496183395, -0.034142617136240005, -0.058035653084516525, 0.006394847296178341, -0.031708452850580215, 0.006064188200980425, 0.05724656209349632, -0.03563583269715309, -0.05170150473713875, -0.09581559151411057, -0.0031126232352107763, -0.03960806131362915, 0.038220908492803574, -0.006394505966454744, 0.021812910214066505, 0.027239691466093063, 0.03285214677453041, -0.003753536380827427, -0.026897814124822617, 0.06423233449459076, -0.025549041107296944, -0.009102324955165386, -0.0017718833405524492, -0.029008898884058, -0.034774646162986755, 0.05623431131243706, 0.022213982418179512, 0.005656637251377106, -0.0020381121430546045, 0.007090546190738678, -0.005778035614639521, 0.025784695520997047, -0.01595900021493435, -0.02116452157497406, 0.05037861689925194, -0.03104790300130844, 0.013191883452236652, 0.0030482416041195393, 0.05810750648379326, 0.0492904894053936, 0.07818780839443207, 0.0006442603189498186, -0.022125443443655968, -0.024750130251049995, 0.002821623580530286, -0.04886247590184212, 0.03325650840997696, 0.0017020903760567307, 0.018687007948756218, 0.006303387228399515, 0.02424726076424122, -0.021118327975273132, -0.02257879078388214, -0.017508840188384056, -0.0039452300406992435, -0.004271599929779768, -0.0010283171432092786, -0.02456914819777012, 0.014620492234826088, -0.011561203747987747, 0.0025493695866316557, -0.08945644646883011, 0.038821205496788025, 0.05850384011864662, 0.0032496429048478603, -0.001494050258770585, 0.03358633816242218, -0.043318528681993484, 0.0013525673421099782, 0.00973509345203638, 0.00237140036188066, 0.024588339030742645, 0.018827933818101883, -0.018944310024380684, 0.028625009581446648, 0.030285870656371117, -0.00808706320822239, 0.027217155322432518, -0.04330090060830116, 0.028323130682110786, -0.02708069235086441, 0.026323961094021797, 0.016147680580615997, 0.010424653999507427, -0.015739301219582558, 0.011106517165899277, 0.0319095216691494, -0.022035622969269753, 0.0016723055159673095, -0.005198324099183083, 0.0033427560701966286, -0.037746917456388474, -0.05215674638748169, 0.02827559784054756, 0.007057853043079376, 0.0256655290722847, 0.02479677088558674, -0.05218888446688652, 0.039632610976696014, -0.025019481778144836, -0.0014387067640200257, -0.0037899392191320658, 0.003820874495431781, -0.03125030919909477, -0.011954410001635551, -0.0298533346503973, -0.03917691856622696, -0.0275180134922266, -0.03595015034079552, 0.013233447447419167, -0.04498976841568947, 0.02391752414405346, 0.0597066693007946, -0.02744879387319088, 0.013675106689333916, 0.013478116132318974, 0.03886896371841431, 0.006187755614519119, 0.0832320973277092, -0.026846738532185555, 0.016496367752552032, 0.012189955450594425, -0.019241448491811752, -0.021130265668034554, -0.010129415430128574, 0.03591187670826912, 0.03418712317943573, 0.031019115820527077, -0.011840041726827621, -0.028119970113039017, -0.004102333914488554, -0.08377571403980255, -0.058411356061697006, -0.014628303237259388, -0.0073417117819190025, 0.009914959780871868, -0.034190207719802856, -0.005446309689432383, 0.0006849311175756156, -0.0326559878885746, -0.04293759539723396, -0.02534380927681923, -0.030421050265431404, 0.002926076063886285, -0.021355656906962395, 0.02484145760536194, 0.008068540133535862, -0.01780553162097931, 0.012713820673525333, -0.03941882401704788, 0.019537579268217087, -0.04231899976730347, 0.013900693506002426, 0.000768852885812521, -0.00825114082545042, 0.0701255202293396, 0.0009972980478778481, -0.01979934610426426, -0.014732741750776768, -0.002510149497538805, -0.0032736605498939753, -0.011174469254910946, -0.009924611076712608, -0.03716268762946129, 0.004407120402902365, 0.02614334039390087, -0.01884818635880947, 0.007994117215275764, -0.02295682393014431, 0.0420764684677124, 0.023643484339118004, -0.012180916033685207, -0.022807586938142776, 0.04378649219870567, 0.01729527674615383, 0.03923940286040306, 0.0003632472362369299, -0.02712811529636383, -0.020127221941947937, 0.016544179990887642, -0.00515709538012743, -0.014552651904523373, 0.042291272431612015, 0.028434263542294502, -0.007061869837343693, 0.019150177016854286, -0.01954650692641735, -0.016914566978812218, 0.0475025400519371, -0.020649580284953117, 0.02170177735388279, -0.008819610811769962, -0.03432633355259895, 0.05817713215947151, -0.05076763778924942, -0.0005134891252964735, 0.03977788984775543, 0.05272636190056801, -0.0700460746884346, -0.01899290457367897, -0.0075101968832314014, 0.00827697105705738, 0.028025882318615913, 0.04586365818977356, -0.059258561581373215, 0.017685359343886375, 0.019320223480463028, 0.0122474180534482, 0.014716004021465778, 0.014744178391993046, 0.02210865169763565, -0.017463093623518944, 0.030344728380441666, -0.01971365138888359, -0.02899673767387867, 0.02536839246749878, 0.030788537114858627, -0.01567893661558628, -0.012389346957206726, -0.0164337158203125, -0.02727450430393219, 0.0012375846272334456, 0.016269108280539513, 0.04073992744088173, -0.027392780408263206, 0.027683110907673836, -0.04990730062127113, 0.009327046573162079, -0.05764467641711235, 0.06980148702859879, 0.01641201414167881, 0.007253619376569986, 0.03552503138780594, 0.050266142934560776, 0.02752712182700634, -0.018076837062835693, 0.03913095220923424, -0.047113798558712006, 0.013959941454231739, 0.0347130112349987, -0.007833330892026424, 0.015391549095511436, -0.01305862981826067, -0.054397713392972946, 0.027038181200623512, 0.07026432454586029, -0.06392616033554077, -0.03929084539413452, -0.023326821625232697, -0.02984619140625, -0.0047892178408801556, 0.022590843960642815, 0.009632774628698826, -0.028107335790991783, -0.024359244853258133, -0.012757671996951103, 0.048776112496852875, -0.026022136211395264, 0.01249914150685072, 0.0053896550089120865, -0.03995976224541664, -0.001355189480818808, 0.041087161749601364, 0.009370562620460987, 0.004791058599948883, -0.016357561573386192, -0.04828270152211189, -0.004562934394925833, -0.012064873240888119, -0.017316868528723717, -0.0721946507692337, -0.06088494509458542, -0.03201964870095253, -0.029732953757047653, -0.009372320026159286, 0.06887761503458023, 0.03077816031873226, 0.016479406505823135, 0.001433936762623489, 0.06095457077026367, -0.01486306544393301, -0.13356876373291016, -0.05411162227392197, -0.007502831984311342, -0.054387446492910385, -0.011197901330888271, 0.019364185631275177, 0.01709839515388012, -0.0033500646241009235, 0.011623465456068516, 0.05273696035146713, 0.00012095223064534366, -0.01641283929347992, 0.03422435000538826, 0.00609810184687376, -0.013006828725337982, -0.008665547706186771, -0.026904061436653137, 0.00842710118740797, 0.0016631907783448696, 0.006401988677680492, -0.004724724683910608, 0.014352003112435341, 0.019987469539046288, -0.017628872767090797, -0.01024230569601059, -0.01165593508630991, 0.05975732207298279, 0.02418575994670391, 0.006196905393153429, 0.04520399868488312, -0.04037841036915779, 0.0565137080848217, 0.01152170542627573, 0.04481983184814453, 0.02531561441719532, -0.020357493311166763, -0.015405342914164066, 0.0006071043317206204, -0.054909415543079376, -0.011409232392907143, 0.0087437080219388, -0.050664257258176804, -0.03172898665070534, 0.050861530005931854, 0.04358208179473877, -0.0014600184513255954, 0.04910749942064285, -0.06658889353275299, 0.01363769918680191, 0.01531574409455061, -0.010150113143026829, -0.005136564839631319, -0.010456343181431293, -0.0037545403465628624, -0.007348629180341959, -0.007315573748201132, 0.033995166420936584, -0.039274662733078, 0.037698715925216675, -0.03998163342475891, 0.01217717956751585, 0.011987884528934956, 0.046892423182725906, -0.005388846155256033, -0.02546066790819168, -0.014757176861166954, 0.004274612758308649, -0.044090885668992996, -0.05012867599725723, -0.001559658907353878, 0.023817772045731544, 0.020754104480147362, -0.00782752875238657, -0.06430552899837494, 0.029789062216877937, 0.04195212572813034, 0.009223947301506996, 0.030174681916832924, 0.014573629014194012, -0.04551463946700096, -0.04100548475980759, -0.051445312798023224, 0.04484962671995163, -0.02416422590613365, -0.008851327002048492, -0.006876201368868351, -0.0504966638982296, -0.006871961522847414, 0.01833285577595234, 0.024722011759877205, -0.016506576910614967, 0.02045353688299656, 0.02139381691813469, 0.002282694447785616, 0.021176906302571297, 0.03238485008478165, 0.030947256833314896, -0.01740194670855999, 0.040927156805992126, 0.018257539719343185, 0.020330576226115227, 0.02818661369383335, 0.02111571468412876, 0.023179981857538223, -0.02116931974887848, -0.027575546875596046, -0.015910129994153976, -0.0795624703168869, 0.03904213011264801, -0.04399341717362404, -0.014630758203566074, 0.007061535492539406, 0.017312126234173775, 0.006566178053617477, 0.007352422922849655, 0.0294659286737442, -0.013821777887642384, -0.020154837518930435, 0.01053701527416706, 0.004062109626829624, -0.031318049877882004, -0.007823735475540161, -0.0388261154294014, 0.0027591390535235405, 0.004971649963408709, -0.02874244563281536, -0.009154600091278553, 0.006594518665224314, -0.010884920135140419, 0.006409798748791218, 0.010209082625806332, 0.009118547663092613, 0.01654903218150139, -0.013935839757323265, 0.02535165473818779, -0.005364633165299892, -0.005297881085425615, -0.04568289965391159, -0.030474606901407242, -0.0047396766021847725, -0.03981247916817665, -0.012568098492920399, -0.019353361800312996, 0.07065842300653458, -0.04424932599067688, -0.03879431262612343, 0.002386351814493537, 0.024101408198475838, 0.0029976684600114822, 0.05570051446557045, -0.055808521807193756, 0.03990798816084862, 0.022983547300100327, 0.023997638374567032, 0.05878903344273567, 0.021059971302747726, -0.00211130827665329, 0.07313459366559982, 0.03020670637488365, -0.06616935133934021, 0.05138104408979416, -0.0009026785846799612, 0.014691903255879879, 0.0008158697164617479, -0.017611494287848473, -0.028630197048187256, 0.08436128497123718, 0.028457581996917725, 0.0071507710963487625, -0.004520757123827934, -0.027482938021421432, 0.000503795628901571, 0.0028312753420323133, -0.014958145096898079, 0.044937100261449814, -0.030961986631155014, 0.017850719392299652, 0.004546197131276131, -0.026507509872317314, 0.020620599389076233, -0.01898994669318199, 0.01429445669054985, -0.021233590319752693, -0.005318774376064539, -0.012734482996165752, -0.05226006731390953, 0.015037800185382366, -7.698989065829664e-05, 0.02224896289408207, -0.001069378457032144, 0.0071364049799740314, -0.028092160820961, -0.03832445293664932, 0.006845294032245874, 0.005781383253633976, 0.01684282347559929, -0.011956529691815376, 0.046709880232810974, -0.0028558787889778614, 0.04565317928791046, 0.037477340549230576, -0.02403870038688183, -0.0030974482651799917, -0.011234800331294537, 0.020296990871429443, 0.004416207317262888, 0.0357099212706089, -0.039288051426410675, 0.0006339950487017632, 0.019149282947182655, -0.012298967689275742, -0.010015380568802357, 0.015221905894577503, 0.0026466669514775276, 0.004475902300328016, -0.04051319509744644, 0.05703277140855789, 0.05664955452084541, 0.056078989058732986, -0.02330433763563633, -0.037176523357629776, 0.061608873307704926, 0.023199619725346565, 0.006516887340694666, -0.0071214125491678715, 0.014034085907042027, -0.004593953490257263, 0.0018388309981673956, -0.04336918890476227, -0.015650872141122818, 0.018403764814138412, -0.016374243423342705, 0.015836654230952263, -0.039694201201200485, 0.0013733211671933532, -0.019124846905469894, 0.0002367718261666596, -0.05424729734659195, 0.030994122847914696, -0.02692369930446148, -0.0016109856078401208, -0.025020822882652283, -0.04652688652276993, 0.04564094915986061, -0.03955436497926712, -0.06208464875817299, 0.03464500606060028, -0.013441940769553185, -0.02546435222029686, 0.0045301299542188644, -0.041565392166376114, 0.007141537964344025, -0.015179616399109364, -0.03355598822236061, 0.012590684927999973, -0.01913689821958542, -0.02782280743122101, -0.02182351052761078, 0.02225961908698082, 0.020398583263158798, -0.06530706584453583, -0.011126712895929813, -0.0277753584086895, -0.0377732515335083, -0.06500803679227829, 0.0044650789350271225, 0.005462377332150936, 0.045227207243442535, 0.0639609694480896, -0.028674662113189697, 0.008761003613471985, 0.028341539204120636, 0.02175913006067276, -0.01818227954208851, -0.01638925075531006, 0.06151960790157318, 0.0036959610879421234, -0.035613514482975006, -0.06519994884729385, -0.0032936055213212967, 0.06449387222528458, -0.0008187429048120975, -0.0672534629702568, 0.001694223959930241, -0.04592391103506088, -0.0343276746571064, -0.0029521717224270105, 0.01506033819168806, -0.024530766531825066, -0.0422944538295269, -0.014840415678918362, -0.0017866117414087057, 0.004992069210857153, -0.014189683832228184, -0.021117448806762695, -0.04160444438457489, 0.0063484301790595055, 0.016624823212623596, 0.02222709357738495, 0.03675296530127525, 0.02001313306391239, -0.06132769212126732, -0.015704600140452385, 0.021822283044457436, -0.018610578030347824, 0.014797680079936981, 0.05640926957130432, 0.051336076110601425, -0.08115136623382568, -0.010242333635687828, -0.0350770428776741, -0.014551089145243168, -0.011493307538330555, 0.010676154866814613, 0.045147765427827835, -0.06744225323200226, 0.041737113147974014, -0.006552007049322128, -0.034074876457452774, 0.06167224794626236, -0.036563724279403687], index=0, object='embedding')], model='voyage-law-2', object='list', usage=Usage(prompt_tokens=None, total_tokens=6), meta={'usage': {'credits_used': 2}})
```

{% endcode %}

</details>

You can find a more advanced example of using embedding vectors in our article [Find Relevant Answers: Semantic Search with Text Embeddings](/use-cases/find-relevant-answers-semantic-search-with-text-embeddings.md) in the Use Cases section.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.aimlapi.com/api-references/embedding-models/anthropic/voyage-law-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
