openai-cookbook
openai-cookbook copied to clipboard
ResponseError: Invalid field type for field `content_vector`
This is for the Chatbot app.
I have the Redisearch module loaded. The errant code:
# Optional step to drop the index if it already exists
#redis_client.ft(INDEX_NAME).dropindex()
# Check if index exists
try:
redis_client.ft(INDEX_NAME).info()
print("Index already exists")
except Exception as e:
print(e)
# Create RediSearch Index
print('Not there yet. Creating')
redis_client.ft(INDEX_NAME).create_index(
fields = fields,
definition = IndexDefinition(prefix=[PREFIX], index_type=IndexType.HASH)
)
Output:
Unknown Index name
Not there yet. Creating
---------------------------------------------------------------------------
ResponseError Traceback (most recent call last)
Cell In[40], line 6
5 try:
----> 6 redis_client.ft(INDEX_NAME).info()
7 print("Index already exists")
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/commands/search/commands.py:370, in SearchCommands.info(self)
363 """
364 Get info an stats about the the current index, including the number of
365 documents, memory consumption, etc
366
367 For more information see `FT.INFO <https://redis.io/commands/ft.info>`_.
368 """
--> 370 res = self.execute_command(INFO_CMD, self.index_name)
371 it = map(to_string, res)
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1258, in Redis.execute_command(self, *args, **options)
1257 try:
-> 1258 return conn.retry.call_with_retry(
1259 lambda: self._send_command_parse_response(
1260 conn, command_name, *args, **options
1261 ),
1262 lambda error: self._disconnect_raise(conn, error),
1263 )
1264 finally:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/retry.py:46, in Retry.call_with_retry(self, do, fail)
45 try:
---> 46 return do()
47 except self._supported_errors as error:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1259, in Redis.execute_command.<locals>.<lambda>()
1257 try:
1258 return conn.retry.call_with_retry(
-> 1259 lambda: self._send_command_parse_response(
1260 conn, command_name, *args, **options
1261 ),
1262 lambda error: self._disconnect_raise(conn, error),
1263 )
1264 finally:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1235, in Redis._send_command_parse_response(self, conn, command_name, *args, **options)
1234 conn.send_command(*args)
-> 1235 return self.parse_response(conn, command_name, **options)
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1275, in Redis.parse_response(self, connection, command_name, **options)
1274 else:
-> 1275 response = connection.read_response()
1276 except ResponseError:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/connection.py:957, in Connection.read_response(self, disable_decoding)
956 if isinstance(response, ResponseError):
--> 957 raise response
958 return response
ResponseError: Unknown Index name
During handling of the above exception, another exception occurred:
ResponseError Traceback (most recent call last)
Cell In[40], line 12
10 # Create RediSearch Index
11 print('Not there yet. Creating')
---> 12 redis_client.ft(INDEX_NAME).create_index(
13 fields = fields,
14 definition = IndexDefinition(prefix=[PREFIX], index_type=IndexType.HASH)
15 )
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/commands/search/commands.py:141, in SearchCommands.create_index(self, fields, no_term_offsets, no_field_flags, stopwords, definition, max_text_fields, temporary, no_highlight, no_term_frequencies, skip_initial_scan)
138 except TypeError:
139 args += fields.redis_args()
--> 141 return self.execute_command(*args)
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1258, in Redis.execute_command(self, *args, **options)
1255 conn = self.connection or pool.get_connection(command_name, **options)
1257 try:
-> 1258 return conn.retry.call_with_retry(
1259 lambda: self._send_command_parse_response(
1260 conn, command_name, *args, **options
1261 ),
1262 lambda error: self._disconnect_raise(conn, error),
1263 )
1264 finally:
1265 if not self.connection:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/retry.py:46, in Retry.call_with_retry(self, do, fail)
44 while True:
45 try:
---> 46 return do()
47 except self._supported_errors as error:
48 failures += 1
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1259, in Redis.execute_command.<locals>.<lambda>()
1255 conn = self.connection or pool.get_connection(command_name, **options)
1257 try:
1258 return conn.retry.call_with_retry(
-> 1259 lambda: self._send_command_parse_response(
1260 conn, command_name, *args, **options
1261 ),
1262 lambda error: self._disconnect_raise(conn, error),
1263 )
1264 finally:
1265 if not self.connection:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1235, in Redis._send_command_parse_response(self, conn, command_name, *args, **options)
1231 """
1232 Send a command and parse the response
1233 """
1234 conn.send_command(*args)
-> 1235 return self.parse_response(conn, command_name, **options)
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/client.py:1275, in Redis.parse_response(self, connection, command_name, **options)
1273 options.pop(NEVER_DECODE)
1274 else:
-> 1275 response = connection.read_response()
1276 except ResponseError:
1277 if EMPTY_RESPONSE in options:
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/redis/connection.py:957, in Connection.read_response(self, disable_decoding)
954 self.next_health_check = time() + self.health_check_interval
956 if isinstance(response, ResponseError):
--> 957 raise response
958 return response
ResponseError: Invalid field type for field `content_vector`
I'm facing the same issue, any hints on how to resolve this ?
I believe this is an issue with your version of redisearch. I was just using 2.0.2 and getting this error, but it worked once I switched to 2.4.3.
I was just running redis locally with the docker images.
Works: docker run -p 6379:6379 redislabs/redisearch:2.4.3
Error you're experiencing: docker run -p 6379:6379 redislabs/redisearch:2.0.2
I believe this is an issue with your version of redisearch. I was just using 2.0.2 and getting this error, but it worked once I switched to 2.4.3.
I was just running redis locally with the docker images.
Works: docker run -p 6379:6379 redislabs/redisearch:2.4.3
Error you're experiencing: docker run -p 6379:6379 redislabs/redisearch:2.0.2
This solution works!! Thanks!!
Can confirm -- please make sure to use the latest version of RediSearch module within Redis Stack: https://redis.io/docs/stack/get-started/install/docker/ OR signup for a hosted instance on Redis Cloud to not deal with the hassle of managing it.
The officially recommended docker command (from link above):
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.
This issue was closed because it has been stalled for 10 days with no activity.