Skip to content
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

Long messages cause an error #3441

Closed
lincheoll opened this issue Feb 11, 2025 · 16 comments
Closed

Long messages cause an error #3441

lincheoll opened this issue Feb 11, 2025 · 16 comments
Labels
bug Something isn't working

Comments

@lincheoll
Copy link
Contributor

Describe the bug

Long messages cause an error.

To Reproduce

Using PostgreSQL as the database, sending a message longer than 255 characters causes an error.

Alternatively, if the most recent message is too long (an error occurs in factsProvider), the issue arises due to the message length. Since it uses the levenshtein function, the error message:

"levenshtein argument exceeds maximum length of 255 characters"

appears when a long message is processed. This happens immediately when sending a long message at once. Applying slicing resolves the issue, but I'm not sure if that's the right approach.

It would be great if someone could fix this.

I'm curious about the best way to handle this, though I haven't tested it on other databases.

Expected behavior

Long texts or past chat history should not cause errors.

Screenshots

Additional context

I don’t think this happened before… I’m not sure. I don’t know where to look.

@lincheoll lincheoll added the bug Something isn't working label Feb 11, 2025
@alois8
Copy link

alois8 commented Feb 12, 2025

+1
(I have this in v0.25.6-alpha.1)

@lincheoll
Copy link
Contributor Author

@alois8
After checking, such an error does not occur in v0.1.9.
However, there seem to be other issues…

@odilitime
Copy link
Collaborator

Encountering this is a v0.1.9 copy

@tercel
Copy link
Contributor

tercel commented Feb 13, 2025

modify to below can work well.
levenshtein( left($1, 255), left(content_text, 255) )

@odilitime
Copy link
Collaborator

can confirm this worked

@salacoste
Copy link

still a problem at #v0.25.6-alpha.1 when switched on postgres

@salacoste
Copy link

modify to below can work well. levenshtein( left($1, 255), left(content_text, 255) )

at which file, sorry?

@nabeelraza-7
Copy link

modify to below can work well. levenshtein( left($1, 255), left(content_text, 255) )

at which file, sorry?

You will have to change getCachedEmbeddings function in your database adapter. In my case, it was adapter-postgres/src/index.ts and that worked.

@kingcozz
Copy link

how does this work if it cuts off at 255? dont we need the entire thing?

@odilitime
Copy link
Collaborator

it's just index used for searching, messages with more than 255 character won't have all their keywords indexed

@daniel-trevino
Copy link
Contributor

I can also confirm @tercel 's fix is working on my fork. I can open a PR with the fix if nobody is up for it.

What's the best approach to patch the bug? On the new community plugins or directly in main? cc @odilitime

@odilitime
Copy link
Collaborator

Adapter changes happens in elizaos-plugins, core changes here in eliza

@retdude
Copy link

retdude commented Feb 26, 2025

Has this been fixed yet? I have the same issue on my end as well. I opened an issue over here that describes my issue. It happens always, the moment I run pnpm start. Not even just when sending a long message:

elizaos-plugins/adapter-postgres#1

@xircusfounder
Copy link

any status on this fix?

@AlejoLovallo
Copy link

I have added the same fix in the adapter repository, they forgot to added it when they make the reorganization

@lincheoll
Copy link
Contributor Author

In v2, the plugin has been separated into a different codebase, so I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests