A set of utility functions to handle LLM structural output
Project description
llmutil
This library provides tools to generate structured output from the OpenAI API.
What is Structured Output?
Structured Output is the recommended method for getting formatted responses. It guarantees that outputs follow your defined schema, making it more reliable than previous methods like JSON mode, function calls, or tool use.
How to Use
To use Structured Output, you need to define a schema. This library makes it easy with simple functions:
sysmsg = "You are a helpful assistant that can answer questions and help with tasks."
result = gen(
sysmsg,
"What is the capital of Japan?",
gen_schema(
answer=gen_str("Name of the capital"),
),
)
# {'answer': 'Tokyo'}
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
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 bfg_llmutil-0.4.0.tar.gz.
File metadata
- Download URL: bfg_llmutil-0.4.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f88da8dd7d3ef3626b169db0a98eeb6cee7593e9ab05f3101a7be5989cc8580
|
|
| MD5 |
cc4cbf180e07caa3645fc5998d671a4d
|
|
| BLAKE2b-256 |
37c3f83410f34654f47da6f251477538f6c57d3a53dd26fb25b8b0225b737e4c
|
File details
Details for the file bfg_llmutil-0.4.0-py3-none-any.whl.
File metadata
- Download URL: bfg_llmutil-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794c4724bf1b200560460e28abdc149f14ab5fd1d76aa936e07285d645f3a33d
|
|
| MD5 |
24a8efc29d7f6549a6d099a2c17a5ffd
|
|
| BLAKE2b-256 |
a82294a25d46fe22212444f47bac5284811c4ba3cfddb52a296beb831f5e96f0
|