NVIDIA AI Coding Agent - OpenCode-like CLI tool with NVIDIA NIM
Project description
Code5 - NVIDIA AI Coding Agent
一個類似 OpenCode 的開源 AI Coding Agent,使用 NVIDIA NIM 服務作為 LLM 後端。
功能特色
- AI 對話式編碼輔助 - 使用自然語言與 AI 互動
- Shell 命令執行 - 自動執行 shell 命令
- 安全審查 - 防止執行危險命令
- 對話記憶 - 滾動歷史 + 關鍵資訊提取
- 多 Session 支援 - 支援多個獨立對話
- Mock 模式 - 測試無需呼叫真實 LLM
安裝
pip install code5
或開發模式:
pip install -e ".[dev]"
快速開始
使用 Mock 模式(測試用)
from code5 import Code5Agent, MockClient
agent = Code5Agent(client=MockClient())
result = await agent.run("Hello!")
使用 NVIDIA NIM
from code5 import Code5Agent, Config
from code5.client import NVIDIAClient
config = Config(api_key="nvapi-xxx")
agent = Code5Agent(client=NVIDIAClient(config))
result = await agent.run("Help me write a function")
CLI 使用
# 互動模式
code5
# 單次執行
code5 "幫我寫一個 hello.py"
# 使用 mock
code5 --use-mock "Hello"
設定
透過環境變數:
NVIDIA_API_KEY- NVIDIA NIM API keyNVIDIA_MODEL- 模型名稱(預設:minimaxai/minimax-m2.7)NVIDIA_BASE_URL- API 端點CODE5_USE_MOCK- 設為true使用 mock 模式
測試
./test.sh
專案結構
code5/
├── src/code5/
│ ├── __init__.py # 套件導出
│ ├── agent.py # 主要 Agent 類別
│ ├── client.py # LLM 客戶端
│ ├── config.py # 設定管理
│ ├── memory.py # 記憶體管理
│ ├── prompts.py # System prompts
│ ├── reviewer.py # 安全審查
│ ├── session.py # Session 管理
│ ├── tools.py # 工具執行
│ └── __main__.py # CLI 入口
└── tests/ # 測試檔案
授權
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
code5-0.7.0.tar.gz
(35.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
code5-0.7.0-py3-none-any.whl
(28.4 kB
view details)
File details
Details for the file code5-0.7.0.tar.gz.
File metadata
- Download URL: code5-0.7.0.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
818ab6e6810eb78e23c3ac164ce298d3ffc44ce086791f99e5d147070e20caa3
|
|
| MD5 |
e139a65f11ff325e115c97edaff9905d
|
|
| BLAKE2b-256 |
468b7fbdc9afa89544da48e1459a46b7a8384381c3dbfe65c261a1e51c5da1c7
|
File details
Details for the file code5-0.7.0-py3-none-any.whl.
File metadata
- Download URL: code5-0.7.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bedfc2e652495e7e90b6724c009145ca8a2d829fe7b41d38eb66b44637f6c11
|
|
| MD5 |
494906492808eca1b0d7e8549ed21bf3
|
|
| BLAKE2b-256 |
ee3497ddd94b4aab1c8df19cceabde60c8390c2d8be823d164467cc9217d6694
|