Skip to content

Commit

Permalink
Handle azure models as well
Browse files Browse the repository at this point in the history
  • Loading branch information
alekszievr committed Jan 7, 2025
1 parent a774191 commit fb13a1b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cognee/tasks/chunks/chunk_by_paragraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def chunk_by_paragraph(
for paragraph_id, sentence, word_count, end_type in chunk_by_sentence(data, maximum_length=paragraph_length):
# Check if this sentence would exceed length limit
if embedding_model:
if embedding_model.startswith("azure/"):
embedding_model = embedding_model.split("/")[-1]
tokenizer = tiktoken.encoding_for_model(embedding_model)
token_count = len(tokenizer.encode(sentence))
else:
Expand Down

0 comments on commit fb13a1b

Please sign in to comment.