1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-11-29 22:27:42 +02:00
Files
OpenIntegrations/docs/en/md/Ollama/Requests-processing/Get-context-response.mdx
Vitaly the Alpaca (bot) 17ada3b115 Main build (Jenkins)
2025-07-05 18:56:59 +03:00

113 lines
6.2 KiB
Plaintext
Vendored

---
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
<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 an industry-specific ERP (Enterprise Resource Planning) system provided by 1C (formerly known as Caspian Software). It provides software solutions for various industries, including manufacturing and distribution, retail, wholesale, logistics, and more. The 1C:Enterprise system is known for its advanced features and functionalities that cater to the unique needs of each industry. It offers a wide range of modules such as financial management, supply chain management, inventory management, order management, customer relationship management (CRM), and more. 1C:Enterprise is available for licensing on a subscription basis, allowing you to scale up or down according to your business requirements.'},{'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 an industry-specific ERP (Enterprise Resource Planning) system provided by 1C (formerly known as Caspian Software). It provides software solutions for various industries, including manufacturing and distribution, retail, wholesale, logistics, and more. The 1C:Enterprise system is known for its advanced features and functionalities that cater to the unique needs of each industry. It offers a wide range of modules such as financial management, supply chain management, inventory management, order management, customer relationship management (CRM), and more. 1C:Enterprise is available for licensing on a subscription basis, allowing you to scale up or down according to your business requirements.'},{'role':'user','content':'When the first version was released?'}]" ^
--headers "{'Authorization':'***'}"
```
</TabItem>
</Tabs>
```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
}
```