Replies: 1 comment
-
I found a similar open issue: [Bug]: TableTransactionError in AzureChatStore. The suggested solution is to ensure that the transaction operations are correctly formed and that the entities being deleted or created do not conflict. Here are the steps to consider:
If the issue persists, you may need to add logging or debugging statements to inspect the entities being processed in the transaction to identify any conflicts or issues [1]. Additionally, here is a more detailed approach to resolving the
Here is an example of how you might modify the def set_messages(self, key: str, messages: List[ChatMessage]) -> None:
"""Set messages for a key."""
chat_client = self._table_service_client.create_table_if_not_exists(
self.chat_table_name
)
entities = chat_client.query_entities(f"PartitionKey eq '{key}'")
# Ensure entities exist before attempting to delete
existing_entities = list(entities)
if not existing_entities:
raise ResourceNotFoundError(f"No entities found for PartitionKey: {key}")
delete_operations = (
(TransactionOperation.DELETE, entity) for entity in existing_entities
)
create_operations = (
(
TransactionOperation.CREATE,
serialize(
self.service_mode,
{
"PartitionKey": key,
"RowKey": self._to_row_key(idx),
**message.dict(),
},
),
)
for idx, message in enumerate(messages)
)
chat_client.submit_transaction(chain(delete_operations, create_operations))
# Update metadata
metadata_client = self._table_service_client.create_table_if_not_exists(
self.metadata_table_name
)
messages_len = len(messages)
metadata_client.upsert_entity(
{
"PartitionKey": self.metadata_partition_key,
"RowKey": key,
"LastMessageRowKey": self._to_row_key(messages_len - 1),
"MessageCount": messages_len,
},
UpdateMode.REPLACE,
) For a practical example of how to set up and use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When trying to use AzureChatStore together with ReActAgent, a TableTransactionError occurs
Version of llama-index: 0.11.1
Steps to Reproduce
Create agent:
At the first call everything is ok, the data is entered into the table:
But if you try to use the agent for the second time, the TableTransactionError occurs:
P.S. Everythinkg works fine with RedisChatStore, so this error is in the llama-index-storage-chat-store-azure library
Beta Was this translation helpful? Give feedback.
All reactions