Skip to main content

A tool for improving the quality of chunks.

Project description

AGENTIC CHUNKER

Installation

pip install agentic-chunker

Usage

from agentic_chunker import AgenticChunker
import markdown
import os

file_path = "test_files/pronoun_dep.md"
api_key = os.environ.get('OPENAI_APIKEY')
with open(file_path, 'r', encoding='utf-8') as f:
    md_content = f.read()
text = markdown.markdown(md_content)
chunker = AgenticChunker(api_key=api_key, model="gpt-4o-mini")
chunks = chunker.agentic_chunking(text, '.')
from agentic_chunker import AgenticChunker
from langchain.text_splitter import CharacterTextSplitter
import markdown
import os

file_path = "test_files/pronoun_dep.md"
api_key = os.environ.get('OPENAI_APIKEY')
with open(file_path, 'r', encoding='utf-8') as f:
    md_content = f.read()

text = markdown.markdown(md_content)
chunker = AgenticChunker(api_key=api_key, model="gpt-4o-mini")
text_splitter = CharacterTextSplitter(
    separator="\n",
    chunk_size=100,
    chunk_overlap=20
)
chunks = text_splitter.create_documents([text])

new_chunks = chunker.rechunk_langchain_chunks(chunks)

Dependencies

  • openai

Contributing

Contributions to AgenticChunker are welcome! Please make sure to follow the code style and conventions used in the project. If you have any suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the GPL-3.0 License.

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

agentic_chunker-0.0.6.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

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

agentic_chunker-0.0.6-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file agentic_chunker-0.0.6.tar.gz.

File metadata

  • Download URL: agentic_chunker-0.0.6.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for agentic_chunker-0.0.6.tar.gz
Algorithm Hash digest
SHA256 8eb84a13d56ec7c2fc263a077bb39beba91b71a89dcbf22206299c971b4bff45
MD5 46b5d3605ca43bde1d53d128a5a75b03
BLAKE2b-256 bd9fd70ca2e64f5c1aa9059c25b3011e2e1d4fcec4ffeb2eddee1604aec46718

See more details on using hashes here.

File details

Details for the file agentic_chunker-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for agentic_chunker-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 838c645164fc27cbc5e28e242748de0d62d121911be6883f795e541511b62725
MD5 167dad2e439cda1bf009a26cb340c20d
BLAKE2b-256 67baf46124920a004bd2ca52f237114fd8ddd3a1fdbea1ee20c55036208df2f5

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