Xata chat memory FIX (#11145)

- **Description:** Changed data type from `text` to `json` in xata for
improved performance. Also corrected the `additionalKwargs` key in the
`messages()` function to `additional_kwargs` to adhere to `BaseMessage`
requirements.
- **Issue:** The Chathisroty.messages() will return {} of
`additional_kwargs`, as the name is wrong for `additionalKwargs` .
  - **Dependencies:**  N/A
  - **Tag maintainer:** N/A
  - **Twitter handle:** N/A

My PR is passing linting and testing before submitting.
pull/11113/head^2
Nan LI 11 months ago committed by GitHub
parent 7bb6d04fc7
commit 53a9d6115e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,7 +56,7 @@ class XataChatMessageHistory(BaseChatMessageHistory):
{"name": "role", "type": "string"},
{"name": "content", "type": "text"},
{"name": "name", "type": "string"},
{"name": "additionalKwargs", "type": "text"},
{"name": "additionalKwargs", "type": "json"},
]
},
)
@ -101,7 +101,7 @@ class XataChatMessageHistory(BaseChatMessageHistory):
"content": m["content"],
"role": m.get("role"),
"name": m.get("name"),
"additionalKwargs": json.loads(m["additionalKwargs"]),
"additional_kwargs": json.loads(m["additionalKwargs"]),
},
}
for m in r["records"]

Loading…
Cancel
Save