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
Fix SQLAlchemy truncating text when it is too big #5206
Conversation
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.
so on one hand this seems reasonable
on the other hand, this may actually weirdly be desirable as LLMs have a limited context length so tough to make work with long strings so this could have actually been saving some stuff...
@hwchase17 I'm going to add this truncate feature and make it default to the same as in SQLAchemy so we keep the behavior but the user can decide if they want to change it or not, I've one question is there a good place to put utility functions, I'd like to put that string truncate function in a place that can be reused, utils.py perhaps? |
@hwchase17 I've added options to change the "truncation" size and add defaults so the behavior will be almost the same as before, but cleaner and without truncating the chain, let me know if you want any other changes. |
…d added default to keep the same behavior as before.
96688bc
to
de89d59
Compare
@eyurtsev I think I've covered it all, let me know if we need more changes |
Hey @eyurtsev do you wanna any other fix in this PR? thanks in advance. |
Thanks for pinging me! @wsantos |
# Fixes SQLAlchemy truncating the result if you have a big/text column with many chars. SQLAlchemy truncates columns if you try to convert a Row or Sequence to a string directly For comparison: - Before: ```[('Harrison', 'That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ... (2 characters truncated) ... hat is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ')]``` - After: ```[('Harrison', 'That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ')]``` ## Who can review? Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested: I'm not sure who to tag for chains, maybe @vowelparrot ?
Fixes SQLAlchemy truncating the result if you have a big/text column with many chars.
SQLAlchemy truncates columns if you try to convert a Row or Sequence to a string directly
For comparison:
Before:
[('Harrison', 'That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ... (2 characters truncated) ... hat is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ')]
After:
[('Harrison', 'That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio That is my Bio ')]
Who can review?
Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:
I'm not sure who to tag for chains, maybe @vowelparrot ?