janito 2.28.0__py3-none-any.whl → 2.30.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 (32) hide show
  1. janito/README.md +3 -3
  2. janito/agent/setup_agent.py +21 -35
  3. janito/agent/templates/profiles/system_prompt_template_Developer_with_Python_Tools.txt.j2 +6 -0
  4. janito/agent/templates/profiles/system_prompt_template_developer.txt.j2 +6 -0
  5. janito/agent/templates/profiles/system_prompt_template_market_analyst.txt.j2 +7 -1
  6. janito/agent/templates/profiles/system_prompt_template_model_conversation_without_tools_or_context.txt.j2 +7 -1
  7. janito/cli/chat_mode/session.py +154 -96
  8. janito/cli/cli_commands/list_plugins.py +99 -75
  9. janito/cli/cli_commands/show_system_prompt.py +8 -3
  10. janito/cli/core/runner.py +2 -2
  11. janito/cli/main_cli.py +9 -15
  12. janito/cli/prompt_core.py +0 -2
  13. janito/cli/rich_terminal_reporter.py +2 -1
  14. janito/cli/single_shot_mode/handler.py +0 -2
  15. janito/llm/agent.py +6 -1
  16. janito/provider_registry.py +1 -1
  17. janito/providers/openai/provider.py +1 -1
  18. janito/tools/adapters/local/ask_user.py +3 -1
  19. janito/tools/adapters/local/fetch_url.py +20 -28
  20. janito/tools/adapters/local/replace_text_in_file.py +9 -3
  21. janito/tools/adapters/local/search_text/core.py +2 -2
  22. janito/tools/loop_protection_decorator.py +12 -16
  23. janito/tools/tools_adapter.py +18 -4
  24. janito-2.30.0.dist-info/METADATA +83 -0
  25. {janito-2.28.0.dist-info → janito-2.30.0.dist-info}/RECORD +29 -30
  26. janito-2.30.0.dist-info/licenses/LICENSE +201 -0
  27. janito/cli/chat_mode/session_profile_select.py +0 -182
  28. janito-2.28.0.dist-info/METADATA +0 -431
  29. janito-2.28.0.dist-info/licenses/LICENSE +0 -21
  30. {janito-2.28.0.dist-info → janito-2.30.0.dist-info}/WHEEL +0 -0
  31. {janito-2.28.0.dist-info → janito-2.30.0.dist-info}/entry_points.txt +0 -0
  32. {janito-2.28.0.dist-info → janito-2.30.0.dist-info}/top_level.txt +0 -0
