From ee3ae18f5556b7d1ba35ab4e54c201c2582ac593 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Tue, 28 Jan 2025 18:11:25 -0800 Subject: [PATCH] add code, remove summarize from agent tools --- .../0084_alter_agent_input_tools.py | 33 +++++++++++++++++++ src/khoj/database/models/__init__.py | 4 +-- src/khoj/utils/helpers.py | 3 +- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 src/khoj/database/migrations/0084_alter_agent_input_tools.py diff --git a/src/khoj/database/migrations/0084_alter_agent_input_tools.py b/src/khoj/database/migrations/0084_alter_agent_input_tools.py new file mode 100644 index 00000000..8133d579 --- /dev/null +++ b/src/khoj/database/migrations/0084_alter_agent_input_tools.py @@ -0,0 +1,33 @@ +# Generated by Django 5.0.10 on 2025-01-28 23:35 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("database", "0083_alter_agent_output_modes_alter_agent_personality_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="agent", + name="input_tools", + field=django.contrib.postgres.fields.ArrayField( + base_field=models.CharField( + choices=[ + ("general", "General"), + ("online", "Online"), + ("notes", "Notes"), + ("webpage", "Webpage"), + ("code", "Code"), + ], + max_length=200, + ), + blank=True, + default=list, + null=True, + size=None, + ), + ), + ] diff --git a/src/khoj/database/models/__init__.py b/src/khoj/database/models/__init__.py index 8e76d3ec..51bc8e27 100644 --- a/src/khoj/database/models/__init__.py +++ b/src/khoj/database/models/__init__.py @@ -280,8 +280,8 @@ class Agent(DbBaseModel): GENERAL = "general" ONLINE = "online" NOTES = "notes" - SUMMARIZE = "summarize" - WEBPAGE = "webpage" + WEBPAGE = ("webpage",) + CODE = "code" class OutputModeOptions(models.TextChoices): # These map to various ConversationCommand types diff --git a/src/khoj/utils/helpers.py b/src/khoj/utils/helpers.py index 1682b166..32290657 100644 --- a/src/khoj/utils/helpers.py +++ b/src/khoj/utils/helpers.py @@ -358,8 +358,8 @@ command_descriptions_for_agent = { ConversationCommand.Notes: "Agent can search the personal knowledge base for information, as well as its own.", ConversationCommand.Online: "Agent can search the internet for information.", ConversationCommand.Webpage: "Agent can read suggested web pages for information.", - ConversationCommand.Summarize: "Agent can read an entire document. Agents knowledge base must be a single document.", ConversationCommand.Research: "Agent can do deep research on a topic.", + ConversationCommand.Code: "Agent can run Python code to parse information, run complex calculations, create documents and charts.", } tool_descriptions_for_llm = { @@ -369,7 +369,6 @@ tool_descriptions_for_llm = { ConversationCommand.Online: "To search for the latest, up-to-date information from the internet. Note: **Questions about Khoj should always use this data source**", ConversationCommand.Webpage: "To use if the user has directly provided the webpage urls or you are certain of the webpage urls to read.", 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.", - ConversationCommand.Summarize: "To retrieve an answer that depends on the entire document or a large text.", } function_calling_description_for_llm = {