Skip to content

Commit 2a4f64a

Browse files
Merge pull request #39 from renan-siqueira/develop
Develop -> main
2 parents 0466ed6 + a74938f commit 2a4f64a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+993
-431
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
All notable changes to this project will be documented in this file.
44
___
55

6+
## [0.6.0] - 2025-04-05
7+
8+
### Added
9+
- Introduced a fully modular architecture under `src/rsazure_openai_toolkit/`, with well-defined packages: `core/`, `cli/`, `env/`, `model_config/`, `models/`, `session/`, `samples/`, `utils/`
10+
- Created `ChatCLI` and `ToolsCLI` classes to encapsulate the logic of `rschat` and `rschat-tools` commands
11+
- Added `ModelConfig` class and enhanced `get_model_config()` function for flexible, reproducible model parameter configuration
12+
- Introduced `ContextInfo` and `ChatResult` as structured output representations in the `models/` module
13+
- Session manager now supports full history via `.full.jsonl`, backup of metadata, and safe system prompt/config overrides
14+
15+
### Changed
16+
- Refactored all CLI logic into object-oriented classes (`cli.py`, `tools.py`)
17+
- Centralized helper functions in a single `utils/` module
18+
- Renamed sample templates to a clearer format (`chat_loop_usage.py.j2`, etc.)
19+
- Updated `pyproject.toml` to reflect new package structure and layout
20+
- Improved CLI feedback: now prints context load info, system prompt in use, token usage, and fallback logging status
21+
- Bumped version to 0.6.0
22+
23+
### Removed
24+
- Removed deprecated and fragmented files: `handler.py`, `integration.py`, `token_utils.py`, `model_config_utils.py`
25+
___
26+
627
## [0.5.2] - 2025-04-03
728

829
### Fixed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,17 @@
5353
</a>
5454
</h1>
5555

