GPT Actions library - Canvas 学习管理系统

,
2024 年 9 月 17 日
在 Github 中打开

目录

  1. 通用应用信息 - Canvas LMS 概述、其功能以及 ChatGPT 自定义操作在通过 AI 集成增强教育体验中的作用。

  2. 从 ChatGPT 到 Canvas 的身份验证 - 解释用于将 ChatGPT 连接到 Canvas 的身份验证方法(OAuth 和用户生成的访问令牌),并提供设置每个选项的详细说明。

  3. 示例用例:学生课程助手 - 使用 ChatGPT 协助学生进行课程导航、考试准备和个性化反馈的详细示例,包括特定的 API 调用和工作流程。

  4. 其他值得考虑的用例 - 使用 Canvas API 的其他潜在集成,例如课堂分析和报告生成。

  5. 恭喜

通用应用信息

Canvas 是一种广泛使用的学习管理系统 (LMS),旨在支持在线学习和教学。它为课程管理、内容交付、评估和学生协作提供了一套强大的工具。通过 Canvas REST API,Canvas 允许广泛的自定义和与第三方应用程序的集成,包括 ChatGPT 等 AI 驱动的工具。

ChatGPT 的 Canvas 自定义操作使教育工作者能够利用 AI 来增强课程内容、自动化任务并为学生提供个性化的学习旅程。示例包括基于活跃课程的虚拟教学助手,因为这些功能非常适合从 Canvas 中提取信息以创建教育对话。ChatGPT 自定义操作并非旨在自动化整个 Canvas 体验,也并非替代 Canvas 应用程序中更适合完成的许多功能。

从 ChatGPT 到 Canvas 的身份验证

有关自定义操作中身份验证的总体概述,请参阅操作身份验证文档

Canvas 中有两种身份验证选项:1) OAuth 和 2) 用户生成的访问令牌。

  • 对于大规模部署,必须使用 OAuth 进行操作身份验证。
  • 如果用户正在考虑单用户部署或无权访问管理设置,他们可以考虑用户生成的访问令牌。请注意,操作发出的任何请求都将使用用户生成的令牌发出,因此 Canvas 会将所有请求注册为用户的活动,并使用用户的权限来完成这些请求。

为 Canvas 实施 OAuth

虽然此 Canvas Cookbook 未使用 OAuth,但任何拥有多个用户的部署都必须使用它。有关详细的演练,请参阅Canvas 文档的 OAuth

以下是在 Canvas 自定义操作中实施 OAuth 时需要记住的一些事项

  • OAuth 需要访问 Canvas 的管理设置才能检索客户端 ID 和客户端密钥。
  • 授权 URL 如下所示(请确保更新 Canvas 安装 URL):https:///login/oauth2/auth
  • 令牌 URL 如下所示(请确保更新 Canvas 安装 URL):ttps:///login/oauth2/token
  • 可能不需要在自定义操作中定义范围。如果开发者密钥不需要范围且未指定范围参数,则访问令牌将有权访问所有范围。如果开发者密钥确实需要范围且未指定范围参数,则 Canvas 将响应“invalid_scope”。有关开发者密钥的更多信息,请点击此处,有关端点的更多信息,请点击此处
  • 令牌交换方法为默认方法(POST 请求)
  • Canvas 使用术语 redirect_uri,而 ChatGPT 使用术语 Callback URL,表示成功身份验证后完成重定向过程的 URL。

使用用户生成的访问令牌实施身份验证

在某些情况下,使用用户生成的访问令牌进行 Canvas 自定义操作身份验证可能是合适的。以下是执行此操作的步骤

  1. 前往此处显示的 Canvas 帐户设置:canvas_lms_settings_link.png
  2. 向下滚动到此处显示的令牌列表
    canvas_lms_list_of_tokens.png
  3. 生成新令牌,并存储此令牌。以后将无法访问它。canvas_lms_new_token.png

示例用例:学生课程助手

概述

通过提供详细信息、生成个性化练习考试以及提供建设性反馈以增强学习,协助学生导航和理解他们的课程。

注意事项

  • 当 API 请求时,某些信息(如教学大纲)会作为 HTML 页面返回。这使得它无法在 ChatGPT 中显示。相反,请参考课程描述、模块和作业来指导用户。
  • 可以使用 include[] 查询参数修改请求以检索特定信息。如果您需要请求有关课程的特定信息,请在 GPT 指令中提供示例。

