Skip to content

Commit bbffacf

Browse files
authored
fix: update summarizer recipe for the ramalama images (#875)
1 parent a4b25dc commit bbffacf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

recipes/natural_language_processing/summarizer/app/summarizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def chunk_text(text):
5757
text_chunks = text_splitter.create_documents([text])
5858
for chunk in text_chunks:
5959
chunk = chunk.page_content
60-
chunk_kwargs = request_kwargs | {"json": {"input": chunk}}
61-
count = requests.post(f"{model_service[:-2]}extras/tokenize/count", **chunk_kwargs).content
62-
count = json.loads(count)["count"]
60+
chunk_kwargs = request_kwargs | {"json": {"content": chunk}}
61+
count = requests.post(f"{model_service[:-2]}tokenize", **chunk_kwargs).content
62+
count = len(json.loads(count)["tokens"])
6363
if count >= 2048:
6464
split_append_chunk(chunk, chunks)
6565
else:

0 commit comments

Comments
 (0)