llm-toolforge
用于大模型工具调用的框架,同时提供 HTTP API(同步、流式、异步)和MCP Server两种接入方式。
安装
任选一种方式安装:
从 PyPI 安装(推荐)
pip install llm-toolforge
从源码安装(开发)
pip install -e .
验证
toolforge --help
使用
从零开始
- 创建项目
toolforge new project my-app # 创建 ./my-app/ 并生成项目初始文件
# 或者
toolforge new project . # 在当前目录初始化项目(目录已存在时使用)
- 创建工具
toolforge new tool <name>
默认工具代码是获取当前时间,可以根据示例代码进行修改。详细说明见工具开发指南
-
编辑配置文件 配置文件位于项目根目录下的
config.yaml,默认配置即可运行。各字段含义见文件内注释。 -
启动 在项目根目录执行,可以在页面
http://localhost:12345进行测试。
toolforge run
使用示例工程
- 安装环境
cd examples
pip install -r requirements.txt
-
编辑
config.yaml,按注释填写配置 -
运行
toolforge run
打开页面http://localhost:12345进行测试。
部署
toolforge new project 会在项目目录下生成 Dockerfile
docker build -t llm-toolforge-example:v0.1.0 .
docker run --rm \
-v "$(pwd)/config.yaml:/app/config.yaml" \
-e SERVICE_NAME=llm-toolforge-example \
-p 12345:12345 \
-p 12346:12346 \
llm-toolforge-example:v0.1.0
运行自动化测试
参与框架开发时,先在项目根目录安装源码及测试依赖:
python -m pip install -e ".[test]"
以后每次修改代码后,在项目根目录运行:
python -m pytest
环境变量
少量字段可由环境变量覆盖(优先级高于 config.yaml):
| 变量 | 覆盖字段 |
|---|---|
SERVICE_NAME |
service.name |
SERVICE_VERSION |
service.version |
K8s 多实例部署时推荐通过 Deployment 注入 SERVICE_NAME,避免镜像里写死。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file llm_toolforge-0.6.3.tar.gz.
File metadata
- Download URL: llm_toolforge-0.6.3.tar.gz
- Upload date:
- Size: 6.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
114a8f6256c0f7b643295811250ae680f80c82839650d988b43ec11910ab4680
|
|
| MD5 |
5b6df2a1c4f44c7c0b2127165d2f14e5
|
|
| BLAKE2b-256 |
5d7216ca4c2df3781bc491211a9c5d5ffada658b98c43f7b81f141c3966ca881
|
File details
Details for the file llm_toolforge-0.6.3-py3-none-any.whl.
File metadata
- Download URL: llm_toolforge-0.6.3-py3-none-any.whl
- Upload date:
- Size: 6.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
500ab2ef5202502a7ef99ed6d1d1a5034e20a9f3099c813b3e9828d0d8081885
|
|
| MD5 |
968971f476f939fe56af381d3c0e613d
|
|
| BLAKE2b-256 |
c146c5edb486119b7152bc3a11e458dff1e9824f2d70be1b619574ddf7347552
|