Canvas LMS 食谱
目录
-
通用应用信息 - Canvas LMS 概述、其功能以及 ChatGPT 自定义操作在通过人工智能集成增强教育体验中的作用。
-
从 ChatGPT 到 Canvas 的身份验证 - 解释身份验证方法(OAuth 和用户生成的访问令牌),用于将 ChatGPT 连接到 Canvas,并提供设置每个选项的详细说明。
-
示例用例:学生课程助手 - 使用 ChatGPT 协助学生进行课程导航、考试准备和个性化反馈的详细示例,包括特定的 API 调用和工作流程。
-
其他用例供考虑 - 使用 Canvas API 的其他潜在集成,例如课堂分析和报告生成。
通用应用信息
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 食谱不使用 OAuth,但任何多于一个用户的部署都必须使用它。请参阅 Canvas 的 OAuth 文档 以获取详细的演练。
以下是在 Canvas 自定义操作中实现 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 的自定义操作身份验证可能是合适的。以下是执行此操作的步骤:
-
前往此处显示的 Canvas 帐户设置:
-
向下滚动到此处显示的令牌列表:
-
生成一个新令牌,并存储此令牌。之后将无法访问它。
示例用例:学生课程助手
概述
通过提供详细信息、生成个性化练习题和提供建设性反馈来帮助学生导航和理解他们的课程,以增强学习。
注意事项
- 通过 API 请求时,某些信息(如教学大纲)将作为 HTML 页面返回。这使得无法在 ChatGPT 中显示。相反,请引用课程描述、模块和作业来指导用户。
- 可以使用
include[]
查询参数修改请求以检索特定信息。如果需要请求有关课程的特定信息,请在 GPT 指令中提供示例。
GPT 指令
可以有多种编写这些指令的方法。此处 提供了有关提示工程策略和最佳实践的指导。
# **背景:** 您通过提供有关托管在 Canvas 学习管理系统上的课程的详细信息来支持大学生。您帮助他们理解课程内容、根据提供的材料生成练习题,并提供有见地的反馈以帮助他们的学习过程。假设学生熟悉基本的学术术语。
# **说明:**
## 情景
### - 当用户询问特定课程的信息时,请遵循以下 5 个步骤:
1. 要求用户指定他们想要获得帮助的课程以及关注的具体领域(例如,总体课程概述、特定模块)。
2. 如果您不知道所请求课程的课程 ID,请使用 listYourCourses 来查找 Canvas 中正确的课程和相应的 ID。如果返回的课程中没有似乎与所请求课程匹配的课程,请使用 searchCourses 来查看是否有任何名称相似的课程。
3. 使用 getSingleCourse API 调用和 listModules API 调用从 Canvas 检索课程信息。
4. 要求用户选择他们想关注的模块,并使用 listModuleItems 来检索所请求的模块项。对于任何作业,请提供指向它们的链接。
5. 询问用户是否需要更多信息或是否需要准备考试。
### 当用户要求参加特定课程的练习测试或练习考试时,请遵循以下 6 个步骤:
1. 询问问题数量
2. 询问他们想测试哪些章节或主题,并从 Canvas 中的课程模块中提供一些示例。
3. 一次问一个问题,确保问题是多项选择题(在问题回答之前不要生成下一个问题)
4. 当用户回答时,告诉他们是对还是错,并为正确答案提供描述
5. 询问用户是否要导出测试结果并编写代码以创建 PDF
6. 提供根据用户需求和进度量身定制的额外资源和学习技巧,并询问他们是否需要其他课程或主题的帮助。
### 当用户要求创建学习指南时
- 以表格形式格式化生成的学习指南
OpenAPI 架构
- API 调用功能
- [GET] listYourCourses
- [GET] getSingleCourse
- [GET] listModules
- [GET] listModuleItems
- [GET] searchCourses
以下内容是结合 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 功能
- [开启] 网页浏览
- [开启] DALL·E 图像生成
- [开启] 代码解释器与数据分析
其他用例供考虑
以下是可以使用 Canvas API 探索的其他用例的非详尽列表。每个用例的基本大纲都已提供,但 GPT 指令以及引用的特定 API 调用故意留给您(用户)来决定最适合您的需求。
课堂分析和报告
用例: 为教师提供关于学生参与度、成绩和出勤率的全面分析和绩效报告。通过利用这些数据,教师可以做出明智的决定来定制他们的课程交付,识别有风险的学生,并提高整体课堂效率。
API 资源:
已评分作业的审查和改进指南
用例: 为学生提供一个工具来审查他们的已评分作业,分析他们的表现,并获得针对他们在知识差距方面的改进的指导。该工具可以突出显示学生遇到困难的特定问题或部分,并建议额外的资源或练习材料来帮助他们改进。
API 资源:
- 提交 和 测验提交:检索学生的提交和相关成绩。
- 作业:检索有关作业的详细信息,包括评分标准和评分标准。
- 评分标准评估:访问详细反馈和评分标准评估
- 模块:使用 List modules API 建议针对学生薄弱领域的额外学习模块。
- 测验:推荐练习测验以帮助学生提高特定知识差距
恭喜!
您已成功创建了一个自定义 GPT,其中包含一个可正常工作的自定义操作,使用了 Canvas LMS。您应该能够进行类似于下面屏幕截图的对话。做得好,继续前进!