pyaudioai package

Submodules

pyaudioai.OpenAiResponse module

class pyaudioai.OpenAiResponse.OpenAiResponse(api_key, model='gpt-3.5-turbo', audio_model='whisper-1')[Quellcode]

Bases: object

A class used to get a text or an audi response from OpenAI ChatGPT.

api_key

key to authenticate through OpenAI API https://platform.openai.com/account/api-keys

Type:

str

model

select a ChatGPT model https://platform.openai.com/docs/guides/gpt (default gpt-3.5-turbo)

Type:

str

audio_model

select a speech to text model https://platform.openai.com/docs/guides/speech-to-text (default whisper-1)

Type:

str

get_audio_response(audio_file)[Quellcode]

Get an audio response of an audio file which contains a question. The function converts the text repsonse with TTS to an audio object and plays the audio.

Parameter:

audio_file (str, required) – Path to an audio file which contains a questio

get_text_response(audio_file)[Quellcode]

Get a text response of an audio file which contains a question.

Parameter:

audio_file (str, required) – Path to an audio file which contains a question

Rückgabe:

response from ChatGPT as text

Rückgabetyp:

str

transcribe(audio_file)[Quellcode]

Transcribe an audio file to text.

Parameter:

audio_file (str, required) – Path to an audio file which contains a question

Verursacht:

FileNotFoundError – If the audio file is not found

pyaudioai.RecordQuestion module

class pyaudioai.RecordQuestion.RecordQuestion(recording_time, audio_file)[Quellcode]

Bases: object

A class used to record an audio file with the computers microphone.

recording_time

recording time in seconds

Type:

int

audio_file

Path to an audio file where the question is stored temporarily.

Type:

str

delete_file()[Quellcode]

Delete the temporary generated audio file.

record()[Quellcode]

Record the audio file.

Module contents