Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions ionic_langchain/prompt.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
TOOL_PROMPT = """
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.
TOOL_PROMPT = str("""
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.

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.
"""
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.
""")
2 changes: 1 addition & 1 deletion ionic_langchain/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)