Ho kenya ts'ebetsong AI ea Agent ho Deterministic Test Automation ka LangChain le DSPy | B4N1

Ho kenya ts'ebetsong AI ea Agent ho Deterministic Test Automation ka LangChain le DSPy

6 months ago · b4n1 Read time: 4 min

Ho kenya tšebetsong AI ea Agent ho Deterministic Test Automation ka LangChain le DSPy

Selelekela

Ho rarahana ho ntseng ho eketseha ha litsamaiso tsa software ho entse hore test automation e be karolo ea bohlokoa ea nts'etsopele ea software. Merero ea khale ea liteko e itšetlehile ka mekhoa e ngotsoeng, e ka bang brittle le ho ba thata ho e hlokomela. Lilemong tsa morao tjena, ho hlaha ha Agentic AI le Orchestration Tools ho butse menyetla e mecha ea ho iketsetsa liteko tse rarahaneng. Sehloohong sena, re tla hlahloba marang-rang a Agent AI, Lisebelisoa tsa Orchestration, le Software Engineering ho iketsetsa maemo a rarahaneng a liteko ho sebelisa LangChain le DSPy.

Agent AI ke eng?

Agetic AI e bua ka mofuta oa bohlale ba maiketsetso bo etselitsoeng ho nka khato molemong oa mosebelisi kapa sistimi. Sistimi ea Agetic AI e khona ho etsa liqeto, ho ithuta ho tsoa boiphihlelo, le ho ikamahanya le maemo a macha. Boemong ba boiketsetso ba liteko, Agent AI e ka sebelisoa ho iketsetsa liteko tse rarahaneng ka ho etsisa litšebelisano tsa basebelisi, ho etsa liqeto ho ipapisitsoe le data ea liteko, le ho ikamahanya le maemo a fetohang a liteko.

LangChain ke eng?

LangChain ke Sesebelisoa sa Orchestration se bulehileng se lumellang bahlahisi hore ba hahe mekhoa e rarahaneng ea AI ba sebelisa lipuo tse sa tšoaneng tsa lenaneo, ho akarelletsa le Python, Rust, le Go. LangChain e fana ka mohaho o feto-fetohang le oa modular o nolofalletsang bahlahisi ho kopanya likarolo tse fapaneng tsa AI, tse kang puo ea tlhaho ea puo (NLP) le pono ea k'homphieutha, ho haha ​​​​litsamaiso tse rarahaneng tsa AI.

DSPy ke eng?

DSPy ke laebrari ea Python e fanang ka lisebelisoa tse ngata tsa ho aha le ho tsamaisa litsamaiso tsa AI. DSPy e etselitsoe ho sebetsa ka mokhoa o sa tsitsang le LangChain mme e fana ka mefuta e mengata ea likarolo, ho kenyeletsa ts'ebetso ea data, ho ithuta ka mochine, le ho ithuta ka botebo.

**Ho kenya ts'ebetsong AI ea Agent ho Boiketsetso ba Tlhahlobo ea Deterministic **

Ho kenya ts'ebetsong AI ea Agent ho automation ea tlhahlobo ea deterministic, re ka sebelisa LangChain le DSPy ho theha moralo oa boiketsetso oa liteko o etsisang litšebelisano tsa basebelisi, o etsa liqeto ho latela lintlha tsa tlhahlobo, 'me o ikamahanya le maemo a fetohang a teko.

Mona ke mohlala o bonolo oa kamoo re ka sebelisang LangChain le DSPy ho iketsetsa boemo ba teko:

import langchain
ho tsoa ho langchain.chains import LLMChain
ho tsoa ho langchain.llms tlisa DSPyLLM


test_scenario = {
    "user_input": "login",
    "expected_output": "ho kena ho atlehile"
}

# Hlalosa moemeli oa AI ea Agent
moemeli = LLMChain(
    llm=DSPyLLM(),
    input_type="mongolo",
    tlhahiso_mofuta = "mongolo"
)

# Hlalosa mosebetsi oa boiketsetso oa liteko
def test_automation(test_scenario):
    # Etsisa tšebelisano ea basebelisi
    user_input = test_scenario["user_input"]
    # Etsa liqeto u ipapisitse le data ea liteko
    qeto = agent.run(user_input)
    # Ikamahanye le maemo a feto-fetohang a liteko
    haeba qeto == "ho kena ho atlehile":
        hatisa ("Teko e fetile")
    tse ling:
        print("Teko e hlotsoe")

