Ho rala Scalable le Ethical AI-Driven Software Systems ka Modular Workflow Architecture le AI Agents. | B4N1

Ho rala Scalable le Ethical AI-Driven Software Systems ka Modular Workflow Architecture le AI Agents.

5 months ago · b4n1 Tiempo de lectura: 6 min

Kenyelletso

Tsoelo-pele e potlakileng ho Artificial Intelligence (AI) le boenjiniere ba software e lebisitse ho nts'etsopele ea litsamaiso tse rarahaneng tsa software tse kopanyang mahlahana a AI le meralo ea modular workflow. Litsamaiso tsena li na le monyetla oa ho fetola tsela eo re atamelang Automation ea DevOps le 'mino oa liletsa. Leha ho le joalo, ho rala lits'ebetso tsa software tse tsamaellanang le tsa boitšoaro tse tsamaisoang ke AI ho hloka kutloisiso e tebileng ea tsoelopele ea morao-rao ho AI, boenjiniere ba software le boqapi.

Sehloohong sena, re tla hlahloba melao-motheo ea moralo le mekhoa e metle ea ho theha litsamaiso tsa software tse modular, tse scalable, le tsa boitšoaro tse kopanyang mahlahana a AI le meralo ea modular workflow. Re tla tsepamisa maikutlo ho kopantseng lintlafatso tsa morao-rao ho AI (Mehlala e Meholo ea Lipuo (LLMs), Retrieval-Augmented Generation (RAG)), boenjiniere ba software (Python, Rust, Go), le meralo ea meralo ho theha litsamaiso tse matla le tse tšoarellang.

Modular Workflow Architecture

Mehaho ea modular workflow ke mokhoa oa meralo o pshatlang litsamaiso tse rarahaneng hore e be li-module tse nyane, tse ikemetseng tse ka bolokoang habonolo, tsa ntlafatsoa le ho lekanyetsoa. Mojule o mong le o mong o ikarabella bakeng sa mosebetsi kapa tšebetso e itseng, 'me ba buisana ka li-interfaces tse hlalositsoeng hantle.

Mona ke mohlala o bonolo oa meralo ea modular workflow ho Python:

# mosebetsi.py
Sehlopha sa tšebetso:
    def __init__(bowena):
        self.modules = []

    def add_module(boithati, mojule):
        "self.modules.append(mojule)

    def run(self):
        bakeng sa module in self.modules:
            module.run()

# module1.py
Sehlopha sa Module1:
    def run(self):
        print("Mojule 1 oa sebetsa")

# module2.py
Sehlopha sa Module2:
    def run(self):
        print("Mojule 2 oa sebetsa")

# main.py
haeba __lebitso__ == "__main__":
    Mokhoa oa ho sebetsa = Mokhoa oa ho sebetsa()
    workflow.add_module(Module1())
    workflow.add_module(Module2())
    workflow.run()

Mohlala ona, re na le sehlopha sa Workflow se laolang lethathamo la li-module. Mojule o mong le o mong o ikarabella bakeng sa mosebetsi o itseng, 'me li kenyelletsoa tšebetsong ho sebelisoa mokhoa oa add_module. Mokhoa oa run o sebelisoa ho etsa mojule o mong le o mong ts'ebetsong ea mosebetsi.

AI Agents

Baemeli ba AI ke likarolo tsa software tse sebelisang li-algorithms tsa ho ithuta ka mochini ho etsa liqeto le ho nka khato tsamaisong. Li ka sebelisoa ho iketsetsa mesebetsi, ho ntlafatsa boiphihlelo ba basebelisi, le ho ntlafatsa ts'ebetso ea sistimi.

Ho na le mefuta e 'maloa ea liakhente tsa AI, ho kenyelletsa:

  • Baemeli ba thehiloeng ho melao: Mahlahana ana a sebelisa melao e boletsoeng esale pele ho etsa liqeto.
  • Basebelisi ba ho ithuta ka mochini: Baemeli bana ba sebelisa mekhoa ea ho ithuta ka mochini ho ithuta ho data le ho etsa liqeto.
  • Baemeli ba Hybrid: Mahlahana ana a kopanya mekhoa e thehiloeng melaong le ea ho ithuta ka mochini ho etsa liqeto.

Mona ke mohlala oa moemeli ea bonolo oa AI ho Python a sebelisa algorithm ea ho ithuta ka mochini:

# moemeli.py
ho tsoa ho sklearn.ensemble import RandomForestClassifier
ho tsoa ho sklearn.model_selection import train_test_split
ho tsoa ho sklearn.datasets import load_iris

Moemeli oa sehlopha:
    def __init__(bowena):
        self.model = RandomForestClassifier()

    def train(self, X, y):
        X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
        self.model.fit(X_train, y_train)

    def bolela esale pele(boithati, X):
        khutlela self.model.predict(X)

# main.py
haeba __lebitso__ == "__main__":
    iris = load_iris()
    X = iris.data
    y = iris.target
    moemeli = Moemeli()
    agent.train(X, y)
    likhakanyo = moemeli.predict(X)
    hatisa (likhakanyo)

Mohlaleng ona, re na le moemeli ea bonolo oa AI ea sebelisang sehlopha sa meru se sa reroang ho bolela esale pele. Moemeli o koetliselitsoe ho dataset ea iris mme o etsa likhakanyo ho dataset e tšoanang.

Ho kopanya li-AI Agents le Modular Workflow Architecture

Ho kopanya mahlahana a AI le meralo ea modular workflow e re lumella ho theha litsamaiso tse rarahaneng tse kopanyang ho etsa liqeto tse tsamaisoang ke AI ka meralo ea modular, e scalable.

