python-fastllm 0.0.51__tar.gz → 0.0.52__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.51 → python_fastllm-0.0.52}/PKG-INFO +2 -2
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/__init__.py +1 -1
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/_modidx.py +11 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/responses.py +39 -2
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/pyproject.toml +1 -1
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/PKG-INFO +2 -2
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/requires.txt +1 -1
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/README.md +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/acomplete.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/anthropic.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/chat.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/codex.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/gemini.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/openai_chat.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/openai_responses.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/streaming.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/fastllm/types.py +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/SOURCES.txt +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/dependency_links.txt +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/entry_points.txt +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/top_level.txt +0 -0
- {python_fastllm-0.0.51 → python_fastllm-0.0.52}/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.52
|
|
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
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
10
10
|
Requires-Python: >=3.10
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: fastcore>=2.1.18
|
|
13
|
-
Requires-Dist: aidialog>=0.0.
|
|
13
|
+
Requires-Dist: aidialog>=0.0.26
|
|
14
14
|
Requires-Dist: fasttransport>=0.0.2
|
|
15
15
|
Requires-Dist: pillow
|
|
16
16
|
|
|
@@ -274,6 +274,17 @@ d = { 'settings': { 'branch': 'main',
|
|
|
274
274
|
'fastllm.responses.ResponseState': ('responses.html#responsestate', 'fastllm/responses.py'),
|
|
275
275
|
'fastllm.responses.ResponseState.__init__': ( 'responses.html#responsestate.__init__',
|
|
276
276
|
'fastllm/responses.py'),
|
|
277
|
+
'fastllm.responses.ResponseState.from_dict': ( 'responses.html#responsestate.from_dict',
|
|
278
|
+
'fastllm/responses.py'),
|
|
279
|
+
'fastllm.responses.ResponseState.to_dict': ( 'responses.html#responsestate.to_dict',
|
|
280
|
+
'fastllm/responses.py'),
|
|
281
|
+
'fastllm.responses.ResponseStore': ('responses.html#responsestore', 'fastllm/responses.py'),
|
|
282
|
+
'fastllm.responses.ResponseStore.__init__': ( 'responses.html#responsestore.__init__',
|
|
283
|
+
'fastllm/responses.py'),
|
|
284
|
+
'fastllm.responses.ResponseStore.dump': ('responses.html#responsestore.dump', 'fastllm/responses.py'),
|
|
285
|
+
'fastllm.responses.ResponseStore.get': ('responses.html#responsestore.get', 'fastllm/responses.py'),
|
|
286
|
+
'fastllm.responses.ResponseStore.load': ('responses.html#responsestore.load', 'fastllm/responses.py'),
|
|
287
|
+
'fastllm.responses.ResponseStore.put': ('responses.html#responsestore.put', 'fastllm/responses.py'),
|
|
277
288
|
'fastllm.responses.ResponseTurn': ('responses.html#responseturn', 'fastllm/responses.py'),
|
|
278
289
|
'fastllm.responses.ResponseTurn.__init__': ( 'responses.html#responseturn.__init__',
|
|
279
290
|
'fastllm/responses.py'),
|
|
@@ -12,7 +12,7 @@ Every request is streamed. `_ResponseStream` only tracks the standard event gram
|
|
|
12
12
|
|
|
13
13
|
# %% auto #0
|
|
14
14
|
__all__ = ['ResponsesError', 'response_input', 'normalize_call_ids', 'response_output', 'response_usage', 'response_object',
|
|
15
|
-
'ResponseState', 'ResponseTurn', 'AsyncResponses', 'response_event', 'pending_response']
|
|
15
|
+
'ResponseState', 'ResponseStore', 'ResponseTurn', 'AsyncResponses', 'response_event', 'pending_response']
|
|
16
16
|
|
|
17
17
|
# %% ../nbs/06a_responses.ipynb #e16fc24e
|
|
18
18
|
import asyncio, copy, json, secrets, time
|
|
@@ -22,7 +22,7 @@ from fasttransport.errors import APIError
|
|
|
22
22
|
|
|
23
23
|
from .acomplete import acomplete
|
|
24
24
|
from .streaming import Status
|
|
25
|
-
from aidialog.msg_parts import Msg, Text, ToolUse, ToolResult, InputImage, InputFile, Completion, tool_text
|
|
25
|
+
from aidialog.msg_parts import Msg, Text, ToolUse, ToolResult, InputImage, InputFile, Completion, tool_text, msg2dict, dict2msg
|
|
26
26
|
|
|
27
27
|
# %% ../nbs/06a_responses.ipynb #f904c16f
|
|
28
28
|
class ResponsesError(Exception):
|
|
@@ -145,6 +145,43 @@ class ResponseState(BasicRepr):
|
|
|
145
145
|
"Canonical history and optional provider continuation metadata."
|
|
146
146
|
def __init__(self, id, model, history, provider_response_id=None): store_attr()
|
|
147
147
|
|
|
148
|
+
# %% ../nbs/06a_responses.ipynb #b28fa30d
|
|
149
|
+
@patch
|
|
150
|
+
def to_dict(self:ResponseState):
|
|
151
|
+
"This state as a JSON-ready dict"
|
|
152
|
+
return dict(id=self.id, model=self.model, history=[msg2dict(m) for m in self.history], provider_response_id=self.provider_response_id)
|
|
153
|
+
|
|
154
|
+
@patch(cls_method=True)
|
|
155
|
+
def from_dict(cls:ResponseState, d):
|
|
156
|
+
"The state `to_dict` produced `d` from"
|
|
157
|
+
return cls(d['id'], d['model'], tuple(dict2msg(m) for m in d['history']), d['provider_response_id'])
|
|
158
|
+
|
|
159
|
+
# %% ../nbs/06a_responses.ipynb #74e09d18
|
|
160
|
+
class ResponseStore:
|
|
161
|
+
"Continuation states kept for `ttl` seconds; override `dump` and `load` to keep them outside this process"
|
|
162
|
+
def __init__(self, ttl=3600): self.ttl,self.items = ttl,{}
|
|
163
|
+
|
|
164
|
+
async def dump(self, rid, data):
|
|
165
|
+
"Keep JSON-ready `data` under `rid` for `ttl` seconds"
|
|
166
|
+
now = time.time()
|
|
167
|
+
self.items = {k:v for k,v in self.items.items() if v[0] > now}
|
|
168
|
+
self.items[rid] = (now+self.ttl, data)
|
|
169
|
+
|
|
170
|
+
async def load(self, rid):
|
|
171
|
+
"The data kept under `rid`, or `None` once it has expired"
|
|
172
|
+
exp,data = self.items.get(rid, (0, None))
|
|
173
|
+
return data if exp > time.time() else None
|
|
174
|
+
|
|
175
|
+
async def put(self, state, **meta):
|
|
176
|
+
"Store `state` with the host's `meta` about it"
|
|
177
|
+
await self.dump(state.id, dict(state=state.to_dict(), **meta))
|
|
178
|
+
|
|
179
|
+
async def get(self, rid):
|
|
180
|
+
"The `(state, meta)` stored under `rid`, or `None`"
|
|
181
|
+
data = await self.load(rid)
|
|
182
|
+
if data is None: return None
|
|
183
|
+
return ResponseState.from_dict(data['state']),{k:v for k,v in data.items() if k != 'state'}
|
|
184
|
+
|
|
148
185
|
# %% ../nbs/06a_responses.ipynb #c9ca3744
|
|
149
186
|
class ResponseTurn(BasicRepr):
|
|
150
187
|
"A prepared Responses request for one provider call."
|
|
@@ -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.
|
|
18
|
+
dependencies = ['fastcore>=2.1.18', 'aidialog>=0.0.26', 'fasttransport>=0.0.2', 'pillow']
|
|
19
19
|
|
|
20
20
|
[project.scripts]
|
|
21
21
|
fastllm-auth = "fastllm.codex:main"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fastllm
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.52
|
|
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
|
|
@@ -10,7 +10,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
10
10
|
Requires-Python: >=3.10
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: fastcore>=2.1.18
|
|
13
|
-
Requires-Dist: aidialog>=0.0.
|
|
13
|
+
Requires-Dist: aidialog>=0.0.26
|
|
14
14
|
Requires-Dist: fasttransport>=0.0.2
|
|
15
15
|
Requires-Dist: pillow
|
|
16
16
|
|
|
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.51 → python_fastllm-0.0.52}/python_fastllm.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|