python-fastllm 0.0.1__tar.gz → 0.0.3__tar.gz

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.
Files changed (27) hide show
  1. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/PKG-INFO +1 -1
  2. python_fastllm-0.0.3/fastllm/__init__.py +1 -0
  3. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/chat.py +2 -14
  4. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/types.py +29 -13
  5. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/pyproject.toml +3 -1
  6. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/PKG-INFO +1 -1
  7. python_fastllm-0.0.1/fastllm/__init__.py +0 -1
  8. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/README.md +0 -0
  9. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/_modidx.py +0 -0
  10. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/acomplete.py +0 -0
  11. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/anthropic.py +0 -0
  12. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/gemini.py +0 -0
  13. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/openai_chat.py +0 -0
  14. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/openai_responses.py +0 -0
  15. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/anthropic.json +0 -0
  16. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/anthropic.yml +0 -0
  17. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/gemini.json +0 -0
  18. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/openai.with-code-samples.json +0 -0
  19. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/openai.with-code-samples.yml +0 -0
  20. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/specs/spec_manifest.json +0 -0
  21. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/fastllm/streaming.py +0 -0
  22. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/SOURCES.txt +0 -0
  23. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/dependency_links.txt +0 -0
  24. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/entry_points.txt +0 -0
  25. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/requires.txt +0 -0
  26. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/python_fastllm.egg-info/top_level.txt +0 -0
  27. {python_fastllm-0.0.1 → python_fastllm-0.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fastllm
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Author-email: Kerem Turgutlu <keremturgutlu@gmail.com>
5
5
  License: Apache-2.0
6
6
  Project-URL: Repository, https://github.com/AnswerDotAI/fastllm
@@ -0,0 +1 @@
1
+ __version__ = "0.0.3"
@@ -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__ = ['haik45', 'sonn45', 'sonn', 'sonn46', 'opus46', 'opus', 'gpt54', 'gpt54m', 'codex54', 'codex55', 'tool_dtls_tag',
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):
@@ -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', 'codex_pricing', 'Part', 'Msg', 'ToolCall',
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 #fbfdeb0a
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
- info['supports_web_search'] = True
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
- # add web search to gpt
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 pricing
277
- if vendor_name == 'codex': info = merge(info, codex_pricing)
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"))
@@ -27,7 +27,7 @@ fastllm = "fastllm._modidx:d"
27
27
  version = {attr = "fastllm.__version__"}
28
28
 
29
29
  [tool.setuptools.packages.find]
30
- include = ["fastllm"]
30
+ include = ["fastllm*"]
31
31
 
32
32
  [tool.setuptools.package-data]
33
33
  fastllm = ["specs/*.yml", "specs/*.json"]
@@ -35,3 +35,5 @@ fastllm = ["specs/*.yml", "specs/*.json"]
35
35
  [tool.nbdev]
36
36
  allowed_metadata_keys = ['solveit']
37
37
  allowed_cell_metadata_keys = ['solveit_ai']
38
+ custom_sidebar = false
39
+ lib_path = "fastllm"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fastllm
3
- Version: 0.0.1
3
+ Version: 0.0.3
4
4
  Author-email: Kerem Turgutlu <keremturgutlu@gmail.com>
5
5
  License: Apache-2.0
6
6
  Project-URL: Repository, https://github.com/AnswerDotAI/fastllm
@@ -1 +0,0 @@
1
- __version__ = "0.0.1"
File without changes
File without changes