GPT 指令

编写这些指令的方法有很多种。请参阅此处,获取有关 Prompt Engineering 策略和最佳实践的指导。

# **Context:** You support college students by providing detailed information about their courses hosted on the Canvas Learning Management System. You help them understand course content, generate practice exams based on provided materials, and offer insightful feedback to aid their learning journey. Assume the students are familiar with basic academic terminologies.

# **Instructions:**

## Scenarios

### - When the user asks for information about a specific course, follow this 5 step process:
1. Ask the user to specify the course they want assistance with and the particular area of focus (e.g., overall course overview, specific module).
2. If you do not know the Course ID for the course requested, use the listYourCourses to find the right course and corresponding ID in Canvas. If none of the courses listed returned courses that seem to match the course request, use the searchCourses to see if there are any similarly named course. 
3. Retrieve the course information from Canvas using the getSingleCourse API call and the listModules API call. 
4. Ask the user which module(s) they would like to focus on and use the listModuleItems to retrieve the requested module items. For any assignments, share links to them.
5. Ask if the user needs more information or if they need to prepare for an exam.

### When a user asks to take a practice test or practice exam for a specific course, follow this 6 step process:
1. Ask how many questions
2. Ask which chapters or topics they want to be tested on, provide a couple examples from the course modules in Canvas.
3. Ask 1 question at a time, be sure the questions are multiple choice (do not generate the next question until the question is answered)
4. When the user answers, tell them if its right or wrong and give a description for the correct answer 
5. Ask the user if they want to export the test results and write the code to create the PDF
6. Offer additional resources and study tips tailored to the user's needs and progress, and inquire if they require further assistance with other courses or topics.

### When a user asks to create a study guide
- Format the generated study guide in a table

OpenAPI 架构

以下内容是通过结合Canvas API 参考ActionsGPT 生成的。

openapi: 3.1.0
info:
  title: Canvas API
  description: API for interacting with Canvas LMS, including courses, modules, module items, and search functionalities.
  version: 1.0.0
servers:
  - url: https://canvas.instructure.com/api/v1
    description: Canvas LMS API server
    variables:
      domain:
        default: canvas.instructure.com
        description: The domain of your Canvas instance
