python-fastllm 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastllm/__init__.py +1 -1
- fastllm/chat.py +2 -14
- fastllm/types.py +29 -13
- {python_fastllm-0.0.1.dist-info → python_fastllm-0.0.3.dist-info}/METADATA +1 -1
- {python_fastllm-0.0.1.dist-info → python_fastllm-0.0.3.dist-info}/RECORD +8 -8
- {python_fastllm-0.0.1.dist-info → python_fastllm-0.0.3.dist-info}/WHEEL +0 -0
- {python_fastllm-0.0.1.dist-info → python_fastllm-0.0.3.dist-info}/entry_points.txt +0 -0
- {python_fastllm-0.0.1.dist-info → python_fastllm-0.0.3.dist-info}/top_level.txt +0 -0
fastllm/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.3"
|
fastllm/chat.py
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/07_chat.ipynb.
|
|
4
4
|
|
|
5
5
|
# %% auto #0
|
|
6
|
-
__all__ = ['
|
|
7
|
-
're_tools', 'token_dtls_tag', 're_token', 'effort', 'remove_cache_ckpts', 'contents', 'stop_reason',
|
|
6
|
+
__all__ = ['tool_dtls_tag', 're_tools', 'token_dtls_tag', 're_token', 'effort', 'remove_cache_ckpts', 'contents', 'stop_reason',
|
|
8
7
|
'mk_msg', 'split_tools', 'fmt2hist', 'mk_msgs', 'cite_footnote', 'postproc', 'lite_mk_func', 'ToolResponse',
|
|
9
8
|
'structured', 'StopResponse', 'FullResponse', 'search_count', 'UsageStats', 'AsyncChat', 'add_warning',
|
|
10
9
|
'astream_with_complete', 'mk_tr_details', 'mk_srv_tc_details', 'StreamFormatter', 'AsyncStreamFormatter',
|
|
@@ -21,19 +20,8 @@ from fastcore import imghdr
|
|
|
21
20
|
from fastcore.xml import Safe
|
|
22
21
|
from dataclasses import dataclass
|
|
23
22
|
|
|
23
|
+
from .types import *
|
|
24
24
|
from .acomplete import *
|
|
25
|
-
from .acomplete import Msg, Part, PartType, ToolCall, Completion, mk_tool_res_msg, get_model_info
|
|
26
|
-
|
|
27
|
-
# %% ../nbs/07_chat.ipynb #c4b8f12b
|
|
28
|
-
haik45 = "claude-haiku-4-5"
|
|
29
|
-
sonn45 = "claude-sonnet-4-5"
|
|
30
|
-
sonn = sonn46 = "claude-sonnet-4-6"
|
|
31
|
-
opus46 = "claude-opus-4-6"
|
|
32
|
-
opus = "claude-opus-4-7"
|
|
33
|
-
gpt54 = "gpt-5.4"
|
|
34
|
-
gpt54m = "gpt-5.4-mini"
|
|
35
|
-
codex54 = "gpt-5.4"
|
|
36
|
-
codex55 = "gpt-5.5"
|
|
37
25
|
|
|
38
26
|
# %% ../nbs/07_chat.ipynb #90f55ad4
|
|
39
27
|
def _bytes2content(data):
|
fastllm/types.py
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_types.ipynb.
|
|
4
4
|
|
|
5
5
|
# %% auto #0
|
|
6
|
-
__all__ = ['PartType', 'FinishReason', 'api_registry', 'model_prices_url', '
|
|
6
|
+
__all__ = ['PartType', 'FinishReason', 'api_registry', 'model_prices_url', 'haik45', 'sonn45', 'sonn', 'sonn46', 'opus46', 'opus',
|
|
7
|
+
'gpt54', 'gpt54m', 'codex54', 'codex55', 'codex53spark', 'codex_pricing', 'Part', 'Msg', 'ToolCall',
|
|
7
8
|
'display_list', 'Usage', 'Completion', 'APIRegistry', 'mk_completion', 'mk_tool_res_msg', 'fn_schema',
|
|
8
9
|
'sys_text', 'part_txt', 'data_url', 'url_mime', 'payload_kwargs', 'get_api_key', 'model_prices_meta',
|
|
9
10
|
'infer_api_name', 'get_model_meta', 'get_model_info']
|
|
@@ -151,7 +152,6 @@ class APIRegistry:
|
|
|
151
152
|
api_registry = APIRegistry()
|
|
152
153
|
|
|
153
154
|
# %% ../nbs/00_types.ipynb #d58a5f96
|
|
154
|
-
#COMMON
|
|
155
155
|
def mk_completion(resp, model, api_name, vendor_name):
|
|
156
156
|
"Normalize an api response into Completion."
|
|
157
157
|
api = api_registry.apis[api_name]
|
|
@@ -167,7 +167,6 @@ def mk_completion(resp, model, api_name, vendor_name):
|
|
|
167
167
|
raw=resp)
|
|
168
168
|
|
|
169
169
|
# %% ../nbs/00_types.ipynb #d5322db5
|
|
170
|
-
#COMMON
|
|
171
170
|
def mk_tool_res_msg(tool_calls:list[ToolCall], results:list[str|list]):
|
|
172
171
|
'A util to prepare parallel tool call with str or media list results'
|
|
173
172
|
parts = []
|
|
@@ -177,7 +176,6 @@ def mk_tool_res_msg(tool_calls:list[ToolCall], results:list[str|list]):
|
|
|
177
176
|
return Msg(role="tool", content=parts)
|
|
178
177
|
|
|
179
178
|
# %% ../nbs/00_types.ipynb #8a8e468b
|
|
180
|
-
#COMMON
|
|
181
179
|
def fn_schema(t):
|
|
182
180
|
"Extract (name, description, parameters) from any tool format."
|
|
183
181
|
if not isinstance(t, dict): return None
|
|
@@ -188,7 +186,6 @@ def fn_schema(t):
|
|
|
188
186
|
return None
|
|
189
187
|
|
|
190
188
|
# %% ../nbs/00_types.ipynb #d1d48d91
|
|
191
|
-
#COMMON
|
|
192
189
|
def sys_text(system):
|
|
193
190
|
"Extract text from system (str or Part)."
|
|
194
191
|
if system is None: return None
|
|
@@ -197,7 +194,6 @@ def sys_text(system):
|
|
|
197
194
|
def part_txt(p): return p.text if isinstance(p,Part) else p
|
|
198
195
|
|
|
199
196
|
# %% ../nbs/00_types.ipynb #dc2b75a0
|
|
200
|
-
#COMMON
|
|
201
197
|
_ext_mime = {
|
|
202
198
|
'.jpg':'image/jpeg', '.jpeg':'image/jpeg', '.png':'image/png', '.gif':'image/gif', '.webp':'image/webp',
|
|
203
199
|
'.pdf':'application/pdf',
|
|
@@ -250,7 +246,19 @@ def get_model_meta(model, vendor_name=None, tfm=noop):
|
|
|
250
246
|
elif vendor_name: key = f"{vendor_name}/{model}"
|
|
251
247
|
return dict2obj(tfm(mp.get(key), model, vendor_name))
|
|
252
248
|
|
|
253
|
-
# %% ../nbs/00_types.ipynb #
|
|
249
|
+
# %% ../nbs/00_types.ipynb #60607e23
|
|
250
|
+
haik45 = "claude-haiku-4-5"
|
|
251
|
+
sonn45 = "claude-sonnet-4-5"
|
|
252
|
+
sonn = sonn46 = "claude-sonnet-4-6"
|
|
253
|
+
opus46 = "claude-opus-4-6"
|
|
254
|
+
opus = "claude-opus-4-7"
|
|
255
|
+
gpt54 = "gpt-5.4"
|
|
256
|
+
gpt54m = "gpt-5.4-mini"
|
|
257
|
+
codex54 = "gpt-5.4"
|
|
258
|
+
codex55 = "gpt-5.5"
|
|
259
|
+
codex53spark = "gpt-5.3-codex-spark"
|
|
260
|
+
|
|
261
|
+
# %% ../nbs/00_types.ipynb #d6d5b98c
|
|
254
262
|
codex_pricing = {
|
|
255
263
|
"input_cost_per_token": 0.10 / 1_000_000,
|
|
256
264
|
"cache_creation_input_token_cost": 0.10 / 1_000_000,
|
|
@@ -258,23 +266,31 @@ codex_pricing = {
|
|
|
258
266
|
"output_cost_per_token": 0.50 / 1_000_000,
|
|
259
267
|
}
|
|
260
268
|
|
|
269
|
+
_codex_overrides = {
|
|
270
|
+
codex53spark: dict(
|
|
271
|
+
supports_vision=False, supports_image_input=False, supports_web_search=True,
|
|
272
|
+
max_tokens=128000, max_input_tokens=128000, max_output_tokens=128000)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
# %% ../nbs/00_types.ipynb #fbfdeb0a
|
|
261
276
|
def get_model_info(mn, vendor_name=None):
|
|
262
277
|
info = get_model_meta(mn, vendor_name)
|
|
263
278
|
# anthropic web search
|
|
264
|
-
if 'search_context_cost_per_query' in info:
|
|
265
|
-
|
|
266
|
-
# add reasoning to kimi
|
|
279
|
+
if 'search_context_cost_per_query' in info: info['supports_web_search'] = True
|
|
280
|
+
# kimi
|
|
267
281
|
if 'kimi' in mn:
|
|
268
282
|
if 'k2p6' in mn: info = get_model_meta(mn.replace('k2p6', 'k2p5'), vendor_name)
|
|
269
283
|
info['supports_reasoning'] = True
|
|
270
284
|
info['supports_vision'] = True
|
|
271
285
|
if vendor_name == 'moonshot': info['supports_assistant_prefill'] = True
|
|
272
|
-
#
|
|
286
|
+
# gpt web search
|
|
273
287
|
if mn in ("gpt-5.4", "gpt-5.4-mini"):
|
|
274
288
|
info['supports_web_search'] = True
|
|
275
289
|
info.pop('mode', None)
|
|
276
|
-
# codex
|
|
277
|
-
if vendor_name == 'codex':
|
|
290
|
+
# codex updates
|
|
291
|
+
if vendor_name == 'codex':
|
|
292
|
+
info = merge(info, codex_pricing)
|
|
293
|
+
info |= _codex_overrides.get(mn, {})
|
|
278
294
|
# deepseek v4
|
|
279
295
|
if vendor_name == 'deepseek' and mn in ("deepseek-v4-flash", "deepseek-v4-pro"):
|
|
280
296
|
info = dict(get_model_meta("deepseek/deepseek-v3.2"))
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
fastllm/__init__.py,sha256=
|
|
1
|
+
fastllm/__init__.py,sha256=4GZKi13lDTD25YBkGakhZyEQZWTER_OWQMNPoH_UM2c,22
|
|
2
2
|
fastllm/_modidx.py,sha256=cOOFPFjpzDYzGBO-4V2gHyxfP9PJKGhxRBzmZ3k4yqs,28453
|
|
3
3
|
fastllm/acomplete.py,sha256=Wl_MdtNe2CuTrmVGPDj5f5pOEnA-ToZqRpPKOHN0J2Q,6764
|
|
4
4
|
fastllm/anthropic.py,sha256=fG20kOv3d3wGKQe8rD5pFWgZHKe-vT-9QJ3nPXh2twY,14615
|
|
5
|
-
fastllm/chat.py,sha256=
|
|
5
|
+
fastllm/chat.py,sha256=RV85NJ9vbmLQ0nU4jsBnjTYNvIYBr1FoPqUtK-HDroc,28941
|
|
6
6
|
fastllm/gemini.py,sha256=E1EYMfV8IMpC_-WzlDrkhz_CJQmzmxvaVUucNgPOqSA,14947
|
|
7
7
|
fastllm/openai_chat.py,sha256=wZ0HI0m9ipy9XVhqmYBXf-BmkVAOipUVwqu9NGB_rJU,10941
|
|
8
8
|
fastllm/openai_responses.py,sha256=Nk5bfTCF2-a17nwvIsf-u39j539v9KIduVfScECItKk,13052
|
|
9
9
|
fastllm/streaming.py,sha256=Ey0ufSYgJREvagMuHuTKBsxMxyS0S_StGuef8taY5PY,7235
|
|
10
|
-
fastllm/types.py,sha256=
|
|
10
|
+
fastllm/types.py,sha256=5jdE1L4Rj2FclCIx_XiuiLn_aY3wcEp2pPcC9TbZaag,12129
|
|
11
11
|
fastllm/specs/anthropic.json,sha256=VCgTjM2_HoDpCkeu3q_TCOEZLMHriJZLAG3LnDBAgGM,541035
|
|
12
12
|
fastllm/specs/anthropic.yml,sha256=3S3NAKdXB1Nwp-Sn9Gmh4tBnwhGGhMO3DXkGqPXPUYs,724122
|
|
13
13
|
fastllm/specs/gemini.json,sha256=zJGOdvZ2BvCiTENZt0-BDEvNBMl8h6EBmEskle_WBto,309331
|
|
14
14
|
fastllm/specs/openai.with-code-samples.json,sha256=Kto19AW1u8MfxVDJ4cFVBIdZQOIyy8NWylswo57eABU,1995929
|
|
15
15
|
fastllm/specs/openai.with-code-samples.yml,sha256=DlcWGdaeP4k7smVjt6UbyehJ-2XGU3rn3nCIBMDRfYU,2553630
|
|
16
16
|
fastllm/specs/spec_manifest.json,sha256=9tVFwojXFnNqsAxQzCRTP1lgSIM0fXixnrXdv4Cmb0c,653
|
|
17
|
-
python_fastllm-0.0.
|
|
18
|
-
python_fastllm-0.0.
|
|
19
|
-
python_fastllm-0.0.
|
|
20
|
-
python_fastllm-0.0.
|
|
21
|
-
python_fastllm-0.0.
|
|
17
|
+
python_fastllm-0.0.3.dist-info/METADATA,sha256=LbVdgthLdWt6iBGtLIM88jV_3chcYtTLxLpm4QzP-MI,19546
|
|
18
|
+
python_fastllm-0.0.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
19
|
+
python_fastllm-0.0.3.dist-info/entry_points.txt,sha256=dq0chsiRjJYStCOXweFW9L6LpyMTjWu2AabKCbTSbuI,36
|
|
20
|
+
python_fastllm-0.0.3.dist-info/top_level.txt,sha256=F8qodL7nEGUHGmzzqfhNKCTIr1i0D6cvudOnm3z7o0Y,8
|
|
21
|
+
python_fastllm-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|