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://api.athenaeum.digital/ollama";
Token = "10KO-82..."; // 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://api.athenaeum.digital/ollama" \
--model "mario" \
--prompt "How are you?" \
--headers "{'Authorization':'Bearer ***'}"
Result
{
"model": "tinyllama",
"created_at": "2025-05-01T06:45:29.2185601Z",
"response": "1C:Enterprise is an integrated suite of business management applications that helps organizations streamline their operations, improve efficiency and boost productivity. It includes ERP (Enterprise Resource Planning), CRM (Customer Relationship Management), HRMS (Human Resources Management System) and MIS (Management Information System). These solutions provide comprehensive tools for managing finances, inventory, sales, purchasing, marketing, HR, operations and customer relations. The software is designed to help organizations of all sizes achieve their business objectives by increasing efficiency, reducing costs, improving decision-making, and enhancing overall value.",
"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,
385,
23387,
9460,
310,
5381,
10643,
8324,
393,
6911,
25700,
4840,
1220,
1009,
6931,
29892,
11157,
19201,
322,
14505,
3234,
2068,
29889,
739,
7805,
8982,
29925,
313,
10399,
7734,
18981,
8402,
1076,
511,
15600,
29924,
313,
15122,
6376,
800,
4034,
15057,
511,
379,
29934,
4345,
313,
29950,
7889,
27562,
15057,
2184,
29897,
322,
341,
3235,
313,
27107,
10343,
2184,
467,
4525,
6851,
3867,
15171,
6270,
8492,
363,
767,
6751,
11782,
778,
29892,
11817,
706,
29892,
16538,
29892,
10596,
5832,
29892,
9999,
292,
29892,
379,
29934,
29892,
6931,
322,
11962,
5302,
29889,
450,
7047,
338,
8688,
...