﻿---
sidebar_position: 4
description: Get embeddings and other functions to work with Ollama 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, Ollama]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Get embeddings
 Gets the embeddings for the given entries



`Function GetEmbeddings(Val URL, Val Model, Val Question, Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | Ollama server URL |
  | Model | --model | String | &#x2714; | Models name |
  | Question | --input | Array Of String | &#x2714; | String or array of request strings |
  | AdditionalParameters | --options | Structure Of KeyAndValue | &#x2716; | Additional parameters. See GetEmbeddingsParameterStructure |
  | AdditionalHeaders | --headers | Map Of KeyAndValue | &#x2716; | Additional request headers, if necessary |

  
  Returns:  Map Of KeyAndValue - Processing result

<br/>

:::tip
Method at API documentation: [Generate Embeddings](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    URL   = "https://hut.openintegrations.dev/ollama";
    Token = "12We34..."; // Authorization - not part API Ollama

    StingsArray = New Array;
    StingsArray.Add("Why is the sky blue?");
    StingsArray.Add("Why is the grass green?");

    Model = "tinyllama";

    AdditionalHeaders = New Map;
    AdditionalHeaders.Insert("Authorization", StrTemplate("Bearer %1", Token));

    Result = OPI_Ollama.GetEmbeddings(URL, Model, StingsArray, , AdditionalHeaders);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint ollama GetEmbeddings \
             --url "https://hut.openintegrations.dev/ollama" \
             --model "tinyllama" \
             --input "['Why is the sky blue?','Why is the grass green?']" \
             --headers "{'Authorization':'***'}"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint ollama GetEmbeddings ^
             --url "https://hut.openintegrations.dev/ollama" ^
             --model "tinyllama" ^
             --input "['Why is the sky blue?','Why is the grass green?']" ^
             --headers "{'Authorization':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "model": "tinyllama",
 "embeddings": [
  [
   0.0061379983,
   0.016888523,
   -0.021224216,
   -0.0006822769,
   -0.0090153655,
   -0.0018350792,
   0.038131323,
   -0.04369648,
   0.020022517,
   0.013495093,
   0.001228152,
   0.004690899,
   -0.003546855,
   0.0058474625,
   -0.00042324018,
   0.028064905,
   0.005310975,
   -0.005735992,
   -0.012619203,
   0.013064234,
   0.005523001,
   0.014706261,
   0.0089911735,
   0.019297577,
   -0.014013198,
   -0.01678316,
   0.008408569,
   -0.010763012,
   -0.009735384,
   -0.010517315,
   -0.05121307,
   -0.06972636,
   0.022462368,
   0.010772618,
   0.0028735315,
   0.059740208,
   0.020583808,
   -0.00007829528,
   -0.017120218,
   0.0222858,
   -0.0017043478,
   0.029446237,
   0.0014208009,
   -0.011425652,
   -0.03135808,
   -0.0041784574,
   -0.015115775,
   -0.020566331,
   -0.020950602,
   0.013203443,
   0.02638328,
   -0.012201243,
   -0.015680917,
   -0.014333849,
   0.016104177,
   -0.009110282,
   0.018798066,
   0.013347891,
   0.01868396,
   0.0024649792,
   -0.014640434,
   -0.03975936,
   0.009130492,
   -0.006286539,
   0.0045654387,
   0.012403077,
   0.0040157256,
   -0.022431197,
   -0.005813648,
   0.006966999,
   -0.036077548,
   0.0010453436,
   -0.003007503,
   -0.030950839,
   0.010573667,
   0.023777286,
   -0.0013602595,
   -0.017266106,
   0.002935542,
   0.00068417675,
   0.011964198,
   0.018228333,
   0.0156074455,
   0.018966112,
   0.0073177945,
   0.0074874,
   0.004678372,
   -0.00026077006,
   -0.0048798085,
   0.012788715,
   -0.02446327,
   0.010051249,
   -0.0013068032,
   0.025128093,
   0.0081787715,
   -0.021493759,
   -0.0251751,
   0.006101706,
   -0.0053877733,
   -0.012186533,
   0.0050914614,
   0.017061438,
   -0.013886302,
   0.006567539,
   -0.0036682982,
   0.0054139793,
   -0.01808865,
   0.011643494,
   0.031284925,
   0.011510916,
   0.027691396,
   -0.0038981554,
   0.067248724,
   -0.0068645906,
   0.00032833914,
   0.0021304367,
   -0.023082081,
   -0.0024188315,
   0.0047677765,
   -0.01566773,
   -0.025478564,
   0.008908278,
   -0.014724895,
   -0.00003381486,
   -0.028239965,
   0.012543222,
   -0.0007969146,
   0.004481648,
   0.020120854,
   -0.004212789,
   -0.03619561,
   -0.016715152,
   -0.008178712,
   -0.003697368,
   -0.0029796471,
   -0.036001354,
   0.021554308,
   0.029659085,
   -0.011573467,
   0.008203886,
   0.020023078,
   -0.0037608575,
   -0.00986851,
   -0.03455922,
   0.005774429,
   -0.01664764,
...
```
