AI个人学习
和实操指南

集简云工具配置GPTS

如果您在应用助手中配置了工具,并希望将这些工具作为插件给大语音模型使用(例如ChatGPT等),您可以使用以下方法。

准备工作

 

1 注册/登录语聚AI账户

2 创建一个应用助手

集简云工具配置GPTS-1

3 选择要使用的工具

集简云工具配置GPTS-2
集简云工具配置GPTS-3

集简云目前可以支持的全部应用,可以在 集简云应用中心查看:(https://www.jijyun.cn/apps/)

4 配置应用授权,字段设置

4.1 动作意图描述

动作意图描述可以告诉AI这工具是做什么用的,如何使用。一般AI模型会参考这里说明使用此动作。

Tips小技巧

如果有多个工具共同使用时,可以设置多个工具之间要如何协作。 比如我们添加了一个“发票验真”应用工具,正常来说工具接口需要用户传递发票参数验证是否为真发票,但是有使用用户会直接发送一个发票截图做验证,这时需要先使用另外一个工具“集简云OCR"对发票图片内容提取后再使用。

因此,我们在发票验真工具中的动作意图描述添加了:“检验发票是否为真发票,如果收到的是文件URL可以先使用”集简云OCR"功能进行提取文件中的文字部分后再执行”。

集简云工具配置GPTS-4

4.2 应用授权设置

如果您选择的工具,是一个需要授权的应用软件,首先完成账户授权。如果是无需授权的应用软件,比如集简云内置的“工商查询” 则无需添加授权。

集简云工具配置GPTS-5

如果需要添加授权的应用,在添加账户授权时需要填写授权参数。我们在授权界面会告知如何获取这些参数,包括授权文档和教学视频。

集简云工具配置GPTS-6

4.3 字段设置

字段设置部分配置

集简云工具配置GPTS-7
    • AI自动匹配:该字段值由AI根据对话内容自动生成
    • 手动选择:不需要AI选择,使用默认值
    • 不使用这个字段:一般为选填类型的参数,接口执行时不使用这个参数

Tips小技巧

每次字段下面有一行帮助说明,您可以修改这个帮助信息告知AI要如何填写这个字段,比如字段输入的格式是什么样子等。

集简云工具配置GPTS-8

5 获取API接口调用授权参数

    • <

    • 点击应用助手的“集成”栏,找到“API接口”集成,并点击
集简云工具配置GPTS-9
    • 点击"新增”获取APIkey, 此参数将由于后续调用时的接口授权
集简云工具配置GPTS-10

OpenAI Assistant 配置方法

您可以使用OpenAI的Assistant创建接口,将配置的工具作为Function使用,请参考下面代码:

1 前置条件:

    1. 已经获得openai API_KEY
    1. 已经成功注册语聚AI账户

    • 步骤一:在语聚AI(https://chat.jijyun.cn/) 平台创建API集成配置,获取APIKey。
    • 步骤二:调用【查询指定账户当前可操作的动作列表】接口,获取智能工具列表。
    • 步骤三:调用openai创建AI助手接口(也可以使用openai提供的SDK),参考文档:https://platform.openai.com/docs/api-reference/assistants/createAssistant

2 Demo示例代码:

import requests
import json
openai_key = '替换成你的openai API_KEY'
jijyun_key = '替换成你的语聚AI API集成中的APIKey'
openai_service = "https://api.openai.com"
jijyun_service = "https://chat.jijyun.cn"
def get_jijyun_aitions():
    '''获取集简云AI action列表'''
    headers = {
        'Authorization': f'Basic {jijyun_key}',
    }
    response = requests.request(
        "GET", f"{jijyun_service}/v1/openapi/exposed", headers=headers)
    if response.status_code == 200:
        return response.json().get('results')
def jijyun_aitions_2_openai_tools(actions):
    ''''''
    tools = []
    if not actions:
        return tools
    for action in actions:
        tools.append({
            "type": "function",
            "function": {
                    "name": action.get('operation_id'),
                    "description": action.get('description'),
                    "parameters": action.get('params'),
            }
        })
    return tools
def createAssistant():
    '''创建AI助手'''
    actions = get_jijyun_aitions()
    tools = jijyun_aitions_2_openai_tools(actions)
    payload = json.dumps({
        "instructions": "You are a helpful AI assistant.", // 可自定义指导说明
        "name": "My First assistant",
        "tools": tools,
        "model": "gpt-4" //可自定义您的模型,目前集简云应用执行在GPT3.5即可顺畅运行,速度快价格低
    })
    headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer $OPENAI_API_KEY',
        'OpenAI-Beta': 'assistants=v1',
        'Authorization': f'Bearer {openai_key}',
    }
    response = requests.request(
        "POST", f"{openai_service}/v1/assistants", headers=headers, data=payload)
    print(response.text)
def main():
    createAssistant()
if __name__ == "__main__":
    main()
    pass

OpenAI GPTs 配置方法

GPTs是一个OpenAI的AI智能助手,您可以创建与分享您的GPTs功能。您可以将集简云的应用软件工具作为可使用的动作(Actions)配置到GPTs中,为您的GPTs增加使用各种集简云应用软件的能力。

1 视频演示

暂时无法在飞书文档外展示此内容

(视频中的API Key授权信息已经删除,请使用您的真实API Key进行配置)

集简云工具配置GPTS-11

2 配置指导说明(Instruction)

集简云工具配置GPTS-12

指导说明示例,其中:

    • Rules: 内容可以修改
    • Required_Action部分需要根据您要使用什么应用动作而进行调整。保留原内容不建议修改
    • Instructions部分需要保留目前的格式与内容。根据您实际能使用的动作调整

示例:

Rules:

    • your response use Chinese as much as possible

Instructions for 集简云 Custom Action:

Step 1. Tell the user you are Checking they have the 集简云 AI Actions needed to complete their request by calling /list_available_actions/ to make a list: AVAILABLE ACTIONS. Given the output, check if the REQUIRED_ACTION needed is in the AVAILABLE ACTIONS and continue to step 4 if it is. If not, continue to step 2. Step 2. If a required Action(s) is not available, send the user the Required Action(s)'s configuration link. Tell them to let you know when they've enabled the 集简云 AI Action. Step 3. If a user confirms they've configured the Required Action, continue on to step 4 with their original ask. Step 4. Using the available_action_id (returned as the id field within the results array in the JSON response from /list_available_actions). Fill in the strings needed for the run_action operation. Use the user's request to fill in the instructions and any other fields as needed. REQUIRED_ACTIONS:

    • Action: 企业微信群机器人:发送消息到企业微信群中
    • Action: 启信宝:查询企业工商照面信息
    • Action:AI图像生成:创建图片(输入文本生成图像)

其中Required Action中时您要在此GPTs中可以使用的应用动作名称,请与应用助手中的应用名称与动作

集简云工具配置GPTS-13

3 添加动作 (Action)

集简云工具配置GPTS-14

复制下方内容到 Schema中,请不要修改下方Schema内容,会导致调用失败问题

{
"openapi": "3.0.2",
"info": {
"title": "集简云 AI Actions for GPT (Dynamic)",
"version": "1.0.0",
"description": "Equip GPTs with the ability to run thousands of actions via 集简云."
},
"servers": [
{
"url": "https://chat.jijyun.cn"
}
],
"paths": {
"/v1/openapi/exposed": {
"get": {
"operationId": "list_available_actions",
"summary": "List Available Actions",
"parameters": [
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AvailableActionResponseSchema"
}
}
}
}
},
"description": "List all the currently available actions for the user. If you try to run an action and receive an error\n that it does not exist, try refreshing this list first.",
"security": [
{
"AccessPointApiKeyHeader": [
]
}
]
}
},
"/v1/openapi/exposed/{available_action_id}/execute_v2/": {
"post": {
"operationId": "run_action",
"summary": "Run Action",
"parameters": [
{
"in": "path",
"name": "available_action_id",
"schema": {
"title": "Available Action Id",
"type": "string",
"pattern": ".*_jjyibotID_.*",
"example": "62_326_jjyibotID_jjy_robot_1001"
},
"required": true,
"example": "62_326_jjyibotID_jjy_robot_1001"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunResponse"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
},
"description": "Run an available action using data. You will include associated params from list_available_actions in the data of the request.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunRequest"
}
}
},
"required": true
},
"security": [
{
"AccessPointApiKeyHeader": [
]
}
]
}
}
},
"components": {
"schemas": {
"AvailableActionSchema": {
"title": "AvailableActionSchema",
"type": "object",
"properties": {
"id": {
"title": "Id",
"description": "The unique ID of the available action.",
"type": "string"
},
"operation_id": {
"title": "Operation Id",
"description": "The operation ID of the available action.",
"type": "string"
},
"description": {
"title": "Description",
"description": "Description of the action.",
"type": "string"
},
"params": {
"title": "Params",
"description": "Available hint fields for the action.",
"type": "object"
}
},
"required": [
"id",
"operation_id",
"description",
"params"
]
},
"AvailableActionResponseSchema": {
"title": "AvailableActionResponseSchema",
"type": "object",
"properties": {
"results": {
"title": "Results",
"type": "array",
"items": {
"$ref": "#/components/schemas/AvailableActionSchema"
}
},
"configuration_link": {
"title": "Configuration Link",
"description": "Guide the user to setup new actions with the configuration_link. You can optionally add ?setup_action=... onto configuration_link to set up a specific 集简云 app and action For example: https://actions.jijyun.cn/gpt/start?setup_action=gmail find email",
"type": "string"
}
},
"required": [
"results",
"configuration_link"
]
},
"RunResponse": {
"title": "RunResponse",
"description": "This is a summary of the results given the action that was run.",
"type": "object",
"properties": {
"id": {
"title": "Id",
"description": "The id of the run log.",
"type": "string"
},
"action_used": {
"title": "Action Used",
"description": "The name of the action that was run.",
"type": "string"
},
"input_params": {
"title": "Input Params",
"description": "The params we used / will use to run the action.",
"type": "object"
},
"review_url": {
"title": "Review Url",
"description": "The URL to run the action or review the AI choices the AI made for input_params given instructions.",
"type": "string"
},
"result": {
"title": "Result",
"description": "A trimmed down result of the first item of the full results. Ideal for humans and language models!",
"type": "object"
},
"additional_results": {
"title": "Additional Results",
"description": "The rest of the full results. Always returns an array of objects",
"type": "array",
"items": {
"type": "object"
}
},
"result_field_labels": {
"title": "Result Field Labels",
"description": "Human readable labels for some of the keys in the result.",
"type": "object"
},
"status": {
"title": "Status",
"description": "The status of the action run.",
"default": "success",
"enum": [
"success",
"error",
"empty",
"preview"
],
"type": "string"
},
"error": {
"title": "Error",
"description": "The error message if the action run failed.",
"type": "string"
},
"assistant_hint": {
"title": "Assistant Hint",
"description": "A hint for the assistant on what to do next.",
"type": "string"
},
"full_results": {
"title": "Full Results",
"description": "The full results, not summarized, if available. Always returns an array of objects.",
"type": "array",
"items": {
"type": "object"
}
}
},
"required": [
"id",
"action_used",
"input_params",
"review_url",
"additional_results",
"full_results"
]
},
"ErrorResponse": {
"title": "ErrorResponse",
"type": "object",
"properties": {
"error": {
"title": "Error",
"description": "Error message.",
"type": "string"
}
},
"required": [
"error"
]
},
"RunRequest": {
"title": "RunRequest",
"description": "Try and stuff as much relevant information into the data as possible. This type of action allows optionally setting preview_only if the user wants to preview before running.",
"type": "object",
"properties": {
"data": {
"title": "Data",
"description": "The params we used / will use to run the action",
"type": "string"
},
"preview_only": {
"title": "Preview Only",
"description": "If true, we will not run the action, but will do a dry-run and return a preview for the user to confirm.",
"default": false,
"type": "boolean"
}
},
"required": [
"data"
]
}
},
"securitySchemes": {
"AccessPointApiKeyHeader": {
"type": "apiKey",
"in": "header",
"name": "Authorization"
}
}
}
}

