python-fastllm 0.0.67__tar.gz → 0.0.69__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.
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/PKG-INFO +1 -1
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/__init__.py +1 -1
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/_modidx.py +2 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/responses.py +16 -7
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/types.py +10 -12
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/PKG-INFO +1 -1
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/README.md +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/acomplete.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/anthropic.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/chat.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/codex.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/gemini.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/model_prices.json +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/openai_chat.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/openai_responses.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/fastllm/streaming.py +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/pyproject.toml +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/SOURCES.txt +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/dependency_links.txt +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/entry_points.txt +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/requires.txt +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/top_level.txt +0 -0
- {python_fastllm-0.0.67 → python_fastllm-0.0.69}/setup.cfg +0 -0
|
@@ -274,6 +274,8 @@ d = { 'settings': { 'branch': 'main',
|
|
|
274
274
|
'fastllm/responses.py'),
|
|
275
275
|
'fastllm.responses.AsyncResponses.prepare': ( 'responses.html#asyncresponses.prepare',
|
|
276
276
|
'fastllm/responses.py'),
|
|
277
|
+
'fastllm.responses.AsyncResponses.provider_kwargs': ( 'responses.html#asyncresponses.provider_kwargs',
|
|
278
|
+
'fastllm/responses.py'),
|
|
277
279
|
'fastllm.responses.AsyncResponses.serve': ( 'responses.html#asyncresponses.serve',
|
|
278
280
|
'fastllm/responses.py'),
|
|
279
281
|
'fastllm.responses.AsyncResponses.server_results': ( 'responses.html#asyncresponses.server_results',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Provider-independent Responses resources and streaming over FastLLM
|
|
2
2
|
|
|
3
|
-
`response_input` accepts a prompt string or
|
|
3
|
+
`response_input` accepts a prompt string, Responses input items, or canonical `msg2dict` messages. It returns `(messages, instructions)`. System and developer text becomes instructions. Canonical messages preserve provider replay data.
|
|
4
4
|
|
|
5
5
|
`normalize_call_ids` supplies missing client call IDs before we retain the history. Later tool results can refer to the same IDs that the client received.
|
|
6
6
|
|
|
@@ -62,7 +62,10 @@ def response_input(inp):
|
|
|
62
62
|
pending_tools.clear()
|
|
63
63
|
for item in inp:
|
|
64
64
|
typ = item.get('type')
|
|
65
|
-
if
|
|
65
|
+
if 'raw_api' in item:
|
|
66
|
+
flush_tools()
|
|
67
|
+
msgs.append(dict2msg(item))
|
|
68
|
+
elif typ in ('message', 'easy_input_message') or 'role' in item:
|
|
66
69
|
flush_tools()
|
|
67
70
|
role = item.get('role', 'user')
|
|
68
71
|
if role in ('system', 'developer'): systems.append(_text_content(item.get('content', '')))
|
|
@@ -144,7 +147,7 @@ def response_usage(usage):
|
|
|
144
147
|
def _response_base(rid, body, previous_response_id=None, created_at=None):
|
|
145
148
|
result = dict(id=rid, object='response', created_at=int(created_at or time.time()), instructions=body.get('instructions'), model=body['model'])
|
|
146
149
|
result.update(parallel_tool_calls=body.get('parallel_tool_calls', True), previous_response_id=previous_response_id,
|
|
147
|
-
reasoning=body.get('reasoning'), store=True, prompt_cache_key=body.get('prompt_cache_key'), temperature=body.get('temperature'))
|
|
150
|
+
reasoning=body.get('reasoning'), store=body.get('store', True), prompt_cache_key=body.get('prompt_cache_key'), temperature=body.get('temperature'))
|
|
148
151
|
result.update(text=body.get('text', {'format':{'type':'text'}}), tool_choice=body.get('tool_choice', 'auto'),
|
|
149
152
|
tools=body.get('tools', []), top_p=body.get('top_p'), metadata=body.get('metadata', {}))
|
|
150
153
|
return result
|
|
@@ -243,16 +246,21 @@ class AsyncResponses:
|
|
|
243
246
|
|
|
244
247
|
# %% ../nbs/08_responses.ipynb #373f7d5e
|
|
245
248
|
@patch
|
|
246
|
-
|
|
247
|
-
"
|
|
249
|
+
def provider_kwargs(self:AsyncResponses, turn):
|
|
250
|
+
"Provider request options shared by calling and input inspection"
|
|
248
251
|
body = turn.body
|
|
249
252
|
reasoning = body.get('reasoning') or {}
|
|
250
253
|
tools = list(body.get('tools') or []) + [dict(type='function', **get_schema(f, pname='parameters')) for f in turn.server_tools.values()]
|
|
251
|
-
kwargs = dict(previous_response_id=turn.provider_previous_id, system=turn.system or None, tools=tools or None)
|
|
254
|
+
kwargs = dict(model=body['model'], previous_response_id=turn.provider_previous_id, system=turn.system or None, tools=tools or None)
|
|
252
255
|
kwargs.update(prompt_cache_key=body['prompt_cache_key'], tool_choice=body.get('tool_choice'), parallel_tool_calls=body.get('parallel_tool_calls', True),
|
|
253
256
|
reasoning_effort=reasoning.get('effort'), max_tokens=body.get('max_output_tokens'), temperature=body.get('temperature'),
|
|
254
257
|
cache_idxs=body.get('cache_idxs'), ttl=body.get('ttl'), web_search_options=body.get('web_search_options'))
|
|
255
|
-
|
|
258
|
+
return kwargs
|
|
259
|
+
|
|
260
|
+
@patch
|
|
261
|
+
async def call(self:AsyncResponses, turn):
|
|
262
|
+
"Start a provider stream, waiting for its first chunk before returning"
|
|
263
|
+
stream = await acomplete(turn.provider_messages, stream=True, **self.provider_kwargs(turn), **turn.call_kwargs)
|
|
256
264
|
first = await anext(stream)
|
|
257
265
|
async def _rest():
|
|
258
266
|
yield first
|
|
@@ -458,6 +466,7 @@ async def events(self:AsyncResponses, turn, finalize=None, stream=None):
|
|
|
458
466
|
comp.message,comp.usage = Msg('assistant', prior + _visible_parts(comp.message.content, results)),usage
|
|
459
467
|
for event in state.done_events(comp): yield event
|
|
460
468
|
response = response_object(first.id, first.body, comp, first.previous.id if first.previous else None, first.created_at)
|
|
469
|
+
response['messages'] = [msg2dict(m) for m in next_state.history[len(first.history):]]
|
|
461
470
|
if finalize and (extra := await finalize(next_state, comp)): response['usage'].update(extra)
|
|
462
471
|
name = 'response.incomplete' if response['status'] == 'incomplete' else 'response.completed'
|
|
463
472
|
yield state.event(name, response=response)
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
# %% auto #0
|
|
6
6
|
__all__ = ['FinishReason', 'api_registry', 'vendor_auth', 'vendor_hdrs', 'model_prices_url', 'sample_img_url', 'sample_doms',
|
|
7
7
|
'haik45', 'haik', 'haik55', 'sonn45', 'sonn46', 'sonn5', 'sonn', 'sonn55', 'opus46', 'opus48', 'opus5',
|
|
8
|
-
'opus', 'opus55', 'fable', 'claude_models', 'gpt55', 'codex53spark', 'sol', '
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
8
|
+
'opus', 'opus55', 'fable', 'claude_models', 'gpt55', 'codex53spark', 'sol', 'terra', 'luna', 'astra',
|
|
9
|
+
'gpt6s', 'flash', 'model_info_registry', 'modern_llm', 'effort_codes', 'mimo_v25_common', 'codex_pricing',
|
|
10
|
+
'Usage', 'APIRegistry', 'mk_completion', 'rebuild_parts', 'fn_schema', 'payload_kwargs', 'provider_req',
|
|
11
|
+
'get_api_key', 'wrap_typed', 'unwrap_typed', 'resize_b64', 'model_prices_meta', 'infer_api_name',
|
|
12
|
+
'get_model_meta', 'register_model_info', 'get_model_info', 'effort_code', 'effort_levels', 'resolve_effort',
|
|
13
|
+
'effort_kwargs', 'register_sub_model', 'find_models', 'get_model_pricing', 'approx_pricing',
|
|
14
|
+
'is_deepseek_peak_hour', 'price_tier', 'tier_rate']
|
|
15
15
|
|
|
16
16
|
# %% ../nbs/00_types.ipynb #b4d047fd
|
|
17
17
|
import httpx2, base64, io
|
|
@@ -220,12 +220,10 @@ opus48 = "claude-opus-4-8"
|
|
|
220
220
|
opus5 = "claude-opus-5"
|
|
221
221
|
opus = opus55 = "claude-opus-5-5"
|
|
222
222
|
fable = 'claude-fable-5-1'
|
|
223
|
-
claude_models =
|
|
223
|
+
claude_models = haik55, sonn55, opus55, fable
|
|
224
224
|
gpt55 = "gpt-5.5"
|
|
225
225
|
codex53spark = "gpt-5.3-codex-spark"
|
|
226
|
-
sol,luna,astra = gpt6s = 'gpt-6-sol gpt-6-luna gpt-6-astra'.split()
|
|
227
|
-
sol,terra = 'gpt-6.1-sol', 'gpt-6.1-terra'
|
|
228
|
-
gpt56s = 'gpt-5.6-sol', 'gpt-5.6-terra', 'gpt-5.6-luna'
|
|
226
|
+
sol,terra,luna,astra = gpt6s = 'gpt-6.1-sol gpt-6.1-terra gpt-6-luna gpt-6-astra'.split()
|
|
229
227
|
flash = 'models/gemini-3.8-flash'
|
|
230
228
|
|
|
231
229
|
# %% ../nbs/00_types.ipynb #583e017b
|
|
@@ -355,7 +353,7 @@ for model in claude_models: register_sub_model(model, 'claude_code', 'anthropic'
|
|
|
355
353
|
# %% ../nbs/00_types.ipynb #bb0c4c2a
|
|
356
354
|
# Codex serves only the suffixed names; bare `gpt-5.6` is rejected with a ChatGPT account.
|
|
357
355
|
# Its window accepts 371,331 input tokens and rejects 371,981 on all three GPT-5.6 models.
|
|
358
|
-
for model in
|
|
356
|
+
for model in gpt6s: register_sub_model(model, 'codex', 'openai', max_input_tokens=371_000)
|
|
359
357
|
|
|
360
358
|
# %% ../nbs/00_types.ipynb #004c0b30
|
|
361
359
|
def find_models(substr:str):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fastllm-0.0.67 → python_fastllm-0.0.69}/python_fastllm.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|