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
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"]);
// ...
- Bash
- CMD/Bat
# 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':'***'}"
:: 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':'***'}"
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
}