Open Interpreter 中的配置文件系统提供了一种灵活的配置机制,使用户能够为特定用例保存、加载和应用不同的设置。该系统允许用户快速切换不同的配置,而无需每次手动更改单个设置。
来源: interpreter/terminal_interface/profiles/profiles.py19-24 interpreter/terminal_interface/profiles/profiles.py31-64
配置文件存储在由 oi_dir 工具确定的用户特定目录中。配置文件目录结构组织如下
{user_config_dir}/open-interpreter/
└── profiles/
├── default.yaml # User's default profile
└── {custom_profiles} # User-created profiles
默认配置文件路径在 Open Interpreter 首次运行时自动创建,根据系统的用户配置目录约定。
默认配置文件随 Open Interpreter 安装一起包含在 interpreter/terminal_interface/profiles/defaults/ 目录中。
来源: interpreter/terminal_interface/profiles/profiles.py16-24
Open Interpreter 支持三种不同的配置文件格式
| 格式 | 文件扩展名 | 描述 |
|---|---|---|
| YAML | .yaml, .yml | 人类可读的配置格式 |
| Python | .py | 直接操作解释器设置的 Python 脚本 |
| JSON | .json | 机器可读的配置格式 |
Open Interpreter 附带了针对特定用例的多个内置配置文件
| 配置文件名称 | 目的 | 关键设置 |
|---|---|---|
| default.yaml | 标准配置 | 使用 gpt-4o 模型 |
| fast.yaml | 快速响应,极少解释 | 使用 gpt-4o-mini 模型 |
| local.py | 离线操作配置 | 使用本地 LLM 设置 |
| os.py | 带计算机视觉的操作系统控制 | 启用计算机 API 和操作系统控制功能 |
| vision.yaml | 图像分析功能 | 启用 gpt-4o 的视觉支持 |
| codestral.py | 使用 Ollama/codestral 进行本地编码 | 使用 codestral 模型设置 Ollama |
| llama3.py | 使用 llama3 进行本地操作 | 使用 llama3 模型设置 Ollama |
来源: interpreter/terminal_interface/profiles/defaults/ interpreter/terminal_interface/profiles/profiles.py23-24
来源: interpreter/terminal_interface/profiles/defaults/default.yaml interpreter/terminal_interface/profiles/profiles.py212-213
配置文件可以通过以下几种方式加载
命令行界面:
Python API:
加载配置文件时,系统遵循以下解析顺序
来源: interpreter/terminal_interface/profiles/profiles.py31-64 interpreter/terminal_interface/profiles/profiles.py67-120
来源: interpreter/terminal_interface/profiles/profiles.py31-64 interpreter/terminal_interface/profiles/profiles.py145-213
配置文件系统由几个协同工作的关键组件组成
来源: interpreter/terminal_interface/profiles/profiles.py31-64 interpreter/terminal_interface/profiles/profiles.py16-28
配置文件的一个重要方面是系统消息,它指导 LLM 的角色和功能。默认系统消息在核心模块中定义,并且可以被配置文件覆盖
来源: interpreter/core/default_system_message.py1-17 interpreter/terminal_interface/profiles/profiles.py195-201
用户可以以任何受支持的格式创建自己的配置文件
YAML 配置文件包含按层次结构组织的配置设置
Python 配置文件直接操作解释器对象
来源: interpreter/terminal_interface/profiles/defaults/default.yaml interpreter/terminal_interface/profiles/defaults/local.py
配置文件系统包含版本跟踪功能,以处理 Open Interpreter 版本之间配置文件结构的变化。当加载过时版本的配置文件时,系统会提供将其迁移到当前格式的选项。
迁移过程
来源: interpreter/terminal_interface/profiles/profiles.py151-193 interpreter/terminal_interface/profiles/profiles.py216-563
配置文件系统还支持为 wtf 命令配置,该命令为终端错误提供快速帮助
配置文件系统与 Open Interpreter 的其他几个组件集成
来源: interpreter/terminal_interface/profiles/profiles.py145-213
| 用例 | 推荐配置文件 | 主要功能 |
|---|---|---|
| 标准开发 | default.yaml | 使用 gpt-4o 的平衡设置 |
| 离线工作 | local.py | 无需互联网连接即可工作 |
| 快速响应 | fast.yaml | 使用较小模型,极少解释 |
| 图像分析 | vision.yaml | 启用视觉功能 |
| 操作系统自动化 | os.py | 带视觉的完整计算机控制 |
| 本地低资源 | llama3.py | 使用 Ollama 和 llama3 进行本地执行 |
| 数据分析 | snowpark.yml | 为 Snowflake 数据操作预配置 |