-
Notifications
You must be signed in to change notification settings - Fork 965
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
add support for json objects in the Message component #292
Conversation
@@ -49,6 +49,10 @@ function prepareContent({ id, elements, content, language }: Props) { | |||
? new RegExp(`(${elementNames.join('|')})`, 'g') | |||
: undefined; | |||
|
|||
if (typeof content === 'object') { |
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.
Might technically be a number or boolean too. Perhaps typeof content !== 'string'
?
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.
just moved the logic to the server. it has to be a string because the message can be persisted and has to respect the DB schema
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.
LGTM
Just occurred to me that LangChain's web scrapers produce Document. (They are |
It gets a little fiddly. from langchain.schema.document import Document
...
'structured': {
'doc': Document(page_content='...'),
... then I get
Looks like we'd need to give |
Edit: Actually no, I'll come back to what I just say: LangChain callback chain of thoughts should work out of the box indeed, so yes, we need something like this, at least when the LangChain callback handler is used. |
Co-authored-by: Guillaume Gelin <[email protected]>
Co-authored-by: Guillaume Gelin <[email protected]>
Co-authored-by: Guillaume Gelin <[email protected]>
I could even argue that a Langchain document should be a text element rather than a message content. Should we keep the support for dicts in the message class and open another PR for Langchain edge cases or do you think everything should be handled in the Langchain specific solution and the message class should always accept a string? |
proposal to fix #291