# Source: https://docs.aimlapi.com/api-references/embedding-models/baai/bge-base-en.md

# bge-base-en

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

* `BAAI/bge-base-en-v1.5`
  {% endhint %}
  {% endcolumn %}

{% column width="33.33333333333334%" %} <a href="https://aimlapi.com/app/BAAI/bge-base-en-v1-5" class="button primary">Try in Playground</a>
{% endcolumn %}
{% endcolumns %}

## Model Overview

An embedding model that excels in creating high-precision linguistic representations. It's designed to generate detailed embeddings that capture the subtleties of language, facilitating advanced natural language processing tasks.

## 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-26c21156c401dc4f293df279d9bf199906d615bf%2Fbge-base-en.json?alt=media&token=5a1c281e-f155-4bf5-857a-b4ff71d91672>" path="/v1/embeddings" method="post" %}
[bge-base-en.json](https://3927338786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FROMd1X5PuqtikJ48n2N9%2Fuploads%2Fgit-blob-26c21156c401dc4f293df279d9bf199906d615bf%2Fbge-base-en.json?alt=media\&token=5a1c281e-f155-4bf5-857a-b4ff71d91672)
{% 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="BAAI/bge-base-en-v1.5"
)

# 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: "BAAI/bge-base-en-v1.5",
});

