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": "2026-07-19T17:08:06.0092105Z",
"response": "1C:Enterprise is a comprehensive suite of business management software designed for small and medium-sized enterprises (SMEs). The product is aimed at helping SMEs streamline their operations, improve efficiency, and grow their businesses. It offers a wide range of features such as accounting, inventory management, production planning, sales and marketing automation, human resources management, and much more. 1C:Enterprise is available for PC, Mac, and mobile devices and has been developed using Microsoft .NET framework 4.7.",
"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,
338,
263,
15171,
6270,
9460,
310,
5381,
10643,
7047,
8688,
363,
2319,
322,
18350,
29899,
2311,
29881,
3896,
7734,
29879,
313,
17061,
14190,
467,
450,
3234,
338,
12242,
287,
472,
19912,
13766,
14190,
4840,
1220,
1009,
6931,
29892,
11157,
19201,
29892,
322,
6548,
1009,
5381,
267,
29889,
739,
16688,
263,
9377,
3464,
310,
5680,
1316,
408,
3633,
292,
29892,
11817,
706,
10643,
29892,
5802,
18987,
29892,
16538,
322,
9999,
292,
5092,
291,
29892,
5199,
7788,
10643,
29892,
322,
1568,
901,
29889,
29871,
29896,
29907,
29901,
10399,
7734,
338,
3625,
363,
9609,
29892,
4326,
29892,
322,
10426,
...