LOT 1 - Optimizare script build -Instalare mono comanda
This commit is contained in:
parent
5380c3fc63
commit
42ff22bf85
127 changed files with 16163 additions and 532 deletions
|
|
@ -8,9 +8,8 @@ OpenAI-compatible speech-to-text transcription API using faster-whisper.
|
|||
{BASE_URL}
|
||||
```
|
||||
|
||||
- **Local development:** `http://localhost:8200`
|
||||
- **Docker (internal):** `http://audio-api:8200`
|
||||
- **Direct:** `http://localhost:54300`
|
||||
- **Local development:** `http://localhost:54300`
|
||||
- **Docker (internal):** `http://audio-api:54300`
|
||||
- **Production:** Use your configured hostname
|
||||
|
||||
## Authentication
|
||||
|
|
@ -34,7 +33,7 @@ Check API health status.
|
|||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:8200/health
|
||||
curl http://localhost:54300/health
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -62,7 +61,20 @@ List available Whisper models (OpenAI-compatible).
|
|||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:8200/v1/models
|
||||
curl http://localhost:54300/v1/models
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Service Info
|
||||
|
||||
Return service catalog metadata (resources, models, functions). Consumed by the DIDI `catalog-api`.
|
||||
|
||||
**Endpoint:** `GET /v1/info`
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
curl http://localhost:54300/v1/info
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -79,13 +91,16 @@ Transcribe audio file to text (OpenAI-compatible endpoint).
|
|||
|
||||
| Parameter | Type | Required | Default | Description |
|
||||
|-----------|------|----------|---------|-------------|
|
||||
| `file` | file | Yes | - | Audio file to transcribe (MP3, WAV, M4A, etc.) |
|
||||
| `file` | file | Yes* | - | Audio file to transcribe (MP3, WAV, M4A, etc.). Provide either `file` or `url` (XOR). |
|
||||
| `url` | string | Yes* | - | URL to download the audio from (DIDI extension over OpenAI). Provide either `file` or `url` (XOR). |
|
||||
| `model` | string | No | `large-v3-turbo` | Model to use (currently ignored, uses configured model) |
|
||||
| `language` | string | No | `null` | Language code (ISO-639-1). Auto-detected if not specified. |
|
||||
| `prompt` | string | No | `null` | Optional text to guide the model's style |
|
||||
| `response_format` | string | No | `json` | Format: `json`, `text`, or `verbose_json` |
|
||||
| `temperature` | float | No | `0.0` | Sampling temperature (0.0-1.0). Use 0.0 for deterministic output. |
|
||||
|
||||
\* `file` and `url` are mutually exclusive — supply exactly one.
|
||||
|
||||
**Supported Languages (ISO-639-1 codes):**
|
||||
`en`, `es`, `fr`, `de`, `it`, `pt`, `nl`, `pl`, `tr`, `ru`, `ja`, `ko`, `zh`, `ar`, `hi`, and 90+ more languages.
|
||||
|
||||
|
|
@ -132,14 +147,21 @@ Full transcription text
|
|||
|
||||
**Basic transcription (JSON):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=json"
|
||||
```
|
||||
|
||||
**From a URL (instead of file upload):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "url=https://example.com/audio.mp3" \
|
||||
-F "response_format=json"
|
||||
```
|
||||
|
||||
**With language specification:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "language=en" \
|
||||
-F "response_format=json"
|
||||
|
|
@ -147,21 +169,21 @@ curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
|||
|
||||
**Text format:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=text"
|
||||
```
|
||||
|
||||
**Verbose JSON with segments:**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "response_format=verbose_json"
|
||||
```
|
||||
|
||||
**With initial prompt (to guide style):**
|
||||
```bash
|
||||
curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
||||
curl -X POST "http://localhost:54300/v1/audio/transcriptions" \
|
||||
-F "file=@audio.mp3" \
|
||||
-F "prompt=This is a technical discussion about machine learning." \
|
||||
-F "response_format=json"
|
||||
|
|
@ -171,7 +193,7 @@ curl -X POST "http://localhost:8200/v1/audio/transcriptions" \
|
|||
```python
|
||||
import requests
|
||||
|
||||
url = "http://localhost:8200/v1/audio/transcriptions"
|
||||
url = "http://localhost:54300/v1/audio/transcriptions"
|
||||
|
||||
with open("audio.mp3", "rb") as f:
|
||||
files = {"file": f}
|
||||
|
|
@ -196,7 +218,7 @@ formData.append('file', audioFile);
|
|||
formData.append('model', 'large-v3-turbo');
|
||||
formData.append('response_format', 'json');
|
||||
|
||||
const response = await fetch('http://localhost:8200/v1/audio/transcriptions', {
|
||||
const response = await fetch('http://localhost:54300/v1/audio/transcriptions', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
|
@ -247,7 +269,7 @@ limit_req_zone $binary_remote_addr zone=audio_limit:10m rate=10r/m;
|
|||
|
||||
location / {
|
||||
limit_req zone=audio_limit burst=5;
|
||||
proxy_pass http://audio-api:8200;
|
||||
proxy_pass http://audio-api:54300;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -330,7 +352,7 @@ from openai import OpenAI
|
|||
# Point to local API
|
||||
client = OpenAI(
|
||||
api_key="not-needed", # No auth required
|
||||
base_url="http://localhost:8200/v1"
|
||||
base_url="http://localhost:54300/v1"
|
||||
)
|
||||
|
||||
with open("audio.mp3", "rb") as f:
|
||||
|
|
@ -351,7 +373,7 @@ import fs from 'fs';
|
|||
|
||||
const openai = new OpenAI({
|
||||
apiKey: 'not-needed',
|
||||
baseURL: 'http://localhost:8200/v1'
|
||||
baseURL: 'http://localhost:54300/v1'
|
||||
});
|
||||
|
||||
const transcription = await openai.audio.transcriptions.create({
|
||||
|
|
@ -391,7 +413,7 @@ Configurable via `AUDIO_BEAM_SIZE` (default: 5). Higher values = better accuracy
|
|||
|
||||
```bash
|
||||
# Check if API is ready
|
||||
curl http://localhost:8200/health
|
||||
curl http://localhost:54300/health
|
||||
|
||||
# Expected response
|
||||
{"status": "ok"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue