python-codex 0.1.1__py3-none-any.whl → 0.1.2__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.
- pycodex/cli.py +8 -1
- pycodex/runtime_services.py +3 -0
- pycodex/tools/exec_tool.py +1 -1
- pycodex/tools/unified_exec_manager.py +19 -2
- pycodex/utils/get_env.py +23 -4
- {python_codex-0.1.1.dist-info → python_codex-0.1.2.dist-info}/METADATA +1 -1
- {python_codex-0.1.1.dist-info → python_codex-0.1.2.dist-info}/RECORD +21 -10
- responses_server/__init__.py +17 -0
- responses_server/__main__.py +5 -0
- responses_server/app.py +217 -0
- responses_server/config.py +63 -0
- responses_server/payload_processors.py +86 -0
- responses_server/server.py +63 -0
- responses_server/session_store.py +37 -0
- responses_server/stream_router.py +784 -0
- responses_server/tools/__init__.py +4 -0
- responses_server/tools/custom_adapter.py +235 -0
- responses_server/tools/web_search.py +263 -0
- {python_codex-0.1.1.dist-info → python_codex-0.1.2.dist-info}/WHEEL +0 -0
- {python_codex-0.1.1.dist-info → python_codex-0.1.2.dist-info}/entry_points.txt +0 -0
- {python_codex-0.1.1.dist-info → python_codex-0.1.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
import threading
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True, slots=True)
|
|
9
|
+
class StoredResponse:
|
|
10
|
+
response_id: str
|
|
11
|
+
session_id: str | None
|
|
12
|
+
model: str
|
|
13
|
+
created_at: float
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SessionStore:
|
|
17
|
+
def __init__(self) -> None:
|
|
18
|
+
self._lock = threading.Lock()
|
|
19
|
+
self._next_response_number = 1
|
|
20
|
+
self._responses: dict[str, StoredResponse] = {}
|
|
21
|
+
|
|
22
|
+
def create_response(self, session_id: str | None, model: str) -> StoredResponse:
|
|
23
|
+
with self._lock:
|
|
24
|
+
response_id = f"resp_{self._next_response_number:08d}"
|
|
25
|
+
self._next_response_number += 1
|
|
26
|
+
stored = StoredResponse(
|
|
27
|
+
response_id=response_id,
|
|
28
|
+
session_id=session_id,
|
|
29
|
+
model=model,
|
|
30
|
+
created_at=time.time(),
|
|
31
|
+
)
|
|
32
|
+
self._responses[response_id] = stored
|
|
33
|
+
return stored
|
|
34
|
+
|
|
35
|
+
def get_response(self, response_id: str) -> StoredResponse | None:
|
|
36
|
+
with self._lock:
|
|
37
|
+
return self._responses.get(response_id)
|