Mixed Brad Cloud: A united API for the Pipelines of the Rules

by SkillAiNest

Mixed Brad Cloud: A united API for the Pipelines of the Rules
Image by Editor (Kanwal Mehreen) | Canva

In a conversation with some machine learning engineers, I asked why we need to connect Langchen with numerous APIs and services so that the RAG pipeline can be set up. Why can’t we have an API that handles everything – such as document loading, analysis, embedd, re -modeling, and vector storage – all in one place?

It turns out, a solution called mixed bread. This platform is fast, user -friendly, and provides recovery pipelines tools tools for construction and service. In this tutorial, we will find the mixed bread cloud and learn how to build a fully functional rag pipeline using the latest model of mixed bread and the latest model of Openi.

Introducing Mixed Brad Cloud

Mixed bread cloud is in the same solution to build appropriate AI application with the most advanced text understanding capabilities. Designed to simplify the development process, it provides a comprehensive sweet of tools to handle everything from document management to intelligent search and recovery.

Mixed Brad provides cloud:

  • Document uploading: Upload any kind of documentation using user -friendly interface or API
  • Document processing: By converting non -imposed data into text, extract structural information from different documents forms
  • Vector Stores: Store and recover embedded with files worth files
  • Text embedding: Change the text into a high quality vector representation that achieves meaningful meaning
  • To work again: Bew

Construction of the Request with the Mixed Brad and Openi

In this project, we will learn how to create a RAG application using mixed bread and Openi API. This phased guide operates you through the creation of the environment, uploading documents, making vector stores, monitoring file processing, and construction of a fully functional rag pipeline.

1. Sorting

  1. See Mixed bread website And create an account. Once you sign up, prepare your API key. Similarly, make sure you have the open API key.
  2. Then, save your API keys as an environmental variable for safe access to your code.
  3. Make sure you have the required trigger libraries:
pip install mixedbread openai
  1. Start the mixed bread client and open the AI ​​client using the API keys. Also, Set the PAT or PDF folder, tell the name of the vector store, and the name of the LLM.
import os
import time
from mixedbread import Mixedbread
from openai import OpenAI

# --- Configuration ---
# 1. Get your Mixedbread API Key
mxbai_api_key = os.getenv("MXBAI_API_KEY")

# 2. Get your OpenAI API Key
openai_api_key = os.getenv("OPENAI_API_KEY")

# 3. Define the path to the FOLDER containing your PDF files
pdf_folder_path = "/work/docs"

# 4. Vector Store Configuration
vector_store_name = "Abid Articles"

# 5. OpenAI Model Configuration
openai_model = "gpt-4.1-nano-2025-04-14"

# --- Initialize Clients ---
mxbai = Mixedbread(api_key=mxbai_api_key)
openai_client = OpenAI(api_key=openai_api_key)

2. Uploading files

We will find all PDF files in the specified folder and then upload them to the mixed bread cloud using the API.

import glob

pdf_files_to_upload = glob.glob(os.path.join(pdf_folder_path, "*.pdf")) # Find all .pdf files

print(f"Found {len(pdf_files_to_upload)} PDF files to upload:")
for pdf_path in pdf_files_to_upload:
    print(f"  - {os.path.basename(pdf_path)}")

uploaded_file_ids = ()
print("\nUploading files...")
for pdf_path in pdf_files_to_upload:
    filename = os.path.basename(pdf_path)
    print(f"  Uploading {filename}...")
    with open(pdf_path, "rb") as f:
        upload_response = mxbai.files.create(file=f)
        file_id = upload_response.id
        uploaded_file_ids.append(file_id)
        print(f"    -> Uploaded successfully. File ID: {file_id}")

print(f"\nSuccessfully uploaded {len(uploaded_file_ids)} files.")

All four PDF files have been successfully uploaded.

Found 4 PDF files to upload:
  - Building Agentic Application using Streamlit and Langchain.pdf
  - Deploying DeepSeek Janus Pro locally.pdf
  - Fine-Tuning GPT-4o.pdf
  - How to Reach $500k on Upwork.pdf

Uploading files...
  Uploading Building Agentic Application using Streamlit and Langchain.pdf...
    -> Uploaded successfully. File ID: 8a538aa9-3bde-4498-90db-dbfcf22b29e9
  Uploading Deploying DeepSeek Janus Pro locally.pdf...
    -> Uploaded successfully. File ID: 52c7dfed-1f9d-492c-9cf8-039cc64834fe
  Uploading Fine-Tuning GPT-4o.pdf...
    -> Uploaded successfully. File ID: 3eaa584f-918d-4671-9b9c-6c91d5ca0595
  Uploading How to Reach $500k on Upwork.pdf...
    -> Uploaded successfully. File ID: 0e47ba93-550a-4d4b-9da1-6880a748402b

