mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
~ truncate vectors for pgvector if too big
This commit is contained in:
parent
4ee5dd58b7
commit
da9966aca1
@ -141,9 +141,8 @@ class PgvectorClient(VectorDBBase):
|
|||||||
# Pad the vector with zeros
|
# Pad the vector with zeros
|
||||||
vector += [0.0] * (VECTOR_LENGTH - current_length)
|
vector += [0.0] * (VECTOR_LENGTH - current_length)
|
||||||
elif current_length > VECTOR_LENGTH:
|
elif current_length > VECTOR_LENGTH:
|
||||||
raise Exception(
|
# Truncate the vector to VECTOR_LENGTH
|
||||||
f"Vector length {current_length} not supported. Max length must be <= {VECTOR_LENGTH}"
|
vector = vector[:VECTOR_LENGTH]
|
||||||
)
|
|
||||||
return vector
|
return vector
|
||||||
|
|
||||||
def insert(self, collection_name: str, items: List[VectorItem]) -> None:
|
def insert(self, collection_name: str, items: List[VectorItem]) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user