khoj 1.35.4.dev1__py3-none-any.whl → 1.35.4.dev53__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.
- khoj/database/adapters/__init__.py +52 -6
- khoj/database/migrations/0081_agent_is_hidden_chatmodel_description_and_more.py +27 -0
- khoj/database/migrations/0082_merge_20250121_1842.py +13 -0
- khoj/database/migrations/0083_alter_agent_output_modes_alter_agent_personality_and_more.py +71 -0
- khoj/database/migrations/0084_alter_agent_input_tools.py +33 -0
- khoj/database/migrations/0085_alter_agent_output_modes.py +24 -0
- khoj/database/models/__init__.py +8 -6
- khoj/interface/compiled/404/index.html +1 -1
- khoj/interface/compiled/_next/static/chunks/2327-724a4b8f1591b53b.js +1 -0
- khoj/interface/compiled/_next/static/chunks/3224-09c2844a0885a301.js +1 -0
- khoj/interface/compiled/_next/static/chunks/4357-73c05a7c905ffc9f.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{4610.196691887afb7fea.js → 4610.a1e7f40a759ed2aa.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/4986-80ecd055ad138cf6.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{5427-0a9a2669cb5cde83.js → 5427-d65c69daf03cc100.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{6434.e6cd986d690f2cef.js → 6434.7afea9648e238ad5.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/{6002-7e3115f142731625.js → 8155-ad130153ddcc930f.js} +9 -9
- khoj/interface/compiled/_next/static/chunks/849-aa69550db1c243e4.js +20 -0
- khoj/interface/compiled/_next/static/chunks/8580-f95d376ed2c5a2cb.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/agents/page-5c32dfc2ab1d37c3.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/automations/{page-f9741f52969fb8f7.js → page-c6dee506ac1ef75c.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-8b64c2ed43be097b.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/page-18c5514c09249e15.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/search/{page-c45f35cc3c12416e.js → page-dfbf62acab34d1f1.js} +1 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-2a68279b34a434e3.js +1 -0
- khoj/interface/compiled/_next/static/chunks/app/share/chat/page-978928ef05d44a48.js +1 -0
- khoj/interface/compiled/_next/static/chunks/{webpack-f4562fb8c56245c5.js → webpack-4b0fb0aafc881a07.js} +1 -1
- khoj/interface/compiled/_next/static/css/20ac73cc3d58b75c.css +25 -0
- khoj/interface/compiled/_next/static/css/{df4b47a2d0d85eae.css → b15666ef52060cd0.css} +1 -1
- khoj/interface/compiled/_next/static/css/{d8518f90b895a246.css → f29752d6e1be7624.css} +1 -1
- khoj/interface/compiled/_next/static/css/f29ee25d068f459b.css +1 -0
- khoj/interface/compiled/agents/index.html +1 -1
- khoj/interface/compiled/agents/index.txt +2 -2
- khoj/interface/compiled/automations/index.html +1 -1
- khoj/interface/compiled/automations/index.txt +3 -3
- khoj/interface/compiled/chat/index.html +1 -1
- khoj/interface/compiled/chat/index.txt +2 -2
- khoj/interface/compiled/index.html +1 -1
- khoj/interface/compiled/index.txt +2 -2
- khoj/interface/compiled/search/index.html +1 -1
- khoj/interface/compiled/search/index.txt +3 -3
- khoj/interface/compiled/settings/index.html +1 -1
- khoj/interface/compiled/settings/index.txt +4 -4
- khoj/interface/compiled/share/chat/index.html +1 -1
- khoj/interface/compiled/share/chat/index.txt +2 -2
- khoj/routers/api_agents.py +164 -4
- khoj/routers/api_chat.py +22 -5
- khoj/routers/api_model.py +14 -7
- khoj/routers/helpers.py +54 -6
- khoj/utils/helpers.py +14 -5
- {khoj-1.35.4.dev1.dist-info → khoj-1.35.4.dev53.dist-info}/METADATA +1 -1
- {khoj-1.35.4.dev1.dist-info → khoj-1.35.4.dev53.dist-info}/RECORD +71 -65
- khoj/interface/compiled/_next/static/chunks/182-f1c48a203dc91e0e.js +0 -20
- khoj/interface/compiled/_next/static/chunks/2327-3b7d77ac1d1c86a2.js +0 -1
- khoj/interface/compiled/_next/static/chunks/4270-28ab75d62e71521c.js +0 -1
- khoj/interface/compiled/_next/static/chunks/4986-4de8a920c7fcbbc6.js +0 -1
- khoj/interface/compiled/_next/static/chunks/9665-391df1e5c51c960a.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/agents/page-fe28a8b1b3648a55.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/chat/page-1fdcaad519ca7b90.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/page-62fd13b0a48494ac.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/settings/page-f478749e6154f7e0.js +0 -1
- khoj/interface/compiled/_next/static/chunks/app/share/chat/page-37328118de6cbefe.js +0 -1
- khoj/interface/compiled/_next/static/css/1b7f52b8da3a37bd.css +0 -1
- khoj/interface/compiled/_next/static/css/d7448372b4f1e3b8.css +0 -25
- /khoj/interface/compiled/_next/static/chunks/{1199-3461ffb259e6d98b.js → 1199-80c79778c44ad4ec.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{1915-d3c36ad6ce697ce7.js → 1915-4b7980a58fb630d6.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2117-b8fc8005fb5af70b.js → 2117-f99825f0a867a42d.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{2509-299ad8b73ce407dd.js → 2509-79b3ce8040bc0bcf.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{5473-b1cf56dedac6577a.js → 5473-02d1709b2a3f4a4b.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{5477-3a4efd2e062e7102.js → 5477-c47515d2934cd866.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{6244-08fb644d7709f449.js → 6244-4b970139897ef46e.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{7647-5a935022fa3da0a6.js → 7647-469de84d236fc7fd.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{8667-b6bf63c72b2d76eb.js → 8667-adbe6017a66cef10.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{9259-1172dbaca0515237.js → 9259-5be50737cfe989bc.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/app/_not-found/{page-a834eddae3e235df.js → page-0ec97c4970898f2d.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/app/automations/{layout-0adc73dba7a04c11.js → layout-02f95fa0a48743eb.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/app/search/{layout-acc9eb43c9962ee1.js → layout-596cdc3a5a1a8e46.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/app/settings/{layout-d09d6510a45cd4bd.js → layout-8a22f370d3eaeed3.js} +0 -0
- /khoj/interface/compiled/_next/static/chunks/{fd9d1056-f14840e2376aea5a.js → fd9d1056-7454f5bbfcf5bd5b.js} +0 -0
- /khoj/interface/compiled/_next/static/{ltlFhW848iOaVGtlI55WG → nzUuinMXEsRX86qGdx-yY}/_buildManifest.js +0 -0
- /khoj/interface/compiled/_next/static/{ltlFhW848iOaVGtlI55WG → nzUuinMXEsRX86qGdx-yY}/_ssgManifest.js +0 -0
- {khoj-1.35.4.dev1.dist-info → khoj-1.35.4.dev53.dist-info}/WHEEL +0 -0
- {khoj-1.35.4.dev1.dist-info → khoj-1.35.4.dev53.dist-info}/entry_points.txt +0 -0
- {khoj-1.35.4.dev1.dist-info → khoj-1.35.4.dev53.dist-info}/licenses/LICENSE +0 -0
khoj/routers/api_chat.py
CHANGED
@@ -226,10 +226,11 @@ def chat_history(
|
|
226
226
|
agent_metadata = {
|
227
227
|
"slug": conversation.agent.slug,
|
228
228
|
"name": conversation.agent.name,
|
229
|
-
"
|
229
|
+
"is_creator": conversation.agent.creator == user,
|
230
230
|
"color": conversation.agent.style_color,
|
231
231
|
"icon": conversation.agent.style_icon,
|
232
232
|
"persona": conversation.agent.personality,
|
233
|
+
"is_hidden": conversation.agent.is_hidden,
|
233
234
|
}
|
234
235
|
|
235
236
|
meta_log = conversation.conversation_log
|
@@ -279,16 +280,29 @@ def get_shared_chat(
|
|
279
280
|
|
280
281
|
agent_metadata = None
|
281
282
|
if conversation.agent:
|
282
|
-
if conversation.agent.privacy_level == Agent.PrivacyLevel.PRIVATE:
|
283
|
-
conversation.agent
|
283
|
+
if conversation.agent.privacy_level == Agent.PrivacyLevel.PRIVATE and conversation.agent.creator != user:
|
284
|
+
if conversation.agent.is_hidden:
|
285
|
+
default_agent = AgentAdapters.get_default_agent()
|
286
|
+
agent_metadata = {
|
287
|
+
"slug": default_agent.slug,
|
288
|
+
"name": default_agent.name,
|
289
|
+
"is_creator": False,
|
290
|
+
"color": default_agent.style_color,
|
291
|
+
"icon": default_agent.style_icon,
|
292
|
+
"persona": default_agent.personality,
|
293
|
+
"is_hidden": default_agent.is_hidden,
|
294
|
+
}
|
295
|
+
else:
|
296
|
+
conversation.agent = None
|
284
297
|
else:
|
285
298
|
agent_metadata = {
|
286
299
|
"slug": conversation.agent.slug,
|
287
300
|
"name": conversation.agent.name,
|
288
|
-
"
|
301
|
+
"is_creator": conversation.agent.creator == user,
|
289
302
|
"color": conversation.agent.style_color,
|
290
303
|
"icon": conversation.agent.style_icon,
|
291
304
|
"persona": conversation.agent.personality,
|
305
|
+
"is_hidden": conversation.agent.is_hidden,
|
292
306
|
}
|
293
307
|
|
294
308
|
meta_log = conversation.conversation_log
|
@@ -443,6 +457,7 @@ def chat_sessions(
|
|
443
457
|
"updated_at",
|
444
458
|
"agent__style_icon",
|
445
459
|
"agent__style_color",
|
460
|
+
"agent__is_hidden",
|
446
461
|
)
|
447
462
|
|
448
463
|
session_values = [
|
@@ -454,6 +469,7 @@ def chat_sessions(
|
|
454
469
|
"updated": session[6].strftime("%Y-%m-%d %H:%M:%S"),
|
455
470
|
"agent_icon": session[7],
|
456
471
|
"agent_color": session[8],
|
472
|
+
"agent_is_hidden": session[9],
|
457
473
|
}
|
458
474
|
for session in sessions
|
459
475
|
]
|
@@ -474,6 +490,7 @@ async def create_chat_session(
|
|
474
490
|
request: Request,
|
475
491
|
common: CommonQueryParams,
|
476
492
|
agent_slug: Optional[str] = None,
|
493
|
+
# Add parameters here to create a custom hidden agent on the fly
|
477
494
|
):
|
478
495
|
user = request.user.object
|
479
496
|
|
@@ -865,7 +882,7 @@ async def chat(
|
|
865
882
|
# and not triggered via slash command
|
866
883
|
and not used_slash_summarize
|
867
884
|
# but we can't actually summarize
|
868
|
-
and len(file_filters)
|
885
|
+
and len(file_filters) == 0
|
869
886
|
):
|
870
887
|
conversation_commands.remove(ConversationCommand.Summarize)
|
871
888
|
elif ConversationCommand.Summarize in conversation_commands:
|
khoj/routers/api_model.py
CHANGED
@@ -20,13 +20,20 @@ def get_chat_model_options(
|
|
20
20
|
request: Request,
|
21
21
|
client: Optional[str] = None,
|
22
22
|
):
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
for
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
chat_models = ConversationAdapters.get_conversation_processor_options().all()
|
24
|
+
|
25
|
+
chat_model_options = list()
|
26
|
+
for chat_model in chat_models:
|
27
|
+
chat_model_options.append(
|
28
|
+
{
|
29
|
+
"name": chat_model.name,
|
30
|
+
"id": chat_model.id,
|
31
|
+
"strengths": chat_model.strengths,
|
32
|
+
"description": chat_model.description,
|
33
|
+
}
|
34
|
+
)
|
35
|
+
|
36
|
+
return Response(content=json.dumps(chat_model_options), media_type="application/json", status_code=200)
|
30
37
|
|
31
38
|
|
32
39
|
@api_model.get("/chat")
|
khoj/routers/helpers.py
CHANGED
@@ -393,12 +393,15 @@ async def aget_data_sources_and_output_format(
|
|
393
393
|
personality_context=personality_context,
|
394
394
|
)
|
395
395
|
|
396
|
+
agent_chat_model = agent.chat_model if agent else None
|
397
|
+
|
396
398
|
with timer("Chat actor: Infer information sources to refer", logger):
|
397
399
|
response = await send_message_to_model_wrapper(
|
398
400
|
relevant_tools_prompt,
|
399
401
|
response_type="json_object",
|
400
402
|
user=user,
|
401
403
|
query_files=query_files,
|
404
|
+
agent_chat_model=agent_chat_model,
|
402
405
|
tracer=tracer,
|
403
406
|
)
|
404
407
|
|
@@ -472,6 +475,8 @@ async def infer_webpage_urls(
|
|
472
475
|
personality_context=personality_context,
|
473
476
|
)
|
474
477
|
|
478
|
+
agent_chat_model = agent.chat_model if agent else None
|
479
|
+
|
475
480
|
with timer("Chat actor: Infer webpage urls to read", logger):
|
476
481
|
response = await send_message_to_model_wrapper(
|
477
482
|
online_queries_prompt,
|
@@ -479,6 +484,7 @@ async def infer_webpage_urls(
|
|
479
484
|
response_type="json_object",
|
480
485
|
user=user,
|
481
486
|
query_files=query_files,
|
487
|
+
agent_chat_model=agent_chat_model,
|
482
488
|
tracer=tracer,
|
483
489
|
)
|
484
490
|
|
@@ -528,6 +534,8 @@ async def generate_online_subqueries(
|
|
528
534
|
personality_context=personality_context,
|
529
535
|
)
|
530
536
|
|
537
|
+
agent_chat_model = agent.chat_model if agent else None
|
538
|
+
|
531
539
|
with timer("Chat actor: Generate online search subqueries", logger):
|
532
540
|
response = await send_message_to_model_wrapper(
|
533
541
|
online_queries_prompt,
|
@@ -535,6 +543,7 @@ async def generate_online_subqueries(
|
|
535
543
|
response_type="json_object",
|
536
544
|
user=user,
|
537
545
|
query_files=query_files,
|
546
|
+
agent_chat_model=agent_chat_model,
|
538
547
|
tracer=tracer,
|
539
548
|
)
|
540
549
|
|
@@ -628,10 +637,13 @@ async def extract_relevant_info(
|
|
628
637
|
personality_context=personality_context,
|
629
638
|
)
|
630
639
|
|
640
|
+
agent_chat_model = agent.chat_model if agent else None
|
641
|
+
|
631
642
|
response = await send_message_to_model_wrapper(
|
632
643
|
extract_relevant_information,
|
633
644
|
prompts.system_prompt_extract_relevant_information,
|
634
645
|
user=user,
|
646
|
+
agent_chat_model=agent_chat_model,
|
635
647
|
tracer=tracer,
|
636
648
|
)
|
637
649
|
return response.strip()
|
@@ -666,12 +678,15 @@ async def extract_relevant_summary(
|
|
666
678
|
personality_context=personality_context,
|
667
679
|
)
|
668
680
|
|
681
|
+
agent_chat_model = agent.chat_model if agent else None
|
682
|
+
|
669
683
|
with timer("Chat actor: Extract relevant information from data", logger):
|
670
684
|
response = await send_message_to_model_wrapper(
|
671
685
|
extract_relevant_information,
|
672
686
|
prompts.system_prompt_extract_relevant_summary,
|
673
687
|
user=user,
|
674
688
|
query_images=query_images,
|
689
|
+
agent_chat_model=agent_chat_model,
|
675
690
|
tracer=tracer,
|
676
691
|
)
|
677
692
|
return response.strip()
|
@@ -834,12 +849,15 @@ async def generate_better_diagram_description(
|
|
834
849
|
personality_context=personality_context,
|
835
850
|
)
|
836
851
|
|
852
|
+
agent_chat_model = agent.chat_model if agent else None
|
853
|
+
|
837
854
|
with timer("Chat actor: Generate better diagram description", logger):
|
838
855
|
response = await send_message_to_model_wrapper(
|
839
856
|
improve_diagram_description_prompt,
|
840
857
|
query_images=query_images,
|
841
858
|
user=user,
|
842
859
|
query_files=query_files,
|
860
|
+
agent_chat_model=agent_chat_model,
|
843
861
|
tracer=tracer,
|
844
862
|
)
|
845
863
|
response = response.strip()
|
@@ -864,9 +882,11 @@ async def generate_excalidraw_diagram_from_description(
|
|
864
882
|
query=q,
|
865
883
|
)
|
866
884
|
|
885
|
+
agent_chat_model = agent.chat_model if agent else None
|
886
|
+
|
867
887
|
with timer("Chat actor: Generate excalidraw diagram", logger):
|
868
888
|
raw_response = await send_message_to_model_wrapper(
|
869
|
-
query=excalidraw_diagram_generation, user=user, tracer=tracer
|
889
|
+
query=excalidraw_diagram_generation, user=user, agent_chat_model=agent_chat_model, tracer=tracer
|
870
890
|
)
|
871
891
|
raw_response = clean_json(raw_response)
|
872
892
|
try:
|
@@ -980,12 +1000,15 @@ async def generate_better_mermaidjs_diagram_description(
|
|
980
1000
|
personality_context=personality_context,
|
981
1001
|
)
|
982
1002
|
|
1003
|
+
agent_chat_model = agent.chat_model if agent else None
|
1004
|
+
|
983
1005
|
with timer("Chat actor: Generate better Mermaid.js diagram description", logger):
|
984
1006
|
response = await send_message_to_model_wrapper(
|
985
1007
|
improve_diagram_description_prompt,
|
986
1008
|
query_images=query_images,
|
987
1009
|
user=user,
|
988
1010
|
query_files=query_files,
|
1011
|
+
agent_chat_model=agent_chat_model,
|
989
1012
|
tracer=tracer,
|
990
1013
|
)
|
991
1014
|
response = response.strip()
|
@@ -1010,8 +1033,12 @@ async def generate_mermaidjs_diagram_from_description(
|
|
1010
1033
|
query=q,
|
1011
1034
|
)
|
1012
1035
|
|
1036
|
+
agent_chat_model = agent.chat_model if agent else None
|
1037
|
+
|
1013
1038
|
with timer("Chat actor: Generate Mermaid.js diagram", logger):
|
1014
|
-
raw_response = await send_message_to_model_wrapper(
|
1039
|
+
raw_response = await send_message_to_model_wrapper(
|
1040
|
+
query=mermaidjs_diagram_generation, user=user, agent_chat_model=agent_chat_model, tracer=tracer
|
1041
|
+
)
|
1015
1042
|
return clean_mermaidjs(raw_response.strip())
|
1016
1043
|
|
1017
1044
|
|
@@ -1072,9 +1099,16 @@ async def generate_better_image_prompt(
|
|
1072
1099
|
personality_context=personality_context,
|
1073
1100
|
)
|
1074
1101
|
|
1102
|
+
agent_chat_model = agent.chat_model if agent else None
|
1103
|
+
|
1075
1104
|
with timer("Chat actor: Generate contextual image prompt", logger):
|
1076
1105
|
response = await send_message_to_model_wrapper(
|
1077
|
-
image_prompt,
|
1106
|
+
image_prompt,
|
1107
|
+
query_images=query_images,
|
1108
|
+
user=user,
|
1109
|
+
query_files=query_files,
|
1110
|
+
agent_chat_model=agent_chat_model,
|
1111
|
+
tracer=tracer,
|
1078
1112
|
)
|
1079
1113
|
response = response.strip()
|
1080
1114
|
if response.startswith(('"', "'")) and response.endswith(('"', "'")):
|
@@ -1091,9 +1125,10 @@ async def send_message_to_model_wrapper(
|
|
1091
1125
|
query_images: List[str] = None,
|
1092
1126
|
context: str = "",
|
1093
1127
|
query_files: str = None,
|
1128
|
+
agent_chat_model: ChatModel = None,
|
1094
1129
|
tracer: dict = {},
|
1095
1130
|
):
|
1096
|
-
chat_model: ChatModel = await ConversationAdapters.aget_default_chat_model(user)
|
1131
|
+
chat_model: ChatModel = await ConversationAdapters.aget_default_chat_model(user, agent_chat_model)
|
1097
1132
|
vision_available = chat_model.vision_enabled
|
1098
1133
|
if not vision_available and query_images:
|
1099
1134
|
logger.warning(f"Vision is not enabled for default model: {chat_model.name}.")
|
@@ -1977,7 +2012,13 @@ def schedule_automation(
|
|
1977
2012
|
# Run automation at some random minute (to distribute request load) instead of running every X minutes
|
1978
2013
|
crontime = " ".join([str(math.floor(random() * 60))] + crontime.split(" ")[1:])
|
1979
2014
|
|
1980
|
-
|
2015
|
+
# Convert timezone string to timezone object
|
2016
|
+
try:
|
2017
|
+
user_timezone = pytz.timezone(timezone)
|
2018
|
+
except pytz.UnknownTimeZoneError:
|
2019
|
+
logger.error(f"Invalid timezone: {timezone}. Fallback to use UTC to schedule automation.")
|
2020
|
+
user_timezone = pytz.utc
|
2021
|
+
|
1981
2022
|
trigger = CronTrigger.from_crontab(crontime, user_timezone)
|
1982
2023
|
trigger.jitter = 60
|
1983
2024
|
# Generate id and metadata used by task scheduler and process locks for the task runs
|
@@ -2231,7 +2272,14 @@ def get_user_config(user: KhojUser, request: Request, is_detailed: bool = False)
|
|
2231
2272
|
chat_models = ConversationAdapters.get_conversation_processor_options().all()
|
2232
2273
|
chat_model_options = list()
|
2233
2274
|
for chat_model in chat_models:
|
2234
|
-
chat_model_options.append(
|
2275
|
+
chat_model_options.append(
|
2276
|
+
{
|
2277
|
+
"name": chat_model.name,
|
2278
|
+
"id": chat_model.id,
|
2279
|
+
"strengths": chat_model.strengths,
|
2280
|
+
"description": chat_model.description,
|
2281
|
+
}
|
2282
|
+
)
|
2235
2283
|
|
2236
2284
|
selected_paint_model_config = ConversationAdapters.get_user_text_to_image_model_config(user)
|
2237
2285
|
paint_model_options = ConversationAdapters.get_text_to_image_model_options().all()
|
khoj/utils/helpers.py
CHANGED
@@ -354,12 +354,12 @@ command_descriptions = {
|
|
354
354
|
}
|
355
355
|
|
356
356
|
command_descriptions_for_agent = {
|
357
|
-
ConversationCommand.General: "Agent can use
|
357
|
+
ConversationCommand.General: "Agent can use its own knowledge base and general knowledge.",
|
358
358
|
ConversationCommand.Notes: "Agent can search the personal knowledge base for information, as well as its own.",
|
359
359
|
ConversationCommand.Online: "Agent can search the internet for information.",
|
360
360
|
ConversationCommand.Webpage: "Agent can read suggested web pages for information.",
|
361
|
-
ConversationCommand.Summarize: "Agent can read an entire document. Agents knowledge base must be a single document.",
|
362
361
|
ConversationCommand.Research: "Agent can do deep research on a topic.",
|
362
|
+
ConversationCommand.Code: "Agent can run Python code to parse information, run complex calculations, create documents and charts.",
|
363
363
|
}
|
364
364
|
|
365
365
|
tool_descriptions_for_llm = {
|
@@ -369,7 +369,6 @@ tool_descriptions_for_llm = {
|
|
369
369
|
ConversationCommand.Online: "To search for the latest, up-to-date information from the internet. Note: **Questions about Khoj should always use this data source**",
|
370
370
|
ConversationCommand.Webpage: "To use if the user has directly provided the webpage urls or you are certain of the webpage urls to read.",
|
371
371
|
ConversationCommand.Code: "To run Python code in a Pyodide sandbox with no network access. Helpful when need to parse complex information, run complex calculations, create plaintext documents, and create charts with quantitative data. Only matplotlib, panda, numpy, scipy, bs4 and sympy external packages are available.",
|
372
|
-
ConversationCommand.Summarize: "To retrieve an answer that depends on the entire document or a large text.",
|
373
372
|
}
|
374
373
|
|
375
374
|
function_calling_description_for_llm = {
|
@@ -387,8 +386,6 @@ mode_descriptions_for_llm = {
|
|
387
386
|
|
388
387
|
mode_descriptions_for_agent = {
|
389
388
|
ConversationCommand.Image: "Agent can generate images in response. It cannot not use this to generate charts and graphs.",
|
390
|
-
ConversationCommand.Automation: "Agent can schedule a task to run at a scheduled date, time and frequency in response.",
|
391
|
-
ConversationCommand.Text: "Agent can generate text in response.",
|
392
389
|
ConversationCommand.Diagram: "Agent can generate a visual representation that requires primitives like lines, rectangles, and text.",
|
393
390
|
}
|
394
391
|
|
@@ -433,6 +430,18 @@ def generate_random_name():
|
|
433
430
|
return name
|
434
431
|
|
435
432
|
|
433
|
+
def generate_random_internal_agent_name():
|
434
|
+
random_name = generate_random_name()
|
435
|
+
|
436
|
+
random_name = random_name.replace(" ", "_")
|
437
|
+
|
438
|
+
random_number = random.randint(1000, 9999)
|
439
|
+
|
440
|
+
name = f"{random_name}{random_number}"
|
441
|
+
|
442
|
+
return name
|
443
|
+
|
444
|
+
|
436
445
|
def batcher(iterable, max_n):
|
437
446
|
"Split an iterable into chunks of size max_n"
|
438
447
|
it = iter(iterable)
|