Skip to content

Commit

Permalink
refactor: use NO_CONTENT on the RedisChatMessageHistory __len Query
Browse files Browse the repository at this point in the history
  • Loading branch information
bsbodden committed Sep 9, 2024
1 parent 805b9a2 commit 9ef01e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/redis/langchain_redis/chat_message_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,5 @@ def search_messages(self, query: str, limit: int = 10) -> List[Dict[str, Any]]:
return [json.loads(doc.json)["data"] for doc in results.docs]

def __len__(self) -> int:
query = Query(f"@session_id:{{{self.session_id}}}")
query = Query(f"@session_id:{{{self.session_id}}}").no_content()
return self.redis_client.ft(self.index_name).search(query).total

0 comments on commit 9ef01e6

Please sign in to comment.