Skip to content

Commit 53a9d61

Browse files
authored
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.
1 parent 7bb6d04 commit 53a9d61

File tree

1 file changed

+2
-2
lines changed
  • libs/langchain/langchain/memory/chat_message_histories

1 file changed

+2
-2
lines changed

libs/langchain/langchain/memory/chat_message_histories/xata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _create_table_if_not_exists(self) -> None:
5656
{"name": "role", "type": "string"},
5757
{"name": "content", "type": "text"},
5858
{"name": "name", "type": "string"},
59-
{"name": "additionalKwargs", "type": "text"},
59+
{"name": "additionalKwargs", "type": "json"},
6060
]
6161
},
6262
)
@@ -101,7 +101,7 @@ def messages(self) -> List[BaseMessage]: # type: ignore
101101
"content": m["content"],
102102
"role": m.get("role"),
103103
"name": m.get("name"),
104-
"additionalKwargs": json.loads(m["additionalKwargs"]),
104+
"additional_kwargs": json.loads(m["additionalKwargs"]),
105105
},
106106
}
107107
for m in r["records"]

0 commit comments

Comments
 (0)