Downloading a pdf and Summarizing it using Assistants API

Hi awesome OpenAI Developers Community!

I wrote a python script to download a pdf (using request) , then read the script (Code Below) and summarize the script using Assistants API + Retrieval Tool but I keep on getting
" requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.openai.com/v1/assistants/asst_NgiHE1odsYwZ2c1jb0IjwAOT/threads"

Please, can someone help me with why that error keeps occurring?

import os
import requests

# Environment variable for API key
api_key = os.environ.get("OPENAI_API_KEY")


def download_pdf(url, filename):
    response = requests.get(url)
    response.raise_for_status()
    with open(filename, "wb") as file:
        file.write(response.content)


def summarize_pdf_with_assistant(assistant_id, pdf_file_path, prompt="Summarize the key points of this PDF for me"):
    headers = {"Authorization": f"Bearer {api_key}"}

    # Create thread
    thread_response = requests.post(
        f"https://api.openai.com/v1/assistants/{assistant_id}/threads", headers=headers
    )
    thread_response.raise_for_status()
    thread_id = thread_response.json()["data"]["id"]

    # Upload PDF with metadata
    files = {"file": (os.path.basename(pdf_file_path), open(pdf_file_path, "rb"), "application/pdf")}
    message_response = requests.post(
        f"https://api.openai.com/v1/assistants/{assistant_id}/threads/{thread_id}/messages",
        headers=headers,
        files=files,
    )
    message_response.raise_for_status()

    # Extract and return assistant response
    messages = message_response.json().get("data", {}).get("messages", [])
    for message in messages:
        if message.get("role") == "assistant":
            return message.get("content", {}).get("text", "No summary available")

    return "No assistant response found"


# Define URL and paths
url = "https://etechyou.org/wp-content/uploads/2021/12/FURIOUS-ENTREPRENEURS-RULES-AND-REGULATIONS-Online-1.pdf"
directory = "C:\\Users\\saya\\MyDrive\\Desktop\\python steps\\"
input_pdf = os.path.join(directory, "downloaded_pdf.pdf")
output_summary = os.path.join(directory, "summary.txt")

# Download and process PDF
download_pdf(url, input_pdf)

# Customize the prompt as needed
summary_prompt = "Summarize the key points of this PDF for me, focusing on the main regulations for entrepreneurs."

# Summarize PDF with customized prompt
summary = summarize_pdf_with_assistant(assistant_id="asst_NgiHE1odsYwZ2c1jb0IjwAOT", pdf_file_path=input_pdf, prompt=summary_prompt)

# Save summary (add error handling and consider user prompt for summary generation)
if summary != "Error in API call" and summary != "No assistant response found":
    with open(output_summary, "w") as file:
        file.write(summary)
        print(f"Summary saved to {output_summary}")
else:
    print("Failed to create a summary.")
type or paste code here