# Etsa mosebetsi oa boiketsetso oa liteko
test_automation(test_scenario)

Mohlaleng ona, re hlalosa boemo ba teko bo kenyelletsang ho etsisa tšebelisano le basebelisi, ho etsa qeto ho latela lintlha tsa tlhahlobo, le ho ikamahanya le maemo a feto-fetohang a tlhahlobo. Ka mor'a moo re hlalosa moemeli oa Agent AI a sebelisa LangChain le DSPy, 'me ae sebelise ho iketsetsa boemo ba teko.

Kaholimo ho 5-10 Litaelo/Lipotlana tse Sebelisitsoeng ka ho Fetisisa

Mona ke tse 5-10 tse sebelisoang ka ho fetesisa litaelo/likotoana tsa LangChain le DSPy:

  1. langchain.LLMChain(llm=DSPyLLM()): E theha Agent AI agent e sebelisa LangChain le DSPy.
  2. DSPyLLM(): E qala mohlala oa DSPy LLM (Mohlala o Moholo oa Puo).
  3. LLMChain(input_type = "text", output_type = "text"): E theha moemeli oa Agentic AI ka mefuta ea mongolo le tlhahiso.
  4. agent.run(user_input): E tsamaisa Agent AI ka ho kenya mosebedisi.
  5. test_scenario = {"user_input": "login", "expected_output": "ho kena ho atlehile"}: E hlalosa boemo ba teko bo nang le kenyo ya mosebedisi le tlhahiso e lebeletsweng.
  6. langchain.chains.LLMChain(llm=DSPyLLM()): E theha moemeli oa Agentic AI ka LangChain le DSPy.
  7. DSPyLLM().predict(mosebedisi_input): E bolela esale pele tlhahiso ya DSPy LLM ka kenyo ya mosebedisi.
  8. LLMChain(input_type = "text", output_type = "text").run(user_input): E tsamaisa moemeli oa Agent AI ka mefuta ea mongolo le tlhahiso.
  9. test_automation(test_scenario): E tsamaisa tšebetso ea othomathike ea teko ka boemo ba teko.
  10. langchain.chains.LLMChain(llm=DSPyLLM()).run(user_input): E tsamaisa moemeli oa AI ka ho kenya mosebedisi.

Pono ya pono

Mona ke pono ea moemeli oa AI a sebelisa Chart.js:

{
  "type": "bar",
  "data": {
    "labels": ["Mosebelisi", "Qeto", "Adaptation"],
    "lintlha tsa boitsebiso": [
      {
        "label": "Agent AI Agent",
        "data": [10, 20, 30],
        "backgroundColor": "rgba(255, 99, 132, 0.2)",
        "borderColor": "rgba(255, 99, 132, 1)",
        "borderWidth": 1
      }
    ]
  },
  "likgetho": {
    "sehlooho": {
      "bontša": 'nete,
      "text": "Agent AI Agent"
    },
    "makala": {
      "yAxes": [
        {
          "li-ticks": {
            "beginAtZero": 'nete
          }
        }
      ]
    }
  }
}

Ponahalo ena e bontša tšebetso ea moemeli oa Agent AI ka ho etsisa litšebelisano tsa basebelisi, ho etsa liqeto ho ipapisitsoe le lintlha tsa liteko, le ho ikamahanya le maemo a feto-fetohang a tlhahlobo.

Qetello

Sehloohong sena, re ile ra hlahloba mateano a litsela tsa Agentic AI, Orchestration Tools, le Software Engineering ho iketsetsa maemo a rarahaneng a liteko ho sebelisa LangChain le DSPy. Re sebelisitse mohlala o bonolo oa Agentic AI ho automation ea tlhahlobo ea deterministic mme ra fana ka mefuta e mengata ea litaelo / li-snippets bakeng sa LangChain le DSPy. Hape re bone tšebetso ea moemeli oa Agetic AI re sebelisa Chart.js. Ka ho sebelisa Agentic AI le Lisebelisoa tsa Orchestration, bahlahisi ba ka theha liforeimi tse tsoetseng pele tsa liteko tse etsisang litšebelisano tsa basebelisi, ho etsa liqeto ho ipapisitsoe le lintlha tsa liteko, le ho ikamahanya le maemo a fetohang a liteko.


Have Questions?

Let's Talk

Contact me on LinkedIn