File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,19 @@ def _process_content_embeddings(serialized_content):
262
262
)
263
263
for md in split_metadatas
264
264
]
265
- split_embeddings = list (encoder .embed_documents (split_texts ))
265
+ split_embeddings = []
266
+ """
267
+ Break up requests according to chunk size to stay under openai limits
268
+ 600,000 tokens per request
269
+ max array size: 2048
270
+ see: https://platform.openai.com/docs/guides/rate-limits
271
+ """
272
+ request_chunk_size = int (
273
+ 600000 / settings .CONTENT_FILE_EMBEDDING_CHUNK_SIZE_OVERRIDE
274
+ )
275
+ for i in range (0 , len (split_texts ), request_chunk_size ):
276
+ split_chunk = split_texts [i : i + request_chunk_size ]
277
+ split_embeddings .extend (list (encoder .embed_documents (split_chunk )))
266
278
if len (split_embeddings ) > 0 :
267
279
resource_points .append (
268
280
models .PointVectors (
You can’t perform that action at this time.
0 commit comments