You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-25 22:12:29 +02:00
107 lines
3.0 KiB
Plaintext
Vendored
107 lines
3.0 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
description: Create transcription and other functions to work with OpenAI in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, OpenAI]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Create transcription
|
|
Creates a text transcription for the selected audio file
|
|
|
|
|
|
|
|
`Function CreateTranscription(Val URL, Val Token, Val Model, Val Audio, Val MIME = "audio/mpeg", Val AdditionalParameters = "", Val AdditionalHeaders = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| URL | --url | String | ✔ | OpenAI server URL |
|
|
| Token | --token | String | ✔ | OpenAI authorization token |
|
|
| Model | --model | String | ✔ | Models name |
|
|
| Audio | --audio | String, BinaryData | ✔ | Audio file |
|
|
| MIME | --type | String | ✖ | MIME type of audio file |
|
|
| AdditionalParameters | --options | Structure Of KeyAndValue | ✖ | Additional request parameters, if necessary |
|
|
| AdditionalHeaders | --headers | Map Of KeyAndValue | ✖ | Additional request headers, if necessary |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - Processing result
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Method at API documentation: [Create transcription](https://platform.openai.com/docs/api-reference/audio/createTranscription)
|
|
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
URL = "https://hut.openintegrations.dev/localai/";
|
|
Token = "12We...";
|
|
|
|
Audio = "C:\Users\bayse\AppData\Local\Temp\v8_1649_1f.wav";
|
|
Model = "whisper-1";
|
|
|
|
Result = OPI_OpenAI.CreateTranscription(URL, Token, Model, Audio, "audio/wav");
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
oint openai CreateTranscription \
|
|
--url "https://hut.openintegrations.dev/localai/" \
|
|
--token "***" \
|
|
--model "whisper-1" \
|
|
--audio "/tmp/ixu0tcts.qx1.wav" \
|
|
--type "audio/wav"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
oint openai CreateTranscription ^
|
|
--url "https://hut.openintegrations.dev/localai/" ^
|
|
--token "***" ^
|
|
--model "whisper-1" ^
|
|
--audio "/tmp/ixu0tcts.qx1.wav" ^
|
|
--type "audio/wav"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"segments": [
|
|
{
|
|
"id": 0,
|
|
"start": 0,
|
|
"end": 4480000000,
|
|
"text": "attack ships on fire off the shoulder of Orion Bright as magnesium.",
|
|
"tokens": [
|
|
50364,
|
|
2690,
|
|
11434,
|
|
322,
|
|
2610,
|
|
766,
|
|
264,
|
|
7948,
|
|
295,
|
|
41028,
|
|
24271,
|
|
382,
|
|
32950,
|
|
13,
|
|
50588
|
|
]
|
|
}
|
|
],
|
|
"text": "attack ships on fire off the shoulder of Orion Bright as magnesium."
|
|
}
|
|
```
|