The AI Framework

Three months ago, I won the Generative AI Hackathon in Valencia, showcasing an AI Applications builder with a Python SDK.

In a similar vein as Bodia AI, my aim was to establish a more user-friendly approach for crafting AI Applications compared to Lagnchain, while also enabling effortless deployment through a single command.

I began to develop the AI Framework officially for Seaplane after pivoting into AI.

ML Flows

Machine Learning Flows determine which steps are included in a machine learning project. They help you managing the end-to-end ML lifecycles solving MLOps usually building DAGs.

Numerous solutions are available for tackling this issue, but Generative AI takes center stage.

The concept involves constructing an ML Flow that can be accessed via HTTP API Calls, Queues, or Cron Jobs. An ML Flow consists of the Entry Point (@app), alongside distinct Steps or @tasks that can be independently scaled.

@task()
def hello_world_task(data):
    return f"hello world {data['_request_id']}"

@app(id="hello-world-app", path="/hello")
def hello_world_app(data):
    return hello_world_task(data)

Here, @app(id="hello-world-app", path="/hello") serves as the Entry Point, generating an endpoint with the path /hello. The structure of the DAG is defined within the body of @app.

On the other hand, @task() represents an individual task responsible for executing a designated job, such as invoking a Generative AI model or storing data.

Smart Pipes AI Framework

The Smart Pipes framework presents an array of pre-built features tailored for real-world AI Applications. This encompasses actions like utilizing Text-to-Text models, converting files into vectors for embedding text into various Gen AI Models, and more.

The framework's aspiration is akin to that of NextJS for Vercel, offering the ability to effortlessly craft web applications and promptly deploy them with a single click.

For instance, if the objective is to load a batch of files and subsequently create a ChatBot that interacts with these files seamlessly:

@app(path="/load_pdfs", id="load_pdfs")
def load_pdfs_app(input):    
    file = save_pdfs(input)    
    store_loaded_file(file)

@task(type="vector", vector_name="my_company_docs")
def save_pdfs(input, store):

    file = input["file"]
    id = store.save(file)

    return {"id": id, "filename": file.filename}

@task(type="sql")
def store_loaded_file(input, sql):

    sql.insert("files_table", input["id"], input["filename"])

@task(type="vector", vector_name="my_company_docs")
def chat_with_pdfs(input, store):    

    return store.chat(input["query"])  # Returns the answer and chat history

@app(path="/chatbot", id="files_chatbot")
def save_files(input):
    return chat_with_pdfs(input)

With this concise snippet, a functional ChatBot capable of engaging with files is established. By default, it utilizes GPT-3.5, requiring the configuration of the OpenAI API Key.

Effortless Deployment

The process of deploying your chatbot is remarkably straightforward with the command seaplane deploy:

> seaplane deploy

[Seaplane]

    Seaplane Apps version 0.3.89

[Seaplane] Deployed Endpoints:

[Seaplane] 🚀 load_pdfs Endpoint: POST /apps/load_pdfs/latest/load_pdfs
[Seaplane] 🚀 files_chatbot Endpoint: POST /apps/files_chatbot/latest/chatbot

[Seaplane] 🚀 Deployment complete

Currently, this framework is in closed beta and is already being used by some customers. You can learn more by exploring the seaplane repository on GitHub.

I plan to delve further into my AI journey. If you are interested on it, please let me know in @tonilopezmr