ws-bom-robot-app 0.0.43__py3-none-any.whl → 0.0.44__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.
- ws_bom_robot_app/llm/agent_handler.py +2 -2
- ws_bom_robot_app/llm/api.py +6 -4
- {ws_bom_robot_app-0.0.43.dist-info → ws_bom_robot_app-0.0.44.dist-info}/METADATA +1 -1
- {ws_bom_robot_app-0.0.43.dist-info → ws_bom_robot_app-0.0.44.dist-info}/RECORD +6 -6
- {ws_bom_robot_app-0.0.43.dist-info → ws_bom_robot_app-0.0.44.dist-info}/WHEEL +0 -0
- {ws_bom_robot_app-0.0.43.dist-info → ws_bom_robot_app-0.0.44.dist-info}/top_level.txt +0 -0
|
@@ -64,7 +64,7 @@ class AgentHandler(AsyncCallbackHandler):
|
|
|
64
64
|
if token:
|
|
65
65
|
token = _parse_token(self.llm,token)
|
|
66
66
|
if token:
|
|
67
|
-
self.stream_buffer += token
|
|
67
|
+
self.stream_buffer += token # append new data to pending buffer
|
|
68
68
|
if not self.in_json_block:
|
|
69
69
|
# search for the start of a json block.
|
|
70
70
|
start_match = self.json_start_regex.search(self.stream_buffer)
|
|
@@ -90,7 +90,7 @@ class AgentHandler(AsyncCallbackHandler):
|
|
|
90
90
|
self.stream_buffer = self.stream_buffer[-3:]
|
|
91
91
|
else:
|
|
92
92
|
# in json block: look for an end fence.
|
|
93
|
-
end_match = self.json_end_regex.search(self.stream_buffer
|
|
93
|
+
end_match = self.json_end_regex.search(self.stream_buffer)
|
|
94
94
|
if end_match:
|
|
95
95
|
end_index = end_match.start()
|
|
96
96
|
self.json_buffer += self.stream_buffer[:end_index]
|
ws_bom_robot_app/llm/api.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Annotated, Any
|
|
1
|
+
from typing import Annotated, Any, Mapping
|
|
2
2
|
from fastapi import APIRouter, HTTPException, Request, Header
|
|
3
3
|
from fastapi.responses import StreamingResponse
|
|
4
4
|
from ws_bom_robot_app.llm.agent_description import AgentDescriptor
|
|
@@ -9,7 +9,7 @@ from ws_bom_robot_app.llm.vector_store.generator import kb, rules, kb_stream_fil
|
|
|
9
9
|
from ws_bom_robot_app.llm.tools.tool_manager import ToolManager
|
|
10
10
|
from ws_bom_robot_app.llm.vector_store.integration.manager import IntegrationManager
|
|
11
11
|
from ws_bom_robot_app.task_manager import task_manager, TaskHeader
|
|
12
|
-
|
|
12
|
+
from uuid import uuid4
|
|
13
13
|
router = APIRouter(prefix="/api/llm", tags=["llm"])
|
|
14
14
|
|
|
15
15
|
@router.get("/")
|
|
@@ -20,13 +20,15 @@ async def root():
|
|
|
20
20
|
async def _invoke(rq: InvokeRequest):
|
|
21
21
|
return await invoke(rq)
|
|
22
22
|
|
|
23
|
+
def _stream_headers(rq: StreamRequest) -> Mapping[str, str]:
|
|
24
|
+
return {"X-thread-id": rq.thread_id or str(uuid4())}
|
|
23
25
|
@router.post("/stream")
|
|
24
26
|
async def _stream(rq: StreamRequest, ctx: Request) -> StreamingResponse:
|
|
25
|
-
return StreamingResponse(stream(rq, ctx), media_type="application/json")
|
|
27
|
+
return StreamingResponse(stream(rq, ctx), media_type="application/json", headers=_stream_headers(rq))
|
|
26
28
|
|
|
27
29
|
@router.post("/stream/raw")
|
|
28
30
|
async def _stream_raw(rq: StreamRequest, ctx: Request) -> StreamingResponse:
|
|
29
|
-
return StreamingResponse(stream(rq, ctx, formatted=False), media_type="application/json")
|
|
31
|
+
return StreamingResponse(stream(rq, ctx, formatted=False), media_type="application/json", headers=_stream_headers(rq))
|
|
30
32
|
|
|
31
33
|
@router.post("/kb")
|
|
32
34
|
async def _kb(rq: KbRequest) -> VectorDbResponse:
|
|
@@ -7,9 +7,9 @@ ws_bom_robot_app/task_manager.py,sha256=Zedzs2R3O-wNSQOqs4jorgFwPRi-ji_0TN4mGfk-
|
|
|
7
7
|
ws_bom_robot_app/util.py,sha256=b49ItlZgh2Wzw-6K8k5Wa44eVgjQ0JmWQwJnEaQBVGw,3502
|
|
8
8
|
ws_bom_robot_app/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
ws_bom_robot_app/llm/agent_description.py,sha256=DKPGchYXrkxt8pRpOabn5QE_qn8jSKl92pLpnVLHG5I,4657
|
|
10
|
-
ws_bom_robot_app/llm/agent_handler.py,sha256=
|
|
10
|
+
ws_bom_robot_app/llm/agent_handler.py,sha256=zRjUZ9D3GIAfmKl1473k2b8YHswZy5rTWdS5BCbZyaY,7578
|
|
11
11
|
ws_bom_robot_app/llm/agent_lcel.py,sha256=iF03Q2fiJ60Zv-ia0eYwz46IPMTJaijb6xcn6cJIUZc,2260
|
|
12
|
-
ws_bom_robot_app/llm/api.py,sha256=
|
|
12
|
+
ws_bom_robot_app/llm/api.py,sha256=BIytnysVK_Iz2RmYmD314cduWAh55l_YcEUvPvb3-oI,3968
|
|
13
13
|
ws_bom_robot_app/llm/defaut_prompt.py,sha256=LlCd_nSMkMmHESfiiiQYfnJyB6Pp-LSs4CEKdYW4vFk,1106
|
|
14
14
|
ws_bom_robot_app/llm/main.py,sha256=tr7gPjSzO2w85ipSxWVcathNxJC3NKTdJKY89VhhKOM,4973
|
|
15
15
|
ws_bom_robot_app/llm/settings.py,sha256=EkFGCppORenStH9W4e6_dYvQ-5p6xiEMpmUHBqNqG9M,117
|
|
@@ -60,7 +60,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
|
60
60
|
ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=L_ugekNuAq0N9O-24wtlHSNHkqSeD-KsJrfGt_FX9Oc,5340
|
|
61
61
|
ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=yP0zgXLeFAlByaYuj-6cYariuknckrFds0dxdRcnVz8,3456
|
|
62
62
|
ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=qo9ejRZyKv_k6jnGgXnu1W5uqsMMtgqK_uvPpZQ0p74,833
|
|
63
|
-
ws_bom_robot_app-0.0.
|
|
64
|
-
ws_bom_robot_app-0.0.
|
|
65
|
-
ws_bom_robot_app-0.0.
|
|
66
|
-
ws_bom_robot_app-0.0.
|
|
63
|
+
ws_bom_robot_app-0.0.44.dist-info/METADATA,sha256=O1jDMPmtgtInI9ZgEHnupOy1ZW9oF6FKa-BD9fdwy4M,8348
|
|
64
|
+
ws_bom_robot_app-0.0.44.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
|
65
|
+
ws_bom_robot_app-0.0.44.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
|
|
66
|
+
ws_bom_robot_app-0.0.44.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|