Skip to main content

Get response

Generates a response for a given text query

Function GetResponse(Val URL, Val Model, Val Question, Val AdditionalParameters = "", Val AdditionalHeaders = "") Export

ParameterCLI optionTypeRequiredDescription
URL--urlStringOllama server URL
Model--modelStringModels name
Question--promptStringRequest text
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 completion


1C:Enterprise/OneScript code example
    URL   = "https://hut.openintegrations.dev/ollama";
Token = "12We34..."; // Authorization - not part API Ollama

Prompt = "What is 1C:Enterprise?";
Model = "tinyllama";

AdditionalHeaders = New Map;
AdditionalHeaders.Insert("Authorization", StrTemplate("Bearer %1", Token));

Result = OPI_Ollama.GetResponse(URL, Model, Prompt, , AdditionalHeaders);

// With paramether

Prompt = "Ollama is 22 years old and is busy saving the world. Respond using JSON";

Format = OPI_Tools.JSONToStructure("
|{
|""type"": ""object"",
|""properties"": {
| ""age"": {
| ""type"": ""integer""
| },
| ""available"": {
| ""type"": ""boolean""
| }
|},
|""required"": [
| ""age"",
| ""available""
|]
|}");

AdditionalParameters = New Structure("format", Format);

Result = OPI_Ollama.GetResponse(URL, Model, Prompt, AdditionalParameters, AdditionalHeaders);
    # JSON data can also be passed as a path to a .json file

oint ollama GetResponse \
--url "https://hut.openintegrations.dev/ollama" \
--model "mario" \
--prompt "How are you?" \
--headers "{'Authorization':'***'}"
Result
{
"model": "tinyllama",
"created_at": "2025-10-31T12:25:39.588614708Z",
"response": "1C:Enterprise, also known as 1C|ACP, is an enterprise accounting software developed and sold by Sistema BV, a Netherlands-based company. It is used by manufacturing companies, distribution businesses, and service providers for their financial management needs. The software's main features include accounting, inventory management, sales order processing, customer relationship management (CRM), human resources management (HRM), and supply chain management (SCM). 1C:Enterprise is a comprehensive solution that offers customization options to meet specific business requirements. It is available on-premise or in the cloud.",
"done": true,
"done_reason": "stop",
"context": [
529,
29989,
5205,
29989,
29958,
13,
3492,
526,
263,
8444,
319,
29902,
20255,
29889,
2,
29871,
13,
29966,
29989,
1792,
29989,
29958,
13,
5618,
338,
29871,
29896,
29907,
29901,
10399,
7734,
29973,
2,
29871,
13,
29966,
29989,
465,
22137,
29989,
29958,
13,
29896,
29907,
29901,
10399,
7734,
29892,
884,
2998,
408,
29871,
29896,
29907,
29989,
2477,
29925,
29892,
338,
385,
3896,
7734,
3633,
292,
7047,
8906,
322,
5239,
491,
6101,
1655,
655,
350,
29963,
29892,
263,
24553,
29899,
6707,
5001,
29889,
739,
338,
1304,
491,
12012,
3864,
14582,
29892,
4978,
5381,
267,
29892,
322,
2669,
13113,
29879,
363,
1009,
18161,
10643,
4225,
29889,
450,
7047,
29915,
29879,
1667,
5680,
3160,
3633,
292,
29892,
11817,
706,
10643,
29892,
16538,
1797,
9068,
29892,
11962,
9443,
10643,
313,
11341,
29924,
511,
5199,
7788,
10643,
313,
20938,
29924,
511,
322,
11421,
9704,
10643,
313,
7187,
29924,
467,
...