56-
A fast, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture.
56+
A fast, modular, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture.
57+
___
58+
59+
## 🚀 What's New in v0.6.0
60+
61+
- Fully modular codebase with dedicated folders for each responsibility
62+
- Object-oriented CLI (`rschat`, `rschat-tools`) for better maintainability
63+
- Persistent session context with full/trimmed history and safety validation
64+
- Unified `utils/` module and improved logging/debug output
65+
66+
> Check the full [CHANGELOG](https://github.com/renan-siqueira/rsazure-openai-toolkit/blob/main/CHANGELOG.md) for details.
5767
___
5868

5969
## 📖 Documentation

RELEASING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ git push origin v<new_version>
6969

7070
## 📦 5. Build Distributable Packages
7171
```bash
72+
find . -type d -name "__pycache__" -exec rm -r {} +
7273
rm -rf dist/
7374
python -m build
7475
```

SECURITY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,23 @@ This toolkit supports optional **context persistence** via `SessionContext`, whi
4949
- Includes message history, system prompt, and model configuration
5050
- All context storage is **opt-in**, triggered via environment variables
5151
- Full history is saved to a separate `.full.jsonl` file, even if context is trimmed
52+
- Metadata changes (e.g., prompt overrides) are automatically backed up with timestamped `.bak` files
5253

5354
> ⚠️ Use with care on shared machines. Avoid using sensitive data in prompts or responses if local storage is enabled.
5455
___
5556

57+
## 🔐 Security-minded Architecture
58+
59+
The modular design of this toolkit (since v0.6.0) reinforces its commitment to safe, auditable, and professional AI integration:
60+
61+
- No shared state or global mutability across modules
62+
- Clear separation of concerns (e.g., `env`, `logging`, `model_config`, `session`)
63+
- CLI and utility components validate inputs explicitly and fail gracefully
64+
- Configuration and history are saved locally with full user control
65+
66+
You are always in charge of what gets stored, when, and how.
67+
___
68+
5669
## 📣 Reporting a Vulnerability
5770

5871
If you discover a potential security issue in this project, please **report it responsibly**:

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ___
3030
If you call `get_model_config()` with no arguments, you get:
3131

3232
```python
33-
from rsazure_openai_toolkit.utils.model_config_utils import get_model_config
33+
from rsazure_openai_toolkit.utils import get_model_config
3434

3535
model_config = get_model_config()
3636

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "rsazure-openai-toolkit"
7-
version = "0.5.2"
8-
description = "A fast, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture."
7+
version = "0.6.0"
8+
description = "A fast, modular, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture."
99
authors = [{ name = "Renan Siqueira Antonio", email = "[email protected]" }]
1010
readme = { file = "README.md", content-type = "text/markdown" }
1111
requires-python = ">=3.9"
@@ -37,7 +37,7 @@ classifiers = [
3737

3838
[project.scripts]
3939
rschat = "rsazure_openai_toolkit.cli:cli"
40-
rschat-tools = "rsazure_openai_toolkit.tools_cli:main"
40+
rschat-tools = "rsazure_openai_toolkit.cli.tools:main"
4141

4242
[project.urls]
4343
"Homepage" = "https://github.com/renan-siqueira/rsazure-openai-toolkit"

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/rsazure_openai_toolkit/__init__.py

Lines changed: 87 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,97 @@
22
rsazure_openai_toolkit
33
44
A fast, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture.
5+
6+
Top-level exports available when importing as `import rsazure_openai_toolkit as rschat`:
7+
8+
# Core interaction
9+
- rschat.main(...)
10+
- rschat.generate_response(...)
11+
12+
# Configuration & utility
13+
- rschat.get_model_config(...)
14+
- rschat.ModelConfig(...)
15+
- rschat.estimate_input_tokens(...)
16+
- rschat.load_env()
17+
- rschat.get_cli_config()
18+
19+
# Session context
20+
- rschat.SessionContext(...)
21+
- rschat.get_context_messages(...)
22+
23+
# Logging
24+
- rschat.InteractionLogger(...)
25+
- rschat.get_logger(...)
26+
27+
# CLI Entrypoints
28+
- rschat.cli(...)
29+
- rschat.main_cli_tools(...)
30+
31+
# Results and metadata
32+
- rschat.ChatResult(...)
33+
- rschat.ContextInfo(...)
534
"""
635

7-
__version__ = "0.5.2"
36+
__version__ = "0.6.0"
37+
__description__ = "A fast, modular, secure, and auditable toolkit to integrate with Azure OpenAI — with a friendly CLI and dev-first architecture."
38+
__author__ = "Renan Siqueira Antonio"
39+
__license__ = "MIT"
40+
__status__ = "Beta"
41+
__url__ = "https://github.com/renan-siqueira/rsazure-openai-toolkit"
42+
__docs__ = "https://github.com/renan-siqueira/rsazure-openai-toolkit/tree/main/docs"
43+
__security_policy_url__ = "https://github.com/renan-siqueira/rsazure-openai-toolkit/security/policy"
44+
45+
46+
# Core interaction
47+
from .core import main, generate_response
48+
49+
# Utility
50+
from .utils import estimate_input_tokens
51+
52+
# Environment
53+
from .env import load_env, get_cli_config
54+
55+
# Model configuration
56+
from .model_config import get_model_config, ModelConfig
57+
58+
# Session management
59+
from .session import SessionContext, get_context_messages
60+
61+
# Logging
62+
from .logging import InteractionLogger, get_logger
63+
64+
# CLI entrypoints
65+
from .cli import cli, tools_main
66+
67+
# Result models
68+
from .models import ChatResult, ContextInfo
869

9-
from .handler import call_azure_openai_handler
10-
from .integration import generate_response, load_azure_client
1170

1271
__all__ = [
13-
"call_azure_openai_handler",
72+
# Core OpenAI interaction
73+
"main",
1474
"generate_response",
15-
"load_azure_client",
75+
76+
# Config & utils
77+
"get_model_config",
78+
"ModelConfig",
79+
"estimate_input_tokens",
80+
"load_env",
81+
"get_cli_config",
82+
83+
# Context management
84+
"SessionContext",
85+
"get_context_messages",
86+
87+
# Logging
88+
"InteractionLogger",
89+
"get_logger",
90+
91+
# CLI entrypoints
92+
"cli",
93+
"tools_main",
94+
95+
# Result and metadata representations
96+
"ChatResult",
97+
"ContextInfo",
1698
]

src/rsazure_openai_toolkit/cli.py

Lines changed: 0 additions & 159 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
CLI utilities for running and extending rschat functionality.
3+
4+
Modules:
5+
- cli: Main CLI entrypoint used in the command-line interface.
6+
- tools: Developer-oriented tools such as sample generation.
7+
"""
8+
9+
from .cli import cli
10+
from .tools import main as tools_main
11+
12+
13+
__all__ = [
14+
"cli",
15+
"tools_main"
16+
]

0 commit comments

Comments
 (0)