Skip to content
Snippets Groups Projects
Commit 923b0135 authored by tolgaidev's avatar tolgaidev
Browse files

modify the code to address the issue when truncating documents

parent ee1cb5b9
No related branches found
No related tags found
No related merge requests found
......@@ -79,8 +79,7 @@ class OpenAIEncoder(BaseEncoder):
if truncate:
# check if any document exceeds token limit and truncate if so
for i in range(len(docs)):
docs[i] = self._truncate(docs[i])
docs = [self._truncate(doc) for doc in docs]
# Exponential backoff
for j in range(1, 7):
......
import pytest
from semantic_router.encoders import OpenAIEncoder
from semantic_router.encoders.openai import OpenAIEncoder
with open("tests/integration/57640.4032.txt", "r") as fp:
long_doc = fp.read()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment