python-fastllm 0.0.39__tar.gz → 0.0.41__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.39 → python_fastllm-0.0.41}/PKG-INFO +2 -2
- python_fastllm-0.0.41/fastllm/__init__.py +1 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/acomplete.py +2 -2
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/gemini.py +1 -1
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/streaming.py +4 -2
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/types.py +3 -3
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/pyproject.toml +1 -1
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/PKG-INFO +2 -2
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/requires.txt +1 -1
- python_fastllm-0.0.39/fastllm/__init__.py +0 -1
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/README.md +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/_modidx.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/anthropic.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/chat.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/codex.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/openai_chat.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/openai_responses.py +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/anthropic.json +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/anthropic.yml +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/gemini.json +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/openai.with-code-samples.json +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/openai.with-code-samples.yml +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/fastllm/specs/spec_manifest.json +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/SOURCES.txt +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/dependency_links.txt +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/entry_points.txt +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/top_level.txt +0 -0
- {python_fastllm-0.0.39 → python_fastllm-0.0.41}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fastllm
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.41
|
|
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
|
|
@@ -11,7 +11,7 @@ Requires-Python: >=3.10
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: fastcore>=2.1.18
|
|
13
13
|
Requires-Dist: aidialog>=0.0.10
|
|
14
|
-
Requires-Dist: fastspec>=0.
|
|
14
|
+
Requires-Dist: fastspec>=0.2.1
|
|
15
15
|
Requires-Dist: pillow
|
|
16
16
|
|
|
17
17
|
# fastllm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.41"
|
|
@@ -7,7 +7,7 @@ __all__ = ['specs_path', 'ant_spec', 'oai_spec', 'gem_spec', 'vendor_mapping', '
|
|
|
7
7
|
'mk_client', 'ContextWindowExceededError', 'acomplete']
|
|
8
8
|
|
|
9
9
|
# %% ../nbs/06_acomplete.ipynb #f2f57253
|
|
10
|
-
import asyncio,json,
|
|
10
|
+
import asyncio,json,httpx2
|
|
11
11
|
from importlib.resources import files
|
|
12
12
|
from fastcore.utils import *
|
|
13
13
|
from fastcore.meta import *
|
|
@@ -79,7 +79,7 @@ def _codex_mtime_policy():
|
|
|
79
79
|
# %% ../nbs/06_acomplete.ipynb #79075d95
|
|
80
80
|
@flexicache(_codex_mtime_policy())
|
|
81
81
|
def mk_client(model=None, vendor_name=None, api_name=None, api_key=None, base_url=None, xtra_hdrs=None,
|
|
82
|
-
timeout=
|
|
82
|
+
timeout=httpx2.Timeout(connect=30, read=300, write=30, pool=10)):
|
|
83
83
|
err_msg = f"please pass a valid one vendor: {', '.join(list(vendor_mapping))} or pass `api_name`,`base_url` and `api_key`"
|
|
84
84
|
if not vendor_name and not api_name and not (base_url and api_key):
|
|
85
85
|
v, m = split_vendor(model)
|
|
@@ -259,7 +259,7 @@ def mk_payload(msgs, model, **kwargs):
|
|
|
259
259
|
has_srv = any(k in t for t in gem_tools for k in ('googleSearch','codeExecution','googleSearchRetrieval'))
|
|
260
260
|
if has_fn and has_srv: payload.setdefault('tool_config', {})['includeServerSideToolInvocations'] = True
|
|
261
261
|
if tchc:=denorm_tool_choice(kwargs.get('tool_choice')): payload.setdefault('tool_config', {}).update(tchc)
|
|
262
|
-
if kwargs.get('stream'): payload.update(stream=True,
|
|
262
|
+
if kwargs.get('stream'): payload.update(stream=True, query_={"alt": "sse"})
|
|
263
263
|
return payload
|
|
264
264
|
|
|
265
265
|
# %% ../nbs/05_gemini.ipynb #60d52c1f
|
|
@@ -19,8 +19,10 @@ class Delta(BasicRepr):
|
|
|
19
19
|
"Normalized streaming delta event."
|
|
20
20
|
def __init__(self, text='', thinking='', refusal='', tool_calls=None, citations=None,
|
|
21
21
|
server_tool_result=None, finish_reason=None, usage=None, raw=None):
|
|
22
|
+
if tool_calls is None: tool_calls = []
|
|
23
|
+
if citations is None: citations = []
|
|
24
|
+
if raw is None: raw = {}
|
|
22
25
|
store_attr()
|
|
23
|
-
self.tool_calls,self.citations,self.raw = ifnone(tool_calls,[]),ifnone(citations,[]),ifnone(raw,{})
|
|
24
26
|
def __eq__(self, o): return type(o) is type(self) and self.__dict__ == o.__dict__
|
|
25
27
|
def __hash__(self): return hash((self.text, self.thinking, self.finish_reason))
|
|
26
28
|
|
|
@@ -45,8 +47,8 @@ class PrintStream:
|
|
|
45
47
|
class PartAccum(BasicRepr):
|
|
46
48
|
"Accumulate streamed part deltas by index"
|
|
47
49
|
def __init__(self, parts=None):
|
|
50
|
+
if parts is None: parts = {}
|
|
48
51
|
store_attr()
|
|
49
|
-
self.parts = ifnone(parts, {})
|
|
50
52
|
def __eq__(self, o): return type(o) is type(self) and self.__dict__ == o.__dict__
|
|
51
53
|
def __hash__(self): return hash(len(self.parts))
|
|
52
54
|
|
|
@@ -12,7 +12,7 @@ __all__ = ['FinishReason', 'api_registry', 'model_prices_url', 'haik45', 'sonn45
|
|
|
12
12
|
'price_tier', 'tier_rate']
|
|
13
13
|
|
|
14
14
|
# %% ../nbs/00_types.ipynb #b4d047fd
|
|
15
|
-
import
|
|
15
|
+
import httpx2, base64, io
|
|
16
16
|
from importlib.metadata import entry_points
|
|
17
17
|
from datetime import datetime, timezone
|
|
18
18
|
from fastcore.utils import *
|
|
@@ -25,8 +25,8 @@ class Usage(BasicRepr):
|
|
|
25
25
|
"Normalized usage."
|
|
26
26
|
def __init__(self, prompt_tokens=0, completion_tokens=0, total_tokens=0, cached_tokens=0,
|
|
27
27
|
cache_creation_tokens=0, reasoning_tokens=0, raw=None):
|
|
28
|
+
if raw is None: raw = {}
|
|
28
29
|
store_attr()
|
|
29
|
-
self.raw = ifnone(raw, {})
|
|
30
30
|
def __eq__(self, o): return type(o) is type(self) and self.__dict__ == o.__dict__
|
|
31
31
|
|
|
32
32
|
|
|
@@ -128,7 +128,7 @@ model_prices_url = 'https://raw.githubusercontent.com/BerriAI/litellm/main/model
|
|
|
128
128
|
def model_prices_meta():
|
|
129
129
|
"Download model prices to the module dir once, then load from disk."
|
|
130
130
|
p = Path(__file__).parent/'model_prices.json'
|
|
131
|
-
if not p.exists(): p.write_text(
|
|
131
|
+
if not p.exists(): p.write_text(httpx2.get(model_prices_url, follow_redirects=True).text)
|
|
132
132
|
return loads(p.read_text())
|
|
133
133
|
|
|
134
134
|
# %% ../nbs/00_types.ipynb #68e488d8
|
|
@@ -15,7 +15,7 @@ classifiers = [
|
|
|
15
15
|
"Programming Language :: Python :: 3",
|
|
16
16
|
"Programming Language :: Python :: 3 :: Only",
|
|
17
17
|
]
|
|
18
|
-
dependencies = ['fastcore>=2.1.18', 'aidialog>=0.0.10', 'fastspec>=0.
|
|
18
|
+
dependencies = ['fastcore>=2.1.18', 'aidialog>=0.0.10', 'fastspec>=0.2.1', 'pillow']
|
|
19
19
|
|
|
20
20
|
[project.urls]
|
|
21
21
|
Repository = "https://github.com/AnswerDotAI/fastllm"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fastllm
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.41
|
|
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
|
|
@@ -11,7 +11,7 @@ Requires-Python: >=3.10
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: fastcore>=2.1.18
|
|
13
13
|
Requires-Dist: aidialog>=0.0.10
|
|
14
|
-
Requires-Dist: fastspec>=0.
|
|
14
|
+
Requires-Dist: fastspec>=0.2.1
|
|
15
15
|
Requires-Dist: pillow
|
|
16
16
|
|
|
17
17
|
# fastllm
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.39"
|
|
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
|
|
File without changes
|
|
File without changes
|
{python_fastllm-0.0.39 → python_fastllm-0.0.41}/python_fastllm.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|