Get response
Generates a response for a given text query
Function GetResponse(Val URL, Val Model, Val Question, Val AdditionalParameters = "", Val AdditionalHeaders = "") Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| URL | --url | String | ✔ | Ollama server URL |
| Model | --model | String | ✔ | Models name |
| Question | --prompt | String | ✔ | Request text |
| 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 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);
- Bash
- CMD/Bat
# 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':'***'}"
:: 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-15T10:58:21.637243648Z",
"response": "1C:Enterprise is a leading provider of enterprise resource planning (ERP) solutions, including accounting, manufacturing, warehouse management, and supply chain management. It's also known as 1C. It provides organizations with comprehensive functionalities for managing business operations, finances, inventory, and logistics, among others.",
"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,
8236,
13113,
310,
3896,
7734,
6503,
18987,
313,
1001,
29925,
29897,
6851,
29892,
3704,
3633,
292,
29892,
12012,
3864,
29892,
1370,
14797,
1709,
10643,
29892,
322,
11421,
9704,
10643,
29889,
739,
29915,
29879,
884,
2998,
408,
29871,
29896,
29907,
29889,
739,
8128,
25700,
411,
15171,
6270,
13303,
1907,
363,
767,
6751,
5381,
6931,
29892,
11782,
778,
29892,
11817,
706,
29892,
322,
1480,
6765,
29892,
4249,
4045,
29889
],
"total_duration": 10662800449,
"load_duration": 1263480838,
"prompt_eval_count": 43,
"prompt_eval_duration": 1452195035,
"eval_count": 75,
"eval_duration": 7937733691
}