python-fastllm 0.0.52__py3-none-any.whl → 0.0.53__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 CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  - `fastllm.responses`: Provider-independent Responses resources and streaming over FastLLM"""
4
4
 
5
- __version__ = "0.0.52"
5
+ __version__ = "0.0.53"
fastllm/responses.py CHANGED
@@ -374,7 +374,7 @@ async def events(self:AsyncResponses, turn, finalize=None, stream=None):
374
374
  comp.message,comp.usage = Msg('assistant', texts + comp.message.content),usage
375
375
  for event in state.done_events(comp): yield event
376
376
  response = response_object(first.id, first.body, comp, first.previous.id if first.previous else None, first.created_at)
377
- if finalize: await finalize(next_state, comp)
377
+ if finalize and (extra := await finalize(next_state, comp)): response['usage'].update(extra)
378
378
  name = 'response.incomplete' if response['status'] == 'incomplete' else 'response.completed'
379
379
  yield state.event(name, response=response)
380
380
  except asyncio.CancelledError: raise
fastllm/types.py CHANGED
@@ -365,6 +365,7 @@ def tier_rate(meta, key, tier):
365
365
  # %% ../nbs/00_types.ipynb #8bfca02d
366
366
  @patch(as_prop=True)
367
367
  def cost(self:Completion):
368
+ if self.usage and 'cost' in self.usage.raw: return self.usage.raw['cost']
368
369
  meta = dict2obj(get_model_info(self.model, self.vendor_name))
369
370
  if not meta: return 0.0 # unregistered model (e.g. a custom base_url server): no pricing metadata
370
371
  api = api_registry[self.api_name]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fastllm
3
- Version: 0.0.52
3
+ Version: 0.0.53
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,4 +1,4 @@
1
- fastllm/__init__.py,sha256=x183GVYCLqcykAxjvdPUj4Ey-Jrq-f2QLormAtnW6g0,131
1
+ fastllm/__init__.py,sha256=p94hx8eEtzJ2eou5yZY7R3C9ab8YAXbWNrFNQoK6S-s,131
2
2
  fastllm/_modidx.py,sha256=5WI8_unIttNYqjHBQBHf33C1OVgMgCcdO2SbdOk04Io,45637
3
3
  fastllm/acomplete.py,sha256=aP1ff9a7WKNhBd1kwKE2TJ-YyihLcdhd9-1Izi4wQP4,10772
4
4
  fastllm/anthropic.py,sha256=k0QeuRnl_CalfCq74WXN6llRQqRiAQ9d8ohn_0YYC7A,18386
@@ -7,11 +7,11 @@ fastllm/codex.py,sha256=r6auZ8egia83aGkWcF4132AzW4SsBvKeDwg_CxyXj9E,5808
7
7
  fastllm/gemini.py,sha256=zbxNmI1cMUJJ10xIfBqPqh38hAQ0exsFKkhTXvG2-eE,16281
8
8
  fastllm/openai_chat.py,sha256=n5INfDCsAZIiKUImWeaX6SJ_OAJ_uMhw20HUkgFgdgM,12379
9
9
  fastllm/openai_responses.py,sha256=zsaOjkQUZ-7iuGPc-UpvnM6oAyqW09BDYwZ_ma4-1Qo,14346
10
- fastllm/responses.py,sha256=6Vzb_wXlTky0OAYBi_gj3JoSUrrjBun94gyZIIUQMWY,21256
10
+ fastllm/responses.py,sha256=ASTWk_dghOfJozQAm6QAZ8VnkGFA-sBLGVeS60DfP3E,21303
11
11
  fastllm/streaming.py,sha256=i_FU_Mt-3F2lBEImYav8I5pEjUSKYk3JFIW3lkiXEb8,8813
12
- fastllm/types.py,sha256=BIZHwlzsbkZELjAib2oSFRab8gKBa216DNNeE_P68go,19525
13
- python_fastllm-0.0.52.dist-info/METADATA,sha256=k0b8YoDfjjePTzN2k51YQt6v-pwQ0VYd_K9p_m6xctk,18537
14
- python_fastllm-0.0.52.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
15
- python_fastllm-0.0.52.dist-info/entry_points.txt,sha256=WkWd04F3xVYFP5bsexaQe9Se6uelwE5ULoTtHWreO0s,133
16
- python_fastllm-0.0.52.dist-info/top_level.txt,sha256=F8qodL7nEGUHGmzzqfhNKCTIr1i0D6cvudOnm3z7o0Y,8
17
- python_fastllm-0.0.52.dist-info/RECORD,,
12
+ fastllm/types.py,sha256=q4rZHTD9sghHI8j5cNQRWmrQW_NO8zYa0KEibKGiSyI,19603
13
+ python_fastllm-0.0.53.dist-info/METADATA,sha256=5mJQJPAsu4tKE4Icowyjc1HaZCEE8xNRH7F1kUJVkKY,18537
14
+ python_fastllm-0.0.53.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
15
+ python_fastllm-0.0.53.dist-info/entry_points.txt,sha256=WkWd04F3xVYFP5bsexaQe9Se6uelwE5ULoTtHWreO0s,133
16
+ python_fastllm-0.0.53.dist-info/top_level.txt,sha256=F8qodL7nEGUHGmzzqfhNKCTIr1i0D6cvudOnm3z7o0Y,8
17
+ python_fastllm-0.0.53.dist-info/RECORD,,