# Source: https://docs.aimlapi.com/api-references/embedding-models/google/text-multilingual-embedding-002.md

# text-multilingual-embedding-002

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

* `text-multilingual-embedding-002`
  {% endhint %}
  {% endcolumn %}

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

## Model Overview

A state-of-the-art model designed to convert textual data into numerical vector representations, capturing the semantic meaning and context of the input text. It is particularly focused on supporting multiple languages, making it suitable for global applications.

## 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="<https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-f37cf8cef8c5a7e89270c34155d1df985c9b82c3%2Ftext-multilingual-embedding-002.json?alt=media&token=3d45d1fb-fbfa-4bac-a932-debf8d036fbb>" path="/v1/embeddings" method="post" %}
[text-multilingual-embedding-002.json](https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-f37cf8cef8c5a7e89270c34155d1df985c9b82c3%2Ftext-multilingual-embedding-002.json?alt=media\&token=3d45d1fb-fbfa-4bac-a932-debf8d036fbb)
{% endopenapi %}

## Code Example

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

<pre class="language-python"><code class="lang-python">import openai
<strong>
</strong># Initialize the API client
client = openai.OpenAI(
    # Insert your AIML API Key instead of &#x3C;YOUR_AIMLAPI_KEY>
    api_key="&#x3C;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="text-multilingual-embedding-002"
)

# Print the embedding
print(response)
</code></pre>

{% 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: "text-embedding-ada-002",
});

