﻿---
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.0009809666,
   0.024712617,
   -0.019719671,
   -0.014311721,
   -0.006512493,
   -0.0046530883,
   0.016887583,
   -0.027884927,
   0.015772425,
   0.013783035,
   0.009702524,
   -0.018980093,
   -0.024029572,
   -0.021359667,
   0.03371715,
   0.039340384,
   0.026929747,
   -0.009660369,
   -0.008677405,
   0.017965715,
   0.029517861,
   0.0012749571,
   -0.018946558,
   0.011057035,
   0.0006219651,
   -0.007947846,
   0.04362136,
   0.0516355,
   0.0038611237,
   -0.014424948,
   -0.015204811,
   -0.026881736,
   0.0016480248,
   -0.012375792,
   0.010350813,
   0.0517457,
   0.052361418,
   -0.0013309978,
   -0.012246977,
   0.011545534,
   0.01412293,
   0.0035833009,
   0.039787408,
   0.0061370744,
   -0.018439654,
   -0.022157338,
   -0.02610015,
   -0.015427742,
   -0.013742548,
   0.012727364,
   0.031380735,
   -0.036169704,
   -0.015526302,
   -0.009149547,
   -0.006861543,
   -0.0075326576,
   0.011122654,
   -0.0011483792,
   0.020708423,
   0.033995684,
   -0.026695631,
   -0.03616638,
   -0.011933725,
   0.024666358,
   0.01182688,
   0.017149005,
   0.005729343,
   -0.037642103,
   0.0012108645,
   0.018408692,
   -0.044061195,
   0.01069649,
   0.018176112,
   -0.030953268,
   0.01763926,
   0.020781323,
   -0.012118079,
   0.006133119,
   0.029072136,
   -0.016567796,
   0.015127948,
   0.014902893,
   0.03359875,
   0.009841997,
   0.007941094,
   -0.014871979,
   -0.024316387,
   0.021699173,
   0.0071866345,
   0.011201469,
   -0.050954506,
   0.0086248135,
   0.013431704,
   0.003995518,
   -0.008871978,
   -0.018520083,
   -0.009460157,
   0.01514209,
   0.012995364,
   -0.003921214,
   0.017037088,
   0.004551234,
   -0.00801134,
   0.008647985,
   -0.018376721,
   0.0020893184,
   -0.0149753,
   -0.0015180008,
   0.018207869,
   0.019271987,
   0.027382633,
   0.036771778,
   0.041053783,
   -0.016119312,
   0.010651199,
   0.011483459,
   -0.0071172155,
   0.020954145,
   0.006645952,
   -0.028561242,
   -0.022561979,
   0.001276336,
   -0.011212229,
   0.014456702,
   -0.029644517,
   0.01900012,
   -0.0024796412,
   -0.0004388661,
   0.006144026,
   -0.0062145274,
   -0.010775579,
   -0.019427497,
   0.027125992,
   0.014924317,
   -0.004897794,
   -0.026406346,
   0.021465264,
   0.008656362,
   -0.015297339,
   -0.0087129455,
   0.033963446,
   0.010128938,
   0.00017434206,
   -0.051782202,
   -0.010223359,
   -0.007730918,
...
```
