janito 0.15.0__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. janito/__init__.py +1 -5
  2. janito/__main__.py +3 -5
  3. janito/agent/__init__.py +1 -0
  4. janito/agent/agent.py +96 -0
  5. janito/agent/config.py +113 -0
  6. janito/agent/config_defaults.py +10 -0
  7. janito/agent/conversation.py +107 -0
  8. janito/agent/queued_tool_handler.py +16 -0
  9. janito/agent/runtime_config.py +30 -0
  10. janito/agent/tool_handler.py +124 -0
  11. janito/agent/tools/__init__.py +11 -0
  12. janito/agent/tools/ask_user.py +63 -0
  13. janito/agent/tools/bash_exec.py +58 -0
  14. janito/agent/tools/create_directory.py +19 -0
  15. janito/agent/tools/create_file.py +43 -0
  16. janito/agent/tools/fetch_url.py +48 -0
  17. janito/agent/tools/file_str_replace.py +48 -0
  18. janito/agent/tools/find_files.py +37 -0
  19. janito/agent/tools/gitignore_utils.py +40 -0
  20. janito/agent/tools/move_file.py +37 -0
  21. janito/agent/tools/remove_file.py +19 -0
  22. janito/agent/tools/rich_live.py +37 -0
  23. janito/agent/tools/rich_utils.py +31 -0
  24. janito/agent/tools/search_text.py +41 -0
  25. janito/agent/tools/view_file.py +34 -0
  26. janito/cli/__init__.py +0 -6
  27. janito/cli/_print_config.py +68 -0
  28. janito/cli/_utils.py +8 -0
  29. janito/cli/arg_parser.py +26 -0
  30. janito/cli/config_commands.py +131 -0
  31. janito/cli/logging_setup.py +27 -0
  32. janito/cli/main.py +39 -0
  33. janito/cli/runner.py +135 -0
  34. janito/cli_chat_shell/__init__.py +1 -0
  35. janito/cli_chat_shell/chat_loop.py +147 -0
  36. janito/cli_chat_shell/commands.py +202 -0
  37. janito/cli_chat_shell/config_shell.py +75 -0
  38. janito/cli_chat_shell/load_prompt.py +15 -0
  39. janito/cli_chat_shell/session_manager.py +60 -0
  40. janito/cli_chat_shell/ui.py +136 -0
  41. janito/render_prompt.py +12 -0
  42. janito/templates/system_instructions.j2 +36 -0
  43. janito/web/__init__.py +0 -0
  44. janito/web/__main__.py +17 -0
  45. janito/web/app.py +132 -0
  46. janito-1.0.0.dist-info/METADATA +144 -0
  47. janito-1.0.0.dist-info/RECORD +51 -0
  48. {janito-0.15.0.dist-info → janito-1.0.0.dist-info}/WHEEL +2 -1
  49. janito-1.0.0.dist-info/entry_points.txt +2 -0
  50. {janito-0.15.0.dist-info → janito-1.0.0.dist-info}/licenses/LICENSE +2 -2
  51. janito-1.0.0.dist-info/top_level.txt +1 -0
  52. janito/callbacks.py +0 -34
  53. janito/cli/agent/__init__.py +0 -7
  54. janito/cli/agent/conversation.py +0 -149
  55. janito/cli/agent/initialization.py +0 -168
  56. janito/cli/agent/query.py +0 -112
  57. janito/cli/agent.py +0 -12
  58. janito/cli/app.py +0 -178
  59. janito/cli/commands/__init__.py +0 -12
  60. janito/cli/commands/config.py +0 -30
  61. janito/cli/commands/history.py +0 -119
  62. janito/cli/commands/profile.py +0 -93
  63. janito/cli/commands/validation.py +0 -24
  64. janito/cli/commands/workspace.py +0 -31
  65. janito/cli/commands.py +0 -12
  66. janito/cli/output.py +0 -29
  67. janito/cli/utils.py +0 -22
  68. janito/config/README.md +0 -104
  69. janito/config/__init__.py +0 -16
  70. janito/config/cli/__init__.py +0 -28
  71. janito/config/cli/commands.py +0 -397
  72. janito/config/cli/validators.py +0 -77
  73. janito/config/core/__init__.py +0 -23
  74. janito/config/core/file_operations.py +0 -90
  75. janito/config/core/properties.py +0 -316
  76. janito/config/core/singleton.py +0 -282
  77. janito/config/profiles/__init__.py +0 -8
  78. janito/config/profiles/definitions.py +0 -38
  79. janito/config/profiles/manager.py +0 -80
  80. janito/data/instructions_template.txt +0 -34
  81. janito/token_report.py +0 -154
  82. janito/tools/__init__.py +0 -44
  83. janito/tools/bash/bash.py +0 -157
  84. janito/tools/bash/unix_persistent_bash.py +0 -215
  85. janito/tools/bash/win_persistent_bash.py +0 -341
  86. janito/tools/decorators.py +0 -90
  87. janito/tools/delete_file.py +0 -65
  88. janito/tools/fetch_webpage/__init__.py +0 -23
  89. janito/tools/fetch_webpage/core.py +0 -182
  90. janito/tools/find_files.py +0 -220
  91. janito/tools/move_file.py +0 -72
  92. janito/tools/prompt_user.py +0 -57
  93. janito/tools/replace_file.py +0 -63
  94. janito/tools/rich_console.py +0 -176
  95. janito/tools/search_text.py +0 -226
  96. janito/tools/str_replace_editor/__init__.py +0 -6
  97. janito/tools/str_replace_editor/editor.py +0 -55
  98. janito/tools/str_replace_editor/handlers/__init__.py +0 -16
  99. janito/tools/str_replace_editor/handlers/create.py +0 -60
  100. janito/tools/str_replace_editor/handlers/insert.py +0 -100
  101. janito/tools/str_replace_editor/handlers/str_replace.py +0 -94
  102. janito/tools/str_replace_editor/handlers/undo.py +0 -64
  103. janito/tools/str_replace_editor/handlers/view.py +0 -165
  104. janito/tools/str_replace_editor/utils.py +0 -33
  105. janito/tools/think.py +0 -37
  106. janito/tools/usage_tracker.py +0 -137
  107. janito-0.15.0.dist-info/METADATA +0 -481
  108. janito-0.15.0.dist-info/RECORD +0 -64
  109. janito-0.15.0.dist-info/entry_points.txt +0 -2