Successfully uploaded 4 files.

You can go to your mixed bread dashboard and click on the “files” tabs to view all uploaded files.

Mixed Brad Cloud: A united API for the Pipelines of the Rules

3. Making and popularizing vector stores

Now we will build a vector store and add uploaded files by providing a list of uploaded file IDS.

vector_store_response = mxbai.vector_stores.create(
    name=vector_store_name,
    file_ids=uploaded_file_ids # Add all uploaded file IDs during creation
)
vector_store_id = vector_store_response.id

4. Monitor the file processing status

The mixed bread vector will convert each page of the store files into embellishness and then save them in the vector store. This means that you can look for images or text matches within the PDF.

We have written a custom code to monitor the status of file processing.

print("\nMonitoring file processing status (this may take some time)...")
all_files_processed = False
max_wait_time = 600 # Maximum seconds to wait (10 minutes, adjust as needed)
check_interval = 20 # Seconds between checks
start_time = time.time()
final_statuses = {}

while not all_files_processed and (time.time() - start_time) < max_wait_time:
    all_files_processed = True # Assume true for this check cycle
    current_statuses = {}
    files_in_progress = 0
    files_completed = 0
    files_failed = 0
    files_pending = 0
    files_other = 0

    for file_id in uploaded_file_ids:
       
        status_response = mxbai.vector_stores.files.retrieve(
            vector_store_id=vector_store_id,
            file_id=file_id
        )
        current_status = status_response.status
        final_statuses(file_id) = current_status # Store the latest status

        if current_status == "completed":
            files_completed += 1
        elif current_status in ("failed", "cancelled", "error"):
            files_failed += 1
        elif current_status == "in_progress":
            files_in_progress += 1
            all_files_processed = False # At least one file is still processing
        elif current_status == "pending":
             files_pending += 1
             all_files_processed = False # At least one file hasn't started
        else:
            files_other += 1
            all_files_processed = False # Unknown status, assume not done

    print(f"  Status Check (Elapsed: {int(time.time() - start_time)}s): "
          f"Completed: {files_completed}, Failed: {files_failed}, "
          f"In Progress: {files_in_progress}, Pending: {files_pending}, Other: {files_other} "
          f"/ Total: {len(uploaded_file_ids)}")

    if not all_files_processed:
        time.sleep(check_interval)

# --- Check Final Processing Outcome ---
completed_count = sum(1 for status in final_statuses.values() if status == 'completed')
failed_count = sum(1 for status in final_statuses.values() if status in ('failed', 'cancelled', 'error'))

print("\n--- Processing Summary ---")
print(f"Total files processed: {len(final_statuses)}")
print(f"Successfully completed: {completed_count}")
print(f"Failed or Cancelled: {failed_count}")
for file_id, status in final_statuses.items():
    if status != 'completed':
        print(f"  - File ID {file_id}: {status}")

if completed_count == 0:
     print("\nNo files completed processing successfully. Exiting RAG pipeline.")
     exit()
elif failed_count > 0:
     print("\nWarning: Some files failed processing. RAG will proceed using only the successfully processed files.")
elif not all_files_processed:
     print(f"\nWarning: File processing did not complete for all files within the maximum wait time ({max_wait_time}s). RAG will proceed using only the successfully processed files.")

It took about 42 42 seconds to take more than 100 pages.

Monitoring file processing status (this may take some time)...
  Status Check (Elapsed: 0s): Completed: 0, Failed: 0, In Progress: 4, Pending: 0, Other: 0 / Total: 4
  Status Check (Elapsed: 21s): Completed: 0, Failed: 0, In Progress: 4, Pending: 0, Other: 0 / Total: 4
  Status Check (Elapsed: 42s): Completed: 4, Failed: 0, In Progress: 0, Pending: 0, Other: 0 / Total: 4

--- Processing Summary ---
Total files processed: 4
Successfully completed: 4
Failed or Cancelled: 0

When you click on the “Vector Store” tab on the mixed bread dashboard, you will see that the vector store is made successfully and has 4 files secure.

Mixed Brad Cloud: A united API for the Pipelines of the Rules