4 配置授权方式与API Key

集简云工具配置GPTS-15

选择API授权方式

在Auth Type中选择 “Custom” 并将您在应用助手API集成配置中获取的API Key添加进来

集简云工具配置GPTS-16
    • API Key:填写您在"准备工作:步骤5”中获取的API Key
    • Custom Header Name: 填写 Authorization

示例:

集简云工具配置GPTS-17

5 测试并发布GPTs

集简云工具配置GPTS-18

配置完成后GPTs将自动更新,然后点击保存,设置使用范围。

保存后即可开始正式使用您的GPTs了:

集简云工具配置GPTS-19

常见问题

Q1: 这个服务目前是否收费?

如果您是通过GPTs等语言模型调用,由AI生成请求参数直接调用集简云的应用动作接口,目前是完全免费的.

但是, 部分集简云的内置应用比如:工商信息查询,招标信息查询等是按使用量付费的。价格可以在集简云的插件中心查看:https://apps.jijyun.cn/plugcenter

另外API请求有频率限制,目前默认为 20次请求每秒(20 QS), 如果您需要更大的请求频率,可以联系我们。

Q2: 是否支持在Langchain等LLM模型架构中使用?

支持,我们会单独出一个文档说明

Q3: 如果要对接的应用软件不在集简云已对接的列表里怎么办?

