tketool.llm
OpenAI-compatible large-model access, structured-output prompts, embeddings, memory, tools, and the current scheduler.
pip install tketool.llm
Chat Completions
import os
from tketool.llm import OpenAI_Complete_Model
llm = OpenAI_Complete_Model(
model_name="gpt-4o-mini",
apitoken=os.environ["OPENAI_API_KEY"],
base_url="https://api.openai.com/v1",
call_dict={"temperature": 0.2},
)
text = llm("用三句话解释向量检索", return_detail=False)
print(text)
Responses API
import os
from tketool.llm import OpenAI_Response_Model
llm = OpenAI_Response_Model(
model_name="gpt-5-mini",
apitoken=os.environ["OPENAI_API_KEY"],
base_url="https://api.openai.com/v1",
call_dict={"max_output_tokens": 300},
)
text, detail = llm("给出一个最小 RAG 流程", return_detail=True)
print(text)
print(detail)
Both transports accept a complete messages list and return the same detail
shape. OpenAI-compatible gateways are supported by changing base_url and
model_name.
messages = [
{"role": "system", "content": "回答要简洁。"},
{"role": "user", "content": "什么是结构化输出?"},
]
answer = llm("", return_detail=False, messages=messages)
New code should import from tketool.llm. The existing tketool.lmc path is
kept as a compatibility API during migration.
Local Hugging Face embeddings are optional:
pip install "tketool.llm[local-embeddings]"
The optional memory extra requires Python 3.11 or newer because its external
backend does. The legacy agent/context implementation was removed because
it depended on the retired scheduler; use scheduler2 for current agent flows.
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 tketool_llm-1.3.4.tar.gz.
File metadata
- Download URL: tketool_llm-1.3.4.tar.gz
- Upload date:
- Size: 106.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c43016c9aa131b7e0823cfcc0cc0b4d7895969463a17cb9157ee78fe4c9bc870
|
|
| MD5 |
e6a0bfa8ac6c595d87a4676e91292976
|
|
| BLAKE2b-256 |
62be8a83be7cd7273930cda651a7906b579918ba36b1660505061af1c68fcb6a
|
File details
Details for the file tketool_llm-1.3.4-py3-none-any.whl.
File metadata
- Download URL: tketool_llm-1.3.4-py3-none-any.whl
- Upload date:
- Size: 168.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
710d28ca292c32a1f0e7521a62f328a5016923e8abf672256499e31224826582
|
|
| MD5 |
18b67982a7aa97128aa128f1c4daf82f
|
|
| BLAKE2b-256 |
f6a4cfb52f62816ca028dc953e3d0c386792b3d19a4e6b7edfdd870216aa8319
|