2025-04-12 00:07:36 +03:00
|
|
|
---
|
2025-04-12 22:59:24 +03:00
|
|
|
sidebar_position: 4
|
2025-04-12 00:07:36 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
|
|
|
|
|
# Create model
|
|
|
|
|
Creates a new model with the specified settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function CreateModel(Val URL, Val Model, Val Settings, Val AdditionalHeaders = "") Export`
|
|
|
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|
|
|
|-|-|-|-|-|
|
|
|
|
|
| URL | --url | String | ✔ | Ollama server URL |
|
|
|
|
|
| Model | --model | String | ✔ | Models name |
|
|
|
|
|
| Settings | --settings | Structure Of KeyAndValue | ✔ | Model settings. See GetModelSettingsStructure |
|
|
|
|
|
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Processing result
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
:::tip
|
|
|
|
|
Method at API documentation: [Create a Model](https://github.com/ollama/ollama/blob/main/docs/api.md#create-a-model)
|
|
|
|
|
:::
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
|
|
|
URL = "https://api.athenaeum.digital/ollama";
|
2025-05-01 23:28:11 +03:00
|
|
|
Token = "10KO-82..."; // Authorization - not part API Ollama
|
2025-04-12 00:07:36 +03:00
|
|
|
|
|
|
|
|
Model = "mario";
|
|
|
|
|
|
|
|
|
|
AdditionalHeaders = New Map;
|
|
|
|
|
AdditionalHeaders.Insert("Authorization", StrTemplate("Bearer %1", Token));
|
|
|
|
|
|
|
|
|
|
Settings = New Structure("from,system", "tinyllama", "You are Mario from Super Mario Bros.");
|
|
|
|
|
|
|
|
|
|
Result = OPI_Ollama.CreateModel(URL, Model, Settings, AdditionalHeaders);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
2025-05-01 20:09:27 +03:00
|
|
|
<Tabs>
|
|
|
|
|
|
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
|
|
|
```bash
|
|
|
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
|
|
|
|
|
|
oint ollama CreateModel \
|
|
|
|
|
--url "https://api.athenaeum.digital/ollama" \
|
|
|
|
|
--model "mario" \
|
|
|
|
|
--settings "{'from':'tinyllama','system':'You are Mario from Super Mario Bros.'}" \
|
2025-05-01 23:21:55 +03:00
|
|
|
--headers "{'Authorization':'Bearer ***'}"
|
2025-05-01 20:09:27 +03:00
|
|
|
```
|
|
|
|
|
</TabItem>
|
|
|
|
|
|
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
|
|
|
```batch
|
|
|
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
|
|
|
|
|
|
oint ollama CreateModel ^
|
|
|
|
|
--url "https://api.athenaeum.digital/ollama" ^
|
|
|
|
|
--model "mario" ^
|
|
|
|
|
--settings "{'from':'tinyllama','system':'You are Mario from Super Mario Bros.'}" ^
|
2025-05-01 23:21:55 +03:00
|
|
|
--headers "{'Authorization':'Bearer ***'}"
|
2025-05-01 20:09:27 +03:00
|
|
|
```
|
|
|
|
|
</TabItem>
|
|
|
|
|
</Tabs>
|
2025-04-12 00:07:36 +03:00
|
|
|
|
|
|
|
|
|
2025-05-01 12:55:47 +03:00
|
|
|
```json title="Result"
|
|
|
|
|
{
|
|
|
|
|
"status": "success"
|
|
|
|
|
}
|
|
|
|
|
```
|