﻿---
sidebar_position: 2
description: Get response 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 response
 Generates a response for a given text query



`Function GetResponse(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 | --prompt | String | &#x2714; | Request text |
  | AdditionalParameters | --options | Structure Of KeyAndValue | &#x2716; | Additional parameters. See GetRequestParametersStructure |
  | AdditionalHeaders | --headers | Map Of KeyAndValue | &#x2716; | Additional request headers, if necessary |

  
  Returns:  Map Of KeyAndValue - Processing result

<br/>

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



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

    Prompt = "What is 1C:Enterprise?";
    Model  = "tinyllama";

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

    Result = OPI_Ollama.GetResponse(URL, Model, Prompt, , AdditionalHeaders);

    // With paramether

    Prompt = "Ollama is 22 years old and is busy saving the world. Respond using JSON";

    Format = OPI_Tools.JSONToStructure("
    |{
    |""type"": ""object"",
    |""properties"": {
    | ""age"": {
    | ""type"": ""integer""
    | },
    | ""available"": {
    | ""type"": ""boolean""
    | }
    |},
    |""required"": [
    | ""age"",
    | ""available""
    |]
    |}");

    AdditionalParameters = New Structure("format", Format);

    Result = OPI_Ollama.GetResponse(URL, Model, Prompt, AdditionalParameters, AdditionalHeaders);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint ollama GetResponse \
             --url "https://hut.openintegrations.dev/ollama" \
             --model "mario" \
             --prompt "How are you?" \
             --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 GetResponse ^
             --url "https://hut.openintegrations.dev/ollama" ^
             --model "mario" ^
             --prompt "How are you?" ^
             --headers "{'Authorization':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "model": "tinyllama",
 "created_at": "2025-05-01T06:45:29.2185601Z",
 "response": "1C:Enterprise is an integrated suite of business management applications that helps organizations streamline their operations, improve efficiency and boost productivity. It includes ERP (Enterprise Resource Planning), CRM (Customer Relationship Management), HRMS (Human Resources Management System) and MIS (Management Information System). These solutions provide comprehensive tools for managing finances, inventory, sales, purchasing, marketing, HR, operations and customer relations. The software is designed to help organizations of all sizes achieve their business objectives by increasing efficiency, reducing costs, improving decision-making, and enhancing overall value.",
 "done": true,
 "done_reason": "stop",
 "context": [
  529,
  29989,
  5205,
  29989,
  29958,
  13,
  3492,
  526,
  263,
  8444,
  319,
  29902,
  20255,
  29889,
  2,
  29871,
  13,
  29966,
  29989,
  1792,
  29989,
  29958,
  13,
  5618,
  338,
  29871,
  29896,
  29907,
  29901,
  10399,
  7734,
  29973,
  2,
  29871,
  13,
  29966,
  29989,
  465,
  22137,
  29989,
  29958,
  13,
  29896,
  29907,
  29901,
  10399,
  7734,
  338,
  385,
  23387,
  9460,
  310,
  5381,
  10643,
  8324,
  393,
  6911,
  25700,
  4840,
  1220,
  1009,
  6931,
  29892,
  11157,
  19201,
  322,
  14505,
  3234,
  2068,
  29889,
  739,
  7805,
  8982,
  29925,
  313,
  10399,
  7734,
  18981,
  8402,
  1076,
  511,
  15600,
  29924,
  313,
  15122,
  6376,
  800,
  4034,
  15057,
  511,
  379,
  29934,
  4345,
  313,
  29950,
  7889,
  27562,
  15057,
  2184,
  29897,
  322,
  341,
  3235,
  313,
  27107,
  10343,
  2184,
  467,
  4525,
  6851,
  3867,
  15171,
  6270,
  8492,
  363,
  767,
  6751,
  11782,
  778,
  29892,
  11817,
  706,
  29892,
  16538,
  29892,
  10596,
  5832,
  29892,
  9999,
  292,
  29892,
  379,
  29934,
  29892,
  6931,
  322,
  11962,
  5302,
  29889,
  450,
  7047,
  338,
  8688,
...
```
