-
Notifications
You must be signed in to change notification settings - Fork 0
[ION-281] use all the API parameters #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0507518 to
69465f9
Compare
69465f9 to
023bb7f
Compare
* 📦 upgrade SDK to 0.5.3 (#3) * tests * 📦 update ionic-sdk-python * 🏷️ bump version * inject ionic into tool (#4) * let ionic be injected into tool * 🏷️ bump version * 📖 [ION-283] document langchain tool (#5) * 📦 fleixble langchain dependency; pinned sdk Idea here being we control which SDK version is being used but allow developers to have higher patch versions of langchain. https://python-poetry.org/docs/dependency-specification/#tilde-requirements * 📖 first pass at documentation * Update README.md * 👷♂️📦🏷️ [ION-285] workflow for publishing new releases (#7) * 👷♂️📦 workflow for publishing new releases Right now this requires manually bumping poetry and creating a git release but I added a couple of guardrails so that we ensure we only publish when the poetry package version matches the github release reference. Future iteration will move the version bumping and release cutting to the workflow. * 🏷️ bump verison to 0.1.3 want something to test with when this merges * set workflow up for iterative testing * dry run for publishing * warn instead of fail if tag checks fail * 👷♂️ [ION-285] release publication workflow fixups (#8) * 📌 pin python version * 🐛 use ref_name instead of ref ref is a lot longer, e.g. 'refs/heads/gmkohler/ION-285' found with debug logging * 🏷️ bump patch version want to compare with new release * 👷♂️ [ION-285] Revert "set workflow up for iterative testing" (#10) * Revert "set workflow up for iterative testing" This reverts commit 49cc39f. * 🏷️ bump version to 0.1.5 want to test the release guardrails * 👷♂️ [ION-285] adjust github expressions (#11) * tidy expressions up think it all needs to be interpolated * 🏷️ poetry version patch need to verify new changes * 👷♂️ [ION-285] automate version bumping / tagging in release workflow (#9) * 👷♂️ bump version within workflow * ☑️ use type: choice for release input This should enforce a dropdown * fix release-action name * tidy release step * 🏷️ prepare version v0.1.7 for release * 🏷️ prepare version v0.1.8 for release * 📖 add sentence re: python version support (#12) * 📖 install library from PyPI instead of GitHub (#13) * Reduce min python version (#14) * version * readme * whoops * working example (#15) --------- Co-authored-by: Gregory M Kohler <gregory@ionicapi.com> Co-authored-by: gmkohler <gmkohler@users.noreply.github.com> Co-authored-by: Owen Sims <owen@ionicapi.com>
a703e70 to
f409645
Compare
c1744bb to
4143b74
Compare
4143b74 to
262741b
Compare
ionic_langchain/prompt.py
Outdated
| 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 stringified List of each search value, for example `['coffee beans']` or `['coffee beans', 'coffee grinder']` and returns results for each search. | ||
| Ionic Tool input is a comma seperated string of values: query (required), number of results, minimum price, and maximum price. For example `coffee beans, 2, 5, 10` or `coffee beans, 2` or `coffee beans, 2, 5` or `coffee beans, 2, , 10`. If the user has not specified how many results they want, use 5 as the default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price as cents?
| @@ -1,7 +1,7 @@ | |||
| TOOL_PROMPT = """ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could stand for a broader update this is pretty old. Added a ticket for later: https://linear.app/ionic-commerce/issue/ION-535/update-langchain-prompt
ionic_langchain/tool.py
Outdated
| :return: | ||
| """ | ||
| query = query_input.query | ||
| split_query = query_input.split(",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for various valid and invalid permutations? This is pretty complex so want to make sure we're covered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://peps.python.org/pep-3132/ maybe valuable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for testing, mock the request or better yet split this into a helper and just test that.
| split_query = query_input.split(",") | ||
| len4_query = split_query + [None] * (4 - len(split_query)) # pad with None | ||
|
|
||
| query, num_results, min_price, max_price, *rest = [ # *rest ignores extra values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How certain are we that the given query_input matches the correct format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its the format that is specified in the prompt. 😅
Query only accepts 1 query now, and extra parameters are commas-separated values in the 1 input string.
The query was:
'query': {'query': 'hair dryers', 'max_price': 50000, 'min_price': 10000, 'num_results': 7}