-
Notifications
You must be signed in to change notification settings - Fork 19
/
open_interpreter_config.py
194 lines (173 loc) · 9.54 KB
/
open_interpreter_config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import os
def configure_open_interpreter():
while True:
print("\nOpen Interpreter Configuration Menu:")
print("1. Language Models")
print("2. Usage Settings")
print("3. Safety Settings")
print("4. Telemetry Settings")
print("5. Interpreter Settings")
print("6. Notebook Settings")
print("7. Return to Main Menu")
open_interpreter_choice = input("Enter your choice (1-7): ")
if open_interpreter_choice == "1":
print("\nLanguage Models:")
print("1. Hosted Providers")
print("2. Local Providers")
print("3. Custom Models")
print("4. Go Back")
language_models_choice = input("Enter your choice (1-4): ")
if language_models_choice == "1":
print("\nHosted Providers:")
print("1. OpenAI")
print("2. Anthropic")
print("3. Hugging Face")
print("4. Go Back")
hosted_providers_choice = input("Enter your choice (1-4): ")
if hosted_providers_choice == "1":
openai_api_key = input("Enter your OpenAI API key: ")
os.environ["OPENAI_API_KEY"] = openai_api_key
print("✅ OpenAI API key saved.")
elif hosted_providers_choice == "2":
anthropic_api_key = input("Enter your Anthropic API key: ")
os.environ["ANTHROPIC_API_KEY"] = anthropic_api_key
print("✅ Anthropic API key saved.")
elif hosted_providers_choice == "3":
huggingface_api_key = input("Enter your Hugging Face API key: ")
os.environ["HUGGINGFACE_API_KEY"] = huggingface_api_key
print("✅ Hugging Face API key saved.")
elif hosted_providers_choice == "4":
pass
else:
print("Invalid choice. Please try again.")
elif language_models_choice == "2":
local_provider_path = input("Enter the path to your local provider: ")
os.environ["OPEN_INTERPRETER_LOCAL_PROVIDER"] = local_provider_path
print(f"✅ Local provider path set to {local_provider_path}.")
elif language_models_choice == "3":
custom_model_name = input("Enter the name of the custom model: ")
os.environ["OPEN_INTERPRETER_CUSTOM_MODEL"] = custom_model_name
print(f"✅ Custom model set to {custom_model_name}.")
elif language_models_choice == "4":
pass
else:
print("Invalid choice. Please try again.")
elif open_interpreter_choice == "2":
print("\nUsage Settings:")
print("1. Code Execution Settings")
print("2. Computer API")
print("3. Custom Languages")
print("4. Protocols")
print("5. LMC Messages")
print("6. Go Back")
usage_settings_choice = input("Enter your choice (1-6): ")
if usage_settings_choice == "1":
code_timeout = input("Enter the code execution timeout (in seconds): ")
os.environ["OPEN_INTERPRETER_CODE_TIMEOUT"] = code_timeout
print(f"✅ Code execution timeout set to {code_timeout} seconds.")
elif usage_settings_choice == "2":
computer_api_endpoint = input("Enter the computer API endpoint: ")
os.environ["OPEN_INTERPRETER_COMPUTER_API"] = computer_api_endpoint
print(f"✅ Computer API endpoint set to {computer_api_endpoint}.")
elif usage_settings_choice == "3":
custom_language = input("Enter the custom language name: ")
os.environ["OPEN_INTERPRETER_CUSTOM_LANGUAGE"] = custom_language
print(f"✅ Custom language set to {custom_language}.")
elif usage_settings_choice == "4":
protocol_name = input("Enter the protocol name: ")
os.environ["OPEN_INTERPRETER_PROTOCOL"] = protocol_name
print(f"✅ Protocol set to {protocol_name}.")
elif usage_settings_choice == "5":
lmc_message_format = input("Enter the LMC message format: ")
os.environ["OPEN_INTERPRETER_LMC_MESSAGE"] = lmc_message_format
print(f"✅ LMC message format set to {lmc_message_format}.")
elif usage_settings_choice == "6":
pass
else:
print("Invalid choice. Please try again.")
elif open_interpreter_choice == "3":
print("\nSafety Settings:")
print("1. Isolation")
print("2. Safe Mode")
print("3. Best Practices")
print("4. Go Back")
safety_settings_choice = input("Enter your choice (1-4): ")
if safety_settings_choice == "1":
isolation_level = input("Enter the isolation level (low/medium/high): ")
os.environ["OPEN_INTERPRETER_ISOLATION"] = isolation_level
print(f"✅ Isolation level set to {isolation_level}.")
elif safety_settings_choice == "2":
enable_safe_mode = input("Enable safe mode? (yes/no): ")
os.environ["OPEN_INTERPRETER_SAFE_MODE"] = enable_safe_mode
print(f"✅ Safe mode {enable_safe_mode}.")
elif safety_settings_choice == "3":
best_practices_path = input("Enter the best practices configuration file path: ")
os.environ["OPEN_INTERPRETER_BEST_PRACTICES"] = best_practices_path
print(f"✅ Best practices configuration file set to {best_practices_path}.")
elif safety_settings_choice == "4":
pass
else:
print("Invalid choice. Please try again.")
elif open_interpreter_choice == "4":
enable_telemetry = input("Enable telemetry? (yes/no): ")
os.environ["OPEN_INTERPRETER_TELEMETRY"] = enable_telemetry
print(f"✅ Telemetry {enable_telemetry}.")
elif open_interpreter_choice == "5":
print("\nInterpreter Settings:")
print("1. Interpreter Name")
print("2. Interpreter Group")
print("3. Interpreter Properties")
print("4. Interpreter Dependencies")
print("5. Go Back")
interpreter_settings_choice = input("Enter your choice (1-5): ")
if interpreter_settings_choice == "1":
interpreter_name = input("Enter the interpreter name: ")
os.environ["OPEN_INTERPRETER_NAME"] = interpreter_name
print(f"✅ Interpreter name set to {interpreter_name}.")
elif interpreter_settings_choice == "2":
interpreter_group = input("Enter the interpreter group: ")
os.environ["OPEN_INTERPRETER_GROUP"] = interpreter_group
print(f"✅ Interpreter group set to {interpreter_group}.")
elif interpreter_settings_choice == "3":
interpreter_properties_path = input("Enter the interpreter properties file path: ")
os.environ["OPEN_INTERPRETER_PROPERTIES"] = interpreter_properties_path
print(f"✅ Interpreter properties file set to {interpreter_properties_path}.")
elif interpreter_settings_choice == "4":
interpreter_dependencies_path = input("Enter the interpreter dependencies file path: ")
os.environ["OPEN_INTERPRETER_DEPENDENCIES"] = interpreter_dependencies_path
print(f"✅ Interpreter dependencies file set to {interpreter_dependencies_path}.")
elif interpreter_settings_choice == "5":
pass
else:
print("Invalid choice. Please try again.")
elif open_interpreter_choice == "6":
print("\nNotebook Settings:")
print("1. Notebook Dependencies")
print("2. SSH Connections")
print("3. Cell Execution Notifications")
print("4. Go Back")
notebook_settings_choice = input("Enter your choice (1-4): ")
if notebook_settings_choice == "1":
notebook_dependencies_path = input("Enter the notebook dependencies file path: ")
os.environ["OPEN_INTERPRETER_NOTEBOOK_DEPENDENCIES"] = notebook_dependencies_path
print(f"✅ Notebook dependencies file set to {notebook_dependencies_path}.")
elif notebook_settings_choice == "2":
ssh_connection_details = input("Enter the SSH connection details: ")
os.environ["OPEN_INTERPRETER_SSH_CONNECTION"] = ssh_connection_details
print(f"✅ SSH connection details set to {ssh_connection_details}.")
elif notebook_settings_choice == "3":
enable_cell_notifications = input("Enable cell execution notifications? (yes/no): ")
os.environ["OPEN_INTERPRETER_CELL_NOTIFICATIONS"] = enable_cell_notifications
print(f"✅ Cell execution notifications {enable_cell_notifications}.")
elif notebook_settings_choice == "4":
pass
else:
print("Invalid choice. Please try again.")
elif open_interpreter_choice == "7":
print("Returning to the main menu...")
break
else:
print("Invalid choice. Please try again.")
print("Open Interpreter configuration completed successfully!")
if __name__ == "__main__":
configure_open_interpreter()