dify 接口工具 schema 是采用openai规范,有get和post两种写法。记录备忘。

一、get写法

{
    "openapi": "3.1.0",
    "info": {
        "title": "Get yuejieri data",
        "description": "查号码信息",
        "version": "v1.0.0"
    },
    "servers": [
        {
            "url": "http://192.168.1.1/serverapi"
        }
    ],
    "paths": {
        "/db/systemtype/findAll.do": {
            "get": {
                "description": "描述信息",
                "operationId": "systemtype",
                "parameters": [
                    {
                        "name": "typedesc",
                        "in": "query",
                        "description": "信息",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "deprecated": false
            }
        },

    "components": {
        "schemas": {}
    }
}

二、post写法

{
    "openapi": "3.1.0",
    "info": {
        "title": "标题",
        "description": "描述",
        "version": "1.0.0"
    },
    "servers": [
        {
            "url": "http://192.168.1.1:80"
        }
    ],
    "paths": {
        "/getSearch": {
            "post": {
                "description": "检索",
                "operationId": "getSearch",
                "requestBody": {
                    "description": "检索",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": 
                                      {
                                        "index": {
                                            "type": "string",
                                            "description": "索引"
                                        },
                                        "text": {
                                            "type": "string",
                                            "description": "问题"
                                        }
                                    
                                },
                                "required": [
                                    "index_name",
                                    "query"
                                ]
                            }
                        }
                    }
                }
             }
        }
    }
}

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