ws-bom-robot-app 0.0.70__py3-none-any.whl → 0.0.71__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_lcel.py +8 -3
- ws_bom_robot_app/llm/utils/cms.py +34 -29
- {ws_bom_robot_app-0.0.70.dist-info → ws_bom_robot_app-0.0.71.dist-info}/METADATA +2 -1
- {ws_bom_robot_app-0.0.70.dist-info → ws_bom_robot_app-0.0.71.dist-info}/RECORD +6 -6
- {ws_bom_robot_app-0.0.70.dist-info → ws_bom_robot_app-0.0.71.dist-info}/WHEEL +0 -0
- {ws_bom_robot_app-0.0.70.dist-info → ws_bom_robot_app-0.0.71.dist-info}/top_level.txt +0 -0
|
@@ -23,14 +23,19 @@ class AgentLcel:
|
|
|
23
23
|
self.executor = self.__create_agent()
|
|
24
24
|
|
|
25
25
|
async def __create_prompt(self, input: dict) -> ChatPromptTemplate:
|
|
26
|
+
from langchain_core.messages import SystemMessage
|
|
26
27
|
message : LlmMessage = input[self.memory_key][-1]
|
|
27
28
|
rules_prompt = await get_rules(self.embeddings, self.rules, message.content) if self.rules else ""
|
|
28
29
|
system = default_prompt + (tool_prompt(render_text_description(self.__tools)) if len(self.__tools)>0 else "") + self.sys_message + rules_prompt
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
prompt = ChatPromptTemplate(
|
|
31
|
+
messages=[
|
|
32
|
+
SystemMessage(content=system), #from ("system",system) to avoid improper f-string substitutions
|
|
31
33
|
MessagesPlaceholder(variable_name=self.memory_key),
|
|
32
34
|
MessagesPlaceholder(variable_name="agent_scratchpad"),
|
|
33
|
-
]
|
|
35
|
+
],
|
|
36
|
+
template_format=None,
|
|
37
|
+
)
|
|
38
|
+
return prompt
|
|
34
39
|
|
|
35
40
|
def __create_agent(self) -> AgentExecutor:
|
|
36
41
|
agent: Any = (
|
|
@@ -50,35 +50,40 @@ async def get_apps() -> list[CmsApp]:
|
|
|
50
50
|
for cms_app in cms_apps:
|
|
51
51
|
if __attr(cms_app,"isActive",default=True) == True:
|
|
52
52
|
_cms_app_dict = DictObject.from_dict(cms_app)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
53
|
+
try:
|
|
54
|
+
_app: CmsApp = CmsApp(
|
|
55
|
+
id=_cms_app_dict.id,
|
|
56
|
+
name=_cms_app_dict.name,
|
|
57
|
+
mode=_cms_app_dict.mode,
|
|
58
|
+
prompt_samples=[__attr(sample,'sampleInputText') or f"{sample.__dict__}" for sample in _cms_app_dict.contents.sampleInputTexts],
|
|
59
|
+
credentials=CmsAppCredential(app_key=_cms_app_dict.settings.credentials.appKey,api_key=_cms_app_dict.settings.credentials.apiKey),
|
|
60
|
+
rq=StreamRequest(
|
|
61
|
+
#thread_id=str(uuid.uuid1()),
|
|
62
|
+
messages=[],
|
|
63
|
+
secrets={
|
|
64
|
+
"apiKey": __attr(_cms_app_dict.settings,'llmConfig','secrets','apiKey', default=''),
|
|
65
|
+
"langChainApiKey": __attr(_cms_app_dict.settings,'llmConfig','secrets','langChainApiKey', default=''),
|
|
66
|
+
"nebulyApiKey": __attr(_cms_app_dict.settings,'llmConfig','secrets','nebulyApiKey', default=''),
|
|
67
|
+
},
|
|
68
|
+
system_message=__attr(_cms_app_dict.settings,'llmConfig','prompt','prompt','systemMessage') if __attr(_cms_app_dict.settings,'llmConfig','prompt','prompt','systemMessage') else __attr(_cms_app_dict.settings,'llmConfig','prompt','systemMessage'),
|
|
69
|
+
provider= __attr(_cms_app_dict.settings,'llmConfig','provider') or 'openai',
|
|
70
|
+
model= __attr(_cms_app_dict.settings,'llmConfig','model') or 'gpt-4o',
|
|
71
|
+
temperature=_cms_app_dict.settings.llmConfig.temperature or 0,
|
|
72
|
+
app_tools=[LlmAppTool(**tool) for tool in cms_app.get('settings').get('appTools',[])],
|
|
73
|
+
rules=LlmRules(
|
|
74
|
+
vector_type=__attr(_cms_app_dict.settings,'rules','vectorDbType', default='faiss'),
|
|
75
|
+
vector_db=__attr(_cms_app_dict.settings,'rules','vectorDbFile','filename'),
|
|
76
|
+
threshold=__attr(_cms_app_dict.settings,'rules','threshold', default=0.7)
|
|
77
|
+
) if __attr(_cms_app_dict.settings,'rules','vectorDbFile','filename') else None,
|
|
78
|
+
#fine_tuned_model=__attr(_cms_app_dict.settings,'llmConfig','fineTunedModel'),
|
|
79
|
+
lang_chain_tracing= __attr(_cms_app_dict.settings,'llmConfig','langChainTracing', default=False),
|
|
80
|
+
lang_chain_project= __attr(_cms_app_dict.settings,'llmConfig','langChainProject', default='')
|
|
81
|
+
))
|
|
82
|
+
except Exception as e:
|
|
83
|
+
import traceback
|
|
84
|
+
ex = traceback.format_exc()
|
|
85
|
+
logging.error(f"Error creating CmsApp {_cms_app_dict.name} from dict: {e}\n{ex}")
|
|
86
|
+
continue
|
|
82
87
|
if _app.rq.app_tools:
|
|
83
88
|
for tool in _app.rq.app_tools:
|
|
84
89
|
_knowledgeBase = tool.knowledgeBase
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ws_bom_robot_app
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.71
|
|
4
4
|
Summary: A FastAPI application serving ws bom/robot/llm platform ai.
|
|
5
5
|
Home-page: https://github.com/websolutespa/bom
|
|
6
6
|
Author: Websolute Spa
|
|
@@ -32,6 +32,7 @@ Requires-Dist: chromadb==1.0.13
|
|
|
32
32
|
Requires-Dist: langchain_chroma==0.2.4
|
|
33
33
|
Requires-Dist: fastembed==0.7.1
|
|
34
34
|
Requires-Dist: langchain-qdrant==0.2.0
|
|
35
|
+
Requires-Dist: qdrant-client==1.15.0
|
|
35
36
|
Requires-Dist: lark==1.2.2
|
|
36
37
|
Requires-Dist: unstructured==0.16.21
|
|
37
38
|
Requires-Dist: unstructured[image]
|
|
@@ -9,7 +9,7 @@ ws_bom_robot_app/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
|
9
9
|
ws_bom_robot_app/llm/agent_context.py,sha256=uatHJ8wcRly6h0S762BgfzDMpmcwCHwNzwo37aWjeE0,1305
|
|
10
10
|
ws_bom_robot_app/llm/agent_description.py,sha256=yK4aVU3RNk1oP4bEneV3QPAi-208JwWk4R6qHlzqYIg,4656
|
|
11
11
|
ws_bom_robot_app/llm/agent_handler.py,sha256=BQ-f--Z5QCJDp-7tzSG_CKrANUCqG65S09psgWVNxa4,7597
|
|
12
|
-
ws_bom_robot_app/llm/agent_lcel.py,sha256=
|
|
12
|
+
ws_bom_robot_app/llm/agent_lcel.py,sha256=tVa1JJOuL1CG0tXS5AwOB4gli0E2rGqSBD5oEehHvOY,2480
|
|
13
13
|
ws_bom_robot_app/llm/api.py,sha256=2bF-UFczY9LuBqPxKObM0TOWYbZgVztX1RiIz5MSorU,5042
|
|
14
14
|
ws_bom_robot_app/llm/defaut_prompt.py,sha256=LlCd_nSMkMmHESfiiiQYfnJyB6Pp-LSs4CEKdYW4vFk,1106
|
|
15
15
|
ws_bom_robot_app/llm/main.py,sha256=vzUfaLCRk2SYujD00hnrTiHEVLYgZcbSw6LUea43siU,5235
|
|
@@ -33,7 +33,7 @@ ws_bom_robot_app/llm/tools/models/main.py,sha256=1hICqHs-KS2heenkH7b2eH0N2GrPaaN
|
|
|
33
33
|
ws_bom_robot_app/llm/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
ws_bom_robot_app/llm/utils/agent.py,sha256=_CY5Dji3UeAIi2iuU7ttz4fml1q8aCFgVWOv970x8Fw,1411
|
|
35
35
|
ws_bom_robot_app/llm/utils/chunker.py,sha256=N7570xBYlObneg-fsvDhPAJ-Pv8C8OaYZOBK6q7LmMI,607
|
|
36
|
-
ws_bom_robot_app/llm/utils/cms.py,sha256=
|
|
36
|
+
ws_bom_robot_app/llm/utils/cms.py,sha256=XhrLQyHQ2JUOInDCCf_uvR4Jiud0YvH2FwwiiuCnnsg,6352
|
|
37
37
|
ws_bom_robot_app/llm/utils/download.py,sha256=iAUxH_NiCpTPtGzhC4hBtxotd2HPFt2MBhttslIxqiI,3194
|
|
38
38
|
ws_bom_robot_app/llm/utils/kb.py,sha256=jja45WCbNI7SGEgqDS99nErlwB5eY8Ga7BMnhdMHZ90,1279
|
|
39
39
|
ws_bom_robot_app/llm/utils/print.py,sha256=IsPYEWRJqu-dqlJA3F9OnnIS4rOq_EYX1Ljp3BvDnww,774
|
|
@@ -67,7 +67,7 @@ ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5
|
|
|
67
67
|
ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=L_ugekNuAq0N9O-24wtlHSNHkqSeD-KsJrfGt_FX9Oc,5340
|
|
68
68
|
ws_bom_robot_app/llm/vector_store/loader/docling.py,sha256=yP0zgXLeFAlByaYuj-6cYariuknckrFds0dxdRcnVz8,3456
|
|
69
69
|
ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=qo9ejRZyKv_k6jnGgXnu1W5uqsMMtgqK_uvPpZQ0p74,833
|
|
70
|
-
ws_bom_robot_app-0.0.
|
|
71
|
-
ws_bom_robot_app-0.0.
|
|
72
|
-
ws_bom_robot_app-0.0.
|
|
73
|
-
ws_bom_robot_app-0.0.
|
|
70
|
+
ws_bom_robot_app-0.0.71.dist-info/METADATA,sha256=iU5PtedaeRduzCzkLrkddKX4ZiW_fvqQHT9fMEMIrC0,8609
|
|
71
|
+
ws_bom_robot_app-0.0.71.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
72
|
+
ws_bom_robot_app-0.0.71.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
|
|
73
|
+
ws_bom_robot_app-0.0.71.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|