@@ -1,316 +0,0 @@
1
- """
2
- Property getters and setters for the Config class.
3
- """
4
- import os
5
- import typer
6
- from typing import Optional, Any, Union, Tuple, Tuple
7
-
8
- class ConfigProperties:
9
- """
10
- Mixin class containing property getters and setters for the Config class.
11
- This class is not meant to be instantiated directly.
12
- """
13
-
14
- @property
15
- def workspace_dir(self) -> str:
16
- """Get the current workspace directory."""
17
- return self._workspace_dir
18
-
19
- @workspace_dir.setter
20
- def workspace_dir(self, path: str) -> None:
21
- """
22
- Set the workspace directory.
23
-
24
- Args:
25
- path: Path to set as workspace directory
26
-
27
- Raises:
28
- ValueError: If the directory doesn't exist and can't be created
29
- """
30
- # Convert to absolute path if not already
31
- if not os.path.isabs(path):
32
- path = os.path.normpath(os.path.abspath(path))
33
- else:
34
- # Ensure Windows paths are properly formatted
35
- path = os.path.normpath(path)
36
-
37
- # Check if the directory exists
38
- if not os.path.isdir(path):
39
- create_dir = typer.confirm(f"Workspace directory does not exist: {path}\nDo you want to create it?")
40
- if create_dir:
41
- try:
42
- os.makedirs(path, exist_ok=True)
43
- print(f"Created workspace directory: {path}")
44
- except Exception as e:
45
- raise ValueError(f"Failed to create workspace directory: {str(e)}") from e
46
- else:
47
- raise ValueError(f"Workspace directory does not exist: {path}")
48
-
49
- self._workspace_dir = path
50
-
51
- @property
52
- def verbose(self) -> bool:
53
- """Get the verbose mode status."""
54
- return self._verbose
55
-
56
- @verbose.setter
57
- def verbose(self, value: bool) -> None:
58
- """Set the verbose mode status."""
59
- self._verbose = value
60
- # This is a runtime setting, not persisted
61
-
62
- # For backward compatibility
63
- @property
64
- def debug_mode(self) -> bool:
65
- """Get the debug mode status (alias for verbose)."""
66
- return self._verbose
67
-
68
- @debug_mode.setter
69
- def debug_mode(self, value: bool) -> None:
70
- """Set the debug mode status (alias for verbose)."""
71
- self._verbose = value
72
- # This is a runtime setting, not persisted
73
-
74
- @property
75
- def ask_mode(self) -> bool:
76
- """Get the ask mode status."""
77
- return self._ask_mode
78
-
79
- @ask_mode.setter
80
- def ask_mode(self, value: bool) -> None:
81
- """
82
- Set the ask mode status.
83
-
84
- Args:
85
- value: Boolean value to set
86
-
87
- Note: This setting is not persisted to config file
88
- as it's meant to be a per-session setting.
89
- """
90
- # Convert tuple to boolean if needed (for backward compatibility)
91
- if isinstance(value, tuple) and len(value) == 2:
92
- bool_value, _ = value
93
- self._ask_mode = bool_value
94
- else:
95
- self._ask_mode = value
96
- # Don't save to config file - this is a runtime setting only
97
-
98
- @property
99
- def trust_mode(self) -> bool:
100
- """Get the trust mode status."""
101
- return self._trust_mode
102
-
103
- @trust_mode.setter
104
- def trust_mode(self, value: bool) -> None:
105
- """
106
- Set the trust mode status.
107
-
108
- Note: This setting is not persisted to config file
109
- as it's meant to be a per-session setting.
110
- """
111
- self._trust_mode = value
112
- # Don't save to config file - this is a per-session setting
113
-
114
- @property
115
- def no_tools(self) -> bool:
116
- """Get the no-tools mode status."""
117
- return self._no_tools
118
-
119
- @no_tools.setter
120
- def no_tools(self, value: bool) -> None:
121
- """
122
- Set the no-tools mode status.
123
-
124
- Note: This setting is not persisted to config file
125
- as it's meant to be a per-session setting.
126
- """
127
- self._no_tools = value
128
- # Don't save to config file - this is a per-session setting
129
-
130
- @property
131
- def temperature(self) -> float:
132
- """Get the temperature value for model generation."""
133
- return self._temperature
134
-
135
- @temperature.setter
136
- def temperature(self, value: Union[float, Tuple[float, str]]) -> None:
137
- """
138
- Set the temperature value for model generation.
139
-
140
- Args:
141
- value: Temperature value (0.0 to 1.0), or a tuple of (value, config_type)
142
-
143
- Example:
144
- config.temperature = 0.7 # Set runtime value only
145
- config.temperature = (0.7, "local") # Set in local config
146
- config.temperature = (0.7, "global") # Set in global config
147
-
148
- Raises:
149
- ValueError: If temperature is not between 0.0 and 1.0
150
- """
151
- if isinstance(value, tuple) and len(value) == 2:
152
- temp_value, config_type = value
153
- if temp_value < 0.0 or temp_value > 1.0:
154
- raise ValueError("Temperature must be between 0.0 and 1.0")
155
-
156
- self._temperature = temp_value
157
-
158
- if config_type == "local":
159
- self.set_local_config("temperature", temp_value)
160
- else:
161
- self.set_global_config("temperature", temp_value)
162
- else:
163
- if value < 0.0 or value > 1.0:
164
- raise ValueError("Temperature must be between 0.0 and 1.0")
165
-
166
- self._temperature = value
167
- # Don't save to config file - this is a runtime setting
168
-
169
- # top_k and top_p are now only accessible through profiles
170
-
171
- @property
172
- def role(self) -> str:
173
- """Get the role for the assistant."""
174
- return self._role
175
-
176
- @role.setter
177
- def role(self, value: Union[str, Tuple[str, str]]) -> None:
178
- """
179
- Set the role for the assistant.
180
-
181
- Args:
182
- value: Role string, or a tuple of (value, config_type)
183
-
184
- Example:
185
- config.role = "software engineer" # Set runtime value only
186
- config.role = ("software engineer", "local") # Set in local config
187
- config.role = ("software engineer", "global") # Set in global config
188
- """
189
- if isinstance(value, tuple) and len(value) == 2:
190
- role_value, config_type = value
191
- self._role = role_value
192
-
193
- if config_type == "local":
194
- self.set_local_config("role", role_value)
195
- else:
196
- self.set_global_config("role", role_value)
197
- else:
198
- self._role = value
199
- # Don't save to config file - this is a runtime setting
200
-
201
- @property
202
- def gitbash_path(self) -> Optional[str]:
203
- """Get the path to the GitBash executable."""
204
- return self._gitbash_path
205
-
206
- @gitbash_path.setter
207
- def gitbash_path(self, value: Union[Optional[str], Tuple[Optional[str], str]]) -> None:
208
- """
209
- Set the path to the GitBash executable.
210
-
211
- Args:
212
- value: Path to the GitBash executable, or None to use auto-detection,
213
- or a tuple of (value, config_type)
214
-
215
- Example:
216
- config.gitbash_path = "C:/Program Files/Git/bin/bash.exe" # Set runtime value only
217
- config.gitbash_path = ("C:/Program Files/Git/bin/bash.exe", "local") # Set in local config
218
- config.gitbash_path = ("C:/Program Files/Git/bin/bash.exe", "global") # Set in global config
219
-
220
- Raises:
221
- ValueError: If the provided path doesn't exist
222
- """
223
- if isinstance(value, tuple) and len(value) == 2:
224
- path_value, config_type = value
225
- # If a path is provided, verify it exists
226
- if path_value is not None and not os.path.exists(path_value):
227
- raise ValueError(f"GitBash executable not found at: {path_value}")
228
-
229
- self._gitbash_path = path_value
230
-
231
- if config_type == "local":
232
- self.set_local_config("gitbash_path", path_value)
233
- else:
234
- self.set_global_config("gitbash_path", path_value)
235
- else:
236
- # If a path is provided, verify it exists
237
- if value is not None and not os.path.exists(value):
238
- raise ValueError(f"GitBash executable not found at: {value}")
239
-
240
- self._gitbash_path = value
241
- # Don't save to config file - this is a runtime setting
242
-
243
- @property
244
- def profile(self) -> Optional[str]:
245
- """Get the current profile name."""
246
- return self._profile
247
-
248
- @property
249
- def max_view_lines(self) -> int:
250
- """Get the maximum number of lines to display before showing a warning."""
251
- return self._merged_config.get("max_view_lines", 500)
252
-
253
- @max_view_lines.setter
254
- def max_view_lines(self, value: Union[int, Tuple[int, str]]) -> None:
255
- """
256
- Set the maximum number of lines to display before showing a warning.
257
-
258
- Args:
259
- value: Maximum number of lines (must be positive), or a tuple of (value, config_type)
260
-
261
- Example:
262
- config.max_view_lines = 1000 # Set runtime value only
263
- config.max_view_lines = (1000, "local") # Set in local config
264
- config.max_view_lines = (1000, "global") # Set in global config
265
-
266
- Raises:
267
- ValueError: If the value is not a positive integer
268
- """
269
- if isinstance(value, tuple) and len(value) == 2:
270
- lines_value, config_type = value
271
- if not isinstance(lines_value, int) or lines_value <= 0:
272
- raise ValueError("max_view_lines must be a positive integer")
273
-
274
- if config_type == "local":
275
- self.set_local_config("max_view_lines", lines_value)
276
- else:
277
- self.set_global_config("max_view_lines", lines_value)
278
- else:
279
- if not isinstance(value, int) or value <= 0:
280
- raise ValueError("max_view_lines must be a positive integer")
281
-
282
- # This is a special case - we don't have a dedicated instance variable
283
- # for max_view_lines, it's accessed directly from merged_config
284
- # So we need to update the merged_config directly
285
- self._merged_config["max_view_lines"] = value
286
- # Don't save to config file - this is a runtime setting
287
-
288
- @property
289
- def show_usage_report(self) -> bool:
290
- """Get the show usage report status."""
291
- return self._show_usage_report
292
-
293
- @show_usage_report.setter
294
- def show_usage_report(self, value: Union[bool, Tuple[bool, str]]) -> None:
295
- """
296
- Set the show usage report status.
297
-
298
- Args:
299
- value: Boolean value to set, or a tuple of (value, config_type)
300
-
301
- Example:
302
- config.show_usage_report = True # Set runtime value only
303
- config.show_usage_report = (True, "local") # Set in local config
304
- config.show_usage_report = (True, "global") # Set in global config
305
- """
306
- if isinstance(value, tuple) and len(value) == 2:
307
- bool_value, config_type = value
308
- self._show_usage_report = bool_value
309
-
310
- if config_type == "local":
311
- self.set_local_config("show_usage_report", bool_value)
312
- else:
313
- self.set_global_config("show_usage_report", bool_value)
314
- else:
315
- self._show_usage_report = value
316
- # Don't save to config file - this is a runtime setting
@@ -1,282 +0,0 @@
1
- """
2
- Singleton implementation of the Config class for Janito.
3
- """
4
- import os
5
- from typing import Dict, Any, Optional, Union
6
-
7
- from .properties import ConfigProperties
8
- from .file_operations import (
9
- get_global_config_path,
10
- get_local_config_path,
11
- load_config_file,
12
- save_config_file,
13
- merge_configs
14
- )
15
- from ..profiles.manager import get_profile
16
- from ..profiles.definitions import PROFILES
17
-
18
- class Config(ConfigProperties):
19
- """Singleton configuration class for Janito."""
20
- _instance = None
21
-
22
- def __new__(cls):
23
- if cls._instance is None:
24
- cls._instance = super(Config, cls).__new__(cls)
25
- cls._instance._workspace_dir = os.getcwd()
26
- cls._instance._verbose = False
27
- cls._instance._ask_mode = False
28
- cls._instance._trust_mode = False
29
- cls._instance._no_tools = False
30
- cls._instance._show_usage_report = True # Enabled by default
31
-
32
- # Set technical profile as default
33
- profile_data = PROFILES["technical"]
34
- cls._instance._temperature = profile_data["temperature"]
35
- cls._instance._profile = "technical"
36
- cls._instance._role = "software engineer"
37
- cls._instance._gitbash_path = None # Default to None for auto-detection
38
- # Default max_view_lines will be retrieved from merged_config
39
-
40
- # Initialize configuration storage
41
- cls._instance._global_config = {}
42
- cls._instance._local_config = {}
43
- cls._instance._merged_config = {}
44
-
45
- # Load configurations
46
- cls._instance._load_config()
47
- return cls._instance
48
-
49
- def _load_config(self) -> None:
50
- """Load both global and local configurations and merge them."""
51
- # Load global config
52
- global_config_path = get_global_config_path()
53
- self._global_config = load_config_file(global_config_path)
54
-
55
- # Load local config
56
- local_config_path = get_local_config_path(self._workspace_dir)
57
- self._local_config = load_config_file(local_config_path)
58
-
59
- # Remove runtime-only settings from config files if they exist
60
- self._clean_runtime_settings()
61
-
62
- # Merge configurations (local overrides global)
63
- self._merge_configs()
64
-
65
- # Apply merged configuration to instance variables
66
- self._apply_config()
67
-
68
- def _clean_runtime_settings(self) -> None:
69
- """Remove runtime-only settings from configuration files if they exist."""
70
- runtime_settings = ["ask_mode"]
71
- config_changed = False
72
-
73
- # Remove from local config
74
- for setting in runtime_settings:
75
- if setting in self._local_config:
76
- del self._local_config[setting]
77
- config_changed = True
78
-
79
- # Remove from global config
80
- for setting in runtime_settings:
81
- if setting in self._global_config:
82
- del self._global_config[setting]
83
- config_changed = True
84
-
85
- # Save changes if needed
86
- if config_changed:
87
- self._save_local_config()
88
- self._save_global_config()
89
-
90
- def _merge_configs(self) -> None:
91
- """Merge global and local configurations with local taking precedence."""
92
- self._merged_config = merge_configs(self._global_config, self._local_config)
93
-
94
- def _apply_config(self) -> None:
95
- """Apply the merged configuration to instance variables."""
96
- config_data = self._merged_config
97
-
98
- # Apply configuration values to instance variables
99
- if "debug_mode" in config_data:
100
- self._verbose = config_data["debug_mode"]
101
- if "verbose" in config_data:
102
- self._verbose = config_data["verbose"]
103
- # ask_mode is a runtime-only setting, not loaded from config
104
- if "trust_mode" in config_data:
105
- self._trust_mode = config_data["trust_mode"]
106
- if "show_usage_report" in config_data:
107
- self._show_usage_report = config_data["show_usage_report"]
108
- if "temperature" in config_data:
109
- self._temperature = config_data["temperature"]
110
- if "profile" in config_data:
111
- self._profile = config_data["profile"]
112
- if "role" in config_data:
113
- self._role = config_data["role"]
114
- if "gitbash_path" in config_data:
115
- self._gitbash_path = config_data["gitbash_path"]
116
- # max_view_lines is accessed directly from merged_config
117
-
118
- def _save_local_config(self) -> None:
119
- """Save local configuration to file."""
120
- config_path = get_local_config_path(self._workspace_dir)
121
- save_config_file(config_path, self._local_config)
122
-
123
- def _save_global_config(self) -> None:
124
- """Save global configuration to file."""
125
- config_path = get_global_config_path()
126
- save_config_file(config_path, self._global_config)
127
-
128
- def _save_config(self) -> None:
129
- """Save local configuration to file (for backward compatibility)."""
130
- self._save_local_config()
131
-
132
- def set_profile(self, profile_name: str, config_type: str = "local") -> None:
133
- """
134
- Set parameter values based on a predefined profile.
135
-
136
- Args:
137
- profile_name: Name of the profile to use (precise, balanced, conversational, creative, technical)
138
- config_type: Type of configuration to update ("local" or "global")
139
-
140
- Raises:
141
- ValueError: If the profile name is not recognized or config_type is invalid
142
- """
143
- if config_type not in ["local", "global"]:
144
- raise ValueError(f"Invalid config_type: {config_type}. Must be 'local' or 'global'")
145
-
146
- profile = get_profile(profile_name)
147
-
148
- # Update the appropriate configuration
149
- if config_type == "local":
150
- self.set_local_config("temperature", profile["temperature"])
151
- self.set_local_config("profile", profile_name)
152
- else:
153
- self.set_global_config("temperature", profile["temperature"])
154
- self.set_global_config("profile", profile_name)
155
-
156
- @staticmethod
157
- def get_available_profiles() -> Dict[str, Dict[str, Any]]:
158
- """Get all available predefined profiles."""
159
- from ..profiles.manager import get_available_profiles
160
- return get_available_profiles()
161
-
162
- def set_local_config(self, key: str, value: Any) -> None:
163
- """
164
- Set a configuration value in the local configuration.
165
-
166
- Args:
167
- key: Configuration key
168
- value: Configuration value
169
- """
170
- self._local_config[key] = value
171
- self._save_local_config()
172
-
173
- # Re-merge and apply configurations
174
- self._merge_configs()
175
- self._apply_config()
176
-
177
- def set_global_config(self, key: str, value: Any) -> None:
178
- """
179
- Set a configuration value in the global configuration.
180
-
181
- Args:
182
- key: Configuration key
183
- value: Configuration value
184
- """
185
- self._global_config[key] = value
186
- self._save_global_config()
187
-
188
- # Re-merge and apply configurations
189
- self._merge_configs()
190
- self._apply_config()
191
-
192
- def get_local_config(self) -> Dict[str, Any]:
193
- """
194
- Get the local configuration.
195
-
196
- Returns:
197
- Dict containing the local configuration
198
- """
199
- return self._local_config.copy()
200
-
201
- def get_global_config(self) -> Dict[str, Any]:
202
- """
203
- Get the global configuration.
204
-
205
- Returns:
206
- Dict containing the global configuration
207
- """
208
- return self._global_config.copy()
209
-
210
- def get_merged_config(self) -> Dict[str, Any]:
211
- """
212
- Get the merged configuration.
213
-
214
- Returns:
215
- Dict containing the merged configuration
216
- """
217
- return self._merged_config.copy()
218
-
219
- @staticmethod
220
- def set_api_key(api_key: str) -> None:
221
- """
222
- Set the API key in the global configuration file.
223
-
224
- Args:
225
- api_key: The Anthropic API key to store
226
- """
227
- # Get the singleton instance
228
- config = Config()
229
-
230
- # Set the API key in the global configuration
231
- config.set_global_config("api_key", api_key)
232
- print(f"API key saved to {get_global_config_path()}")
233
-
234
- @staticmethod
235
- def get_api_key() -> Optional[str]:
236
- """
237
- Get the API key from the global configuration file.
238
-
239
- Returns:
240
- The API key if found, None otherwise
241
- """
242
- # Get the singleton instance
243
- config = Config()
244
-
245
- # Get the API key from the merged configuration
246
- return config.get_merged_config().get("api_key")
247
-
248
- def reset_local_config(self) -> bool:
249
- """
250
- Reset local configuration by removing the local config file.
251
-
252
- Returns:
253
- bool: True if the config file was removed, False if it didn't exist
254
- """
255
- config_path = get_local_config_path(self._workspace_dir)
256
- if config_path.exists():
257
- config_path.unlink()
258
- # Clear local configuration
259
- self._local_config = {}
260
- # Re-merge and apply configurations
261
- self._merge_configs()
262
- self._apply_config()
263
- return True
264
- return False
265
-
266
- def reset_global_config(self) -> bool:
267
- """
268
- Reset global configuration by removing the global config file.
269
-
270
- Returns:
271
- bool: True if the config file was removed, False if it didn't exist
272
- """
273
- config_path = get_global_config_path()
274
- if config_path.exists():
275
- config_path.unlink()
276
- # Clear global configuration
277
- self._global_config = {}
278
- # Re-merge and apply configurations
279
- self._merge_configs()
280
- self._apply_config()
281
- return True
282
- return False
@@ -1,8 +0,0 @@
1
- """
2
- Profile management for Janito configuration.
3
- Provides predefined parameter profiles and related functionality.
4
- """
5
- from .definitions import PROFILES
6
- from .manager import get_profile, get_available_profiles
7
-
8
- __all__ = ["PROFILES", "get_profile", "get_available_profiles"]
@@ -1,38 +0,0 @@
1
- """
2
- Predefined parameter profiles for Janito.
3
- """
4
- from typing import Dict, Any
5
-
6
- # Predefined parameter profiles
7
- PROFILES = {
8
- "precise": {
9
- "temperature": 0.2,
10
- "top_p": 0.85,
11
- "top_k": 20,
12
- "description": "Factual answers, documentation, structured data, avoiding hallucinations"
13
- },
14
- "balanced": {
15
- "temperature": 0.5,
16
- "top_p": 0.9,
17
- "top_k": 40,
18
- "description": "Professional writing, summarization, everyday tasks with moderate creativity"
19
- },
20
- "conversational": {
21
- "temperature": 0.7,
22
- "top_p": 0.9,
23
- "top_k": 45,
24
- "description": "Natural dialogue, educational content, support conversations"
25
- },
26
- "creative": {
27
- "temperature": 0.9,
28
- "top_p": 0.95,
29
- "top_k": 70,
30
- "description": "Storytelling, brainstorming, marketing copy, poetry"
31
- },
32
- "technical": {
33
- "temperature": 0.3,
34
- "top_p": 0.95,
35
- "top_k": 15,
36
- "description": "Code generation, debugging, decision analysis, technical problem-solving"
37
- }
38
- }