Skip to content

Commit

Permalink
docs: added endpoint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
francis2tm committed Jan 31, 2024
1 parent 41023e5 commit c095c9c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 392 deletions.
83 changes: 33 additions & 50 deletions docs/src/app/api-reference/audio/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,86 +14,69 @@ Discover how to convert audio to text or text to audio. OpenAI compliant. {{ cla
<Row>
<Col>

Transcribes audio into text.
Transcribes speech into text.

### Required attributes

<Properties>
<Property name="username" type="string">
The username for the contact.
</Property>
<Property name="phone_number" type="string">
The phone number for the contact.
<Property name="file" type="file">
The audio file to be transcribed. Supported file types: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
</Property>
</Properties>

### Optional attributes

<Properties>
<Property name="avatar_url" type="string">
The avatar image URL for the contact.
</Property>
<Property name="display_name" type="string">
The contact display name in the contact list. By default, this is just the username.
<Property name="model" type="string">
The model used for transcription. **WARNING**: currently, this attribute is **ignored** and the **default model is used**.
</Property>
</Properties>


</Col>
<Col sticky>

<CodeGroup title="Request" tag="GET" label="/v1/contacts">
<CodeGroup title="Request" tag="POST" label="v1/audio/transcriptions">

```bash {{ title: 'cURL' }}
curl -G http://localhost:33322/v1/audio/transcriptions \
-H "Authorization: Bearer no-key" \
curl http://localhost:33322/v1/audio/transcriptions \
-H "Authorization: Bearer no-key-required" \
-H "Content-Type: multipart/form-data" \
-F file="/path/to/file/audio.mp3" \
-F model="distil-small.en"
-F file="@/path/to/file/audio.mp3" \
-F model="default"
```

```js
import ApiClient from '@example/protocol-api'
const client = new ApiClient(token)
await client.contacts.list()
```python
from edgen import Edgen
client = Edgen()
audio_file = open("speech.mp3", "rb")
transcript = client.audio.transcriptions.create(
model="default",
file=audio_file
)
```

```python
from protocol_api import ApiClient
```ts
import fs from "fs";
import Edgen from "edgen";
client = ApiClient(token)
const client = new Edgen();
client.contacts.list()
```
async function main() {
const transcription = await client.audio.transcriptions.create({
model: "default",
file: fs.createReadStream("audio.mp3")
});
```php
$client = new \Protocol\ApiClient($token);
console.log(transcription.text);
}
main();
$client->contacts->list();
```

</CodeGroup>

```json {{ title: 'Response' }}
{
"has_more": false,
"data": [
{
"id": "WAz8eIbvDR60rouK",
"username": "FrankMcCallister",
"phone_number": "1-800-759-3000",
"avatar_url": "https://assets.protocol.chat/avatars/frank.jpg",
"display_name": null,
"conversation_id": "xgQQXg3hrtjh7AvZ",
"last_active_at": 705103200,
"created_at": 692233200
},
{
"id": "hSIhXBhNe8X1d8Et"
// ...
}
]
"text": "The woods are lovely, dark and deep, but I have promises to keep and miles to go before I sleep, and miles to go before I sleep."
}
```

Expand Down
Loading

0 comments on commit c095c9c

Please sign in to comment.