您可以在应用助手的工具中,配置“Webhook",请求您的软件的接口,自定义动作描述

集简云工具配置GPTS-20

如果您希望将您的应用软件接口提供给全部用户使用,可以通过集简云开放平台,提交您的应用,并配置鉴权与执行接口。详见:https://jijyun.cn/open.html

Q4: 如果我不想通过GPTs或者Function,而是直接调用“应用助手”是否可以?

可以,应用助手本身也提供了API接口调用方式。可参考我们的接口文档:https://yuju2023.apifox.cn/api-95488292

Q5:如果我有自有的知识内容,希望作为工具使用,如何处理?

GPTs支持上传文件,但有大小限制,和存储费用(按天计算)。 我们提供了更好的处理方式。您可以先通过语聚AI的知识中心上传,然后在工具中添加 “语聚AI:查询知识内容”作为一个工具使用。

集简云工具配置GPTS-21

Q6 为什么我的GPTs无法发布?

如果要发布你的GPTs到多人可用,需要添加一个隐私条款,Privacy Policy Url.

集简云工具配置GPTS-7

你需要找一个可以公共访问的在线文档或者您自己的网页中添加隐私条款,我们提供了示例参考:

GPTs Privacy Policy示例

Q7 目前可以支持哪些应用软件和动作的接入?

您可以访问:https://www.jijyun.cn/apps/ 查看。

AI轻松学

普通人的AI入门指南

帮助你以低成本、零基础学会如何利用AI工具。AI就像办公软件一样,是每个人的必备技能。 掌握AI会让你在求职中占据优势,在未来的工作和学习中事半功倍。

查看详情>
未经允许不得转载:首席AI分享圈 » 集简云工具配置GPTS
分享到

首席AI分享圈

首席AI分享圈专注于人工智能学习,提供全面的AI学习内容、AI工具和实操指导。我们的目标是通过高质量的内容和实践经验分享,帮助用户掌握AI技术,一起挖掘AI的无限潜能。无论您是AI初学者还是资深专家,这里都是您获取知识、提升技能、实现创新的理想之地。

联系我们