1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-27 22:18:36 +02:00
Files
OpenIntegrations/docs/en/md/OpenAI/Requests-processing/Get-embeddings.mdx
Vitaly the Alpaca (bot) 17ada3b115 Main build (Jenkins)
2025-07-05 18:56:59 +03:00

226 lines
4.8 KiB
Plaintext
Vendored

---
sidebar_position: 3
description: Get embeddings and other functions to work with OpenAI in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, OpenAI]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Get embeddings
Gets the embeddings for the given entries
`Function GetEmbeddings(Val URL, Val Token, Val Model, Val Text, Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | OpenAI server URL |
| Token | --token | String | ✔ | OpenAI authorization token |
| Model | --model | String | ✔ | Models name |
| Text | --input | Array Of String | ✔ | String or array of request strings |
| AdditionalParameters | --options | Structure Of KeyAndValue | ✖ | Additional request parameters, if necessary |
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
Returns: Map Of KeyAndValue - Processing result
<br/>
:::tip
Method at API documentation: [Create embeddings](https://platform.openai.com/docs/api-reference/embeddings/create)
:::
<br/>
```bsl title="1C:Enterprise/OneScript code example"
URL = "https://hut.openintegrations.dev/localai/";
Token = "12We...";
Text = "What is 1C:Enterprise?";
Model = "text-embedding-ada-002";
Result = OPI_OpenAI.GetEmbeddings(URL, Token, Model, Text);
```
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint openai GetEmbeddings \
--url "https://hut.openintegrations.dev/localai/" \
--token "***" \
--model "text-embedding-ada-002" \
--input "What is 1C:Enterprise?"
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint openai GetEmbeddings ^
--url "https://hut.openintegrations.dev/localai/" ^
--token "***" ^
--model "text-embedding-ada-002" ^
--input "What is 1C:Enterprise?"
```
</TabItem>
</Tabs>
```json title="Result"
{
"created": 1750098830,
"object": "list",
"id": "b3f4ef3a-aab8-4187-a069-0fedf4dce39a",
"model": "text-embedding-ada-002",
"data": [
{
"embedding": [
0.039306823,
0.06800108,
0.093336634,
0.047399748,
0.05303847,
-0.0045703063,
0.020564303,
-0.003982316,
0.059974182,
0.031575102,
-0.03782351,
0.04336627,
0.056829922,
0.011082156,
-0.031761564,
0.026220128,
-0.041899752,
0.020279199,
-0.00035605827,
0.054048635,
-0.051941708,
0.019693118,
0.03152523,
-0.022279833,
-0.21035573,
0.06253101,
0.10740045,
-0.022270266,
0.039815478,
-0.002064826,
-0.00812831,
0.063703835,
-0.022949163,
-0.09700429,
0.024405506,
0.044985574,
0.07021579,
0.024271835,
-0.034903727,
0.02306525,
0.04803343,
-0.009328123,
0.013489357,
-0.009203817,
-0.01898265,
-0.014102292,
-0.009530809,
0.020919267,
-0.011196746,
-0.017657628,
0.04030774,
0.105887584,
-0.004947376,
0.03007073,
0.03934076,
0.039994504,
0.030013865,
-0.018841594,
0.03419733,
0.05684305,
0.03685053,
0.060417134,
0.018449405,
-0.0042305985,
-0.039747328,
-0.096211,
0.033421766,
0.040231947,
0.03321413,
0.054666597,
0.081802234,
0.08984425,
0.037576202,
0.033987753,
0.028289821,
0.116815776,
0.007793949,
0.11911435,
-0.02762124,
0.0159002,
0.032154307,
0.023621202,
0.021270113,
0.07893777,
-0.0068564774,
0.09800187,
-0.033729196,
0.037148777,
0.099280804,
-0.015576986,
0.0056228465,
0.11206355,
0.038822416,
-0.0052458174,
-0.051602654,
0.048757896,
-0.22307399,
0.0327857,
0.057355624,
0.055558134,
0.037836656,
0.044565056,
0.005684226,
0.010523712,
0.019725367,
0.04057688,
0.039402287,
-0.050534364,
0.03588121,
0.042030934,
0.11653809,
-0.027830344,
-0.0047458205,
0.03760887,
0.033754453,
0.077402346,
0.051007684,
0.017851146,
0.012366402,
0.05565584,
0.024153136,
-0.000036634745,
0.052900832,
-0.049814638,
0.012233756,
0.024264883,
-0.028618433,
-0.0062483093,
-0.024868632,
-0.02409473,
0.03079852,
0.014156766,
0.13093096,
0.061249103,
0.023122463,
-0.0014724428,
0.009159956,
0.055081178,
-0.109666854,
0.054890707,
0.12889037,
0.026120793,
...
```