paths:
  /courses:
    get:
      operationId: listYourCourses
      summary: List your courses
      description: Retrieves a paginated list of active courses for the current user.
      parameters:
        - name: enrollment_type
          in: query
          description: Filter by enrollment type (e.g., "teacher", "student").
          schema:
            type: string
        - name: enrollment_role
          in: query
          description: Filter by role type. Requires admin permissions.
          schema:
            type: string
        - name: enrollment_state
          in: query
          description: Filter by enrollment state (e.g., "active", "invited").
          schema:
            type: string
        - name: exclude_blueprint_courses
          in: query
          description: Exclude Blueprint courses if true.
          schema:
            type: boolean
        - name: include
          in: query
          description: Array of additional information to include (e.g., "term", "teachers").
          schema:
            type: array
            items:
              type: string
        - name: per_page
          in: query
          description: The number of results to return per page.
          schema:
            type: integer
          example: 10
        - name: page
          in: query
          description: The page number to return.
          schema:
            type: integer
          example: 1
      responses:
        '200':
          description: A list of courses.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: The ID of the course.
                    name:
                      type: string
                      description: The name of the course.
                    account_id:
                      type: integer
                      description: The ID of the account associated with the course.
                    enrollment_term_id:
                      type: integer
                      description: The ID of the term associated with the course.
                    start_at:
                      type: string
                      format: date-time
                      description: The start date of the course.
                    end_at:
                      type: string
                      format: date-time
                      description: The end date of the course.
                    course_code:
                      type: string
                      description: The course code.
                    state:
                      type: string
                      description: The current state of the course (e.g., "unpublished", "available").
        '400':
          description: Bad request, possibly due to invalid query parameters.
        '401':
          description: Unauthorized, likely due to invalid authentication credentials.
 
  /courses/{course_id}:
    get:
      operationId: getSingleCourse
      summary: Get a single course
      description: Retrieves the details of a specific course by its ID.
      parameters:
        - name: course_id
          in: path
          required: true
          description: The ID of the course.
          schema:
            type: integer
        - name: include
          in: query
          description: Array of additional information to include (e.g., "term", "teachers").
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: A single course object.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                    description: The ID of the course.
                  name:
                    type: string
                    description: The name of the course.
                  account_id:
                    type: integer
                    description: The ID of the account associated with the course.
                  enrollment_term_id:
                    type: integer
                    description: The ID of the term associated with the course.
                  start_at:
                    type: string
                    format: date-time
                    description: The start date of the course.
                  end_at:
                    type: string
                    format: date-time
                    description: The end date of the course.
                  course_code:
                    type: string
                    description: The course code.
                  state:
                    type: string
                    description: The current state of the course (e.g., "unpublished", "available").
                  is_public:
                    type: boolean
                    description: Whether the course is public.
                  syllabus_body:
                    type: string
                    description: The syllabus content of the course.
                  term:
                    type: object
                    description: The term associated with the course.
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                      start_at:
                        type: string
                        format: date-time
                      end_at:
                        type: string
                        format: date-time
        '400':
          description: Bad request, possibly due to an invalid course ID or query parameters.
        '401':
          description: Unauthorized, likely due to invalid authentication credentials.
        '404':
          description: Course not found, possibly due to an invalid course ID.
 
  /courses/{course_id}/modules:
    get:
      operationId: listModules
      summary: List modules in a course
      description: Retrieves the list of modules for a given course in Canvas.
      parameters:
        - name: course_id
          in: path
          required: true
          description: The ID of the course.
          schema:
            type: integer
        - name: include
          in: query
          description: Include additional information such as items in the response.
          schema:
            type: array
            items:
              type: string
            example: ["items"]
        - name: search_term
          in: query
          description: The partial title of the module to match and return.
          schema:
            type: string
        - name: student_id
          in: query
          description: Return module completion information for the student with this ID.
          schema:
            type: integer
        - name: per_page
          in: query
          description: The number of results to return per page.
          schema:
            type: integer
          example: 10
        - name: page
          in: query
          description: The page number to return.
          schema:
            type: integer
          example: 1
      responses:
        '200':
          description: A list of modules in the course.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: The ID of the module.
                    name:
                      type: string
                      description: The name of the module.
                    items_count:
                      type: integer
                      description: The number of items in the module.
                    state:
                      type: string
                      description: The state of the module (e.g., "active", "locked").
        '400':
          description: Bad request, possibly due to an invalid course ID or query parameters.
        '401':
          description: Unauthorized, likely due to invalid authentication credentials.
        '404':
          description: Course not found, possibly due to an invalid course ID.
 
  /courses/{course_id}/modules/{module_id}/items:
    get:
      operationId: listModuleItems
      summary: List items in a module
      description: Retrieves the list of items within a specific module in a Canvas course.
      parameters:
        - name: course_id
          in: path
          required: true
          description: The ID of the course.
          schema:
            type: integer
        - name: module_id
          in: path
          required: true
          description: The ID of the module.
          schema:
            type: integer
        - name: include
          in: query
          description: Include additional information in the response, such as content details.
          schema:
            type: array
            items:
              type: string
            example: ["content_details"]
        - name: student_id
          in: query
          description: Return completion information for the student with this ID.
          schema:
            type: integer
        - name: per_page
          in: query
          description: The number of results to return per page.
          schema:
            type: integer
          example: 10
        - name: page
          in: query
          description: The page number to return.
          schema:
            type: integer
          example: 1
      responses:
        '200':
          description: A list of items in the module.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: The ID of the module item.
                    title:
                      type: string
                      description: The title of the module item.
                    type:
                      type: string
                      description: The type of the module item (e.g., "Assignment", "File").
                    position:
                      type: integer
                      description: The position of the item within the module.
                    indent:
                      type: integer
                      description: The level of indentation of the item in the module.
                    completion_requirement:
                      type: object
                      description: The completion requirement for the item.
                      properties:
                        type:
                          type: string
                        min_score:
                          type: integer
                    content_id:
                      type: integer
                      description: The ID of the associated content item (e.g., assignment, file).
                    state:
                      type: string
                      description: The state of the item (e.g., "active", "locked").
        '400':
          description: Bad request, possibly due to an invalid module ID or query parameters.
        '401':
          description: Unauthorized, likely due to invalid authentication credentials.
        '404':
          description: Module or course not found, possibly due to an invalid module or course ID.
 
  /search/all_courses:
    get:
      operationId: searchCourses
      summary: Search for courses
      description: Searches for public courses in Canvas.
      parameters:
        - name: search
          in: query
          description: The search term to filter courses.
          schema:
            type: string
        - name: public_only
          in: query
          description: If true, only returns public courses.
          schema:
            type: boolean
        - name: open_enrollment_only
          in: query
          description: If true, only returns courses with open enrollment.
          schema:
            type: boolean
        - name: enrollment_type
          in: query
          description: Filter by enrollment type (e.g., "teacher", "student").
          schema:
            type: string
        - name: sort
          in: query
          description: Sort the results by "asc" or "desc" order.
          schema:
            type: string
          enum:
            - asc
            - desc
        - name: per_page
          in: query
          description: The number of results to return per page.
          schema:
            type: integer
          example: 10
        - name: page
          in: query
          description: The page number to return.
          schema:
            type: integer
          example: 1
      responses:
        '200':
          description: A list of courses matching the search criteria.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: integer
                      description: The ID of the course.
                    name:
                      type: string
                      description: The name of the course.
                    account_id:
                      type: integer
                      description: The ID of the account associated with the course.
                    enrollment_term_id:
                      type: integer
                      description: The ID of the term associated with the course.
                    start_at:
                      type: string
                      format: date-time
                      description: The start date of the course.
                    end_at:
                      type: string
                      format: date-time
                      description: The end date of the course.
                    course_code:
                      type: string
                      description: The course code.
                    state:
                      type: string
                      description: The current state of the course (e.g., "unpublished", "available").
                    is_public:
                      type: boolean
                      description: Whether the course is public.
                    term:
                      type: object
                      description: The term associated with the course.
                      properties:
                        id:
                          type: integer
                        name:
                          type: string
                        start_at:
                          type: string
                          format: date-time
                        end_at:
                          type: string
                          format: date-time
        '400':
          description: Bad request, possibly due to invalid query parameters.
        '401':
          description: Unauthorized, likely due to invalid authentication credentials.
        '404':
          description: No courses found matching the criteria.

