python-fastllm 0.0.4__py3-none-any.whl → 0.0.5__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/acomplete.py +1 -1
- fastllm/chat.py +1 -1
- fastllm/types.py +5 -2
- {python_fastllm-0.0.4.dist-info → python_fastllm-0.0.5.dist-info}/METADATA +1 -1
- {python_fastllm-0.0.4.dist-info → python_fastllm-0.0.5.dist-info}/RECORD +9 -9
- {python_fastllm-0.0.4.dist-info → python_fastllm-0.0.5.dist-info}/WHEEL +0 -0
- {python_fastllm-0.0.4.dist-info → python_fastllm-0.0.5.dist-info}/entry_points.txt +0 -0
- {python_fastllm-0.0.4.dist-info → python_fastllm-0.0.5.dist-info}/top_level.txt +0 -0
fastllm/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.5"
|
fastllm/acomplete.py
CHANGED
|
@@ -62,7 +62,7 @@ def mk_client(model, vendor_name=None, api_name=None, api_key=None, base_url=Non
|
|
|
62
62
|
if auth_fn.exists(): api_key = nested_idx(json.loads(auth_fn.read_text()), *keys)
|
|
63
63
|
api_key = get_api_key(api_key, env_api_nm)
|
|
64
64
|
except KeyError: raise ValueError(f"Unknown vendor '{vendor_name}', {err_msg}")
|
|
65
|
-
elif
|
|
65
|
+
elif base_url and api_key: vendor_name, api_name = ifnone(vendor_name, 'custom'), ifnone(api_name, 'openai_chat')
|
|
66
66
|
elif (api_name:=infer_api_name(model)): base_url, vendor_name = None, api_name
|
|
67
67
|
else: raise ValueError(f"Model {model} can't be auto resolved, {err_msg}")
|
|
68
68
|
api = api_registry.apis[api_name]
|
fastllm/chat.py
CHANGED
|
@@ -476,7 +476,7 @@ def _think_kw(model, think, vendor_name):
|
|
|
476
476
|
def _prep_call(self:AsyncChat, prefill, search, max_tokens, kwargs, stream=False, think=None):
|
|
477
477
|
"Prepare model info, prefill, search, and provider kwargs for a completion call"
|
|
478
478
|
model_info = get_model_info(self.model, self.vendor_name)
|
|
479
|
-
if max_tokens is None: max_tokens = model_info.get('max_output_tokens')
|
|
479
|
+
if max_tokens is None: max_tokens = ifnone(model_info.get('max_output_tokens'), 32_000)
|
|
480
480
|
if not model_info.get("supports_assistant_prefill"): prefill = None
|
|
481
481
|
if _has_search(model_info) and (s:=ifnone(search,self.search)):
|
|
482
482
|
if 'web_search_options' not in kwargs: kwargs['web_search_options'] = {}
|
fastllm/types.py
CHANGED
|
@@ -240,7 +240,7 @@ def infer_api_name(model):
|
|
|
240
240
|
def get_model_meta(model, vendor_name=None, tfm=noop):
|
|
241
241
|
"Look up cost metadata for `model` from litellm price map, using `vendor_name` prefix if needed."
|
|
242
242
|
vendor_name = ifnone(vendor_name, infer_api_name(model))
|
|
243
|
-
mp = model_prices_meta()
|
|
243
|
+
mp, key = model_prices_meta(), ''
|
|
244
244
|
if model in mp: key = model
|
|
245
245
|
elif vendor_name=='gemini' and model.startswith('models/'): key = f"gemini/{model.removeprefix('models/')}"
|
|
246
246
|
elif vendor_name: key = f"{vendor_name}/{model}"
|
|
@@ -273,7 +273,7 @@ _codex_overrides = {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
# %% ../nbs/00_types.ipynb #fbfdeb0a
|
|
276
|
-
def get_model_info(mn, vendor_name=None):
|
|
276
|
+
def get_model_info(mn, vendor_name=None, strict=False):
|
|
277
277
|
info = get_model_meta(mn, 'chatgpt' if vendor_name=='codex' else vendor_name)
|
|
278
278
|
# anthropic web search
|
|
279
279
|
if 'search_context_cost_per_query' in info: info['supports_web_search'] = True
|
|
@@ -306,6 +306,9 @@ def get_model_info(mn, vendor_name=None):
|
|
|
306
306
|
supports_prompt_caching=True, supports_native_streaming=True, supports_native_structured_output=True,
|
|
307
307
|
max_tokens=1000000, max_input_tokens=1000000, max_output_tokens=65536,
|
|
308
308
|
input_cost_per_token=0.5e-6, cache_read_input_token_cost=0.1e-6, output_cost_per_token=3.0e-6)
|
|
309
|
+
|
|
310
|
+
# unresolved models
|
|
311
|
+
if not info and not strict: info = info | codex_pricing
|
|
309
312
|
return dict2obj(info)
|
|
310
313
|
|
|
311
314
|
# %% ../nbs/00_types.ipynb #8bfca02d
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
fastllm/__init__.py,sha256=
|
|
1
|
+
fastllm/__init__.py,sha256=S7u1lbuWmM3A3ajykBialmPoJUK6Jg-WmNqM-9OZFdk,22
|
|
2
2
|
fastllm/_modidx.py,sha256=oWXxw9eciYsnR2YAhla6c7HCPdXSFb9jV7WQ71fZXPQ,29551
|
|
3
|
-
fastllm/acomplete.py,sha256=
|
|
3
|
+
fastllm/acomplete.py,sha256=juAS2UutHSNJYA2OgisKGc5l991yg3dCn5QLNIgqAUY,6644
|
|
4
4
|
fastllm/anthropic.py,sha256=fG20kOv3d3wGKQe8rD5pFWgZHKe-vT-9QJ3nPXh2twY,14615
|
|
5
|
-
fastllm/chat.py,sha256=
|
|
5
|
+
fastllm/chat.py,sha256=3zDfqcMt_v8NNDiOyhNz8czd4vlOzA7r0_GL1zNt-uI,32937
|
|
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=FYG4-rt7mfGKrUPxCMp_Z3kkxGLKKAVPev8ifD3YFlQ,6652
|
|
10
|
-
fastllm/types.py,sha256=
|
|
10
|
+
fastllm/types.py,sha256=JQdMrAdkqYOIeDtuNC18CFtsXjp12FqTp2_3OlOroV8,12304
|
|
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.5.dist-info/METADATA,sha256=j24Nj_C1FR9tUVG3loB_xMkc_05qOAbZ9JmimlK6fPc,19546
|
|
18
|
+
python_fastllm-0.0.5.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
19
|
+
python_fastllm-0.0.5.dist-info/entry_points.txt,sha256=dq0chsiRjJYStCOXweFW9L6LpyMTjWu2AabKCbTSbuI,36
|
|
20
|
+
python_fastllm-0.0.5.dist-info/top_level.txt,sha256=F8qodL7nEGUHGmzzqfhNKCTIr1i0D6cvudOnm3z7o0Y,8
|
|
21
|
+
python_fastllm-0.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|