5. Rag pipeline construction

A rag pipeline consists of three main components: recovery, promotion, and breed. The following is a step -by -step explanation of how these ingredients work together to create a strong question answering system.

The first step in the RAG pipeline is recovery, where the system searches related information based on the user’s inquiry. It is obtained by inquiring from the vector store to find a similar result.

user_query = "How to Deploy Deepseek Janus Pro?"

retrieved_context = ""

search_results = mxbai.vector_stores.search(
    vector_store_ids=(vector_store_id), # Search within our newly created store
    query=user_query,
    top_k=10 # Retrieve top 10 relevant chunks across all documents
)

if search_results.data:
    # Combine the content of the chunks into a single context string
    context_parts = ()
    for i, chunk in enumerate(search_results.data):
        context_parts.append(f"Chunk {i+1} from '{chunk.filename}' (Score: {chunk.score:.4f}):\n{chunk.content}\n---")
    retrieved_context = "\n".join(context_parts)
else:
    retrieved_context = "No context was retrieved." 

The next step is increasing, where the recovered context is mixed with the user’s inquiry so that the customs prompt can be prepared. This gesture includes system instructions, user questions, and recovery context.

prompt_template = f"""
You are an assistant answering questions based *only* on the provided context from multiple documents.
Do not use any prior knowledge. If the context does not contain the answer to the question, state that clearly.

Context from the documents:
---
{retrieved_context}
---

Question: {user_query}

Answer:
"""

The last step is the generation, where the shared gesture is sent to a language model (Openi’s GPT -4.1 -Nano) to create the answer. This model has been selected for its cost effectiveness and speed.

response = openai_client.chat.completions.create(
    model=openai_model,
    messages=(
        {"role": "user", "content": prompt_template}
    ),
    temperature=0.2,
    max_tokens=500
)

final_answer = response.choices(0).message.content.strip()

print(final_answer)

The Rag pipeline produces highly accurate and context -related answers.

To deploy DeepSeek Janus Pro locally, follow these steps:

1. Install Docker Desktop from  and set it up with default settings. On Windows, ensure WSL is installed if prompted.

2. Clone the Janus repository by running:
   ```
   git clone 
   ```
3. Navigate into the cloned directory:
   ```
   cd Janus
   ```
4. Build the Docker image using the provided Dockerfile:
   ```
   docker build -t janus .
   ```
5. Run the Docker container with the following command, which sets up port forwarding, GPU access, and persistent storage:
   ```
   docker run -it --rm -p 7860:7860 --gpus all --name janus_pro -e TRANSFORMERS_CACHE=/root/.cache/huggingface -v huggingface:/root/.cache/huggingface janus:latest
   ```
6. Wait for the container to download the model and start the Gradio application. Once running, access the app at 

7. The application has two sections: one for image understanding and one for image generation, allowing you to upload images, ask for descriptions or poems, and generate images based on prompts.

This process enables you to deploy DeepSeek Janus Pro locally on your machine.

Conclusion

Applying a rag using mixed bread was a straightforward and effective process. The mixed bread team is highly recommended for tasks such as using documents, analyzing data, building vector stores, and looking for similarities through intuitive user interface. From this point of view, professionals from different fields make it easy to make applications for understanding their text without the need for broader technical skills.

In this tutorial, we learned how the unified API of mixed bread facilitates the process of making a rag pipeline. Implementation only requires a few steps and provides fast, accurate results. Unlike traditional methods, documents that scratch the text, mixed bread converts the entire pages to embedded, which can enable more efficient and precise recovery of related information. The approach to embedd from this page level ensures that the results are full of context and extremely related.

Abid Ali Owan For,,,,,,,,,, for,, for,,,, for,,,, for,,, for,,,, for,,,, for,,,, for,,, for,,, for,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,,, for,,, for,,, for,,, for,,, for,,,,, for,,,, for,,,, for,,,, for,, for,.@1abidaliawan) A certified data scientist is a professional who loves to create a machine learning model. Currently, he is focusing on creating content and writing technical blogs on machine learning and data science technologies. Abid has a master’s degree in technology management and a bachelor’s degree in telecommunications engineering. Its vision is to create AI products using a graph neural network for students with mental illness.

You may also like

Leave a Comment

At Skillainest, we believe the future belongs to those who embrace AI, upgrade their skills, and stay ahead of the curve.

Get latest news

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

@2025 Skillainest.Designed and Developed by Pro