caseflow


Namecaseflow JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryReplay the interface recording packets, orchestrate and run them based on the LCEL using the langChain.
upload_time2024-07-28 12:48:58
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords caseflow langchain lcel rpa case interface test
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # caseflow

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

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

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

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

# 安装

``` shell
pip install caseflow
```

# 示例

``` python

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())

```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "caseflow",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "caseflow, langchain, LCEL, RPA, case, interface test",
    "author": null,
    "author_email": "gnakw <gnakw@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/99/bb/f4f0adf03ee7225523138f96cac0de4e4ad27c7b67d1bd5b6bd87dcb7066/caseflow-0.1.4.tar.gz",
    "platform": null,
    "description": "# caseflow\n\n\u4f7f\u7528langchain \u7684LCEL\u8bed\u6cd5\u6765\u7f16\u6392\u7528\u4f8b\u7ec4\u6210\uff0c\u6bcf\u4e00\u6b65\uff0c\u6bcf\u4e00\u4e2a\u7528\u4f8b\u90fd\u662frunnable\u5bf9\u8c61\u3002\n\n\u6bcf\u4e2a\u6b65\u9aa4\u6216\u7528\u4f8b\u90fd\u53ef\u4f7f\u7528 lanngchain\u7684callbackmanager\u3001retry\u7b49\n\n\u6bcf\u4e2a\u81ea\u52a8\u5316\u7528\u4f8b\u90fd\u53ef\u88c5\u9970\u6210agent tool\uff0c\u4f9bagent\u4f7f\u7528\u3002\u6b64agent\u5373\u4e3a\u5177\u6709AI\u7684RPA\uff08Robotic Process Automation\uff09\u3002\n\n\u7528\u4f8b\u91c7\u7528\u63a5\u53e3\u5f55\u5236har\u6587\u4ef6\u8f6c\u63a5\u53e3\u81ea\u52a8\u5316\u7528\u4f8b\uff0c\u5e76\u5b8c\u6210\u7528\u4f8b\u53c2\u6570\u5316\u3002\uff08todo: \u6b64\u8f6c\u6362\u8fc7\u7a0b\u4e5f\u53ef\u4ea4\u7531agent\u6765\u81ea\u52a8\u8f6c\u6362\uff09\n\n# \u5b89\u88c5\n\n``` shell\npip install caseflow\n```\n\n# \u793a\u4f8b\n\n``` python\n\nimport asyncio\n\nfrom langchain_core.globals import set_verbose\n\nfrom caseflow import CaseStep\nfrom caseflow.run_case import parse_har\n\nset_verbose(True)\n\nstepJson_1 = parse_har(\"file/request.step_1.har\")\nstepJson_2 = parse_har(\"file/request.step_2.har\")\n\nflow = (\n    CaseStep(step_json_file_path=stepJson_1)\n    | CaseStep(step_json_file_path=stepJson_2)\n)\n    \n\n# invoke\nresult = flow.invoke({})\nprint(result)\n\n# ainvoke\nresult = asyncio.run(\n    flow.ainvoke(\n        {},\n        config={\n            \"callbacks\": [\n                # CaseStepStdOutCallbackHandler(),\n            ]\n        },\n    )\n)\nprint(result)\n\n# stream\nfor chunk in flow.stream({}):\n    print(chunk)\n\n\n# astream\nasync def stream_output():\n    async for chunk in flow.astream({}):\n        print(chunk)\n\n\nasyncio.run(stream_output())\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Replay the interface recording packets, orchestrate and run them based on the LCEL using the langChain.",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "caseflow",
        " langchain",
        " lcel",
        " rpa",
        " case",
        " interface test"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09fd7ed636a20babf6c51a5574e8c09424684bc357421883a714acd7bedfe082",
                "md5": "c45f639bf7c23e0da0fcde7687f20e28",
                "sha256": "4df680208f18610f7692fe7b0de93dc5abc3bd28084c04184c57a88b947c37ee"
            },
            "downloads": -1,
            "filename": "caseflow-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c45f639bf7c23e0da0fcde7687f20e28",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 22944,
            "upload_time": "2024-07-28T12:48:57",
            "upload_time_iso_8601": "2024-07-28T12:48:57.067314Z",
            "url": "https://files.pythonhosted.org/packages/09/fd/7ed636a20babf6c51a5574e8c09424684bc357421883a714acd7bedfe082/caseflow-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "99bbf4f0adf03ee7225523138f96cac0de4e4ad27c7b67d1bd5b6bd87dcb7066",
                "md5": "5afbaa942ecc07003dc9f22d38503c72",
                "sha256": "668d88a01d7204531fe735378a68931f0bc0895477474bfdc3127c3d806612d2"
            },
            "downloads": -1,
            "filename": "caseflow-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "5afbaa942ecc07003dc9f22d38503c72",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 19645,
            "upload_time": "2024-07-28T12:48:58",
            "upload_time_iso_8601": "2024-07-28T12:48:58.324622Z",
            "url": "https://files.pythonhosted.org/packages/99/bb/f4f0adf03ee7225523138f96cac0de4e4ad27c7b67d1bd5b6bd87dcb7066/caseflow-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-28 12:48:58",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "caseflow"
}
        
Elapsed time: 0.26572s