this is my apis python script: from fastapi import FastAPI, UploadFile, File, Form, HTTPException
from fastapi.responses import JSONResponse, FileResponse
from pydantic import BaseModel
import os
import datetime
from dotenv import load_dotenv
import uvicorn
from io import BytesIO
import tempfile
import openai

app = FastAPI()

# تشفير سيزار
def caesar_encrypt(text, shift):
    def shift_char(char):
        if char.isalpha():
            shift_base = ord('a') if char.islower() else ord('A')
            return chr((ord(char) - shift_base + shift) % 26 + shift_base)
        return char
    return ''.join(map(shift_char, text))

def caesar_decrypt(text, shift):
    return caesar_encrypt(text, -shift)

# تحميل مفتاح API من البيئة
def load_api_key():
    load_dotenv()
    encrypted_api_key = os.getenv("API_KEY")
    return caesar_decrypt(encrypted_api_key, 3)

# إعداد عميل OpenAI
def create_openai_client(api_key):
    openai.api_key = api_key

# استخدام API Key
api_key = load_api_key()
create_openai_client(api_key)

# نموذج الطلب للدردشة
class ChatRequest(BaseModel):
    messages: list
    text: str

# تحويل الصوت إلى نص
@app.post("/speech_to_text/")
async def speech_to_text_conversion(audio_file: UploadFile = File(...)):
    try:
        audio_bytes = await audio_file.read()
        audio_bio = BytesIO(audio_bytes)
        audio_bio.name = "file.wav"

        transcription = openai.Audio.transcribe(
            model="whisper-1",  
            file=audio_bio  
        )
        return {"transcription": transcription["text"]}
    except Exception as e:
        raise HTTPException(status_code=500, detail="Failed to transcribe audio.")

@app.post("/text_chat/")
async def text_chat(request: ChatRequest):
    """Generate a response using OpenAI based on the context provided."""
    messages = request.messages
    messages.append({"role": "user", "content": request.text})
    
    response = openai.ChatCompletion.create(
        model="gpt-4",
        messages=messages
    )
    
    bot_response = response.choices[0].message["content"]
    messages.append({"role": "assistant", "content": bot_response})
    
    return {"response": bot_response, "messages": messages}

@app.post("/text_to_speech/")
async def text_to_speech_conversion(text: str = Form(...)):
    """Converts text to audio format message using OpenAI's text-to-speech model - tts-1."""
    if text:
        speech_file_path = datetime.datetime.now().strftime("%Y%m%d%H%M%S") + "_speech.webm"
        response = openai.Audio.create(
            model="tts-1",  
            voice="nova",  
            input=text  
        )
        with open(speech_file_path, "wb") as audio_file:
            for chunk in response:
                audio_file.write(chunk)

        with open(speech_file_path, "rb") as audio_file:
            audio_data = audio_file.read()
        
        os.remove(speech_file_path)
        return {"audio_data": audio_data}


if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=8000)

there are problem in text to speech api only: the error is:
E:\LangChain\api_demo_1_9_2024>.myvenv\scripts\activate

(.myvenv) E:\LangChain\api_demo_1_9_2024>python back.py
←[32mINFO←[0m:     Started server process [←[36m17132←[0m]
←[32mINFO←[0m:     Waiting for application startup.
←[32mINFO←[0m:     Application startup complete.
←[32mINFO←[0m:     Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)
←[32mINFO←[0m:     127.0.0.1:58032 - "←[1mGET / HTTP/1.1←[0m" ←[31m404 Not Found←[0m
←[32mINFO←[0m:     127.0.0.1:52679 - "←[1mGET /docs HTTP/1.1←[0m" ←[32m200 OK←[0m
←[32mINFO←[0m:     127.0.0.1:52679 - "←[1mGET /openapi.json HTTP/1.1←[0m" ←[32m200 OK←[0m
←[32mINFO←[0m:     127.0.0.1:52826 - "←[1mPOST /speech_to_text/ HTTP/1.1←[0m" ←[32m200 OK←[0m
←[32mINFO←[0m:     127.0.0.1:52859 - "←[1mPOST /text_chat/ HTTP/1.1←[0m" ←[32m200 OK←[0m
←[32mINFO←[0m:     127.0.0.1:52867 - "←[1mPOST /text_to_speech/ HTTP/1.1←[0m" ←[91m500 Internal Server Error←[0m
←[31mERROR←[0m:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
    raise exc
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\starlette\routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\fastapi\routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ebrahim\anaconda3\Lib\site-packages\fastapi\routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\LangChain\api_demo_1_9_2024\back.py", line 82, in text_to_speech_conversion
    response = openai.Audio.create(
               ^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Audio' has no attribute 'create'
fixit and return response