Skip to main content

A text chunking strategy that keeps document title and section as headers for each chunk.

Project description

Context-Enriched Chunking

A text chunking strategy that keeps document title and section as headers for each chunk.

from context_enriched_chunking import ContextEnrichedChunking

text = "Any text"
splitter = ContextEnrichedChunking(section_max_words=10, chunk_size=1000, chunk_overlap=100)
splitter.split_text(text, title)

Prompt para geração de palavras-chave:

Você é um assistente de inteligência artificial que extrai palavras-chave de uma resposta, e essas palavras-chave devem conter as informações mais importantes da resposta, sem as quais a resposta estaria incorreta.
Todas as palavras-chave devem ser substrings contidas na resposta.
É necessário gerar um mínimo de uma e um máximo de quatro palavras-chave.
As palavras-chave devem estar em uma única linha separadas por ;
Pergunta: {question}
Resposta: {answer}
Palavras-chave: 

.env

OPENAI_API_KEY=
LLM_EVALUATOR=gpt-4o-mini
RAGAS_DO_NOT_TRACK=true

python3 evaluate/generate_embeddings.py cec,recursive,token,semantic

python3 evaluate/generate_answers.py gpt-4o-mini-2024-07-18,deepseek-r1:8b,llama3.1:8b [--n_questions=20]

python3 evaluate/generate_answers.py gpt-4o,llama3-1-8b-instruct-v1,llama3-1-405b-instruct-v1,llama3-1-70b-instruct-v1

gpt, ollama, or evaluate/custom_llm.load_llm(model_name)

python3 evaluate/evaluate.py [--overwrite]

pip install -e .

python3 -m build twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

context_enriched_chunking-0.1.2.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

context_enriched_chunking-0.1.2-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file context_enriched_chunking-0.1.2.tar.gz.

File metadata

File hashes

Hashes for context_enriched_chunking-0.1.2.tar.gz
Algorithm Hash digest
SHA256 56200fd95d6daf8d487caae71c101ad8f2f514616a8c9205eca2d7f860f38ed4
MD5 a906e161fb8319c99c913537242a9111
BLAKE2b-256 3b784e091bf25014b62e271eb8432530950f10eaee06c7219a4313f515e4c66a

See more details on using hashes here.

File details

Details for the file context_enriched_chunking-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for context_enriched_chunking-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b50feaa5826dba631ea12925bbadb78a70b017649a6fe2ea2850d2f832e550e4
MD5 74c7a8ae10dca1cc07fc261b224b54e5
BLAKE2b-256 7f533379176e08b634e759f7e4014339074b4a927ef9468e4887272e7cbc3b9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page