Skip to main content

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

ParameterCLI optionTypeRequiredDescription
URL--urlStringOllama server URL
Model--modelStringModels name
Messages--msgsArray of StructureMessages log. See GetContextMessageStructure
AdditionalParameters--optionsStructure Of KeyAndValueAdditional parameters. See GetRequestParametersStructure
AdditionalHeaders--headersMap Of KeyAndValueAdditional 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"]);

// ...
# 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':'***'}"
Result
{
"model": "tinyllama",
"created_at": "2026-07-19T17:08:32.3894884Z",
"message": {
"role": "assistant",
"content": "1C:Enterprise has been continuously enhanced and released since its original launch in the mid-2000s. The most recent version of the software, known as 1C:Enterprise 15, was released in 2017. At this time, it includes numerous improvements and updates, including new features, enhancements to existing ones, and bug fixes.\n\nRegarding the exact release date, the official release dates of 1C:Enterprise software are as follows:\n\n- 1C:3D - Version 4.6 (April 2008)\n- 1C:3D - Version 5.2 (September 2009)\n- 1C:3D - Version 5.4 (March 2011)\n- 1C:3D - Version 6.0 (June 2012)\n- 1C:3D - Version 6.1 (November 2013)\n- 1C:3D - Version 6.2 (January 2014)\n- 1C:3D - Version 7.0 (October 2015)\n- 1C:3D - Version 8.0 (February 2016)\n- 1C:3D - Version 8.1 (July 2016)\n- 1C:3D - Version 9.0 (August 2017)\n\nThe latest version of 1C:Enterprise is 15, which was released in 2017."
},
"done": true,
"done_reason": "stop",
"total_duration": 12637744000,
"load_duration": 111482200,
"prompt_eval_count": 319,
"prompt_eval_duration": 805372000,
"eval_count": 367,
"eval_duration": 11696134000
}