Chinf
API calls to Cheap Inference without dependencies.
pip install chinf
Then:
# Python
from yaml import safe_load as yl
from chinf.chat import chat_complete as cc
kwargs = """ # this is a string in YAML format
max_tokens: 32000
stop_sequences:
- STOP
- "\nTitle"
temperature: 1.0
top_k: 10
top_p: 0.5
reasoning_effort: high
"""
instruction = 'You are a helpful assistant. Do not use markdown or lists in your responses.'
weather_tool = """ # YAML definition of a function (old format)
type: function
function:
name: get_weather
description: Determine weather in a location
parameters:
type: object
properties:
location:
type: string
description: The city and state, e.g. San Francisco, CA
additionalProperties: false
required:
- location
"""
tools = [yl(weather_tool)]
msgs = [{'role': 'user', 'content': 'What is the weather in Chicago, IL and Paris, France?'}]
thoughts, text = cc(
messages=msgs,
instructions=instruction,
tools=tools,
**yl(kwargs)
)
or
from yaml import safe_load as yl
from chinf.messages import message
kwargs = """ # this is a string in YAML format
max_tokens: 32000
stop_sequences:
- STOP
- "\nTitle"
temperature: 1.0
top_k: 10
top_p: 0.5
thinking:
type: enabled
budget_tokens: 24576
display: summarized
tool_choice:
type: auto
disable_parallel_tool_use: false
"""
instruction = 'You are a helpful assistant. Do not use markdown or lists in your responses.'
get_weather_tool_str = """ # YAML definition of a function
name: get_weather
description: Determine weather in a location
input_schema:
type: object
properties:
location:
type: string
description: The city and state, e.g. San Francisco, CA
additionalProperties: true
required:
- location
"""
tools = [yl(get_weather_tool_str)]
msg = [{'role': 'user', 'content': 'What is the weather in Chicago, IL and Paris, France?'}]
thoughts, text = message(
messages=msg,
instructions=instruction,
tools=tools,
**yl(kwargs)
)
or
from yaml import safe_load as yl
from chinf.responses import respond
kwargs = """ # this is a string in YAML format
max_tokens: 64000
temperature: 1.0
"""
msgs = [{'role': 'user', 'content': 'What is the weather in Chicago, IL and Paris, France?'}]
weather_tool = """ # YAML definition of a function (new format)
type: function
name: get_weather
description: Determine weather in a location
parameters:
type: object
properties:
location:
type: string
description: The city and state, e.g. San Francisco, CA
additionalProperties: false
required:
- location
"""
tools = [yl(weather_tool)]
instructions = """
You are a helpful assistant.
Rubric: respond in plain text without any markdown, emphasis or lists;
all paragraphs except the first one should begin with a newline and a tab.
"""
thougts, text = respond(
messages=msgs,
instructions=instructions,
tools=tools,
**yl(kwargs)
)
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 chinf-0.0.7.tar.gz.
File metadata
- Download URL: chinf-0.0.7.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e561b2fcc7ce4090be98eb00e4ccd9175ae76fc9dab30f688e2e9fd931eccbdb
|
|
| MD5 |
535610b277696d840800dd8fdcc84d83
|
|
| BLAKE2b-256 |
8187b56f6da519262fa20a0a84f7fdf1e7f49f7cfbf559323052060e33dfc99d
|
Provenance
The following attestation bundles were made for chinf-0.0.7.tar.gz:
Publisher:
python-publish.yml on alxfed/chinf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chinf-0.0.7.tar.gz -
Subject digest:
e561b2fcc7ce4090be98eb00e4ccd9175ae76fc9dab30f688e2e9fd931eccbdb - Sigstore transparency entry: 2664393569
- Sigstore integration time:
-
Permalink:
alxfed/chinf@46fb833f2970712c5c1f8181c5bc015e374f39b0 -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/alxfed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@46fb833f2970712c5c1f8181c5bc015e374f39b0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file chinf-0.0.7-py3-none-any.whl.
File metadata
- Download URL: chinf-0.0.7-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d44a26ce5ecee8ed50c0726e14237c3c924e94bbe2f169584d05c54c07899947
|
|
| MD5 |
5b2555717d95ec85bd79818b2d81e601
|
|
| BLAKE2b-256 |
c3b170f95ec3bd4dc596fa43eed56d97f731f452fb700267310716867451475a
|
Provenance
The following attestation bundles were made for chinf-0.0.7-py3-none-any.whl:
Publisher:
python-publish.yml on alxfed/chinf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chinf-0.0.7-py3-none-any.whl -
Subject digest:
d44a26ce5ecee8ed50c0726e14237c3c924e94bbe2f169584d05c54c07899947 - Sigstore transparency entry: 2664393596
- Sigstore integration time:
-
Permalink:
alxfed/chinf@46fb833f2970712c5c1f8181c5bc015e374f39b0 -
Branch / Tag:
refs/tags/0.0.7 - Owner: https://github.com/alxfed
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@46fb833f2970712c5c1f8181c5bc015e374f39b0 -
Trigger Event:
release
-
Statement type: