Skip to content

Commit 1677e59

Browse files
committed
Fix redisvl API compatibility in course_manager
Handle both list and object with .docs attribute from vector_index.query() to support different redisvl versions.
1 parent bc37b82 commit 1677e59

File tree

1 file changed

+4
-2
lines changed
  • python-recipes/context-engineering/reference-agent/redis_context_course

1 file changed

+4
-2
lines changed

python-recipes/context-engineering/reference-agent/redis_context_course/course_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,12 @@ async def search_courses(
152152

153153
# Execute search
154154
results = self.vector_index.query(vector_query)
155-
155+
156156
# Convert results to Course objects
157157
courses = []
158-
for result in results.docs:
158+
# Handle both list and object with .docs attribute
159+
result_list = results if isinstance(results, list) else results.docs
160+
for result in result_list:
159161
if result.vector_score >= similarity_threshold:
160162
course = self._dict_to_course(result.__dict__)
161163
if course:

0 commit comments

Comments
 (0)