--- 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 | ✔ | Ollama server URL | | Model | --model | String | ✔ | Models name | | Messages | --msgs | Array of Structure | ✔ | Messages log. See GetContextMessageStructure | | AdditionalParameters | --options | Structure Of KeyAndValue | ✖ | Additional parameters. See GetRequestParametersStructure | | AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | 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) :::
```bsl title="1C:Enterprise/OneScript code example" URL = FunctionParameters["Ollama_URL"]; Token = FunctionParameters["Ollama_Token"]; // 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"]); // ... ``` ```bash # JSON data can also be passed as a path to a .json file oint ollama GetContextResponse \ --url "https://api.athenaeum.digital/ollama" \ --model "tinyllama" \ --msgs "[{'role':'user','content':'What is 1C:Enterprise?'},{'role':'assistant','content':'1C:Enterprise is a comprehensive ERP (enterprise resource planning) system designed for midsize and large businesses. It provides automation, integration, customization, and financial management solutions to optimize operations and streamline processes across various departments. The system includes accounting, purchasing, inventory management, production planning, sales, human resources, customer relationship management, and other essential modules. 1C:Enterprise is designed for businesses with between 50-2000 employees and with revenue ranging from $10 million to $4 billion.'},{'role':'user','content':'When the first version was released?'}]" \ --headers "{'Authorization':'***'}" ``` ```batch :: JSON data can also be passed as a path to a .json file oint ollama GetContextResponse ^ --url "https://api.athenaeum.digital/ollama" ^ --model "tinyllama" ^ --msgs "[{'role':'user','content':'What is 1C:Enterprise?'},{'role':'assistant','content':'1C:Enterprise is a comprehensive ERP (enterprise resource planning) system designed for midsize and large businesses. It provides automation, integration, customization, and financial management solutions to optimize operations and streamline processes across various departments. The system includes accounting, purchasing, inventory management, production planning, sales, human resources, customer relationship management, and other essential modules. 1C:Enterprise is designed for businesses with between 50-2000 employees and with revenue ranging from $10 million to $4 billion.'},{'role':'user','content':'When the first version was released?'}]" ^ --headers "{'Authorization':'***'}" ``` ```json title="Result" { "model": "tinyllama", "created_at": "2025-05-01T06:46:43.0816524Z", "message": { "role": "assistant", "content": "1C:Enterprise has been around since 2004. The first release, which is called Version 3, was released in 2005, and it brought some significant changes to the system that have remained constant through the years. The latest version, 6, was released in 2019 and is still in active development. Some of the most notable features in recent versions include:\n\n- Improved interface for users, with a more modern design and streamlined navigation\n- Enhanced reporting functionality to provide more detailed insights into business performance and key areas for improvement\n- Integration with popular accounting software such as Xero and Sage\n- Support for multilingual environments, with options for French, German, Spanish, Italian, Japanese, and Korean.\n\nOverall, 1C:Enterprise has remained a reliable and stable ERP solution for businesses for many years, and new updates and features are released regularly to keep the system up to date and relevant in today's market." }, "done_reason": "stop", "done": true, "total_duration": 48411004700, "load_duration": 14000500, "prompt_eval_count": 194, "prompt_eval_duration": 13206002400, "eval_count": 216, "eval_duration": 35186999300 } ```