// 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.011658690869808197, -0.018578968942165375, 0.012323499657213688, 0.0073761423118412495, 0.06261733919382095, -0.0008231595857068896, 0.0031039523892104626, 0.018022214993834496, -0.05936441570520401, -0.005633850581943989, -0.025196731090545654, 0.029335038736462593, -0.05275379866361618, 0.007178363855928183, -0.012582371011376381, 0.05022329464554787, 0.012615736573934555, -0.03852837532758713, 0.04922296851873398, -0.013275686651468277, 0.02643674612045288, 0.04058190807700157, 0.0013573297765105963, 0.02061430923640728, -0.02698611654341221, -0.020850922912359238, -0.011911595240235329, 0.021286388859152794, -0.03574862331151962, 0.015528105199337006, 0.07527229189872742, -0.06804201006889343, 0.040051039308309555, -0.08631309121847153, 0.011029606685042381, 0.0038828470278531313, 0.055851999670267105, -0.0026011005975306034, -0.01863997057080269, -0.02572443336248398, -0.08648759871721268, -0.014346427284181118, 0.021596228703856468, 0.005607986822724342, -0.0599936842918396, -0.003305061487480998, -0.015417912974953651, 0.051326293498277664, 0.02928423322737217, -0.026041774079203606, -0.04577408730983734, 0.023901036009192467, 0.0357603095471859, 0.05475606769323349, -0.012751741334795952, 0.03616871312260628, -0.004525776486843824, -0.022031307220458984, -0.03058265522122383, -0.01109786331653595, -0.005847369786351919, -0.01874837465584278, 0.003786420449614525, -0.04965910315513611, 0.060039080679416656, 0.02385510504245758, 0.01522880233824253, 0.03449542075395584, -0.004220642149448395, -0.03513180837035179, -0.03691013529896736, 0.007439743261784315, 0.006748793181031942, -0.02299191616475582, -0.06698129326105118, -0.012593718245625496, 0.058502670377492905, -0.025966312736272812, 0.016721542924642563, 0.0600757971405983, 0.034065745770931244, -0.04764077812433243, 0.016392020508646965, 0.06289635598659515, 0.010011296719312668, -0.03453841432929039, -0.037166569381952286, -0.006588813848793507, -0.05419961363077164, 0.03145653009414673, -0.06678452342748642, -0.05227635055780411, 0.04169771447777748, 0.05716203898191452, 0.004991025198251009, 0.029354732483625412, 0.0354110449552536, -0.041608862578868866, 0.0342419408261776, 0.012666147202253342, -0.02381219156086445, -0.0198355782777071, 0.016474245116114616, -0.04728461429476738, -0.059621986001729965, -0.019043199717998505, -0.020126933231949806, 0.018849564716219902, -0.01700529083609581, 0.005782770924270153, 0.013347440399229527, 0.008009222336113453, -0.012010510079562664, -0.006792867556214333, -0.0012243515811860561, 0.02190832421183586, -0.026272114366292953, -0.01806635782122612, 0.021971991285681725, -0.03756976127624512, 0.046954382210969925, 0.024942057207226753, -0.013467652723193169, 0.05566409230232239, -0.02939034253358841, -0.004486191086471081, -0.0420663096010685, 0.06319195032119751, 0.003994333557784557, -0.015539233572781086, 0.045254092663526535, 0.028824059292674065, -0.005584255326539278, 0.011505923233926296, 0.015092678368091583, 0.019955521449446678, 0.02006419748067856, 0.0337817519903183, 0.02504267357289791, 0.013282686471939087, 0.01852530986070633, 0.0019804458133876324, -0.010732145980000496, -0.013852943666279316, -0.0055500902235507965, 0.021653370931744576, -0.00998683925718069, -0.03388819098472595, 0.004470963031053543, 0.007828164845705032, -0.0068223122507333755, 0.0488409623503685, 0.00487419031560421, -0.08021607995033264, 0.04309513419866562, 0.0019645097199827433, -0.009185535833239555, -0.0013155249180272222, -0.04033482447266579, 0.03934170678257942, -0.04436792433261871, 0.013499065302312374, 0.007129736710339785, 0.01721024140715599, 0.03379036486148834, 0.026883987709879875, -0.027901146560907364, 0.07364347577095032, -0.023422986268997192, -0.0019132699817419052, -0.03887537121772766, 0.015111638233065605, -0.004181549418717623, -0.004101315513253212, -0.10936370491981506, 0.03308088332414627, 0.09255659580230713, 0.003848041407763958, 0.01188590470701456, 0.01495142001658678, -0.04235406219959259, 0.0327109768986702, -0.011958586983382702, 0.008720827288925648, -0.0024145329371094704, 0.0008358414052054286, -0.003333167638629675, 0.010237077251076698, 0.0024563176557421684, 0.003806204767897725, -0.04134238883852959, -0.03535868972539902, -0.02361328713595867, 0.003962222021073103, 0.011405540630221367, -0.01352467481046915, -0.008801989257335663, 0.08732294291257858, 0.03357969969511032, 0.017288845032453537, 0.004777946975082159, 0.04029672220349312, -0.00314644118770957, -0.036461833864450455, -0.02734217420220375, 0.013465276919305325, 0.018797509372234344, -0.02859959751367569, -0.007447289768606424, 0.014241132885217667, -0.0006345664151012897, -0.03280339762568474, 0.08878018707036972, 0.01593293435871601, 0.027651024982333183, -0.025776559486985207, -0.01438236702233553, -0.009261127561330795, -0.04037085548043251, 0.0014654992846772075, 0.02597060799598694, 0.03997795656323433, -0.024606656283140182, 0.01760828122496605, -0.011711525730788708, 0.07737505435943604, 0.02062726393342018, -0.020670557394623756, -0.017537551000714302, 0.02612995356321335, -0.007961840368807316, -0.012151774950325489, -0.003072962397709489, -0.005992882885038853, 0.08971364796161652, 0.040506526827812195, -0.002490011043846607, -0.009759923443198204, -0.003256001975387335, -0.047061026096343994, -0.025094516575336456, 0.027257798239588737, -0.010738528333604336, 0.08344828337430954, -0.05279938876628876, -0.01345988642424345, -0.045219000428915024, -0.023960597813129425, 0.01320223044604063, -0.016804419457912445, 0.008912402205169201, -0.0123392753303051, -0.017277240753173828, 0.05045454204082489, -0.03717101365327835, -0.0550372377038002, -0.007294025272130966, -0.00808947067707777, 0.0436876006424427, 0.029658302664756775, 0.024017637595534325, -0.002700371900573373, 0.0232936330139637, -0.01014023832976818, -0.037643108516931534, -0.08409059047698975, -0.028104886412620544, -0.03111935406923294, 0.04546510800719261, -0.006859905086457729, 0.010472486726939678, 0.07629445195198059, 0.029637569561600685, -0.005264559295028448, -0.018116015940904617, 0.03656730428338051, -0.00324469362385571, 0.01844063214957714, 0.025931894779205322, -0.06714964658021927, 0.0015349012101069093, 0.020911550149321556, -0.016625486314296722, -0.05212928354740143, -0.02442360483109951, -0.03819900006055832, 0.0039304024539887905, 0.010794945061206818, -0.026110151782631874, 0.03273048624396324, -0.0398159995675087, 0.022590041160583496, 0.008729050867259502, -0.01432312373071909, 0.04990584775805473, -0.00878953281790018, 0.014817493036389351, 0.003577686147764325, -0.048889484256505966, 0.027168627828359604, -0.032785143703222275, 0.001428293762728572, -0.012991726398468018, 0.002207501558586955, -0.031595587730407715, -0.04929297789931297, 0.07943408191204071, -0.030240967869758606, -0.28902173042297363, 0.02503572776913643, -0.01670674793422222, -0.04970690980553627, 0.010199888609349728, -0.054794687777757645, 0.01522759348154068, -0.050625383853912354, -0.04223717749118805, 0.017970046028494835, -0.0337534174323082, 0.032258693128824234, -0.038969989866018295, 0.03947341442108154, 0.06362343579530716, 0.01295317243784666, -0.03605831041932106, -0.012009094469249249, -0.011229542084038258, 0.04157596826553345, -0.023201780393719673, -0.02855140157043934, -0.019053790718317032, -0.046474337577819824, 0.036980241537094116, 0.01553323119878769, 0.006598281674087048, -0.05002759024500847, -0.04619036242365837, 0.001307979109697044, 0.016306757926940918, -0.014870641753077507, -0.0583050437271595, -0.027423717081546783, 0.028048831969499588, 0.00561688793823123, -0.013109457679092884, -0.060974009335041046, 0.04908984526991844, -0.031463250517845154, -0.029546959325671196, -0.042048774659633636, -0.007008932530879974, 0.005690962076187134, 0.031728338450193405, -0.009632786735892296, -0.027723178267478943, -0.03559422865509987, 0.016514359042048454, 0.07822524756193161, -0.027891991659998894, -0.013297860510647297, 0.025567054748535156, -0.03333411365747452, -0.00414719432592392, 0.02465416118502617, 0.009624198079109192, -0.028551414608955383, -0.01517847552895546, -0.03812381625175476, 0.02285400591790676, -0.021881822496652603, 0.0007843165658414364, -0.02498115599155426, -0.013946430757641792, -0.00893888808786869, 0.011626829393208027, -0.06035604700446129, 0.05703093111515045, 0.035672836005687714, 0.03164256364107132, -0.07518582046031952, 0.003520556027069688, -0.07736840844154358, -0.039008162915706635, -0.0074194250628352165, -0.04513378441333771, -0.030272195115685463, 0.034462280571460724, -0.028183691203594208, 0.02213544026017189, 0.025428684428334236, 0.02164965309202671, -0.005362908821552992, 0.016267089173197746, -0.04896216094493866, 0.056062184274196625, 0.01068164687603712, -0.05329759046435356, 0.012132675386965275, 0.01482552569359541, 0.02420257031917572, -0.014463119208812714, 0.03615114465355873, -0.028405772522091866, 0.023333707824349403, 0.002132097724825144, -0.0029442200902849436, 0.023667745292186737, 0.017944909632205963, 0.04902446269989014, -0.032475341111421585, 0.01893465593457222, 0.008250508457422256, 0.025931477546691895, -0.05746575817465782, -0.06726448237895966, -0.04720583185553551, -0.023415101692080498, -0.03320658579468727, 0.007519441191107035, -0.011187655851244926, 0.06192195042967796, -0.07022793591022491, 0.01893569901585579, -0.07046280056238174, 0.0304004717618227, 0.024508673697710037, -0.017410725355148315, -0.024023018777370453, 0.02454483136534691, 0.012349991127848625, -0.04359012097120285, 0.014789453707635403, -0.048688847571611404, 0.042428791522979736, 0.011397453024983406, 0.0031104108784347773, -0.037755489349365234, 0.032866220921278, -0.039232075214385986, -0.03735247254371643, 0.012811037711799145, -0.052589088678359985, 0.032366082072257996, 0.03369993343949318, -0.014085110276937485, -0.06036509573459625, 0.04668035730719566, 0.005542110651731491, -0.020530635491013527, -1.3337402378965635e-05, -0.0036837924271821976, 0.00015563184570055455, 0.06424855440855026, 0.0019413833506405354, 0.008460842072963715, -0.0013321915175765753, -0.021368030458688736, 0.0005175513215363026, 0.05508086830377579, 0.003703558351844549, 0.016298184171319008, -0.05562125891447067, 0.04376213252544403, 0.0007460187771357596, 0.044157881289720535, -0.01038070023059845, -0.003666197182610631, -0.022915473207831383, -0.015332457609474659, -0.03458123281598091, -0.05164092034101486, 0.006279381923377514, 0.00730145163834095, 0.06235000863671303, -0.0054173278622329235, 0.03942393139004707, -0.019114740192890167, -0.012854578904807568, -0.04528335854411125, -0.028437446802854538, 0.05823083594441414, 0.04027895629405975, 0.015850722789764404, 0.02131357043981552, 0.0014371995348483324, 0.03518809750676155, 0.051746103912591934, 0.053245820105075836, -0.028711413964629173, -0.014230514876544476, -0.047211743891239166, 0.01689412072300911, 0.04366833344101906, 0.01632235012948513, -0.05013277009129524, -0.02260572463274002, 0.046214453876018524, 0.013100503012537956, 0.009009084664285183, 0.04649597406387329, -0.02283347025513649, 0.007127475459128618, -0.04864220693707466, -0.039959296584129333, 0.011588836088776588, 0.07114911824464798, -0.051676250994205475, -0.02821783907711506, -0.03221212700009346, 0.010966045781970024, 0.003503242041915655, 0.04182348772883415, 0.04281967505812645, -0.0666528195142746, 0.05860932171344757, 0.008202419616281986, -0.0290206428617239, 0.036701276898384094, -0.031827524304389954, -0.016598979011178017, 0.05001441761851311, -0.005293721798807383, -0.023273391649127007, -0.021332601085305214, 0.012163229286670685, 0.03855433687567711, 0.03917527571320534, -0.000506638316437602, 0.010299109853804111, -0.026933452114462852, -0.019489889964461327, 0.00023776893795002252, -0.000930268841329962, 0.020109230652451515, -0.06015421822667122, 0.0388009212911129, 0.0036858306266367435, -0.0614473782479763, 0.03543441742658615, -0.0546044297516346, -0.0002424120029900223, -0.00031788364867679775, -0.02662869170308113, 0.016553305089473724, -0.044441912323236465, 0.03416808322072029, 0.02251741848886013, 0.025819605216383934, 0.0725560337305069, -0.03633907064795494, 1.8129039744962938e-05, -0.0005926945596002042, 0.01997777633368969, 0.06660829484462738, -0.03621210530400276, -0.019180625677108765, -0.0015497016720473766, -0.04997091367840767, 0.006882124580442905, 0.03433854505419731, 0.0044527300633490086, -0.005119694862514734, 0.04012249410152435, -0.048189420253038406, -0.02032427489757538, 0.003958383109420538, -0.0470176562666893, 0.006208898965269327, 0.03419186547398567, -0.0039625572971999645, -0.0211471077054739, 0.017989803105592728, 0.05225418135523796, 0.021960897371172905, -0.0090477941557765, -0.02973831631243229, 0.006917226128280163, -0.02460668236017227, 0.019219186156988144, -0.019327064976096153, -0.028160177171230316, -0.040624815970659256, 0.018049148842692375, -0.007872330024838448, 0.0013795916456729174, -0.05496736988425255, 0.02021488919854164, -0.07206983119249344, -0.006986201275140047, 0.011781449429690838, 2.6940986572299153e-05, -0.009080830030143261, 0.014979347586631775, -0.021085567772388458, 0.01631174236536026, -0.011692334897816181, -0.020261332392692566, -0.0005780161009170115, 0.027564585208892822, 0.03675185516476631, 0.04981456696987152, 0.038751695305109024, -0.001692216726951301, 0.0030602680053561926, 0.05946047604084015, 0.03279809281229973, 0.018662715330719948, 0.0010382626205682755, -0.03739776462316513, 0.058492474257946014, -0.004906819202005863, 0.011189996264874935, -0.042336802929639816, -0.03350737690925598, 0.05382155254483223, -0.11734187602996826, 0.010130063630640507, 0.03273265063762665, -0.03998766466975212, -0.024963650852441788, 0.0777893140912056, 0.0044626276940107346, -0.03591876104474068, -0.004831091966480017, 0.04886357858777046, -0.014175692573189735, 0.009981085546314716, 0.0513734370470047, -0.010054119862616062, -0.06900234520435333, 0.03559659793972969, 0.03199708089232445, 0.0762697234749794, 0.020331457257270813, 0.016148889437317848, 0.022265996783971786, 0.01014411635696888, 0.05869985744357109, 0.06161825358867645, 0.038302212953567505, 0.055247604846954346, 0.0547727569937706, -0.03966425731778145, -0.04922478646039963, -0.008416063152253628, 0.032850269228219986, -0.0010125684784725308, -0.02813360095024109, -0.02904607728123665, 0.045110028237104416, 0.02027292549610138, 0.05021657794713974, 0.06494481861591339, -0.04767780005931854, 0.02763231098651886, 0.009192290715873241, 0.000659125973470509, -0.04054149240255356, 0.003907663282006979, 0.033963315188884735, 0.008144555613398552, -0.08116139471530914, 0.07988631725311279, 0.017002783715724945, 0.014132574200630188, 0.01550651341676712, -0.023972097784280777, 0.023776691406965256, -0.044400569051504135, 0.001965914387255907, 0.08696596324443817, 0.019283894449472427, -0.04227995499968529, -0.08769670128822327, -0.002612076234072447, 0.03166748955845833, 0.025596309453248978, 0.002526302821934223, 0.03700852394104004, 0.010600398294627666, -0.052719831466674805, 0.010206802748143673, -0.01595372147858143, -0.043334148824214935, -0.027373841032385826, -0.040282879024744034, 0.0038889567367732525, 0.06101490557193756, 0.017439477145671844, -0.03916575014591217, -0.036308906972408295, -0.016030609607696533, -0.04583678022027016, -0.045579031109809875, -0.014705915004014969, 0.024154217913746834, -0.04914421588182449, 0.0008538658730685711, 0.061218466609716415, -0.01976163499057293, 0.026634687557816505, 0.03310007601976395, -0.033564817160367966, -0.03548832982778549, 0.04763418436050415, 0.0440690740942955, -0.009795410558581352, 0.04135273024439812, 0.06297280639410019, 0.0390808992087841, 0.005284945480525494, 0.0074376920238137245, -0.024793729186058044, 0.042871683835983276, -0.04783324897289276, -0.026509402319788933, -0.05406336486339569, 0.034168824553489685, -0.009172582998871803, 0.006330863572657108, -0.05980753153562546, 0.03882012143731117, 0.012579734437167645, 0.05506054684519768, 0.026283686980605125, -0.0037538025062531233, -0.0005106416065245867, -0.011596854776144028, -0.04689883440732956, 0.01959231123328209, 0.032121509313583374, 0.033550020307302475, -0.01649251952767372, 0.05118260905146599, -0.022494375705718994, -0.014754097908735275, -0.001066056895069778, 0.03409600257873535, 0.037240006029605865, -0.024016207084059715, 0.005816940683871508, -0.057898782193660736, -0.03646031394600868, -0.07734798640012741, -0.04578268527984619, 0.014451026916503906, -0.0029571594204753637, -0.0457887202501297, 0.017878886312246323, 0.008322810754179955, 0.0049087475053966045, -0.02843366749584675, 0.02956739068031311, -0.016335176303982735, -0.04846349358558655, -0.016797350719571114, -0.0617985799908638, -0.03490974381566048, -0.04078895226120949, -0.025277748703956604, 0.00685898819938302, -0.017386544495821, -0.018116246908903122, -0.02631491608917713, 0.005632593296468258, -0.017169492319226265, 0.030786830931901932, -0.023545755073428154], index=0, object='embedding')], model='BAAI/bge-base-en-v1.5', object='list', usage=Usage(prompt_tokens=7, total_tokens=7, completion_tokens=0, prompt_tokens_details=None), id='embd-643b9c23567f410daf9d1f949e8f87f9', created=1768555048, 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.