From 9dfaa5ffcdbe75bc785b5799ebee031e1945d7d9 Mon Sep 17 00:00:00 2001 From: Jarod Stewart Date: Thu, 25 Jan 2024 16:00:53 -0700 Subject: [PATCH 1/4] Shorter prompt and name cannot include spaces --- ionic_langchain/prompt.py | 10 ++-------- ionic_langchain/tool.py | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/ionic_langchain/prompt.py b/ionic_langchain/prompt.py index c71bce3..410e9d3 100644 --- a/ionic_langchain/prompt.py +++ b/ionic_langchain/prompt.py @@ -1,13 +1,7 @@ -TOOL_PROMPT = """ +TOOL_PROMPT = str(""" Ionic is an ecommerce shopping tool. Assistant uses the Ionic Commerce Shopping Tool to find, discover, and compare products from thousands of online retailers. Assistant should use the tool when the user is looking for a product recommendation or trying to find a specific product. The user can specify the number of results, minimum price, and maximum price that they want to see results for. Ionic Tool input is a comma seperated string of values: query (required), number of results (default to 5), minimum price in cents, and maximum price in cents. For example `coffee beans, 5, 500, 1000` or `coffee beans, 5` or `coffee beans, 5, 500` or `coffee beans, 5, , 1000`. If the user has not specified how many results they want, use 5 as the default. Convert the price to cents before passing to the tool. For example, if the user asks for a product between $5 and $10, you would pass `500` and `1000` to the tool. - - If the human asks for what items are needed for an activity or project, you can provide product recommendations alongside your response about the required items instead of waiting for the user to follow up after. - For example, if the user asks 'what do I need to go camping?', you would compile your list of product requirements for camping (e.g. 'tent', 'stove', 'sleeping bag'), and before responding to user you might use Ionic Tool for - recommendations on those items. Avoid using Ionic for general topics like 'camping gear' when you or the user have already begun listing specific items. If the user's request is broad or vague, you should ask clarifying questions before using tool. You should build the query input based on the latest topic of conversation. If a new topic or product search is started, you would create a new query. - - Always end your message with a friendly message asking if the user is satisfied with the results or if they have additional requirements. -""" +""") diff --git a/ionic_langchain/tool.py b/ionic_langchain/tool.py index 414e20f..32a0951 100644 --- a/ionic_langchain/tool.py +++ b/ionic_langchain/tool.py @@ -93,7 +93,7 @@ def tool(self) -> Tool: """ return Tool.from_function( func=self._ionic.query, - name="Ionic Commerce Shopping Tool", + name="Ionic_Commerce_Shopping_Tool", description=TOOL_PROMPT, verbose=True, ) From 6c3e9a9d0b6cf1e02230b1748a7d141a2514c109 Mon Sep 17 00:00:00 2001 From: Jarod Stewart Date: Fri, 26 Jan 2024 09:35:18 -0700 Subject: [PATCH 2/4] Prompt agent to use full pdp url --- ionic_langchain/prompt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ionic_langchain/prompt.py b/ionic_langchain/prompt.py index 410e9d3..fd9ce30 100644 --- a/ionic_langchain/prompt.py +++ b/ionic_langchain/prompt.py @@ -3,5 +3,6 @@ The user can specify the number of results, minimum price, and maximum price that they want to see results for. Ionic Tool input is a comma seperated string of values: query (required), number of results (default to 5), minimum price in cents, and maximum price in cents. For example `coffee beans, 5, 500, 1000` or `coffee beans, 5` or `coffee beans, 5, 500` or `coffee beans, 5, , 1000`. If the user has not specified how many results they want, use 5 as the default. - Convert the price to cents before passing to the tool. For example, if the user asks for a product between $5 and $10, you would pass `500` and `1000` to the tool. + Convert the price to cents before passing to the tool. For example, if the user asks for a product between $5 and $10, you would pass `500` and `1000` to the tool. + Use the full pdp type url when presenting to users. """) From 4baaa022c2ee9e230950fd0820da1009adcdacac Mon Sep 17 00:00:00 2001 From: Jarod Stewart Date: Fri, 26 Jan 2024 10:55:22 -0700 Subject: [PATCH 3/4] expand tool prompt within length --- ionic_langchain/prompt.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ionic_langchain/prompt.py b/ionic_langchain/prompt.py index fd9ce30..4e044aa 100644 --- a/ionic_langchain/prompt.py +++ b/ionic_langchain/prompt.py @@ -1,8 +1,14 @@ TOOL_PROMPT = str(""" - Ionic is an ecommerce shopping tool. Assistant uses the Ionic Commerce Shopping Tool to find, discover, and compare products from thousands of online retailers. Assistant should use the tool when the user is looking for a product recommendation or trying to find a specific product. +Ionic is an e-commerce shopping tool. Assistant uses the Ionic Commerce Shopping Tool to find, discover, and compare products from thousands of online retailers. Assistant should use the tool when the user is looking for a product recommendation or trying to find a specific product. - The user can specify the number of results, minimum price, and maximum price that they want to see results for. - Ionic Tool input is a comma seperated string of values: query (required), number of results (default to 5), minimum price in cents, and maximum price in cents. For example `coffee beans, 5, 500, 1000` or `coffee beans, 5` or `coffee beans, 5, 500` or `coffee beans, 5, , 1000`. If the user has not specified how many results they want, use 5 as the default. - Convert the price to cents before passing to the tool. For example, if the user asks for a product between $5 and $10, you would pass `500` and `1000` to the tool. - Use the full pdp type url when presenting to users. +The user may specify the number of results, minimum price, and maximum price for which they want to see results. +Ionic Tool input is a comma-separated string of values: + - query (required) + - number of results (default to 5) + - minimum price in cents + - maximum price in cents +For example, `coffee beans, 5, 500, 1000` or `coffee beans, 5` or `coffee beans, 5, 500` or `coffee beans, 5, 1000`. +Query values cannot include commas; replace with `-` +Convert the price to cents before passing to the tool. For example, if the user asks for a product between $5 and $10, you would pass `500` and `1000` to the tool. +Use the full detail PDP URL and always include query parameters. """) From e80fd78b45232dfef0b303c231a65b7420d5e237 Mon Sep 17 00:00:00 2001 From: Jarod Stewart Date: Fri, 26 Jan 2024 14:27:26 -0700 Subject: [PATCH 4/4] lowercase name --- ionic_langchain/tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionic_langchain/tool.py b/ionic_langchain/tool.py index 32a0951..c116407 100644 --- a/ionic_langchain/tool.py +++ b/ionic_langchain/tool.py @@ -93,7 +93,7 @@ def tool(self) -> Tool: """ return Tool.from_function( func=self._ionic.query, - name="Ionic_Commerce_Shopping_Tool", + name="ionic_commerce_shopping_tool", description=TOOL_PROMPT, verbose=True, )