// 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.10541483759880066, -0.007883904501795769, 0.026113376021385193, 0.054472994059324265, 0.0018547746585682034, 0.02877396158874035, -0.00769799156114459, -0.003931521438062191, -0.057099711149930954, -0.020155033096671104, -0.06802556663751602, -0.019316386431455612, -0.06921651214361191, -0.007963858544826508, -0.05464792624115944, 0.012803184799849987, -0.027932647615671158, -0.0076736449263989925, 0.01603902503848076, 0.03274304419755936, -0.013360762037336826, 0.09150521457195282, 0.01921369507908821, -0.013365000486373901, 0.028981221839785576, 0.04328111559152603, 0.005482512526214123, 0.01715942844748497, -0.013837876729667187, 0.06653714925050735, -0.024773558601737022, 0.02344578132033348, -0.029198521748185158, -0.06147294491529465, -0.021522384136915207, -0.025527307763695717, -0.04977520927786827, 0.0844593346118927, 0.056941527873277664, 0.06679201871156693, 0.015225042589008808, -0.01128363236784935, 0.02270553447306156, 0.06964384764432907, 0.026676936075091362, -0.05248146504163742, -0.027674159035086632, 0.002598844701424241, 0.005095692817121744, -0.0027368897572159767, -0.047891248017549515, 0.04109680652618408, -0.00821056216955185, 0.016158444806933403, 0.05628462880849838, -0.043633244931697845, 0.037761297076940536, 0.020936453714966774, 0.0007829850655980408, 0.06270337849855423, 0.038746483623981476, 0.030863342806696892, -0.03845648840069771, 0.07812996208667755, 0.012175951153039932, 0.04687779024243355, 0.010342667810618877, -0.09965818375349045, 0.05219428241252899, -0.03436046093702316, 0.017349041998386383, -0.00011120631825178862, 0.04728730767965317, -0.026517922058701515, 0.07252275943756104, -0.0018733064644038677, -0.0007468919502571225, 0.010333850048482418, -0.03524129465222359, 0.05117466673254967, 0.00041889090789482, -0.03684258833527565, -0.08609402179718018, 0.02175017260015011, 0.02974739484488964, -0.013284076005220413, -0.027022719383239746, -0.04528650641441345, -0.052713438868522644, -0.025287456810474396, 0.004377525299787521, -0.04269234836101532, 0.014155752956867218, 0.044733673334121704, 0.003990505822002888, 0.03460191562771797, 0.015483484603464603, 0.0005434624035842717, 0.0526236854493618, -0.02392028085887432, 0.04107077419757843, -0.05365500599145889, 0.022245658561587334, -0.006321287713944912, 0.03576485812664032, -0.03458407521247864, -0.0099563617259264, 0.03043089061975479, -0.01229866873472929, 0.10173600912094116, 0.044640809297561646, -0.009982876479625702, -0.016069957986474037, 0.009124591946601868, 0.06838742643594742, -0.035522133111953735, 0.05543530732393265, -0.0013946437975391746, 0.0927274078130722, 0.034123584628105164, -0.014755425043404102, -0.017285535112023354, -0.04379658028483391, -0.030314555391669273, 0.06716187298297882, 0.00887513067573309, -0.011652286164462566, 0.005866208113729954, 0.01511433906853199, 0.02389564737677574, -0.03916412964463234, -0.02358449064195156, 0.03001827374100685, -0.060621969401836395, -0.07665064185857773, -0.03950328379869461, -0.002718890318647027, -0.014662333764135838, 0.0013778071152046323, 0.02223793789744377, 0.035168033093214035, 0.04346954822540283, 0.0468519926071167, -0.013297604396939278, 0.01414682436734438, 0.02022908255457878, -0.04937032237648964, 0.03167034685611725, 0.040002986788749695, -0.045246321707963943, -0.04559050872921944, -0.010372575372457504, 0.003129618475213647, 0.03954334184527397, 0.0016535307513549924, -0.060084063559770584, -0.02649986930191517, -0.018224049359560013, 0.10545213520526886, 0.008776690810918808, -0.03858313709497452, 0.03134262189269066, -0.0395696647465229, -0.01682112365961075, 0.050783682614564896, 0.007121562026441097, 0.0013971769949421287, 0.036619797348976135, -0.025335906073451042, -0.0283689983189106, 0.005473538301885128, 0.10782677680253983, -0.022483186796307564, -0.014317331835627556, -0.03339641913771629, 0.05742904171347618, 0.019783759489655495, 0.047230735421180725, -0.013860595412552357, 0.0033149269875139, 0.03399600088596344, 0.014117563143372536, -0.00810042954981327, -0.0009640059433877468, 0.03456024080514908, 0.01474673580378294, -0.07780274748802185, -0.017924414947628975, 0.029849525541067123, 0.009047921746969223, 0.009600736200809479, 0.06379818916320801, 0.03630800172686577, 0.023115526884794235, -0.0630350336432457, 0.08914418518543243, 0.027336396276950836, 0.0012266739504411817, -0.057352956384420395, -0.0601881705224514, 0.02066897787153721, 0.005252629518508911, -0.01602790504693985, 0.042200129479169846, 0.01646212674677372, -0.04976451396942139, -0.049337781965732574, -0.043403275310993195, -0.0017237275606021285, 0.018216293305158615, 0.011884267441928387, 0.030069757252931595, -0.04934302344918251, 0.04761583358049393, 0.018104569986462593, -0.011641259305179119, -0.02107829414308071, -0.01970154419541359, -0.09320578724145889, 0.004196232184767723, -0.036841537803411484, -0.04561808332800865, -0.04469692334532738, 0.06998735666275024, 0.015792086720466614, 0.024417148903012276, -0.11421520262956619, -0.008014567196369171, -0.0266828965395689, 0.04702435061335564, 0.003292808076366782, -0.025582270696759224, -0.04064546525478363, 0.014371630735695362, -0.03262140229344368, -0.061057932674884796, 0.053506895899772644, 0.038311976939439774, 0.05097329989075661, -0.019703472033143044, -0.06507222354412079, -0.01362341083586216, 0.01779693365097046, 0.020742127671837807, 0.034182559698820114, 0.029347538948059082, -0.012036549858748913, -0.06035514920949936, -0.011091498658061028, 0.041539814323186874, -0.028728418052196503, 0.005448998883366585, 0.027802273631095886, -0.11522385478019714, -0.026985827833414078, 0.0043976036831736565, 0.06785836815834045, 0.0010907434625551105, 0.001246947213076055, -0.0018652870785444975, -0.017310690134763718, -0.016702132299542427, 0.02318611927330494, 0.018930615857243538, -0.0013963589444756508, -0.012603643350303173, -0.01375376246869564, -0.05014721676707268, -0.07737474143505096, 0.0839085727930069, 0.005047287791967392, 0.03685343265533447, 0.03665076941251755, -0.0027055980172008276, 0.06818031519651413, 0.02106393314898014, 0.0012829666957259178, -0.022001679986715317, 0.0150755038484931, 0.03303465619683266, 0.06591128557920456, 0.007813464850187302, -0.023850057274103165, 0.016857007518410683, 0.0063236854039132595, 0.02303488552570343, -0.0401245579123497, -0.0008188458741642535, -0.013317331671714783, 0.006902510300278664, 0.0440266877412796, 0.0389348641037941, 0.013790890574455261, 0.01848253794014454, 0.047146931290626526, 0.04700205475091934, -0.02963370271027088, 0.029775753617286682, -0.005542314145714045, -0.015500043518841267, 0.021673990413546562, 0.0030377220828086138, -0.014151815325021744, 0.0289536714553833, -0.024538973346352577, 0.0005367443081922829, -0.030160577967762947, 0.002442609751597047, -0.0221922155469656, 0.016572823747992516, 0.007224297616630793, 0.05132747069001198, 0.003126216819509864, -0.01649540662765503, -0.0124611621722579, -0.0309552401304245, 0.017682349309325218, 0.027138158679008484, 0.02613825350999832, -0.04024757817387581, -0.033114124089479446, 0.03375857695937157, -0.07853676378726959, 0.03848689794540405, 0.016865670680999756, -0.04072817787528038, 0.02666451223194599, -0.013163897208869457, -0.026936916634440422, -0.00950457900762558, -0.019679944962263107, -0.036505382508039474, -0.039251092821359634, -0.0038097763899713755, -0.02909981831908226, 0.01689119264483452, -0.005631598643958569, -0.04444366693496704, -0.018400058150291443, 0.09948165714740753, 0.05777476355433464, -0.03311845287680626, -0.031255386769771576, -0.031179746612906456, 0.036125656217336655, -0.0624731220304966, -0.0010934110032394528, -0.015725823119282722, 0.02055438794195652, 0.01676548272371292, -0.030562592670321465, 0.049558937549591064, 0.006549779325723648, -0.05628368258476257, 0.0030370282474905252, 0.08227083832025528, -0.027348440140485764, -0.010132908821105957, -0.06792967766523361, -0.007587062194943428, -0.051301259547472, -0.04431433975696564, 0.021835889667272568, -0.005453919526189566, 0.021799972280859947, 0.03162528946995735, -0.030169980600476265, 0.05377469211816788, -0.009431601502001286, 0.040705256164073944, -0.026424163952469826, 0.03118319623172283, -0.011243980377912521, -0.02357340045273304, 0.009723024442791939, -0.024781029671430588, -0.01325237937271595, 0.0545160286128521, -0.03766128793358803, -0.007153951562941074, -0.043688032776117325, -0.026015624403953552, 0.014584463089704514, 0.03432517126202583, 0.008212804794311523, 0.036940645426511765, -0.01661819778382778, -0.049259286373853683, -0.03470727801322937, -0.0729813426733017, 0.027661921456456184, -0.006366741377860308, -0.0010814400156959891, 0.037873804569244385, 0.001636164146475494, 0.024390170350670815, -0.023241546005010605, -0.004419784527271986, 0.00021935513359494507, -0.0006985748768784106, -0.025970149785280228, 0.002878018422052264, -0.001978357322514057, 0.01109653152525425, -0.058058299124240875, 0.004800621420145035, -0.017448358237743378, 0.045124951750040054, -0.02438781037926674, -0.027957573533058167, 0.06991402059793472, -0.01748705841600895, 0.005101828835904598, -0.009217784740030766, -0.03929601609706879, 0.042745620012283325, 0.015901906415820122, 0.00827154703438282, -0.04116705432534218, 0.011149227619171143, -0.03674894571304321, 0.01657249964773655, 0.011382927186787128, -0.015481950715184212, 0.012986314482986927, 0.05802534148097038, -0.00427026953548193, 0.010893828235566616, -0.017678258940577507, 0.02985813096165657, 0.014119092375040054, 0.02017025649547577, -0.040343813598155975, 0.04583633691072464, 0.014568722806870937, 0.007760098669677973, -0.020953616127371788, -0.002645008033141494, -0.009975298307836056, 0.0109878433868289, 0.08978055417537689, -0.03491469472646713, -0.004549204837530851, -0.050083693116903305, 0.0663733258843422, -0.00014237713185139, 0.017145995050668716, 0.01258561946451664, -0.014209295623004436, -0.001900106086395681, -0.023971112444996834, -0.018014049157500267, 0.008617166429758072, 0.017878243699669838, 0.05544265732169151, 0.02757343277335167, -0.030268710106611252, 0.024967852979898453, -0.035106536000967026, -0.006238855421543121, 0.008238940499722958, -0.044876616448163986, 0.028921762481331825, 0.015378402546048164, -0.026995697990059853, 0.004544367082417011, -0.055179350078105927, 0.04271208122372627, -0.028120635077357292, -0.06017487868666649, -0.04825679957866669, 0.020116129890084267, -0.016937239095568657, 0.009041895158588886, -0.053952544927597046, -0.016601426526904106, -0.007171609904617071, 0.025520171970129013, -0.05172353237867355, -0.07343856245279312, -0.0027180544566363096, 0.026363555341959, 0.044201355427503586, 0.03072921559214592, -0.07209662348031998, 0.0015088224317878485, -0.0131612503901124, -0.013388683088123798, 0.007486466318368912, 0.014169180765748024, -0.01832996867597103, -0.02055710181593895, -0.013201910071074963, 0.015327156521379948, -0.013345331884920597, -0.038747526705265045, 5.188623981666751e-05, -0.047390252351760864, 0.009996161796152592, -0.03464282304048538, -0.024708427488803864, -0.01920105330646038, 0.013454530388116837, 0.04075838252902031, 0.027596058323979378, -0.041049111634492874, -0.059456340968608856, 0.014690705575048923, -0.006486057303845882, -0.012127645313739777, 0.02257193997502327, 0.05453644320368767, 0.03415334224700928, 0.018023844808340073, 0.018970809876918793, 0.014337809756398201, -0.05923903360962868, 0.006621537264436483, -0.012769654393196106, -0.01525796391069889, -0.05761175602674484, 0.014176602475345135, -0.03600331023335457, 0.014103407971560955, 0.002629275433719158, -0.042703017592430115, 0.017850475385785103, -0.06273061037063599, -0.015869449824094772, 0.0104240532964468, -0.01796787418425083, -0.05366405099630356, -0.03884487599134445, 0.04246446490287781, -0.04479784518480301, 0.03576481342315674, -0.05046236887574196, 0.06475111097097397, 0.01779775880277157, -0.022702552378177643, -0.024778805673122406, -0.032896753400564194, 0.014413094148039818, 0.014635851606726646, 0.05545400083065033, -0.029285220429301262, 0.009321717545390129, -0.02157060243189335, -0.03143489360809326, 0.017710482701659203, 0.0011548701440915465, -0.005124518182128668, 0.014864994212985039, 0.05080557242035866, 0.019815851002931595, -0.057410337030887604, 0.004832068923860788, 0.009037822484970093, 0.04442164674401283, -0.002744280034676194, -0.0016123239183798432, 0.04296940192580223, 0.06427883356809616, 0.029972447082400322, -0.0057030292227864265, 0.006052183918654919, 0.06463455408811569, 0.027237165719270706, -0.05719420313835144, -0.03605857118964195, -0.02898549847304821, 0.007863245904445648, 0.014614919200539589, -0.02659311704337597, 0.031053777784109116, -0.0026954931672662497, 0.00022154960606712848, -0.015376832336187363, -0.0517142154276371, -0.03851758688688278, -0.006986594758927822, -0.004580304026603699, 0.08692935854196548, -0.014041777700185776, -0.0488242544233799, 0.025057353079319, 0.047696955502033234, -0.004421543795615435, 0.038907237350940704, 0.022293761372566223, -0.013860499486327171, 0.0423780158162117, 0.003362421179190278, 0.03651099279522896, 0.0007563064573332667, -0.014398363418877125, 0.007066812831908464, -0.013017090037465096, -0.008531485684216022, -0.021991243585944176, 0.04669685661792755, -0.012894587591290474, -0.036281686276197433, 0.0839996337890625, 0.030898727476596832, 0.02604648470878601, 0.06207050383090973, 0.02818981558084488, 0.0044098105281591415, 0.010841469280421734, 0.05071385204792023, 0.00784313678741455, 0.011369949206709862, 0.029672332108020782, 0.0008224845514632761, -0.1018763855099678, -0.010897420346736908, 0.020405111834406853, 0.0501691997051239, 0.04700278118252754, 0.0008367817499674857, -0.013964204117655754, 0.0650942325592041, -0.04510926827788353, 0.03625116124749184, 0.0110673438757658, -0.0033491647336632013, 0.01288105733692646, -0.025371048599481583, -0.032318200916051865, 0.018797485157847404, 0.01117926649749279, 0.0009412311483174562, -0.0516565777361393, -0.030875766649842262, -0.0056093051098287106, -0.028411203995347023, 0.0583677813410759, -0.01625736989080906, 0.029757395386695862, 0.005774027202278376, 0.03949824348092079, 0.00406526168808341, 0.05045682564377785, 0.014958338811993599, 0.057375192642211914, 0.010575571097433567, 0.050990670919418335, -0.0018780494574457407, -0.08699759840965271, -0.03311669081449509, -0.03518478944897652, -0.033709704875946045, -0.035157229751348495, -0.024795537814497948, 0.05064483731985092, -0.01920083723962307, 0.0053268978372216225, 0.04345114529132843, -0.0023100650869309902, 0.020509513095021248, -0.07417090982198715, -0.002616697922348976, -0.036853764206171036, -0.0184538122266531, -0.03070104494690895, 0.007581486366689205, 0.03965935483574867, -0.016653701663017273, -0.02727309800684452, 0.0013350006192922592, 0.020473089069128036, -0.04971387982368469, -0.0531112402677536, 0.031720954924821854, 0.008794956840574741, -0.08100474625825882, -0.0611133798956871, 0.0030386624857783318, 0.07589129358530045, 0.02881506271660328, 0.03126321732997894, -0.0283834058791399, -0.019227558746933937, 0.019624903798103333, 0.027269525453448296, 0.016047395765781403, 0.019875943660736084, 0.04076007753610611, -0.027479643002152443, -0.034122537821531296, 0.04605992138385773, -0.012987939640879631, -0.05422277748584747, 0.024422643706202507, -0.0037328244652599096, -0.05694421008229256, 0.00044419063488021493, -0.005865314044058323, -0.049558524042367935, -0.009033908136188984, -0.015324024483561516, 0.03439310938119888, -0.023355944082140923, -0.00034369336208328605, 0.0718943327665329, -0.017749890685081482, 0.005547091830521822, -0.014735191129148006, -0.00652679055929184, -0.026814408600330353, -0.08084239810705185, 0.043691858649253845, 0.046687304973602295, 0.020473962649703026, 0.026001254096627235, 0.013263455592095852, -0.051931556314229965, 0.025399165228009224, -0.07429972290992737, -0.02504633367061615, 0.026031633839011192, -0.01469772681593895, 0.014889966696500778, 0.0026077907532453537, -0.0033559161238372326, 0.04125768691301346, 0.009770219214260578, 0.0009674556204117835, -0.014875940047204494, -0.06782210618257523, -0.020606884732842445, 0.002791142091155052, -0.04532765969634056, 0.0190111193805933, -0.030455727130174637, 0.03111374005675316, -0.026067044585943222, 0.031605035066604614, -0.0337536558508873, -0.023059749975800514, 0.022104579955339432, -0.034084659069776535, 0.03991895541548729, -0.0655144676566124, 0.023636501282453537, -0.04924291372299194, -0.010195080190896988, -0.049843352288007736, 0.05068054050207138, -0.010111130774021149, -0.009207621216773987, 0.021595565602183342, 0.0040507847443223, 0.003638329217210412, -0.034894753247499466, 0.00010474702139617875, 0.005512204486876726, 0.042723167687654495, -0.014063868671655655, 0.023876750841736794, -0.03542742505669594, 0.017430925741791725, -0.02914072386920452, -0.007632249500602484, 0.04023684561252594, -0.005290816072374582, 0.044632382690906525], index=0, object='embedding')], model='text-multilingual-embedding-002', object='list', usage=Usage(prompt_tokens=11, total_tokens=11), meta={'usage': {'credits_used': 1}})
```

{% endcode %}

</details>

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