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.2 [--only-one-question]

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 .

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.0.tar.gz (2.8 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.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for context_enriched_chunking-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a03be4cc5a50b63ef6b759e2499cbcdb7832c2af37163ab61fde283ab600147
MD5 2767765231a6a4b96b323e7ee68d8ee3
BLAKE2b-256 769e97f9263422356acf1c720a8b0e4fb90fd1500590c91e4089f5d765abc198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for context_enriched_chunking-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa5a7ee7454e3b9e1d8d9fe71fbdab6cc3b7210e82901f3f6820ed42189b9b0f
MD5 a36a047ac3f84046818f783764933cf7
BLAKE2b-256 07b79d612216b27159790220f38cab09dfbfda9810963349967bda2d2ef654cb

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