Skip to main content

Replay the interface recording packets, orchestrate and run them based on the LCEL using the langChain.

Project description

caseflow

使用langchain 的LCEL语法来编排用例组成,每一步,每一个用例都是runnable对象。

每个步骤或用例都可使用 lanngchain的callbackmanager、retry等

每个自动化用例都可装饰成agent tool,供agent使用。此agent即为具有AI的RPA(Robotic Process Automation)。

用例采用接口录制har文件转接口自动化用例,并完成用例参数化。(todo: 此转换过程也可交由agent来自动转换)

安装

pip install caseflow

示例

import asyncio

from langchain_core.globals import set_verbose

from caseflow import CaseStep
from caseflow.run_case import parse_har

set_verbose(True)

stepJson_1 = parse_har("file/request.step_1.har")
stepJson_2 = parse_har("file/request.step_2.har")

flow = (
    CaseStep(step_json_file_path=stepJson_1)
    | CaseStep(step_json_file_path=stepJson_2)
)
    

# invoke
result = flow.invoke({})
print(result)

# ainvoke
result = asyncio.run(
    flow.ainvoke(
        {},
        config={
            "callbacks": [
                # CaseStepStdOutCallbackHandler(),
            ]
        },
    )
)
print(result)

# stream
for chunk in flow.stream({}):
    print(chunk)


# astream
async def stream_output():
    async for chunk in flow.astream({}):
        print(chunk)


asyncio.run(stream_output())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caseflow-0.1.2.tar.gz (16.5 kB view hashes)

Uploaded Source

Built Distribution

caseflow-0.1.2-py3-none-any.whl (19.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page