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);
    oint ollama GetResponse \
--url ""https://hut.openintegrations.dev/ollama"" \
--model ""mario"" \
--prompt ""How are you?"" \
--headers "{'Authorization':'***'}"
Result
{
"model": "tinyllama",
"created_at": "2025-09-16T00:15:52.411861196Z",
"response": "1C:Enterprise is a powerful financial software system developed by the Czech company Cerezo. It offers a wide range of features including accounting, inventory management, payroll, and customer relationship management (CRM). The software provides a user-friendly interface for both administrators and end-users, making it suitable for organizations with a diverse set of needs. With its advanced capabilities and integration options, 1C:Enterprise is highly recommended by accounting experts, financial analysts, and other professionals in the field.",
"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,
13988,
18161,
7047,
1788,
8906,
491,
278,
21489,
5001,
10580,
6096,
29877,
29889,
739,
16688,
263,
9377,
3464,
310,
5680,
3704,
3633,
292,
29892,
11817,
706,
10643,
29892,
5146,
1245,
29892,
322,
11962,
9443,
10643,
313,
11341,
29924,
467,
450,
7047,
8128,
263,
1404,
29899,
18326,
368,
5067,
363,
1716,
27443,
29879,
322,
1095,
29899,
7193,
29892,
3907,
372,
13907,
363,
25700,
411,
263,
16984,
731,
310,
4225,
29889,
2973,
967,
12862,
27108,
322,
13465,
3987,
29892,
29871,
29896,
29907,
29901,
10399,
7734,
338,
10712,
13622,
491,
3633,
292,
17924,
29879,
29892,
18161,
16455,
...