Mona ke mohlala oa sistimi e kopanyang liakhente tsa AI le meralo ea modular workflow:

# mosebetsi.py
Sehlopha sa tšebetso:
    def __init__(bowena):
        self.modules = []
        self.agent = Ha ho letho

    def add_module(boithati, mojule):
        "self.modules.append(mojule)

    def add_agent(boithati, moemeli):
        moemedi = moemedi

    def run(self):
        bakeng sa module in self.modules:
            module.run()
        haeba self.agent:
            self.agent.predict()

# module1.py
Sehlopha sa Module1:
    def run(self):
        print("Mojule 1 oa sebetsa")

# module2.py
Sehlopha sa Module2:
    def run(self):
        print("Mojule 2 oa sebetsa")

# moemeli.py
ho tsoa ho sklearn.ensemble import RandomForestClassifier
ho tsoa ho sklearn.model_selection import train_test_split
ho tsoa ho sklearn.datasets import load_iris

Moemeli oa sehlopha:
    def __init__(bowena):
        self.model = RandomForestClassifier()

    def train(self, X, y):
        X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
        self.model.fit(X_train, y_train)

    def bolela esale pele(boithati, X):
        khutlela self.model.predict(X)

# main.py
haeba __lebitso__ == "__main__":
    Mokhoa oa ho sebetsa = Mokhoa oa ho sebetsa()
    workflow.add_module(Module1())
    workflow.add_module(Module2())
    moemeli = Moemeli()
    agent.train(X, y)
    workflow.add_agent(moemedi)
    workflow.run()

Mohlaleng ona, re na le sistimi e kopanyang liakhente tsa AI le meralo ea modular workflow. Sistimi e na le li-module tse peli le moemeli oa AI ea sebelisang sehlopha sa meru se sa reroang ho etsa likhakanyo. Moemeli o kengoa tšebetsong ka mokhoa oa add_agent, 'me o etsa likhakanyo ka mor'a hore limmojule li sebetse.

Top 5-10 Litaelo / Linotsoana tse Sebelisitsoeng ka ho Fetisisa

Mona ke tse ling tsa litaelo le likonopo tse sebelisoang haholo bakeng sa ho rala lits'ebetso tsa software tse khannoang ke AI tse nang le boits'oaro ba modular workflow le li-agents tsa AI:

  1. Python: import pandas as pd (ho kenya laeborari ea pandas)
  2. Python: pd.read_csv('data.csv') (ho bala faele ea CSV ho pandas dataframe)
  3. Python: agent.train(X, y) (kwetlisa moemedi wa AI letlapeng la datha)
  4. Python: agent.predict(X) (ho etsa likhakanyo ka ho sebelisa moemeli oa AI)
  5. Rust: let mut agent = Moemeli::ncha() (ho theha moemeli e mocha oa AI ho Rust)
  6. Rust: agent.train(X, y) (kwetlisa moemedi wa AI ka datha tsa Rust)
  7. Eya: moemedi := NewAgent() (ho theha moemeli e mocha oa AI ho Go)
  8. Eya: agent.Train(X, y) (kwetlisa moemedi wa AI ka datha ho Go)
  9. Chart.js: const chart = new Chart(ctx, {type: 'bar', data: {labels: ['Label 1', 'Label 2'], datasets: [{label: 'Dataset 1', data: [10, 20] }] } }); (ho etsa chate ea tšupa) ho sebelisoa chate
  10. Chart.js: chart.data.datasets[0].data.push(30) (kenyelletsa ntlha e ncha ea data chateng u sebelisa Chart.js)

Ho bona pono

Mohlala ke ona oa chate e sebelisang Chart.js:

{
  "type": "bar",
  "data": {
    "labels": ["Label 1", "Label 2"],
    "lintlha tsa boitsebiso": [
      {
        "label": "Lethathamo la 1",
        "data": [10, 20]
      }
    ]
  }
}

Chate ena e na le lileibole tse peli le dataset e le 'ngoe e nang le lintlha tse peli tsa data. Chate e ka etsoa ka mokhoa o ikhethileng ho sebelisoa likhetho le litlhophiso tse fapaneng.

Qetello

Ho rala lits'ebetso tsa software tse tsamaellanang le tsa boitšoaro tse tsamaisoang ke AI tse nang le meralo ea modular workflow le baemeli ba AI ho hloka kutloisiso e tebileng ea tsoelopele ea morao-rao ho AI, boenjiniere ba software le boqapi. Ka ho kopanya li-agent tsa AI le meralo ea modular workflow, re ka theha litsamaiso tse rarahaneng tse kopanyang ho etsa liqeto tse tsamaisoang ke AI le meralo ea modular, e scalable.

Sehloohong sena, re hlahlobile melao-motheo ea moralo le mekhoa e metle ea ho theha litsamaiso tsa software tse modular, tse scalable, le tsa boitšoaro tse kopanyang mahlahana a AI le meralo ea modular workflow. Re boetse re fane ka mehlala ea baemeli ba bonolo ba AI le meralo ea modular workflow ho Python, Rust, le Go, hammoho le mohlala oa pono o sebelisang Chart.js.

Ka ho latela litataiso le mekhoa e metle e boletsoeng sengolong sena, bahlahisi ba ka theha litsamaiso tse matla tsa software tse tsamaisoang ke AI tse fihlelang litlhoko tsa lits'ebetso le liindasteri tsa sejoale-joale.


¿Tienes preguntas?

Hablemos

Contáctame en LinkedIn