---
sidebar_position: 3
description: Get context 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 context response
 Receives the next response from the model according to the message history



`Function GetContextResponse(Val URL, Val Model, Val Messages, Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | Ollama server URL |
  | Model | --model | String | &#x2714; | Models name |
  | Messages | --msgs | Array of Structure | &#x2714; | Messages log. See GetContextMessageStructure |
  | 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

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


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

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

    Model = "tinyllama";

    MessagesArray = New Array;

    Question1 = OPI_Ollama.GetContextMessageStructure("user", "What is 1C:Enterprise?");
    Question2 = OPI_Ollama.GetContextMessageStructure("user", "When the first version was released?"); // Question without specifics

    // Adding the first question to the context
    MessagesArray.Add(Question1);

    Response1 = OPI_Ollama.GetContextResponse(URL, Model, MessagesArray, , AdditionalHeaders);

    MessagesArray.Add(Response1["message"]); // Add response to first question in context
    MessagesArray.Add(Question2); // Add second question in context

    Response2 = OPI_Ollama.GetContextResponse(URL, Model, MessagesArray, , AdditionalHeaders);

    MessagesArray.Add(Response2["message"]);

    // ...
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint ollama GetContextResponse \
             --url "https://hut.openintegrations.dev/ollama" \
             --model "tinyllama" \
             --msgs "[{'role':'user','content':'Hello!'}]" \
             --options "{'options':{'seed':'555','temperature':'10'}}" \
             --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 GetContextResponse ^
             --url "https://hut.openintegrations.dev/ollama" ^
             --model "tinyllama" ^
             --msgs "[{'role':'user','content':'Hello!'}]" ^
             --options "{'options':{'seed':'555','temperature':'10'}}" ^
             --headers "{'Authorization':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "model": "tinyllama",
 "created_at": "2025-12-10T21:16:37.243820912Z",
 "message": {
  "role": "assistant",
  "content": "The first version of 1C:Enterprise (also known as 1C:ERP) was released in 2003, and it has since been re-released multiple times under various names. In 2006, Xeroon acquired the open-source project from its original developer and renamed it to 1C:Enterprise Enterprise Business Solutions (later renamed to 1C:ERP for short) after acquiring the company. The first version of 1C:ERP was released in 2007, and since then, it has been re-released multiple times as part of larger business solutions offered by Xeroon or as a standalone software solution for use on various platforms."
 },
 "done_reason": "stop",
 "done": true,
 "total_duration": 23156842641,
 "load_duration": 24642952,
 "prompt_eval_count": 233,
 "prompt_eval_duration": 8106765442,
 "eval_count": 157,
 "eval_duration": 15015938122
}
```
