quarkiverse/quarkus-langchain4j

Custom memory id is now converted to String

Closed this issue · 11 comments

With this PR, #594, the custom memory ID is converted to String, even if this memory ID is not a String.

I believe it introduces a significant restriction, at the langchain4J level it is documented that the memory ID can be any object.

I can no longer pass a pair of properties representing an authentication session in #539.

Is it possible to rework #594 ?

Perhaps do the extra addition only if it is an instance of String ?

I can no longer pass a pair of properties representing an authentication session in #539.

Why not? If should work correctly if toString works correctly.

Perhaps do the extra addition only if it is an instance of String ?

That would leave the use case that we intended to fix by adding the AI service, broken

Why not? If should work correctly if toString works correctly.

I can do some manual parsing, but it is not a good dev experience for anyone interested to use anything but String for a memory id.

That would leave the use case that we intended to fix by adding the AI service, broken

Sure, that one has to be supported, but now quarkus-langchain4j can only support String as a memory id.

I can workaround about it, but I guess there should be a doc note about it if you prefer to close this issue

Thanks

I suppose with @MemoryId users can still use objects, this update only impacts memory id providers

I can do some manual parsing, but it is not a good dev experience for anyone interested to use anything but String for a memory id.

There should really be nothing the developer needs to do because this is really an SPI meant to be implemented by integration code.

Sure, that one has to be supported, but now quarkus-langchain4j can only support String as a memory id.

Not exactly: It's the default memory Id service (which only kicks in when no memoryId is provided) that needs to come up with an object that can be converted to a unique string.

Georgios, but we've discussed the use case before, and I thought we agreed it was worth pursuing, how do I demo a case where a security session which correctly covers the current user interactions can be used to support the user specific retrieval ? The only tool to customize the memory id is DefaultMemoryIdProvider and now it does not work any more.

Should I reopen #523 to have a provider which is not meant to be for internal use only ?

Sure, you can go ahead and do it, it's just that now you'll have to make sure that whatever you use as the key for the memory can be properly converted into a unique string unfortunately there is no way around this

All right, I can work with a string, and expect a # suffix, it is not too difficult, thanks

👍🏼