# dify2py **Repository Path**: yinwangcode/dify2py ## Basic Information - **Project Name**: dify2py - **Description**: ai agent with python from dify dsl - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-02-04 - **Last Updated**: 2026-02-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Agent Case2Py (LlamaIndex RAG Test Case Generator) 这是一个基于 LlamaIndex 和 Weaviate 的 AI Agent,用于根据 API 文档自动生成测试脚本。 ## 项目结构 ``` llamaindex/ ├── src/ # 源代码目录 │ ├── main.py # 主程序入口 │ └── agent_case2py/ # 核心逻辑包 │ ├── config.py # 配置文件 │ ├── rag_engine.py # RAG 索引引擎 │ └── workflow.py # 工作流定义 ├── tests/ # 测试用例目录 │ ├── test_index.py # 索引功能测试 │ └── test_weaviate.py # Weaviate 连接测试 ├── requirements.txt # 依赖列表 └── README.md # 项目说明 ``` ## 快速开始 ### 1. 安装依赖 ```bash pip install -r requirements.txt ``` ### 2. 配置环境 编辑 `src/agent_case2py/config.py`,配置您的 LLM 和 Embedding API 地址,以及 Weaviate 连接信息。 ### 3. 运行程序 #### 索引 API 文档 ```bash python src/main.py --index --docs ./data/api_docs ``` #### 生成测试脚本 ```bash python src/main.py --testcase "验证用户登录接口返回 200 OK" ``` #### 解析 Dify DSL 并生成工作流代码 ```bash python src/main.py --parse-dify ./your_dify_app.yml --output ./src/agent_case2py/generated_workflow.py ``` ## 运行测试 使用 pytest 运行所有测试: ```bash pytest tests/ ```