> 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-code-2.md).

# Voyage Code 2

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

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

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

## Model Overview

This embedding model is designed for semantic retrieval of code and related text from both natural language and code-based queries. In a comprehensive evaluation across 11 code retrieval tasks—sourced from popular datasets like HumanEval and MBPP—it achieved a significant 14.52% improvement in recall over competitors, including OpenAI and Cohere. Additionally, it demonstrated consistent gains, averaging 3.03%, across various general-purpose text datasets.

## 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/7PUMUiQpe1Ru3EWM1Hao" path="/v1/embeddings" method="post" %}
[voyage-code-2 (1).json](https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-5808a74e4d0eab3f7f8308ab36d84298a9d5a046%2Fvoyage-code-2%20\(1\).json?alt=media)
{% 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-code-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-code-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 Python 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.015611, 0.016381765, 0.015262494, 0.028116634, 0.026989678, 0.000494121, -0.025271986, -0.011951271, -0.056328308, 0.021407766, -0.012444285, 0.059624858, -0.035985306, -0.046485253, -0.000635049, -0.036895629, 0.037314452, -0.027377753, -0.03597226, 0.018330064, 0.014466659, 0.064007834, -0.017127983, -0.010960116, 0.019682391, -0.019696601, -0.020545894, -0.036266111, 0.022564862, 0.015046909, 0.005086916, -0.055712417, -0.009372988, -0.05443871, 0.010829321, 0.01392135, 0.012792529, 0.00985686, 0.038214996, -0.017488923, 0.027313927, 0.001062958, 0.0097226, -0.03439014, 0.047425389, -0.037770782, 0.028628167, 0.009835372, 0.027161121, -0.004167856, -0.00672366, 0.000454347, -0.017227914, 0.027887423, 0.007638352, -0.010299153, -0.02586738, 0.021838237, 0.046358533, 0.026485134, 0.02549421, -0.042892404, 0.035525952, -0.037090834, 0.022934681, -0.027275261, -0.031381506, 0.002224463, -0.036881655, 0.018545765, 0.016824408, 0.01838477, 0.018052051, -0.016227443, 0.037551586, -0.040155433, -0.026702231, -0.016971217, -0.030671043, 0.002195622, 0.051781811, 0.030518234, -0.04866416, 0.031219378, -0.016983096, 0.016476454, -0.006486237, -0.042233393, -0.002773252, -0.040842075, -0.005939151, 0.011872188, 0.023673562, -0.026831048, 0.017583612, -0.036388755, -0.032783795, -0.000287563, -0.027190471, -0.0390778, 0.010886581, 0.014972136, -0.015995087, -0.013510212, -0.003812624, 0.003719332, 0.00348453, 0.053938825, -0.000124156, -0.023103451, 0.028389407, 0.01323488, 0.009557214, 0.02266226, 0.001955404, -0.047263268, 0.026736386, 0.036146846, 0.025940521, -0.035005916, -0.028510768, 0.007205901, -0.008451774, 0.035909835, 0.020070933, 0.051763173, 0.001338349, 0.02156928, -0.010956738, -0.016569598, -0.006681964, -0.021342516, -0.006222259, 0.011128997, 0.055099327, 0.009063849, 0.001973457, 0.003928495, 0.036765184, 0.031590916, 0.022166915, 0.000420003, -0.010268055, -0.068100102, 0.00809546, -0.023065213, -0.038423706, -0.049879633, 0.016797153, -0.025161108, -0.007720867, 0.013069551, -0.006471504, -0.028841076, -0.075326793, 0.02133905, 0.003436457, -0.022415226, 0.002941419, 0.040881678, -0.018296639, 0.00921459, 0.03463123, 0.033101056, -0.008069638, -0.029624565, 0.018412407, -0.015460201, -0.013632738, 0.019308757, -0.017245501, 0.02154031, 0.010338636, 0.025030896, -0.02780077, -0.032005314, 0.000267355, -0.026330926, -0.003410077, -0.008583209, 0.032415751, 0.004901031, -0.028110811, 0.004195867, -0.004088773, -0.033787295, -0.016172703, -0.029049715, 0.026614645, -0.035513837, 0.033748161, 0.017315267, 0.064818926, 0.007677719, -0.010386271, -0.001057964, 0.023316467, 0.001422498, -0.039107617, 0.028060731, -0.01471736, -0.023774076, 0.008702532, 0.006201076, 0.015451756, -0.02938685, -0.007175386, -0.027763966, -0.029969895, -0.009932857, -0.039219659, 0.012605711, -0.006088872, 0.019028416, 0.04584793, -0.016598979, 0.034786601, 0.025516806, -0.059132893, -0.037109409, -0.003896716, 0.03235985, 0.017011747, -0.009764849, 0.026055971, -0.028698517, 0.017838636, 0.001355179, -0.00779378, -0.011981669, -0.022837313, 0.027087046, -0.001790017, -0.010994941, 0.020262875, 0.023161562, -0.019865714, 0.032496117, -0.023300394, -0.010266366, 0.015670486, 0.004460398, -0.010391513, -0.015774146, -0.009346084, 0.018950731, -0.02709054, -0.028998075, -0.054021753, 0.013167793, 0.011030814, 0.007862847, 0.005070377, -0.000759557, 0.000793489, -0.054297082, 0.034167916, -0.019880621, 0.02641991, 0.038295127, -0.017762044, 0.056693558, 0.03424304, -0.029434605, -0.000219647, 0.017203951, 0.016556468, -0.005071542, 0.04677207, -0.015545865, 0.000654765, -0.050357625, 0.015936911, -0.00074884, 0.027610691, 0.03909364, -0.011458663, -0.008858659, 0.015301278, 0.006836169, 0.000164921, -0.026906285, 0.019307591, -0.001797821, -0.013217874, -0.012339754, -0.043093197, 0.022559881, 0.01490074, -0.011686536, 0.02538636, 0.034338895, 0.019348122, -0.005348564, -0.003482434, 0.021459246, -0.044842567, -0.028761964, 0.018909441, -0.027968049, 0.026672415, -0.032805227, 0.011964898, 0.025785385, 0.044160988, 0.02507434, -0.005189846, 0.018182497, -0.011724213, -0.001976419, -0.019829841, -0.00734696, -0.000371858, -0.001410153, 0.027824996, -0.024330683, 0.030691365, -0.032004382, 0.036360804, -0.018323893, 0.018969597, -0.010687898, 0.035673633, 0.006694892, -0.007840834, 0.013054301, -0.000389386, -0.024205361, -0.016925793, -0.02575743, -0.000165386, 0.030299271, 0.013027214, 0.038340781, -0.009825821, 0.008132764, -0.007000391, -0.037161179, -0.010215527, 0.031265035, 0.015670953, -0.005347385, -0.039390869, 0.014860559, -0.035821315, -0.009872874, -0.028576458, -0.002587163, 0.040891401, -0.024546077, 0.021533787, 0.034094777, -0.050905496, 0.015685512, -0.033866495, -0.000772789, 0.037627056, -0.007396445, -0.040399026, -0.000197488, -0.015808154, 0.02177418, 0.011872421, 0.038658511, 0.0426194, 0.015379932, -0.040902641, -0.008455093, -0.024551915, 0.004770935, -0.016702231, 0.055900633, -0.012855888, -0.021779072, 0.005040241, 0.012406258, 0.039369438, 0.007326621, 0.00689513, -0.039187744, -0.008432061, 0.020185595, -0.011021, 0.033220321, 0.00132267, 0.020309927, 0.023763478, -0.00414794, -0.031565759, -0.023394037, 0.025752308, 0.020198582, 0.038441993, -0.007633868, 0.023998277, 0.017810496, 0.005160058, 0.027906992, 0.030801022, 0.029096726, -0.031985048, -0.030738126, -0.00627467, 0.027680574, -0.003697211, -0.022719562, 0.019191004, 0.016859522, -0.020008272, -0.026645396, -0.023417097, -0.000267239, 0.025659597, -0.048059918, 0.010213664, -0.007070855, 0.007548583, -0.036012795, -0.012392806, 0.017474597, -0.002490173, -0.021732775, -0.030866243, -0.022850109, 0.007194837, 0.022641642, 0.046713531, 0.032564715, 0.041126203, 0.04461056, -0.006376931, -0.015022743, -0.064248227, -0.024678169, -0.022263817, 0.021715712, 0.009394215, -0.057244223, -0.015287651, 0.03833985, 0.021717804, -0.016180331, -0.017088385, 0.012107222, -0.00306757, 0.007209512, 0.000661197, -0.03068828, -0.034486111, 0.022149444, -0.01720299, 0.054231863, 0.015475634, -0.043653183, 0.020307802, -0.026378913, 0.011381386, 0.002471269, -0.004868681, -0.002345242, 0.029836655, 0.01477309, 0.030104067, 0.034129251, 0.013569321, -0.033810124, 0.014772042, 0.028001098, 0.012205523, 0.007632704, 0.003523664, -0.019178078, 0.035184927, 0.03753062, 0.042594243, 0.032781933, 0.020368861, 0.008273867, 0.021707559, 0.008643657, 0.01484006, -0.015387419, 0.026205169, 0.017482458, 0.004658003, 0.008840374, -0.010825594, -0.018101435, 0.012904659, -0.02008188, 0.038989633, -0.032659408, 0.003149099, -0.051365085, -0.051896881, -0.0103992, 0.023441555, -0.017339958, -0.0056126, -0.026190698, 0.013750197, 0.033381984, 0.026715508, 0.01451348, 0.030357504, -0.043078754, 0.007957769, 0.042994898, -1.7907e-05, 9.7601e-05, 0.030064965, 0.01354428, -0.020923488, 0.006907099, 0.018497197, -0.017796518, 0.032020688, 0.005771552, 0.035817079, -0.024985239, 0.000536269, 0.031402934, 0.010627712, 0.004155976, 0.005783042, 0.013424434, -0.02892866, -0.031268761, -0.022247424, -0.025858061, 0.00743785, 0.043632913, -0.008121845, 0.038240153, -0.0066504, -0.022195799, -0.014472716, 0.015444652, 0.056213651, -0.02303531, 0.019451221, -0.001878538, 0.010490861, -0.013677478, -0.047267925, -0.006145244, 0.03423325, -0.023927465, -0.026708286, -0.020278713, 0.017376296, -0.033349369, -0.040836021, 0.000131643, -0.005370519, 0.003878663, 0.035750501, 0.036146499, -0.018382505, -0.0313394, -0.0297118, -0.031755138, -0.039810274, 0.018974256, -0.002660772, 0.019133937, 0.019708479, -0.045819979, 0.056935813, -0.047368087, -0.008553044, -0.008238053, -0.010541642, -0.009270364, -0.009780166, 0.01240818, 0.015221381, 0.011449492, -0.004644944, -0.003332421, -0.003668552, 0.008332102, -0.009887608, 0.004527135, -0.000840443, -0.018239103, -0.028126884, 0.039549269, -0.008352513, 0.023325318, 0.024531709, 0.020384176, -0.016664436, -0.053531185, 0.03832937, 0.03291098, -0.028109182, -0.030703187, 0.007889867, 0.006861967, -0.007612088, 0.002401773, 0.000229219, -0.01053113, 0.018540291, -0.045134205, 0.005439235, 0.031725321, 0.041210584, 0.068142027, -0.04373844, -0.006974651, 0.024038345, 0.02907506, -0.016794357, 0.021829618, 0.003944119, 0.020799797, 0.06064979, -0.003670648, 0.003946331, -0.072844014, -0.013736164, -0.028947761, 0.014498338, 0.017725239, -0.014983084, 0.016463643, 0.010431287, 0.029970827, 0.006815846, 0.007061843, -0.033205878, -0.018893892, 0.01319132, -0.01642218, 0.011988658, 0.003912148, -0.017554611, 0.000968865, 0.041245062, -0.027315559, 0.040810864, -0.022731557, 0.007542265, 0.04177523, 0.009034295, 0.008090428, -0.051856816, 0.028538255, 0.028897448, 0.031723224, 0.027290866, 0.030006234, -0.002491673, 0.001948736, -0.022764636, 0.008652334, 0.03118537, -0.022183001, 0.043283511, -0.00111713, -0.017360223, -0.012476343, 0.016625332, -0.036035385, -0.014988209, 0.03618563, 0.011506612, -0.015947102, 0.001922764, -0.084294006, -0.005222864, -0.020355582, 0.058243997, 0.001653283, 0.04175543, -0.016341962, 0.023160107, -0.028642146, -0.01251341, 0.014522098, -0.004431193, 0.046760585, 0.053287994, -0.031150661, -0.0014462, -0.009594921, -0.0391174, -0.04584001, 0.03600068, -0.026939364, 0.052646946, -0.009305509, 0.023651665, 0.025636302, -0.020257866, -0.021728059, -0.015569856, 0.010018519, -0.02437564, 0.005361609, 0.027821269, -0.007882501, 0.022768479, 0.03887631, 0.0074131, -0.014477491, -0.027937505, -0.017782075, -0.032050971, -0.012589843, 0.015063564, -0.004670072, -0.032362644, 0.008738464, 0.007616048, -0.008742598, -0.008126941, 0.01282677, -0.019974729, 0.044416755, 0.018706245, 0.004110466, -0.037363835, 0.001835193, -0.003515686, 0.002670948, 0.019135538, 0.022398455, 0.01745078, 0.006963208, 0.037930578, -0.010789867, 0.007281198, 0.008048629, -0.006295373, 0.022937009, -0.011130307, -0.034877449, -0.012287984, -0.022205582, -0.049219251, 0.029961511, 0.002944651, -0.014541316, 0.02640046, -0.000927329, 0.018898783, 0.014154056, 0.005410526, -0.000258329, -0.026302043, -0.032856006, 0.045477092, -0.006668744, 0.007745023, 0.014358838, -0.010156244, 0.036752138, -0.022165982, 0.028456725, -0.012960317, -0.018919632, 0.01604048, 0.02016364, -0.024941329, 0.0013182, -0.012210182, 0.007593337, -0.000710463, 0.029780284, 0.012326651, -0.037585128, 0.009976067, 0.03007332, -0.033798944, 0.015984429, 0.012692219, -0.02526593, -0.039634056, -0.025179744, -0.022155734, -0.052543521, -0.062722944, -0.002050327, 0.018734971, 0.028678484, -0.014052029, -0.037452821, 0.019475307, 0.028859012, 0.014578586, 0.001146175, 0.006506037, -0.001387922, 0.017282655, -0.018453784, -0.023963971, -0.003730572, 0.045663442, -0.022658793, -0.009229324, -0.023069087, 0.025768846, -0.009896314, 0.017938552, -0.011646354, -0.039687168, -0.018215343, -0.017861508, -0.044688828, -0.040194042, 0.045632694, -0.069371015, 0.022027617, -0.006465214, 0.018402275, 0.015563626, -0.013454656, -0.019538434, 0.010059197, -0.011015439, -0.010352844, 0.016007345, -0.030400831, 0.016225813, 0.031665225, -0.020887615, -0.00609621, -0.00903313, 0.009699306, 0.019045362, 0.014117499, -0.001653399, 0.027659375, 0.033881404, -0.035415307, -0.012575429, 0.002386923, 0.045318693, 0.019648731, -0.027894411, 0.063151546, -0.019919056, -0.005587909, -0.023773842, -0.003372487, 0.004125345, -0.035242464, 0.008068765, -0.039144419, -0.047504593, -0.032891646, 0.00299862, -0.003852923, -0.015390843, 0.017134739, 0.006639453, 0.013510912, -0.022561979, -0.002769059, -0.001198068, 0.00210565, -0.012595928, 0.014941155, -0.020060217, 0.02406257, 0.003997694, -0.012755258, 0.027232867, 0.0141077, -0.002023422, -0.022545673, 0.013797863, -0.017208988, -0.025878558, -0.006478958, 0.063711539, 0.04815216, 0.053829342, 0.024223238, -0.016742732, 0.062703371, 0.02559915, -0.008966394, -0.023493268, -0.02120115, 0.000611824, -0.002047706, 0.0226682, 0.013453784, -0.005134494, 0.026178585, 0.037016757, -0.022436425, 0.01363996, -0.037418343, -0.001696376, -0.01873149, -0.027977804, -0.016997539, -0.008062853, -0.015733147, -0.03153431, -0.001088231, 0.028254069, -0.005617798, -0.00650365, 0.018883877, -0.013767377, -0.017329738, -0.014273304, -0.01020819, -0.024503173, 0.033769123, -0.001677159, 0.01848951, 0.002620939, -0.01345687, 0.048838396, -0.039051712, -0.037484501, -0.010618104, -0.023755556, -0.043276288, -0.022812387, 0.041284196, 0.000191133, 0.044082254, 0.00988854, 0.000775162, -0.004219532, 0.029304622, -0.000159563, 0.047956958, -0.009022107, 0.009663695, 0.013498711, 0.013341753, -0.006239263, 0.0262876, 0.008061776, 0.005327804, -0.029840384, -0.018596197, -0.036637533, 0.018667594, 0.019062307, 0.013389318, 0.015211889, -0.00793925, 0.006764511, 0.01986222, -0.021661904, 0.020057306, -0.008008783, 0.045864701, 0.025284158, 0.03566758, 0.003686838, 0.015757034, -0.007217112, -0.036837861, 0.002733186, -0.010106512, 0.001044905, 0.008318242, -0.014558088, -0.013355759, 0.003240178, 0.014596032, 0.006481752, 0.028111978, 0.009407085, 0.033123419, -0.021547282, 0.018333012, -0.012182579, 0.046242468, 0.014572355, 0.005895446, -0.024843615, 0.037900526, -0.021420114, -0.022534957, 0.049734276, 0.005535614, 0.019395176, -0.003887281, 0.010220885, -0.026501905, 0.045801811, -0.036292784, -0.008702532, -0.040622182, -0.018621936, -0.029899081, -0.036115285, -0.001091667, 0.028605225, 0.011706801, -0.061634656, 2.539e-05, 0.023150848, 0.04028349, 0.009031616, -0.051419828, 0.036838792, -0.032690387, 0.019212786, 0.021576183, 0.006947805, -0.023350826, 0.015494268, -0.009872583, -0.037689485, 3.3776e-05, -0.016289581, 0.024223763, 0.011166267, 0.034005791, -0.01973387, -0.011461983, 0.004578876, 0.033777047, -0.059561502, 0.010628761, 0.012592085, -0.028173238, 0.004983928, -0.055424977, 0.023941442, 0.015258144, -0.02407841, -0.027858073, -0.022866197, -0.01072118, 0.000891806, -7.3929e-05, 8.7527e-05, 0.038084548, 0.032564133, 0.011673957, 0.014724988, 0.023894854, 0.009600103, 0.010993776, -0.032555282, -0.050410733, -0.017919976, -0.010584779, 0.019684136, 0.001148737, 0.027992537, 0.029773993, -0.035321895, 0.004375172, -0.018227717, -0.035163496, -0.021728756, 0.034177467, 0.020600634, -0.002479982, -0.015657792, 0.019945988, 0.003030882, -0.03452152, -0.023360493, -0.014217298, -0.016765997, 0.030197244, 0.063730173, -0.009890462, 0.001885406, 0.014999543, -0.017975181, 0.015541205, 0.011049449, -0.056103755, -0.021746986, -0.011690029, -0.007622119, 0.008191464, -0.055434987, -0.026299478, -0.0289841, -0.017471859, -8.3916e-05, -0.014356364, 0.024609976, 0.025466723, 0.026995735, -0.006338262, 0.001575607, -0.024756495, 0.012681999, -0.038303509, 0.018343575, -0.029486548, -0.027943794, 0.019458303, 0.009602433, 0.01613613, -0.013485755, 0.01825813, 0.017384276, -0.000316928, 0.017263787, 0.032837603, -0.009313444, 0.032886986, 0.0102118, 0.035332147, 0.025198612, -0.016384443, 0.036642659, -0.013293929, 0.013863727, 0.016344845, 0.018475069, -0.000290649, -0.007840252, 0.018346254, -0.017929759, -0.023469042, -0.04118729, 0.038131136, 0.028544776, -0.010191069, -0.040393438, -0.03620613, -0.029817089, -0.0319359, -0.022628715, -0.007936688, -0.000475428, -0.021273594, -0.000706794, -0.026177952, -0.023912091, 0.005262377, 0.008055895, -0.004182644, -0.020185538, 0.035657313, 0.035227787, 0.018733107, 0.02888347, 0.004832547, -0.008453495, -0.003766736, 0.050058998, -0.039882839, -0.021579908, 0.016212068, 0.005246013, 0.007194546, 0.022853501, 0.008869258, 0.011671642, -0.026226453, -0.017740613, 0.011699114, -0.050423194, -0.007674807, -0.010096263, 0.025419205, -0.014626921, 0.02581986, -0.001477996, 0.047581926, 0.017626006, -0.039669465, 0.004964914, -0.010106803, 0.016803266, 0.002636051, 0.009402979, 0.026830349, -0.017281257, 0.026732512, 0.044769306, -0.022035304, -0.002668662, -0.048302639, -0.01875902, 0.049695149, 0.008410485, 0.014944417, 0.021057194, -0.002655734, -0.011493313, -0.05742405, -0.027233506, -0.025073057, 0.006897956, -0.014840759, -0.006567823, 0.021026913, 0.021548696, -0.045652263, -0.040652465, -0.002003258, -0.026414275, -0.013808841, -0.018532604, 0.003003978, 0.032578111, -0.012093013, -0.015617376, -0.00637332, -0.017388644, -0.076099686, 0.024051156, 0.054509755, 0.007753249, -0.022590397, -0.017270193, 0.005862136, 0.00566705, 0.056552865, -0.018218137, 0.002630227, -0.018802524, 0.008255202, 0.010540069, -0.025897196, 0.024512608, -0.032300681, 0.018701049, 0.056824006, 0.005657848, 0.029999042, -0.00605466, 0.034501251, 0.028386846, -0.031859726, 0.020399375, 0.010903133, -0.009345181, -0.010869314, 0.02023329, -0.005056008, 0.011826298, -0.051125389, 0.017834837, -0.030273182, -0.025018549, 0.02829227, 0.002678679, 0.040275104, 0.017609002, 0.042985346, 0.048773643, -0.011546772, 0.00323696, -0.042179611, 0.00390743, 0.00747477, 0.002057897, -0.007932656, 0.035253875, 0.040193111, 0.028112909, 0.002775698, -0.013180255, 0.05293905, -0.016773218, -0.011929666, -0.017886667, -0.03832005, -0.001474327, 0.003844304, -0.020997096, 0.05371194, 0.034125056, 0.00527363, 0.030854598, -0.009823259, -0.014736343, 0.01346712, -0.003143042, 0.03621766, 0.016900169, -0.026269898, -0.04309646, -0.034129016, 0.026982691, 0.044919901, 0.04545543, 0.034214042, 0.039675053, 0.02023958, 0.029184952, 0.000920457, -0.027673122, -0.004076311, 0.024206176, -0.001077706, 0.036422297, -0.009551186, 0.027132703, -0.03030486, -0.009744526, 0.009027307, -0.002761124, -0.013965347, -0.023005495, 0.03726647, -0.009159151, -0.012412722, 0.046041735, 0.002539789, -0.04388845, 0.013942474, 0.012532802, -0.028174404, 0.001187813, 0.034147058, -0.011002627, -0.053223703, 0.000261648, -0.008412198, -0.026623497, -0.014190278, 0.013136841, -0.020314703, 0.011970721, -0.014818396, 0.004021381, 0.038948283, -0.009349752, -0.033922866, -0.046694897, 0.033164416, -0.012412606, -0.006987055, 0.005013802, -0.025574109, 0.037253805, -0.025639564, 0.010128132, 0.006705403, 0.028493064, 0.036673874, -0.01876927, 0.011673374, -0.00912504, 0.043242745, -0.022041215, -0.013873131, 0.004001421, 0.014715438, 0.009864256, -0.005650744, 0.005212543, 0.009848242, -0.004596463, 0.014585982, 0.001060599, 0.019630212, -0.052668378, -0.007540052, 0.01891998, 0.002873386, -0.022146182, -0.008001561, 0.018102599, 0.012984353, -0.012753745, 0.047343399, -0.019010827, -0.012095343, -0.028844832, 0.027450385, 0.036025371, -0.026323007, 0.038918469, -0.024301914, 0.024433874, 0.015063681, 0.008245798, -0.017457766, 0.033603974, -0.001605996, -0.04229841, 0.049860653, -0.012155674, -0.030027665, -0.040266719, -0.044764303, -0.019847078, 0.042488955, 0.039395526, 0.024377037, -0.015419845, -0.042060345, -0.039582811, -0.031520102, 0.002762974, 0.003738492, 0.006927481, 0.012872193, -0.028545475, -0.005230406, 0.006820213, 0.020259146, 0.0190474, -0.018458763, 0.032726493, 0.009633414, -0.024924967, -0.019173885, 0.000709415, 0.019329721, 0.037488226, 0.006577199, -0.00800983, -0.022320187, 0.013312099, 0.037994169, 0.048728917, 0.003272542, 0.008341069, -0.03505262, -0.011916213, -0.009421906, 0.003632912, -0.053927179, 0.058800019, -0.016113304, 0.010717394, 0.004583652, 0.005885954, -0.006185091, -0.004404172, -0.041753337, 0.017930575, -0.012142047, -0.01298511, 0.007763761, -0.028712956, -0.034760512, -0.010070872, -0.069825709, -0.019545421, -0.011839343, 0.022942251, -0.019640811, 0.004966545, -0.000883216, 0.019450616, -0.010295076, -0.010681492, 0.023387048, -0.023490474, -0.036058448, -0.018022003, 0.012867885, -0.015124739, 0.006681992, -0.03926345, 0.0044567, 0.029135974, 0.004535754, -0.010490454, 0.04586377, -0.002237143, 0.028558986, 0.010980673, -0.005637721, 0.006188716, -0.000773065, -0.003796042, -0.010051538, -0.014218376, -0.023889147, -0.027194895, 0.021702843, -0.000127476, -0.023174141, -0.027701072, -0.028250808, 0.051525578, 0.021920698, 0.044554655, -0.037631717, 0.006336661, -0.017803447, 0.024745546, -0.002253915, 0.012576362, -0.012260497, 0.008785051, 0.035455137, -0.01433633, -0.035767276, -0.035517562, 0.028417127, 0.015258068, 0.003360724, -0.016561128, 0.029584149, 0.009740099, 0.010442876, 3.6215e-05, 0.047732871, -0.050517883, -0.025515407, -0.012026627, 0.017299311, 0.042422917, 0.00455931, -0.036336109, -0.036769845, -0.011859143, 0.029975951, -0.004758006, 0.023865504, -0.005783548, 0.038912646, 0.019545887, -0.029897219, 0.054783925, -0.022606848, 0.013859833, 0.004012602, -0.004110699, 0.010832582, -0.004449653, 0.018642087, 0.01201428, -0.016844381, 0.021052158, -0.030187925], index=0, object='embedding')], model='voyage-code-2', object='list', usage=Usage(prompt_tokens=None, total_tokens=6))
```

{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
