﻿---
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

<br/>

:::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':'What is 1C:Enterprise?'},{'role':'assistant','content':'1C:Enterprise is a comprehensive enterprise resource planning (ERP) system developed by the Russian company 1-Central. It has various modules for accounting, inventory management, manufacturing, logistics, and marketing. The system includes features like customer relationship management (CRM), e-commerce, supply chain management (SCM), production planning, and order and delivery management. It is widely used in industries such as manufacturing, retail, wholesale, and service sectors. 1C:Enterprise\u0027s software is sold and supported by the company, and is available for purchase on its website.'},{'role':'user','content':'When the first version was released?'}]" \
             --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':'What is 1C:Enterprise?'},{'role':'assistant','content':'1C:Enterprise is a comprehensive enterprise resource planning (ERP) system developed by the Russian company 1-Central. It has various modules for accounting, inventory management, manufacturing, logistics, and marketing. The system includes features like customer relationship management (CRM), e-commerce, supply chain management (SCM), production planning, and order and delivery management. It is widely used in industries such as manufacturing, retail, wholesale, and service sectors. 1C:Enterprise\u0027s software is sold and supported by the company, and is available for purchase on its website.'},{'role':'user','content':'When the first version was released?'}]" ^
             --headers "{'Authorization':'***'}"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "model": "tinyllama",
 "created_at": "2025-09-15T07:09:20.438652926Z",
 "message": {
  "role": "assistant",
  "content": "I do not have access to internal company information related to product releases. However, in general, a first version of a new software product is called beta or alpha until it is officially released by its manufacturer or vendor. This process usually involves testing and refining the features and functionality before they are made available for public use. Beta versions may include preview builds of the product with limited functionality or pre-release software, while alpha versions may have more advanced features that are still in development. The official release of a new version is typically announced by the company on their website, newsletter, or social media channels."
 },
 "done_reason": "stop",
 "done": true,
 "total_duration": 26081060413,
 "load_duration": 39885386,
 "prompt_eval_count": 198,
 "prompt_eval_duration": 4355715040,
 "eval_count": 124,
 "eval_duration": 21679482545
}
```