@@ -1,431 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: janito
3
- Version: 2.28.0
4
- Summary: A new Python package called janito.
5
- Author-email: João Pinto <janito@ikignosis.org>
6
- Project-URL: Homepage, https://github.com/ikignosis/janito
7
- Requires-Python: >=3.7
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: attrs==25.3.0
11
- Requires-Dist: rich==14.0.0
12
- Requires-Dist: pathspec==0.12.1
13
- Requires-Dist: setuptools>=61.0
14
- Requires-Dist: pyyaml>=6.0
15
- Requires-Dist: jinja2>=3.0.0
16
- Requires-Dist: prompt_toolkit>=3.0.51
17
- Requires-Dist: lxml>=5.4.0
18
- Requires-Dist: requests>=2.32.4
19
- Requires-Dist: bs4>=0.0.2
20
- Requires-Dist: questionary>=2.0.1
21
- Requires-Dist: openai>=1.68.0
22
- Provides-Extra: dev
23
- Requires-Dist: pytest; extra == "dev"
24
- Requires-Dist: pre-commit; extra == "dev"
25
- Requires-Dist: ruff==0.11.9; extra == "dev"
26
- Requires-Dist: detect-secrets==1.4.0; extra == "dev"
27
- Requires-Dist: codespell==2.4.1; extra == "dev"
28
- Requires-Dist: black; extra == "dev"
29
- Requires-Dist: questionary>=2.0.1; extra == "dev"
30
- Requires-Dist: setuptools_scm>=8.0; extra == "dev"
31
- Provides-Extra: coder
32
- Requires-Dist: janito-coder; extra == "coder"
33
- Dynamic: license-file
34
-
35
- # Janito, control you context
36
-
37
- [![PyPI version](https://badge.fury.io/py/janito.svg)](https://badge.fury.io/py/janito)
38
-
39
- Janito is a command-line interface (CLI) tool for managing and interacting with Large Language Model (LLM) providers. It enables you to configure API keys, select providers and models, and submit prompts to various LLMs from your terminal. Janito is designed for extensibility, supporting multiple providers and a wide range of tools for automation and productivity.
40
-
41
- ## Features
42
-
43
- - 🔑 Manage API keys and provider configurations
44
- - 🤖 Interact with multiple LLM providers (OpenAI, Google Gemini, DeepSeek, and more)
45
- - 🛠️ List and use a variety of registered tools
46
- - 📝 Submit prompts and receive responses directly from the CLI
47
- - 📋 List available models for each provider
48
- - 🧩 Extensible architecture for adding new providers and tools
49
- - 🎛️ Rich terminal output and event logging
50
-
51
- ### Advanced and Architectural Features
52
-
53
- - ⚡ **Event-driven architecture**: Modular, decoupled system using a custom EventBus for extensibility and integration.
54
- - 🧑‍💻 **Tool registry & dynamic tool execution**: Register new tools easily, execute them by name or call from automation pipelines.
55
- - 🤖 **LLM Agent automation**: Supports agent-like workflows with the ability to chain tools or make decisions during LLM conversations.
56
- - 🏗️ **Extensible provider management**: Add, configure, or switch between LLM providers and their models on the fly.
57
- - 🧰 **Rich tool ecosystem**: Includes file operations, local/remote script and command execution, text processing, and internet access (fetching URLs), all reusable by LLM or user.
58
- - 📝 **Comprehensive event & history reporting**: Detailed logs of prompts, events, tool usage, and responses for traceability and audit.
59
- - 🖥️ **Enhanced terminal UI**: Colorful, informative real-time outputs and logs to improve productivity and insight during LLM usage.
60
-
61
- ## Installation
62
-
63
- Janito is a Python package. Since this is a development version, you can install it directly from GitHub:
64
-
65
- ```bash
66
- pip install git+git@github.com:ikignosis/janito.git
67
- ```
68
-
69
- ### First launch and quick setup
70
-
71
- Janito integrates with external LLM providers (list below), and most of them require a subscription to get an API_KEY.
72
-
73
- > [!NOTE]
74
- > Today, on June the 26th 2025, Google has a free tier subscription for its Gemini-2.5-flash and Gemini-2.5-pro models. Despite the limitation of the models and of the rate limit of the free tier, they can be used for testing janito. The API_KEY for Gemini is available [here](https://aistudio.google.com/app/apikey).
75
-
76
- > [!NOTE]
77
- > [Here](https://github.com/cheahjs/free-llm-api-resources/blob/main/README.md) a list of various services that provide free access or credits towards API-based LLM usage. Note that not all of them are supported by Janito, yet.
78
-
79
- For a quick usage you can:
80
-
81
- 1. once you get the API_KEY from your favourite LLM provider, setup the API_KEY in Janito
82
-
83
- ```bash
84
- janito --set-api-key API_KEY -p PROVIDER
85
- ```
86
-
87
- 2. then run janito from command line with the specific LLM provider of your choice
88
-
89
- ```bash
90
- janito -p PROVIDER "Hello, who are you? How can you help me in my tasks?"
91
- ```
92
-
93
- 3. or you can run janito in interactive mode without the trailing argument
94
-
95
- ```bash
96
- janito -p PROVIDER
97
- ```
98
-
99
- 4. if you want to setup a specific provider for any further interactions you can use:
100
-
101
- ```bash
102
- janito -set provider=PROVIDER
103
- ```
104
-
105
- > [!WARNING]
106
- > Currently the supported providers are: `openai`, `google`, `anthropic`, `azure_openai`. You can get more details with `janito --list-providers`.
107
-
108
- 5. for more advanced setup, continue reading.
109
-
110
-
111
- ## Usage
112
-
113
- After installation, use the `janito` command in your terminal with the syntax: `janito [options] [prompt]`
114
-
115
- Janito supports both general-purpose and specialized assistance through the use of **profiles**. Profiles allow you to select a specific system prompt template and behavior for the agent, enabling workflows tailored to different roles or tasks (e.g., developer, writer, data analyst), or to use Janito as a generic AI assistant.
116
-
117
- ### Profiles: General-Purpose and Specialized Assistance
118
-
119
- - By default, Janito acts as a general-purpose assistant.
120
- - You can select a specialized profile using the `--profile` option:
121
- ```bash
122
- janito --profile developer "Refactor this code for better readability."
123
- janito --profile writer "Draft a blog post about AI in healthcare."
124
- ```
125
- - Profiles change the system prompt and agent behavior to suit the selected role or workflow.
126
- - To see available profiles or customize them, refer to the documentation or the `agent/templates/profiles/` directory.
127
-
128
- > **Tip:** Use `--profile` for targeted workflows, or omit it for a general-purpose assistant.
129
-
130
- Janito has configuration options, like `--set api-key API_KEY` and `--set provider=PROVIDER`, that create durable configurations and single shoot options, like `-p PROVIDER` and `-m MODEL`, that are active for the single run of the command or session.
131
-
132
- ### Basic Commands
133
-
134
- - **Set API Key for a Provider (requires -p PROVIDER)**
135
- ```bash
136
- janito --set-api-key API_KEY -p PROVIDER
137
- ```
138
- > **Note:** The `-p PROVIDER` argument is required when setting an API key. For example:
139
- > ```bash
140
- > janito --set-api-key sk-xxxxxxx -p openai
141
- > ```
142
-
143
- - **Set the Provider (durable)**
144
- ```bash
145
- janito --set provider=provider_name
146
- ```
147
-
148
- - **List Supported Providers**
149
- ```bash
150
- janito --list-providers
151
- ```
152
-
153
- - **List Registered Tools**
154
- ```bash
155
- janito --list-tools
156
- ```
157
-
158
- - **List Models for a Provider**
159
- ```bash
160
- janito -p PROVIDER --list-models
161
- ```
162
-
163
- - **Submit a Prompt**
164
- ```bash
165
- janito "What is the capital of France?"
166
- ```
167
-
168
- - **Start Interactive Chat Shell**
169
- ```bash
170
- janito
171
- ```
172
-
173
- ### Advanced Options
174
-
175
- - **Enable Execution Tools (Code/Shell Execution)**
176
-
177
- By default, **all tool privileges (read, write, execute)** are disabled for safety. This means Janito starts with no permissions to run tools that read, write, or execute code/shell commands unless you explicitly enable them.
178
-
179
- - To enable **read** tools (e.g., file reading, searching): add `-r` or `--read`
180
- - To enable **write** tools (e.g., file editing): add `-w` or `--write`
181
- - To enable **execution** tools (code/shell execution): add `-x` or `--exec`
182
-
183
- You can combine these flags as needed. For example, to enable both read and write tools:
184
-
185
- ```bash
186
- janito -r -w "Read and update this file: ..."
187
- ```
188
-
189
- To enable all permissions (read, write, execute):
190
-
191
- ```bash
192
- # Using individual flags
193
- janito -r -w -x "Run this code: print('Hello, world!')"
194
-
195
- # Using the convenient /rwx prefix (single-shot mode)
196
- janito /rwx "Run this code: print('Hello, world!')"
197
- ```
198
-
199
- #### One-Shot Mode
200
- For quick tasks without entering interactive mode, provide your prompt directly:
201
-
202
- ```bash
203
- # Basic one-shot
204
- janito "What are the key classes in this project?"
205
-
206
- # One-shot with all permissions enabled
207
- janito /rwx "Create a Python script and run it"
208
-
209
- # One-shot with specific permissions
210
- janito -r -w "Read this file and create a summary"
211
- ```
212
-
213
- > **Warning:** Enabling execution tools allows running arbitrary code or shell commands. Only use `--exec` if you trust your prompt and environment.
214
-
215
- - **Set a System Prompt**
216
- ```bash
217
- janito -s path/to/system_prompt.txt "Your prompt here"
218
- ```
219
-
220
- - **Select Model and Provider Temporarily**
221
- ```bash
222
- janito -p openai -m gpt-3.5-turbo "Your prompt here"
223
- janito -p google -m gemini-2.5-flash "Your prompt here"
224
- ```
225
-
226
-
227
-
228
- - **Enable Event Logging**
229
- ```bash
230
- janito -e "Your prompt here"
231
- ```
232
-
233
- ## 🌟 CLI Options Reference
234
-
235
- ### Core CLI Options
236
- | Option | Description |
237
- |------------------------|-----------------------------------------------------------------------------|
238
- | `--version` | Show program version |
239
- | `--list-tools` | List all registered tools |
240
- | `--list-providers` | List all supported LLM providers |
241
- | `-l`, `--list-models` | List models for current/selected provider |
242
- | `--set-api-key` | Set API key for a provider. **Requires** `-p PROVIDER` to specify the provider. |
243
- | `--set provider=name` | Set the current LLM provider (e.g., `janito --set provider=openai`) |
244
- | `--set PROVIDER.model=MODEL` or `--set model=MODEL` | Set the default model for the current/selected provider, or globally. (e.g., `janito --set openai.model=gpt-3.5-turbo`) |
245
- | `-s`, `--system` | Set a system prompt (e.g., `janito -s path/to/system_prompt.txt "Your prompt here"`) |
246
-
247
- | `-p`, `--provider` | Select LLM provider (overrides config) (e.g., `janito -p openai "Your prompt here"`) |
248
- | `-m`, `--model` | Select model for the provider (e.g., `janito -m gpt-3.5-turbo "Your prompt here"`) |
249
- | `-v`, `--verbose` | Print extra information before answering |
250
- | `-R`, `--raw` | Print raw JSON response from API |
251
- | `-e`, `--event-log` | Log events to console as they occur |
252
- | `prompt` | Prompt to submit for the non interactive mode (e.g. `janito "What is the capital of France?"`) |
253
-
254
- ### 🧩 Extended Chat Mode Commands
255
- Once inside the interactive chat mode, you can use these slash commands:
256
-
257
- #### 📲 Basic Interaction
258
- | Command | Description |
259
- |-------------------|----------------------------------------------|
260
- | `/exit` or `exit` | Exit chat mode |
261
- | `/help` | Show available commands |
262
- | `/multi` | Activate multiline input mode |
263
- | `/clear` | Clear the terminal screen |
264
- | `/history` | Show input history |
265
- | `/view` | Print current conversation history |
266
- | `/track` | Show tool usage history |
267
-
268
- #### 💬 Conversation Management
269
- | Command | Description |
270
- |---------------------|----------------------------------------------|
271
- | `/restart` | Start a new conversation (reset context) |
272
- | `/prompt` | Show the current system prompt |
273
- | `/role <description>` | Change the system role |
274
- | `/lang [code]` | Change interface language (e.g., `/lang en`) |
275
-
276
- #### 🛠️ Tool & Provider Interaction
277
- | Command | Description |
278
- |----------------------|----------------------------------------------|
279
- | `/tools` | List available tools |
280
- | `/-status` | Show status of server |
281
- | `/-logs` | Show last lines of logs |
282
- | `/write [on\|off]` | Enable or disable write tool permissions |
283
- | `/read [on\|off]` | Enable or disable read tool permissions |
284
- | `/execute [on\|off]` | Enable or disable execute tool permissions |
285
-
286
-
287
- #### 📊 Output Control
288
- | Command | Description |
289
- |---------------------|----------------------------------------------|
290
- | `/verbose` | Show current verbose mode status |
291
- | `/verbose [on\|off]` | Set verbose mode |
292
-
293
- ## Extending Janito
294
-
295
- Janito is built to be extensible. You can add new LLM providers or tools by implementing new modules in the `janito/providers` or `janito/tools` directories, respectively. See the source code and developer documentation for more details.
296
-
297
- ## Supported Providers
298
-
299
- - OpenAI
300
- - OpenAI over Azure
301
- - Google Gemini
302
- - DeepSeek
303
- - Anthropic
304
-
305
- See [docs/supported-providers-models.md](docs/supported-providers-models.md) for more details.
306
-
307
- ## Contributing
308
-
309
- Contributions are welcome! Please see the `CONTRIBUTING.md` (if available) or open an issue to get started.
310
-
311
- ---
312
-
313
- ## Developer Documentation
314
-
315
- For developer-specific setup, versioning, and contribution guidelines, see [README-dev.md](./README-dev.md).
316
-
317
- ## License
318
-
319
- This project is licensed under the terms of the MIT license.
320
-
321
- For more information, see the documentation in the `docs/` directory or run `janito --help`.
322
-
323
- ---
324
-
325
- # Support
326
-
327
-
328
- ## 📖 Detailed Documentation
329
-
330
- Full and up-to-date documentation is available at: https://ikignosis.github.io/janito/
331
-
332
- ---
333
-
334
-
335
- ## FAQ: Setting API Keys
336
-
337
- - [Multiple API_KEY setup](#faq-multiple-api-key)
338
- - [Use a specific model](#faq-use-specific-model)
339
- - [Fetch the available LLM providers](#faq-fetch-providers)
340
- - [Fetch the available models](#faq-fetch-models)
341
-
342
-
343
- <a id="faq-multiple-api-key"></a>
344
- ### Multiple API_KEY setup
345
-
346
- To set an API key for a provider, you **must** specify both the API key and the provider name:
347
-
348
- ```bash
349
- janito --set-api-key YOUR_API_KEY -p PROVIDER_NAME
350
- ```
351
-
352
- You can have an API_KEY for each LLM provider
353
-
354
- ```bash
355
- janito --set-api-key API_KEY_1 -p PROVIDER_1
356
- janito --set-api-key API_KEY_2 -p PROVIDER_2
357
- ```
358
-
359
- Then you can easily use one provider or the other without changing the API_KEY
360
-
361
- ```bash
362
- janito -p PROVIDER_1 "What provider do you use?"
363
- janito -p PROVIDER_2 "What provider do you use?"
364
- ```
365
-
366
- If you omit the `-p PROVIDER_NAME` argument, Janito will show an error and not set the key.
367
-
368
- <a id="faq-use-specific-model"></a>
369
- ### Use a specific model
370
-
371
- To use a specific model, you can use the `-m` option in the following way:
372
-
373
- ```bash
374
- janito -m gpt-4.1-nano -p openai "What model do you use?"
375
- ```
376
-
377
- Or you can use the durable `--set` option:
378
-
379
- ```bash
380
- janito --set provider=openai
381
- janito --set model=gpt-4.1-nano
382
- janito "What model do you use?"
383
- ```
384
-
385
- <a id="faq-fetch-providers"></a>
386
- ### Fetch the available LLM providers
387
-
388
- You can list all the LLM providers available using:
389
-
390
- ```bash
391
- janito --list-providers
392
- ```
393
-
394
- <a id="faq-fetch-models"></a>
395
- ### Fetch the available models
396
-
397
- Each LLM provider has its own models, the best way to check what are the available models is using the following commands:
398
-
399
- ```bash
400
- janito -p openai --list-models
401
- janito -p google --list-models
402
- janito -p azure_openai --list-models
403
- janito -p anthropic --list-models
404
- janito -p deepseek --list-models
405
- ```
406
-
407
-
408
- ## Ask Me Anything
409
-
410
- <div align="center">
411
- <a href="git@github.com:ikignosis/janito.git" title="Ask Me Anything">
412
- <img width="250" src="docs/imgs/ama.png" alt="Ask Me Anything">
413
- </a>
414
- </div
415
-
416
- When the FAQ are not enough, you can contact the contributors of the project by direct questions
417
-
418
- <p align="center">
419
- <kbd><a href="../../issues/new?labels=question">Ask a question</a></kbd> <kbd><a href="../../issues?q=is%3Aissue+is%3Aclosed+label%3Aquestion">Read questions</a></kbd>
420
- </p>
421
-
422
- #### Guidelines
423
-
424
- - :mag: Ensure your question hasn't already been answered.
425
- - :memo: Use a succinct title and description.
426
- - :bug: Bugs & feature requests should be opened on the relevant issue tracker.
427
- - :signal_strength: Support questions are better asked on Stack Overflow.
428
- - :blush: Be nice, civil and polite.
429
- - :heart_eyes: If you include at least one emoji in your question, the feedback will probably come faster.
430
- - [Read more AMAs](https://github.com/sindresorhus/amas)
431
- - [What's an AMA?](https://en.wikipedia.org/wiki/R/IAmA)
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.