You've already forked ModuleLLM-OpenAI-Plugin
mirror of
https://github.com/m5stack/ModuleLLM-OpenAI-Plugin.git
synced 2026-05-20 11:37:26 -07:00
[update] Update Docs
This commit is contained in:
@@ -12,7 +12,7 @@ openai = OpenAI(
|
||||
)
|
||||
|
||||
completion = client.chat.completions.create(
|
||||
model="qwen2.5-0.5b-p256-ax630c",
|
||||
model="qwen2.5-0.5B-p256-ax630c",
|
||||
messages=[
|
||||
{"role": "developer", "content": "You are a helpful assistant."},
|
||||
{"role": "user", "content": "Hello!"}
|
||||
@@ -28,7 +28,7 @@ print(completion.choices[0].message)
|
||||
A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio.
|
||||
|
||||
### model `string` <span style="color: red;">Required</span>
|
||||
Model ID used to generate the response, like `qwen2.5-0.5b-p256-ax630c` or `deepseek-r1-1.5b-p256-ax630c`. StackFlow offers a wide range of models with different capabilities, performance characteristics. Refer to the model Docs to browse and compare available models.
|
||||
Model ID used to generate the response, like `qwen2.5-0.5B-p256-ax630c` or `deepseek-r1-1.5B-p256-ax630c`. StackFlow offers a wide range of models with different capabilities, performance characteristics. Refer to the model Docs to browse and compare available models.
|
||||
|
||||
### audio
|
||||
`Audio output is not currently supported`
|
||||
|
||||
+2
-1
@@ -8,12 +8,13 @@ Lists the currently available models, and provides basic information about each
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
openai = OpenAI(
|
||||
client = OpenAI(
|
||||
api_key="sk-",
|
||||
base_url="http://192.168.20.186:8000/v1"
|
||||
)
|
||||
|
||||
client.models.list()
|
||||
print(client.models.list())
|
||||
```
|
||||
|
||||
## Returns
|
||||
|
||||
+18
-30
@@ -1,45 +1,33 @@
|
||||
# Audio
|
||||
Learn how to turn audio into text or text into audio.
|
||||
|
||||
# Create speech
|
||||
post https://192.168.20.186:8000/v1/audio/speech
|
||||
|
||||
Generates audio from the input text.
|
||||
# Create transcription
|
||||
`post http://192.168.20.186:8000/v1/audio/transcriptions`
|
||||
Transcribes audio into the input language.
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
from openai import OpenAI
|
||||
|
||||
openai = OpenAI(
|
||||
client = OpenAI(
|
||||
api_key="sk-",
|
||||
base_url="http://192.168.20.186:8000/v1"
|
||||
)
|
||||
|
||||
speech_file_path = Path(__file__).parent / "speech.mp3"
|
||||
with openai.audio.speech.with_streaming_response.create(
|
||||
model="gpt-4o-mini-tts",
|
||||
voice="alloy",
|
||||
input="The quick brown fox jumped over the lazy dog."
|
||||
) as response:
|
||||
response.stream_to_file(speech_file_path)
|
||||
audio_file = open("speech.mp3", "rb")
|
||||
transcript = client.audio.transcriptions.create(
|
||||
model="whisper-tiny",
|
||||
language="en",
|
||||
file=audio_file
|
||||
)
|
||||
```
|
||||
|
||||
## Request body
|
||||
|
||||
### input `string` <span style="color: red;">Required</span>
|
||||
The text to generate audio for. The maximum length is `1024` characters.
|
||||
### file file Required
|
||||
The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
|
||||
|
||||
### model `string` <span style="color: red;">Required</span>
|
||||
One of the available TTS models: `melotts-zh-cn`, `melotts-en-us`.
|
||||
ID of the model to use. The options are `whisper-tiny`, `whisper-base`, and `whisper-small`.
|
||||
|
||||
### voice
|
||||
`Voice selection is not currently supported`
|
||||
### language `string` <span style="color: red;">Required</span>
|
||||
The language of the input audio. Supplying the input language in ISO-639-1 (e.g. en) format will improve accuracy and latency.
|
||||
|
||||
### response_format `string` Optional Defaults to mp3
|
||||
The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
|
||||
|
||||
### speed `number` Optional Defaults to 1
|
||||
The speed of the generated audio. Select a value from `0.25` to `2.0`. `1.0` is the default.
|
||||
|
||||
## Returns
|
||||
The audio file content.
|
||||
### response_format string Optional
|
||||
Defaults to json
|
||||
`Currently only supported format is json.`
|
||||
+30
-18
@@ -1,33 +1,45 @@
|
||||
# Create transcription
|
||||
`post http://192.168.20.186:8000/v1/audio/transcriptions`
|
||||
Transcribes audio into the input language.
|
||||
# Audio
|
||||
Learn how to turn audio into text or text into audio.
|
||||
|
||||
# Create speech
|
||||
post https://192.168.20.186:8000/v1/audio/speech
|
||||
|
||||
Generates audio from the input text.
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
from openai import OpenAI
|
||||
client = OpenAI(
|
||||
|
||||
openai = OpenAI(
|
||||
api_key="sk-",
|
||||
base_url="http://192.168.20.186:8000/v1"
|
||||
)
|
||||
|
||||
audio_file = open("speech.mp3", "rb")
|
||||
transcript = client.audio.transcriptions.create(
|
||||
model="whisper-tiny",
|
||||
language="en",
|
||||
file=audio_file
|
||||
)
|
||||
speech_file_path = Path(__file__).parent / "speech.mp3"
|
||||
with openai.audio.speech.with_streaming_response.create(
|
||||
model="melotts-en-us",
|
||||
voice="alloy",
|
||||
input="The quick brown fox jumped over the lazy dog."
|
||||
) as response:
|
||||
response.stream_to_file(speech_file_path)
|
||||
```
|
||||
|
||||
## Request body
|
||||
|
||||
### file file Required
|
||||
The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
|
||||
### input `string` <span style="color: red;">Required</span>
|
||||
The text to generate audio for. The maximum length is `1024` characters.
|
||||
|
||||
### model `string` <span style="color: red;">Required</span>
|
||||
ID of the model to use. The options are `whisper-tiny`, `whisper-base`, and `whisper-small`.
|
||||
One of the available TTS models: `melotts-zh-cn`, `melotts-en-us`.
|
||||
|
||||
### language `string` <span style="color: red;">Required</span>
|
||||
The language of the input audio. Supplying the input language in ISO-639-1 (e.g. en) format will improve accuracy and latency.
|
||||
### voice
|
||||
`Voice selection is not currently supported`
|
||||
|
||||
### response_format string Optional
|
||||
Defaults to json
|
||||
`Currently only supported format is json.`
|
||||
### response_format `string` Optional Defaults to mp3
|
||||
The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
|
||||
|
||||
### speed `number` Optional Defaults to 1
|
||||
The speed of the generated audio. Select a value from `0.25` to `2.0`. `1.0` is the default.
|
||||
|
||||
## Returns
|
||||
The audio file content.
|
||||
Reference in New Issue
Block a user