Airflow operator for managing Ollama and ngrok
Project description
Ollama-Airflow-Operator: Because AI, Airflow, and Alliteration Are Awesome!
🤖 "Airflow + Ollama = Magic" - Some Data Scientist, probably
Welcome to the Ollama-Airflow-Operator, where we make running LLMs as easy as pie (and potentially more delicious)!
What's This All About?
Ever wished you could orchestrate Large Language Models (LLMs) with the ease of scheduling a tweet? Well, now you can! This Airflow plugin lets you manage Ollama (the cool kid in the LLM playground) with no external compute dependencies. That is the key.
Here is why
In the wild world of enterprise AI, Data Engineers often find themselves in a peculiar predicament. They have the skills, the ideas, and the burning desire to leverage LLMs for innovative solutions. But alas! They're often stymied by the lack of access to dedicated LLM endpoints in their organizations.
Enter the Ollama-Airflow-Operator – a glimmer of hope in the dark night of corporate red tape. Born from the frustration of Data Engineers who dared to dream, this plugin turns the tables on the traditional AI deployment model.
With this operator, Data Engineers can now leverage their existing Airflow infrastructure to spin up LLM endpoints on demand. No need for external compute resources or endpoints. No more waiting for IT approvals. Just pure, unadulterated LLM power at your fingertips.
Is this the only reason?
No. Imagine the future of Agents. There are tools after tools and frameworks after frameworks that are showing up. But nothing stands as tall as Airflow in the world of task orchestration. Any AI Agent will first and foremost be an orchestrated workflow, and that is where the power of Airflow comes in. Pair it up with Ollama - and Data Engineers can now make magic happen say with enriching data in ways not possible previously, or making sense of unstructured data and the possibilities are limitless.
Getting Started
Get ready to embark on your LLM journey with Airflow! Here's how to get started:
1. Installation
First, install the Ollama-Airflow-Operator package:
pip install airflow-ollama
OR
pip install git+https://github.com/KarmaloopAI/Ollama-Airflow-Operator.git
2. Import the Operators
This should be same as any other operators you use in your Airflow DAGs
from airflow import DAG
from airflow.utils.dates import days_ago
from airflow_ollama.operators.ollama_operator import OllamaOperator
from airflow_ollama.operators.ngrok_exposer_operator import NgrokExposerOperator
3. Use it in your DAGs
Here is an example of how to use it.
with DAG('ollama_llm_setup', start_date=days_ago(1), schedule_interval=None) as dag:
install_ollama = OllamaOperator(
task_id='install_ollama',
install_ollama=True,
model_name='gemma:2b', # Choose your model
run_model=False
)
expose_ollama = NgrokExposerOperator(
task_id='expose_ollama',
port=11434, # Default Ollama port
auth_token='your_ngrok_auth_token'
)
run_model = OllamaOperator(
task_id='run_model',
model_name='gemma:2b',
run_model=True
)
install_ollama >> expose_ollama >> run_model
About the Author
Hello, my name is Abi Chatterjee and you may reach me via LinkedIn
I am in love with LLMs, for the better or worse, and have been finding innovative ways of building LLM and GenAi solutions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file airflow-ollama-0.11.0.tar.gz
.
File metadata
- Download URL: airflow-ollama-0.11.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2a989ec7eb7a2a7b5229dc4db2935351277585c83ee64824881c7d282716b47 |
|
MD5 | 0d2afa84af607a3ccc92e9cf36c481f2 |
|
BLAKE2b-256 | b3a62b2bd709da7eee3d502383d16b57ddb5aba3ab182cbcfc09ee4da8024aa1 |
File details
Details for the file airflow_ollama-0.11.0-py3-none-any.whl
.
File metadata
- Download URL: airflow_ollama-0.11.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f68ffd6512020a6aae38f0d75b8aac1aec1ebb91c5ce75ed83a1079d92a0c58 |
|
MD5 | 0715d609db29fbab606912a862e33993 |
|
BLAKE2b-256 | c745486dc8ac40945806fb9a98f3a2d19190217dc8ecfab5d3e4c56dcd8b2160 |