对话示例开始

  • 帮助我参加一次练习考试。
  • 概述我的其中一门课程。
  • 列出我的所有课程。

GPT 功能

  • [开启] Web 浏览
  • [开启] DALL·E 图像生成
  • [开启] 代码解释器和数据分析

其他值得考虑的用例

以下是使用 Canvas API 可以探索的其他用例的非详尽列表。下面提供了每个用例的基本轮廓,但 GPT 指令和引用的特定 API 调用有意留给您作为用户来决定什么最适合您的需求。

课堂分析和报告

用例: 使教师能够获得关于学生参与度、成绩和出勤情况的全面分析和绩效报告。通过利用这些数据,教师可以做出明智的决定来调整他们的课程交付、识别有风险的学生并提高整体课堂效率。

API 资源

  • 分析测验统计:检索有关学生出勤情况、成绩和课程级别统计的详细数据。
  • 测验报告:生成和查看各种报告,以分析班级整体表现并跟踪一段时间内的进度。

评分作业的审查和改进指导

用例: 为学生提供一个工具来审查他们评分的作业,分析他们的表现,并获得关于如何在知识差距领域改进的有针对性的指导。该工具可以突出显示学生遇到困难的特定问题或部分,并建议额外的资源或练习材料来帮助他们改进。

API 资源

  • 提交测验提交:检索学生的提交和相关的成绩。
  • 作业:检索有关作业的详细信息,包括评分标准和评分标准。
  • 评分标准评估:访问详细的反馈和评分标准评估
  • 模块:使用 List modules API 建议针对学生薄弱领域的其他学习模块。
  • 测验:推荐练习测验,以帮助学生提高特定的知识差距

恭喜!

您已成功使用 Canvas LMS 创建了具有工作自定义操作的自定义 GPT。您应该能够进行类似于下面屏幕截图的对话。做得好,继续努力!

canvas_lms_sample_conversation.png