From 66f58df0a161152a85f166db87d31a4f0c3962f1 Mon Sep 17 00:00:00 2001 From: Haofei Yu <1125027232@qq.com> Date: Wed, 1 Nov 2023 13:59:44 -0400 Subject: [PATCH] add a test --- llm_generate/test_redis2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 llm_generate/test_redis2.py diff --git a/llm_generate/test_redis2.py b/llm_generate/test_redis2.py new file mode 100644 index 00000000..9e3996cf --- /dev/null +++ b/llm_generate/test_redis2.py @@ -0,0 +1,18 @@ +from redis_om import JsonModel, get_redis_connection + +class Person(JsonModel): + name: str + age: int + +# Create an instance of your model +person = Person(name="John", age=30) + +# Save to Redis +person.save() + +# Retrieve from Redis +retrieved_person = Person.load(person.id) + +# Print the retrieved data +print(retrieved_person.name) # Output: John +print(retrieved_person.age) # Output: 30 \ No newline at end of file